MCPcopy Create free account
hub / github.com/MariaDB/server / GetText

Method GetText

storage/connect/json.cpp:1126–1177  ·  view source on GitHub ↗

/ Return the text corresponding to all keys (XML like). */ /

Source from the content-addressed store, hash-verified

1124/* Return the text corresponding to all keys (XML like). */
1125/***********************************************************************/
1126PSZ JOBJECT::GetText(PGLOBAL g, PSTRG text)
1127{
1128 if (First) {
1129 bool b;
1130
1131 if (!text) {
1132 text = new(g) STRING(g, 256);
1133 b = true;
1134 } else {
1135 if (text->GetLastChar() != ' ')
1136 text->Append(' ');
1137
1138 b = false;
1139 } // endif text
1140
1141 if (b && !First->Next && !strcmp(First->Key, "$date")) {
1142 int i;
1143 PSZ s;
1144
1145 First->Val->GetText(g, text);
1146 s = text->GetStr();
1147 i = (s[1] == '-' ? 2 : 1);
1148
1149 if (IsNum(s + i)) {
1150 // Date is in milliseconds
1151 int j = text->GetLength();
1152
1153 if (j >= 4 + i) {
1154 s[j - 3] = 0; // Change it to seconds
1155 text->SetLength((uint)strlen(s));
1156 } else
1157 text->Set(" 0");
1158
1159 } // endif text
1160
1161 } else for (PJPR jp = First; jp; jp = jp->Next) {
1162 jp->Val->GetText(g, text);
1163
1164 if (jp->Next)
1165 text->Append(' ');
1166
1167 } // endfor jp
1168
1169 if (b) {
1170 text->Trim();
1171 return text->GetStr();
1172 } // endif b
1173
1174 } // endif First
1175
1176 return NULL;
1177} // end of GetText;
1178
1179/***********************************************************************/
1180/* Merge two objects. */

Callers 3

XMLColumnsFunction · 0.45
SetJsonValueMethod · 0.45
SetJsonValueMethod · 0.45

Calls 5

IsNumFunction · 0.85
GetJsonNullFunction · 0.85
AppendMethod · 0.80
SetMethod · 0.80
GetLengthMethod · 0.45

Tested by

no test coverage detected