mirror of
https://github.com/MariaDB/server.git
synced 2025-08-08 11:22:35 +03:00
Fix insecure use of strcpy, strcat and sprintf in Connect
Old style C functions `strcpy()`, `strcat()` and `sprintf()` are vulnerable to security issues due to lacking memory boundary checks. Replace these in the Connect storage engine with safe new and/or custom functions such as `snprintf()` `safe_strcpy()` and `safe_strcat()`. With this change FlawFinder and other static security analyzers report 287 fewer findings. All new code of the whole pull request, including one or several files that are either new files or modified ones, are contributed under the BSD-new license. I am contributing on behalf of my employer Amazon Web Services, Inc.
This commit is contained in:
committed by
Andrew Hutchings
parent
b3cdb61249
commit
2ff01e763e
@@ -215,7 +215,7 @@ OFFSET BDOC::ParseArray(size_t& i)
|
|||||||
switch (s[i]) {
|
switch (s[i]) {
|
||||||
case ',':
|
case ',':
|
||||||
if (level < 2) {
|
if (level < 2) {
|
||||||
sprintf(G->Message, "Unexpected ',' near %.*s", (int) ARGS);
|
snprintf(G->Message, sizeof(G->Message), "Unexpected ',' near %.*s", (int) ARGS);
|
||||||
throw 1;
|
throw 1;
|
||||||
} else
|
} else
|
||||||
level = 1;
|
level = 1;
|
||||||
@@ -223,7 +223,7 @@ OFFSET BDOC::ParseArray(size_t& i)
|
|||||||
break;
|
break;
|
||||||
case ']':
|
case ']':
|
||||||
if (level == 1) {
|
if (level == 1) {
|
||||||
sprintf(G->Message, "Unexpected ',]' near %.*s", (int) ARGS);
|
snprintf(G->Message, sizeof(G->Message), "Unexpected ',]' near %.*s", (int) ARGS);
|
||||||
throw 1;
|
throw 1;
|
||||||
} // endif level
|
} // endif level
|
||||||
|
|
||||||
@@ -237,7 +237,7 @@ OFFSET BDOC::ParseArray(size_t& i)
|
|||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
if (level == 2) {
|
if (level == 2) {
|
||||||
sprintf(G->Message, "Unexpected value near %.*s", (int) ARGS);
|
snprintf(G->Message, sizeof(G->Message), "Unexpected value near %.*s", (int) ARGS);
|
||||||
throw 1;
|
throw 1;
|
||||||
} else if (lastvlp) {
|
} else if (lastvlp) {
|
||||||
vlp = ParseValue(i, NewVal());
|
vlp = ParseValue(i, NewVal());
|
||||||
@@ -284,7 +284,7 @@ OFFSET BDOC::ParseObject(size_t& i)
|
|||||||
|
|
||||||
level = 2;
|
level = 2;
|
||||||
} else {
|
} else {
|
||||||
sprintf(G->Message, "misplaced string near %.*s", (int) ARGS);
|
snprintf(G->Message, sizeof(G->Message), "misplaced string near %.*s", (int) ARGS);
|
||||||
throw 2;
|
throw 2;
|
||||||
} // endif level
|
} // endif level
|
||||||
|
|
||||||
@@ -294,14 +294,14 @@ OFFSET BDOC::ParseObject(size_t& i)
|
|||||||
ParseValue(++i, GetVlp(lastbpp));
|
ParseValue(++i, GetVlp(lastbpp));
|
||||||
level = 3;
|
level = 3;
|
||||||
} else {
|
} else {
|
||||||
sprintf(G->Message, "Unexpected ':' near %.*s", (int) ARGS);
|
snprintf(G->Message, sizeof(G->Message), "Unexpected ':' near %.*s", (int) ARGS);
|
||||||
throw 2;
|
throw 2;
|
||||||
} // endif level
|
} // endif level
|
||||||
|
|
||||||
break;
|
break;
|
||||||
case ',':
|
case ',':
|
||||||
if (level < 3) {
|
if (level < 3) {
|
||||||
sprintf(G->Message, "Unexpected ',' near %.*s", (int) ARGS);
|
snprintf(G->Message, sizeof(G->Message), "Unexpected ',' near %.*s", (int) ARGS);
|
||||||
throw 2;
|
throw 2;
|
||||||
} else
|
} else
|
||||||
level = 1;
|
level = 1;
|
||||||
@@ -309,7 +309,7 @@ OFFSET BDOC::ParseObject(size_t& i)
|
|||||||
break;
|
break;
|
||||||
case '}':
|
case '}':
|
||||||
if (!(level == 0 || level == 3)) {
|
if (!(level == 0 || level == 3)) {
|
||||||
sprintf(G->Message, "Unexpected '}' near %.*s", (int) ARGS);
|
snprintf(G->Message, sizeof(G->Message), "Unexpected '}' near %.*s", (int) ARGS);
|
||||||
throw 2;
|
throw 2;
|
||||||
} // endif level
|
} // endif level
|
||||||
|
|
||||||
@@ -321,7 +321,7 @@ OFFSET BDOC::ParseObject(size_t& i)
|
|||||||
case '\t':
|
case '\t':
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
sprintf(G->Message, "Unexpected character '%c' near %.*s",
|
snprintf(G->Message, sizeof(G->Message), "Unexpected character '%c' near %.*s",
|
||||||
s[i], (int) ARGS);
|
s[i], (int) ARGS);
|
||||||
throw 2;
|
throw 2;
|
||||||
}; // endswitch s[i]
|
}; // endswitch s[i]
|
||||||
@@ -399,7 +399,7 @@ suite:
|
|||||||
return bvp;
|
return bvp;
|
||||||
|
|
||||||
err:
|
err:
|
||||||
sprintf(G->Message, "Unexpected character '%c' near %.*s", s[i], (int) ARGS);
|
snprintf(G->Message, sizeof(G->Message), "Unexpected character '%c' near %.*s", s[i], (int) ARGS);
|
||||||
throw 3;
|
throw 3;
|
||||||
} // end of ParseValue
|
} // end of ParseValue
|
||||||
|
|
||||||
@@ -758,16 +758,16 @@ bool BDOC::SerializeValue(PBVAL jvp, bool b)
|
|||||||
return jp->Escape(MZP(jvp->To_Val));
|
return jp->Escape(MZP(jvp->To_Val));
|
||||||
|
|
||||||
case TYPE_INTG:
|
case TYPE_INTG:
|
||||||
sprintf(buf, "%d", jvp->N);
|
snprintf(buf, sizeof(buf), "%d", jvp->N);
|
||||||
return jp->WriteStr(buf);
|
return jp->WriteStr(buf);
|
||||||
case TYPE_BINT:
|
case TYPE_BINT:
|
||||||
sprintf(buf, "%lld", *(longlong*)MakePtr(Base, jvp->To_Val));
|
snprintf(buf, sizeof(buf), "%lld", *(longlong*)MakePtr(Base, jvp->To_Val));
|
||||||
return jp->WriteStr(buf);
|
return jp->WriteStr(buf);
|
||||||
case TYPE_FLOAT:
|
case TYPE_FLOAT:
|
||||||
sprintf(buf, "%.*f", jvp->Nd, jvp->F);
|
snprintf(buf, sizeof(buf), "%.*f", jvp->Nd, jvp->F);
|
||||||
return jp->WriteStr(buf);
|
return jp->WriteStr(buf);
|
||||||
case TYPE_DBL:
|
case TYPE_DBL:
|
||||||
sprintf(buf, "%.*lf", jvp->Nd, *(double*)MakePtr(Base, jvp->To_Val));
|
snprintf(buf, sizeof(buf), "%.*lf", jvp->Nd, *(double*)MakePtr(Base, jvp->To_Val));
|
||||||
return jp->WriteStr(buf);
|
return jp->WriteStr(buf);
|
||||||
case TYPE_NULL:
|
case TYPE_NULL:
|
||||||
return jp->WriteStr("null");
|
return jp->WriteStr("null");
|
||||||
@@ -797,7 +797,7 @@ void* BJSON::BsonSubAlloc(size_t size)
|
|||||||
memp, size, pph->To_Free, pph->FreeBlk);
|
memp, size, pph->To_Free, pph->FreeBlk);
|
||||||
|
|
||||||
if (size > pph->FreeBlk) { /* Not enough memory left in pool */
|
if (size > pph->FreeBlk) { /* Not enough memory left in pool */
|
||||||
sprintf(G->Message,
|
snprintf(G->Message, sizeof(G->Message),
|
||||||
"Not enough memory for request of %zd (used=%zd free=%zd)",
|
"Not enough memory for request of %zd (used=%zd free=%zd)",
|
||||||
size, pph->To_Free, pph->FreeBlk);
|
size, pph->To_Free, pph->FreeBlk);
|
||||||
xtrc(1, "BsonSubAlloc: %s\n", G->Message);
|
xtrc(1, "BsonSubAlloc: %s\n", G->Message);
|
||||||
@@ -1679,7 +1679,7 @@ PBVAL BJSON::SetValue(PBVAL vlp, PVAL valp)
|
|||||||
|
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
sprintf(G->Message, "Unsupported typ %d\n", valp->GetType());
|
snprintf(G->Message, sizeof(G->Message), "Unsupported typ %d\n", valp->GetType());
|
||||||
throw(777);
|
throw(777);
|
||||||
} // endswitch Type
|
} // endswitch Type
|
||||||
|
|
||||||
|
@@ -68,7 +68,7 @@ static PBSON BbinAlloc(PGLOBAL g, ulong len, PBVAL jsp)
|
|||||||
PBSON bsp = (PBSON)PlgDBSubAlloc(g, NULL, sizeof(BSON));
|
PBSON bsp = (PBSON)PlgDBSubAlloc(g, NULL, sizeof(BSON));
|
||||||
|
|
||||||
if (bsp) {
|
if (bsp) {
|
||||||
strcpy(bsp->Msg, "Binary Json");
|
snprintf(bsp->Msg, sizeof(bsp->Msg), "Binary Json");
|
||||||
bsp->Msg[BMX] = 0;
|
bsp->Msg[BMX] = 0;
|
||||||
bsp->Filename = NULL;
|
bsp->Filename = NULL;
|
||||||
bsp->G = g;
|
bsp->G = g;
|
||||||
@@ -270,7 +270,7 @@ my_bool BJNX::SetArrayOptions(PGLOBAL g, char* p, int i, PSZ nm)
|
|||||||
} // endif n
|
} // endif n
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
strcpy(g->Message, "Wrong array specification");
|
snprintf(g->Message, sizeof(g->Message), "Wrong array specification");
|
||||||
return true;
|
return true;
|
||||||
} // endif's
|
} // endif's
|
||||||
|
|
||||||
@@ -565,7 +565,7 @@ PBVAL BJNX::GetRowValue(PGLOBAL g, PBVAL row, int i)
|
|||||||
vlp = row; // DupVal(g, row) ???
|
vlp = row; // DupVal(g, row) ???
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
strcpy(g->Message, "Unexpected object");
|
snprintf(g->Message, sizeof(g->Message), "Unexpected object");
|
||||||
vlp = NULL;
|
vlp = NULL;
|
||||||
} //endif Op
|
} //endif Op
|
||||||
|
|
||||||
@@ -610,7 +610,7 @@ PBVAL BJNX::GetRowValue(PGLOBAL g, PBVAL row, int i)
|
|||||||
/*********************************************************************************/
|
/*********************************************************************************/
|
||||||
PVAL BJNX::ExpandArray(PGLOBAL g, PBVAL arp, int n)
|
PVAL BJNX::ExpandArray(PGLOBAL g, PBVAL arp, int n)
|
||||||
{
|
{
|
||||||
strcpy(g->Message, "Expand cannot be done by this function");
|
snprintf(g->Message, sizeof(g->Message), "Expand cannot be done by this function");
|
||||||
return NULL;
|
return NULL;
|
||||||
} // end of ExpandArray
|
} // end of ExpandArray
|
||||||
|
|
||||||
@@ -791,7 +791,7 @@ PVAL BJNX::CalculateArray(PGLOBAL g, PBVAL bap, int n)
|
|||||||
xtrc(1, "Exception %d: %s\n", n, g->Message);
|
xtrc(1, "Exception %d: %s\n", n, g->Message);
|
||||||
PUSH_WARNING(g->Message);
|
PUSH_WARNING(g->Message);
|
||||||
} catch (const char* msg) {
|
} catch (const char* msg) {
|
||||||
strcpy(g->Message, msg);
|
snprintf(g->Message, sizeof(g->Message), "%s", msg);
|
||||||
} // end catch
|
} // end catch
|
||||||
|
|
||||||
return vp;
|
return vp;
|
||||||
@@ -860,7 +860,7 @@ PBVAL BJNX::GetRow(PGLOBAL g)
|
|||||||
} else if (row->Type == TYPE_JAR) {
|
} else if (row->Type == TYPE_JAR) {
|
||||||
AddArrayValue(row, MOF(nwr));
|
AddArrayValue(row, MOF(nwr));
|
||||||
} else {
|
} else {
|
||||||
strcpy(g->Message, "Wrong type when writing new row");
|
snprintf(g->Message, sizeof(g->Message), "Wrong type when writing new row");
|
||||||
nwr = NULL;
|
nwr = NULL;
|
||||||
} // endif's
|
} // endif's
|
||||||
|
|
||||||
@@ -893,7 +893,7 @@ my_bool BJNX::WriteValue(PGLOBAL g, PBVAL jvalp)
|
|||||||
case TYPE_JAR: arp = row; break;
|
case TYPE_JAR: arp = row; break;
|
||||||
case TYPE_JVAL: jvp = MVP(row->To_Val); break;
|
case TYPE_JVAL: jvp = MVP(row->To_Val); break;
|
||||||
default:
|
default:
|
||||||
strcpy(g->Message, "Invalid target type");
|
snprintf(g->Message, sizeof(g->Message), "Invalid target type");
|
||||||
return true;
|
return true;
|
||||||
} // endswitch Type
|
} // endswitch Type
|
||||||
|
|
||||||
@@ -1067,7 +1067,7 @@ my_bool BJNX::CheckPath(PGLOBAL g, UDF_ARGS *args, PBVAL jsp, PBVAL& jvp, int n)
|
|||||||
return false;
|
return false;
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
strcpy(g->Message, "Path argument is null");
|
snprintf(g->Message, sizeof(g->Message), "Path argument is null");
|
||||||
return true;
|
return true;
|
||||||
} // endif path
|
} // endif path
|
||||||
|
|
||||||
@@ -1088,7 +1088,7 @@ PSZ BJNX::Locate(PGLOBAL g, PBVAL jsp, PBVAL jvp, int k)
|
|||||||
g->Message[0] = 0;
|
g->Message[0] = 0;
|
||||||
|
|
||||||
if (!jsp) {
|
if (!jsp) {
|
||||||
strcpy(g->Message, "Null json tree");
|
snprintf(g->Message, sizeof(g->Message), "Null json tree");
|
||||||
return NULL;
|
return NULL;
|
||||||
} // endif jsp
|
} // endif jsp
|
||||||
|
|
||||||
@@ -1115,7 +1115,7 @@ PSZ BJNX::Locate(PGLOBAL g, PBVAL jsp, PBVAL jvp, int k)
|
|||||||
|
|
||||||
if (err) {
|
if (err) {
|
||||||
if (!g->Message[0])
|
if (!g->Message[0])
|
||||||
strcpy(g->Message, "Invalid json tree");
|
snprintf(g->Message, sizeof(g->Message), "Invalid json tree");
|
||||||
|
|
||||||
} else if (Found) {
|
} else if (Found) {
|
||||||
Jp->WriteChr('\0');
|
Jp->WriteChr('\0');
|
||||||
@@ -1127,7 +1127,7 @@ PSZ BJNX::Locate(PGLOBAL g, PBVAL jsp, PBVAL jvp, int k)
|
|||||||
xtrc(1, "Exception %d: %s\n", n, g->Message);
|
xtrc(1, "Exception %d: %s\n", n, g->Message);
|
||||||
PUSH_WARNING(g->Message);
|
PUSH_WARNING(g->Message);
|
||||||
} catch (const char* msg) {
|
} catch (const char* msg) {
|
||||||
strcpy(g->Message, msg);
|
snprintf(g->Message, sizeof(g->Message), "%s", msg);
|
||||||
} // end catch
|
} // end catch
|
||||||
|
|
||||||
return str;
|
return str;
|
||||||
@@ -1208,7 +1208,7 @@ PSZ BJNX::LocateAll(PGLOBAL g, PBVAL jsp, PBVAL bvp, int mx)
|
|||||||
PJPN jnp;
|
PJPN jnp;
|
||||||
|
|
||||||
if (!jsp) {
|
if (!jsp) {
|
||||||
strcpy(g->Message, "Null json tree");
|
snprintf(g->Message, sizeof(g->Message), "Null json tree");
|
||||||
return NULL;
|
return NULL;
|
||||||
} // endif jsp
|
} // endif jsp
|
||||||
|
|
||||||
@@ -1247,13 +1247,13 @@ PSZ BJNX::LocateAll(PGLOBAL g, PBVAL jsp, PBVAL bvp, int mx)
|
|||||||
PlugSubAlloc(g, NULL, Jp->N);
|
PlugSubAlloc(g, NULL, Jp->N);
|
||||||
str = Jp->Strp;
|
str = Jp->Strp;
|
||||||
} else if (!g->Message[0])
|
} else if (!g->Message[0])
|
||||||
strcpy(g->Message, "Invalid json tree");
|
snprintf(g->Message, sizeof(g->Message), "Invalid json tree");
|
||||||
|
|
||||||
} catch (int n) {
|
} catch (int n) {
|
||||||
xtrc(1, "Exception %d: %s\n", n, g->Message);
|
xtrc(1, "Exception %d: %s\n", n, g->Message);
|
||||||
PUSH_WARNING(g->Message);
|
PUSH_WARNING(g->Message);
|
||||||
} catch (const char* msg) {
|
} catch (const char* msg) {
|
||||||
strcpy(g->Message, msg);
|
snprintf(g->Message, sizeof(g->Message), "%s", msg);
|
||||||
} // end catch
|
} // end catch
|
||||||
|
|
||||||
return str;
|
return str;
|
||||||
@@ -1744,7 +1744,7 @@ PBSON BJNX::MakeBinResult(UDF_ARGS *args, PBVAL top, ulong len, int n)
|
|||||||
if ((bnp = BbinAlloc(G, len, top))) {
|
if ((bnp = BbinAlloc(G, len, top))) {
|
||||||
bnp->Filename = filename;
|
bnp->Filename = filename;
|
||||||
bnp->Pretty = pretty;
|
bnp->Pretty = pretty;
|
||||||
strcpy(bnp->Msg, "Json Binary item");
|
snprintf(bnp->Msg, sizeof(bnp->Msg), "Json Binary item");
|
||||||
} //endif bnp
|
} //endif bnp
|
||||||
|
|
||||||
return bnp;
|
return bnp;
|
||||||
@@ -3100,7 +3100,7 @@ char* bson_test(UDF_INIT* initid, UDF_ARGS* args, char* result,
|
|||||||
*error = 1;
|
*error = 1;
|
||||||
str = NULL;
|
str = NULL;
|
||||||
} catch (const char* msg) {
|
} catch (const char* msg) {
|
||||||
strcpy(g->Message, msg);
|
snprintf(g->Message, sizeof(g->Message), "%s", msg);
|
||||||
PUSH_WARNING(g->Message);
|
PUSH_WARNING(g->Message);
|
||||||
*error = 1;
|
*error = 1;
|
||||||
str = NULL;
|
str = NULL;
|
||||||
@@ -3221,7 +3221,7 @@ char* bsonlocate(UDF_INIT* initid, UDF_ARGS* args, char* result,
|
|||||||
*error = 1;
|
*error = 1;
|
||||||
path = NULL;
|
path = NULL;
|
||||||
} catch (const char* msg) {
|
} catch (const char* msg) {
|
||||||
strcpy(g->Message, msg);
|
snprintf(g->Message, sizeof(g->Message), "%s", msg);
|
||||||
PUSH_WARNING(g->Message);
|
PUSH_WARNING(g->Message);
|
||||||
*error = 1;
|
*error = 1;
|
||||||
path = NULL;
|
path = NULL;
|
||||||
@@ -3339,7 +3339,7 @@ char* bson_locate_all(UDF_INIT* initid, UDF_ARGS* args, char* result,
|
|||||||
*error = 1;
|
*error = 1;
|
||||||
path = NULL;
|
path = NULL;
|
||||||
} catch (const char* msg) {
|
} catch (const char* msg) {
|
||||||
strcpy(g->Message, msg);
|
snprintf(g->Message, sizeof(g->Message), "%s", msg);
|
||||||
PUSH_WARNING(g->Message);
|
PUSH_WARNING(g->Message);
|
||||||
*error = 1;
|
*error = 1;
|
||||||
path = NULL;
|
path = NULL;
|
||||||
@@ -3706,7 +3706,7 @@ char *bson_get_item(UDF_INIT *initid, UDF_ARGS *args, char *result,
|
|||||||
jvp = bnx.GetRowValue(g, jvp, 0);
|
jvp = bnx.GetRowValue(g, jvp, 0);
|
||||||
|
|
||||||
if (!bnx.IsJson(jvp)) {
|
if (!bnx.IsJson(jvp)) {
|
||||||
strcpy(g->Message, "Not a Json item");
|
snprintf(g->Message, sizeof(g->Message), "Not a Json item");
|
||||||
} else
|
} else
|
||||||
str = bnx.Serialize(g, jvp, NULL, 0);
|
str = bnx.Serialize(g, jvp, NULL, 0);
|
||||||
|
|
||||||
@@ -3838,7 +3838,7 @@ char *bsonget_string(UDF_INIT *initid, UDF_ARGS *args, char *result,
|
|||||||
PUSH_WARNING(g->Message);
|
PUSH_WARNING(g->Message);
|
||||||
str = NULL;
|
str = NULL;
|
||||||
} catch (const char *msg) {
|
} catch (const char *msg) {
|
||||||
strcpy(g->Message, msg);
|
snprintf(g->Message, sizeof(g->Message), "%s", msg);
|
||||||
PUSH_WARNING(g->Message);
|
PUSH_WARNING(g->Message);
|
||||||
str = NULL;
|
str = NULL;
|
||||||
} // end catch
|
} // end catch
|
||||||
@@ -4297,7 +4297,7 @@ static char *bson_handle_item(UDF_INIT *initid, UDF_ARGS *args, char *result,
|
|||||||
PUSH_WARNING(g->Message);
|
PUSH_WARNING(g->Message);
|
||||||
str = NULL;
|
str = NULL;
|
||||||
} catch (const char *msg) {
|
} catch (const char *msg) {
|
||||||
strcpy(g->Message, msg);
|
snprintf(g->Message, sizeof(g->Message), "%s", msg);
|
||||||
PUSH_WARNING(g->Message);
|
PUSH_WARNING(g->Message);
|
||||||
str = NULL;
|
str = NULL;
|
||||||
} // end catch
|
} // end catch
|
||||||
@@ -4739,8 +4739,8 @@ char *bfile_bjson(UDF_INIT *initid, UDF_ARGS *args, char *result,
|
|||||||
PGLOBAL g = (PGLOBAL)initid->ptr;
|
PGLOBAL g = (PGLOBAL)initid->ptr;
|
||||||
BDOC doc(g);
|
BDOC doc(g);
|
||||||
|
|
||||||
strcpy(fn, MakePSZ(g, args, 0));
|
snprintf(fn, sizeof(fn), "%s", MakePSZ(g, args, 0));
|
||||||
strcpy(ofn, MakePSZ(g, args, 1));
|
snprintf(ofn, sizeof(ofn), "%s", MakePSZ(g, args, 1));
|
||||||
|
|
||||||
if (args->arg_count == 3)
|
if (args->arg_count == 3)
|
||||||
lrecl = (size_t)*(longlong*)args->args[2];
|
lrecl = (size_t)*(longlong*)args->args[2];
|
||||||
@@ -5866,7 +5866,7 @@ static char *bbin_handle_item(UDF_INIT *initid, UDF_ARGS *args, char *result,
|
|||||||
|
|
||||||
PUSH_WARNING(g->Message);
|
PUSH_WARNING(g->Message);
|
||||||
} catch (const char *msg) {
|
} catch (const char *msg) {
|
||||||
strcpy(g->Message, msg);
|
snprintf(g->Message, sizeof(g->Message), "%s", msg);
|
||||||
PUSH_WARNING(g->Message);
|
PUSH_WARNING(g->Message);
|
||||||
} // end catch
|
} // end catch
|
||||||
|
|
||||||
@@ -6198,7 +6198,7 @@ char* bbin_locate_all(UDF_INIT* initid, UDF_ARGS* args, char* result,
|
|||||||
*error = 1;
|
*error = 1;
|
||||||
path = NULL;
|
path = NULL;
|
||||||
} catch (const char* msg) {
|
} catch (const char* msg) {
|
||||||
strcpy(g->Message, msg);
|
snprintf(g->Message, sizeof(g->Message), "%s", msg);
|
||||||
PUSH_WARNING(g->Message);
|
PUSH_WARNING(g->Message);
|
||||||
*error = 1;
|
*error = 1;
|
||||||
path = NULL;
|
path = NULL;
|
||||||
|
@@ -156,7 +156,7 @@ bool CMgoConn::Connect(PGLOBAL g)
|
|||||||
{
|
{
|
||||||
if (!Pcg->Db_name || !Pcg->Coll_name) {
|
if (!Pcg->Db_name || !Pcg->Coll_name) {
|
||||||
// This would crash in mongoc_client_get_collection
|
// This would crash in mongoc_client_get_collection
|
||||||
strcpy(g->Message, "Missing DB or collection name");
|
snprintf(g->Message, sizeof(g->Message), "Missing DB or collection name");
|
||||||
return true;
|
return true;
|
||||||
} // endif name
|
} // endif name
|
||||||
|
|
||||||
@@ -165,7 +165,7 @@ bool CMgoConn::Connect(PGLOBAL g)
|
|||||||
__try {
|
__try {
|
||||||
mongo_init(true);
|
mongo_init(true);
|
||||||
} __except (EXCEPTION_EXECUTE_HANDLER) {
|
} __except (EXCEPTION_EXECUTE_HANDLER) {
|
||||||
strcpy(g->Message, "Cannot load MongoDB C driver");
|
snprintf(g->Message, sizeof(g->Message), "Cannot load MongoDB C driver");
|
||||||
return true;
|
return true;
|
||||||
} // end try/except
|
} // end try/except
|
||||||
#else // !_WIN32
|
#else // !_WIN32
|
||||||
@@ -379,7 +379,7 @@ bool CMgoConn::MakeCursor(PGLOBAL g)
|
|||||||
p = strrchr(options, ']');
|
p = strrchr(options, ']');
|
||||||
|
|
||||||
if (!p) {
|
if (!p) {
|
||||||
strcpy(g->Message, "Missing ] in pipeline");
|
snprintf(g->Message, sizeof(g->Message), "Missing ] in pipeline");
|
||||||
return true;
|
return true;
|
||||||
} else
|
} else
|
||||||
*(char*)p = 0;
|
*(char*)p = 0;
|
||||||
@@ -390,7 +390,7 @@ bool CMgoConn::MakeCursor(PGLOBAL g)
|
|||||||
s->Append(",{\"$match\":");
|
s->Append(",{\"$match\":");
|
||||||
|
|
||||||
if (MakeSelector(g, filp, s)) {
|
if (MakeSelector(g, filp, s)) {
|
||||||
strcpy(g->Message, "Failed making selector");
|
snprintf(g->Message, sizeof(g->Message), "Failed making selector");
|
||||||
return true;
|
return true;
|
||||||
} else
|
} else
|
||||||
s->Append('}');
|
s->Append('}');
|
||||||
@@ -454,7 +454,7 @@ bool CMgoConn::MakeCursor(PGLOBAL g)
|
|||||||
s->Append(',');
|
s->Append(',');
|
||||||
|
|
||||||
if (MakeSelector(g, filp, s)) {
|
if (MakeSelector(g, filp, s)) {
|
||||||
strcpy(g->Message, "Failed making selector");
|
snprintf(g->Message, sizeof(g->Message), "Failed making selector");
|
||||||
return true;
|
return true;
|
||||||
} // endif Selector
|
} // endif Selector
|
||||||
|
|
||||||
@@ -771,7 +771,7 @@ int CMgoConn::Write(PGLOBAL g)
|
|||||||
} // endif remove
|
} // endif remove
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
strcpy(g->Message, "Mongo update: cannot find _id");
|
snprintf(g->Message, sizeof(g->Message), "Mongo update: cannot find _id");
|
||||||
rc = RC_FX;
|
rc = RC_FX;
|
||||||
} // endif b
|
} // endif b
|
||||||
|
|
||||||
@@ -1066,7 +1066,7 @@ bool CMgoConn::AddValue(PGLOBAL g, PCOL colp, bson_t *doc, char *key, bool upd)
|
|||||||
} // endswitch Buf_Type
|
} // endswitch Buf_Type
|
||||||
|
|
||||||
if (!rc) {
|
if (!rc) {
|
||||||
strcpy(g->Message, "Adding value failed");
|
snprintf(g->Message, sizeof(g->Message), "Adding value failed");
|
||||||
return true;
|
return true;
|
||||||
} else
|
} else
|
||||||
return false;
|
return false;
|
||||||
|
@@ -88,7 +88,7 @@ int GZFAM::Zerror(PGLOBAL g)
|
|||||||
{
|
{
|
||||||
int errnum;
|
int errnum;
|
||||||
|
|
||||||
strcpy(g->Message, gzerror(Zfile, &errnum));
|
snprintf(g->Message, sizeof(g->Message), "%s", gzerror(Zfile, &errnum));
|
||||||
|
|
||||||
if (errnum == Z_ERRNO)
|
if (errnum == Z_ERRNO)
|
||||||
#if defined(_WIN32)
|
#if defined(_WIN32)
|
||||||
@@ -142,7 +142,7 @@ bool GZFAM::OpenTableFile(PGLOBAL g)
|
|||||||
/*****************************************************************/
|
/*****************************************************************/
|
||||||
/* Updating GZ files not implemented yet. */
|
/* Updating GZ files not implemented yet. */
|
||||||
/*****************************************************************/
|
/*****************************************************************/
|
||||||
strcpy(g->Message, MSG(UPD_ZIP_NOT_IMP));
|
snprintf(g->Message, sizeof(g->Message), MSG(UPD_ZIP_NOT_IMP));
|
||||||
return true;
|
return true;
|
||||||
case MODE_DELETE:
|
case MODE_DELETE:
|
||||||
if (!Tdbp->GetNext()) {
|
if (!Tdbp->GetNext()) {
|
||||||
@@ -379,7 +379,7 @@ int GZFAM::WriteBuffer(PGLOBAL g)
|
|||||||
/***********************************************************************/
|
/***********************************************************************/
|
||||||
int GZFAM::DeleteRecords(PGLOBAL g, int)
|
int GZFAM::DeleteRecords(PGLOBAL g, int)
|
||||||
{
|
{
|
||||||
strcpy(g->Message, MSG(NO_ZIP_DELETE));
|
snprintf(g->Message, sizeof(g->Message), MSG(NO_ZIP_DELETE));
|
||||||
return RC_FX;
|
return RC_FX;
|
||||||
} // end of DeleteRecords
|
} // end of DeleteRecords
|
||||||
|
|
||||||
@@ -926,7 +926,7 @@ bool ZLBFAM::AllocateBuffer(PGLOBAL g)
|
|||||||
|
|
||||||
#if 0
|
#if 0
|
||||||
if (!Optimized && Tdbp->NeedIndexing(g)) {
|
if (!Optimized && Tdbp->NeedIndexing(g)) {
|
||||||
strcpy(g->Message, MSG(NOP_ZLIB_INDEX));
|
snprintf(g->Message, sizeof(g->Message), MSG(NOP_ZLIB_INDEX));
|
||||||
return TRUE;
|
return TRUE;
|
||||||
} // endif indexing
|
} // endif indexing
|
||||||
#endif // 0
|
#endif // 0
|
||||||
@@ -993,7 +993,7 @@ bool ZLBFAM::AllocateBuffer(PGLOBAL g)
|
|||||||
CurBlk = Block - 1;
|
CurBlk = Block - 1;
|
||||||
CurNum = Last;
|
CurNum = Last;
|
||||||
|
|
||||||
strcpy(g->Message, MSG(NO_PAR_BLK_INS));
|
snprintf(g->Message, sizeof(g->Message), "%s",MSG(NO_PAR_BLK_INS));
|
||||||
return TRUE;
|
return TRUE;
|
||||||
} // endif Last
|
} // endif Last
|
||||||
|
|
||||||
@@ -1068,7 +1068,7 @@ bool ZLBFAM::SetPos(PGLOBAL g, int pos __attribute__((unused)))
|
|||||||
return true;
|
return true;
|
||||||
#if 0 // All this must be checked
|
#if 0 // All this must be checked
|
||||||
if (pos < 0) {
|
if (pos < 0) {
|
||||||
strcpy(g->Message, MSG(INV_REC_POS));
|
snprintf(g->Message, sizeof(g->Message), MSG(INV_REC_POS));
|
||||||
return true;
|
return true;
|
||||||
} // endif recpos
|
} // endif recpos
|
||||||
|
|
||||||
@@ -1156,7 +1156,7 @@ int ZLBFAM::ReadBuffer(PGLOBAL g)
|
|||||||
rdbuf = Zlenp;
|
rdbuf = Zlenp;
|
||||||
} else { // !Optimized
|
} else { // !Optimized
|
||||||
if (CurBlk != OldBlk + 1) {
|
if (CurBlk != OldBlk + 1) {
|
||||||
strcpy(g->Message, MSG(INV_RAND_ACC));
|
snprintf(g->Message, sizeof(g->Message), MSG(INV_RAND_ACC));
|
||||||
return RC_FX;
|
return RC_FX;
|
||||||
} else
|
} else
|
||||||
Fpos = ftell(Stream); // Used when optimizing
|
Fpos = ftell(Stream); // Used when optimizing
|
||||||
@@ -1276,7 +1276,7 @@ int ZLBFAM::WriteBuffer(PGLOBAL g)
|
|||||||
#if defined(_DEBUG)
|
#if defined(_DEBUG)
|
||||||
if (Tdbp->GetFtype() == RECFM_FIX &&
|
if (Tdbp->GetFtype() == RECFM_FIX &&
|
||||||
(signed)strlen(CurLine) != Lrecl + (signed)strlen(CrLf)) {
|
(signed)strlen(CurLine) != Lrecl + (signed)strlen(CrLf)) {
|
||||||
strcpy(g->Message, MSG(BAD_LINE_LEN));
|
snprintf(g->Message, sizeof(g->Message), MSG(BAD_LINE_LEN));
|
||||||
Closing = TRUE;
|
Closing = TRUE;
|
||||||
return RC_FX;
|
return RC_FX;
|
||||||
} // endif Lrecl
|
} // endif Lrecl
|
||||||
|
@@ -367,13 +367,13 @@ int TXTFAM::UpdateSortedRows(PGLOBAL g)
|
|||||||
// return RC_INFO;
|
// return RC_INFO;
|
||||||
return RC_OK; // Nothing to do
|
return RC_OK; // Nothing to do
|
||||||
} else if (!(Sosar = MakeValueArray(g, To_Sos))) {
|
} else if (!(Sosar = MakeValueArray(g, To_Sos))) {
|
||||||
strcpy(g->Message, "Start position array is null");
|
snprintf(g->Message, sizeof(g->Message), "Start position array is null");
|
||||||
goto err;
|
goto err;
|
||||||
} else if (!(Updar = MakeValueArray(g, To_Upd))) {
|
} else if (!(Updar = MakeValueArray(g, To_Upd))) {
|
||||||
strcpy(g->Message, "Updated line array is null");
|
snprintf(g->Message, sizeof(g->Message), "Updated line array is null");
|
||||||
goto err;
|
goto err;
|
||||||
} else if (!(ix = (int*)Posar->GetSortIndex(g))) {
|
} else if (!(ix = (int*)Posar->GetSortIndex(g))) {
|
||||||
strcpy(g->Message, "Error getting array sort index");
|
snprintf(g->Message, sizeof(g->Message), "Error getting array sort index");
|
||||||
goto err;
|
goto err;
|
||||||
} // endif's
|
} // endif's
|
||||||
|
|
||||||
@@ -419,10 +419,10 @@ int TXTFAM::DeleteSortedRows(PGLOBAL g)
|
|||||||
// return RC_INFO;
|
// return RC_INFO;
|
||||||
return RC_OK; // Nothing to do
|
return RC_OK; // Nothing to do
|
||||||
} else if (!(Sosar = MakeValueArray(g, To_Sos))) {
|
} else if (!(Sosar = MakeValueArray(g, To_Sos))) {
|
||||||
strcpy(g->Message, "Start position array is null");
|
snprintf(g->Message, sizeof(g->Message), "Start position array is null");
|
||||||
goto err;
|
goto err;
|
||||||
} else if (!(ix = (int*)Posar->GetSortIndex(g))) {
|
} else if (!(ix = (int*)Posar->GetSortIndex(g))) {
|
||||||
strcpy(g->Message, "Error getting array sort index");
|
snprintf(g->Message, sizeof(g->Message), "Error getting array sort index");
|
||||||
goto err;
|
goto err;
|
||||||
} // endif's
|
} // endif's
|
||||||
|
|
||||||
@@ -454,7 +454,7 @@ err:
|
|||||||
/***********************************************************************/
|
/***********************************************************************/
|
||||||
int TXTFAM::InitDelete(PGLOBAL g, int, int)
|
int TXTFAM::InitDelete(PGLOBAL g, int, int)
|
||||||
{
|
{
|
||||||
strcpy(g->Message, "InitDelete should not be used by this table type");
|
snprintf(g->Message, sizeof(g->Message), "InitDelete should not be used by this table type");
|
||||||
return RC_FX;
|
return RC_FX;
|
||||||
} // end of InitDelete
|
} // end of InitDelete
|
||||||
|
|
||||||
@@ -556,7 +556,7 @@ bool DOSFAM::OpenTableFile(PGLOBAL g)
|
|||||||
|
|
||||||
switch (mode) {
|
switch (mode) {
|
||||||
case MODE_READ:
|
case MODE_READ:
|
||||||
strcpy(opmode, "r");
|
snprintf(opmode, sizeof(opmode), "r");
|
||||||
break;
|
break;
|
||||||
case MODE_DELETE:
|
case MODE_DELETE:
|
||||||
if (!Tdbp->Next) {
|
if (!Tdbp->Next) {
|
||||||
@@ -570,7 +570,7 @@ bool DOSFAM::OpenTableFile(PGLOBAL g)
|
|||||||
} // endif blocked
|
} // endif blocked
|
||||||
|
|
||||||
// This will erase the entire file
|
// This will erase the entire file
|
||||||
strcpy(opmode, "w");
|
snprintf(opmode, sizeof(opmode), "w");
|
||||||
Tdbp->ResetSize();
|
Tdbp->ResetSize();
|
||||||
break;
|
break;
|
||||||
} // endif
|
} // endif
|
||||||
@@ -580,14 +580,14 @@ bool DOSFAM::OpenTableFile(PGLOBAL g)
|
|||||||
/* fall through */
|
/* fall through */
|
||||||
case MODE_UPDATE:
|
case MODE_UPDATE:
|
||||||
if ((UseTemp = Tdbp->IsUsingTemp(g))) {
|
if ((UseTemp = Tdbp->IsUsingTemp(g))) {
|
||||||
strcpy(opmode, "r");
|
snprintf(opmode, sizeof(opmode), "r");
|
||||||
Bin = true;
|
Bin = true;
|
||||||
} else
|
} else
|
||||||
strcpy(opmode, "r+");
|
snprintf(opmode, sizeof(opmode), "r+");
|
||||||
|
|
||||||
break;
|
break;
|
||||||
case MODE_INSERT:
|
case MODE_INSERT:
|
||||||
strcpy(opmode, "a+");
|
snprintf(opmode, sizeof(opmode), "a+");
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
snprintf(g->Message, sizeof(g->Message), MSG(BAD_OPEN_MODE), mode);
|
snprintf(g->Message, sizeof(g->Message), MSG(BAD_OPEN_MODE), mode);
|
||||||
@@ -1364,7 +1364,7 @@ int BLKFAM::GetNextPos(void)
|
|||||||
/***********************************************************************/
|
/***********************************************************************/
|
||||||
bool BLKFAM::SetPos(PGLOBAL g, int)
|
bool BLKFAM::SetPos(PGLOBAL g, int)
|
||||||
{
|
{
|
||||||
strcpy(g->Message, "Blocked variable tables cannot be used indexed");
|
snprintf(g->Message, sizeof(g->Message), "Blocked variable tables cannot be used indexed");
|
||||||
return true;
|
return true;
|
||||||
} // end of SetPos
|
} // end of SetPos
|
||||||
|
|
||||||
@@ -1708,10 +1708,10 @@ bool BINFAM::OpenTableFile(PGLOBAL g) {
|
|||||||
|
|
||||||
switch (mode) {
|
switch (mode) {
|
||||||
case MODE_READ:
|
case MODE_READ:
|
||||||
strcpy(opmode, "rb");
|
snprintf(opmode, sizeof(opmode), "rb");
|
||||||
break;
|
break;
|
||||||
case MODE_WRITE:
|
case MODE_WRITE:
|
||||||
strcpy(opmode, "wb");
|
snprintf(opmode, sizeof(opmode), "wb");
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
snprintf(g->Message, sizeof(g->Message), MSG(BAD_OPEN_MODE), mode);
|
snprintf(g->Message, sizeof(g->Message), MSG(BAD_OPEN_MODE), mode);
|
||||||
@@ -1859,7 +1859,7 @@ int BINFAM::ReadBuffer(PGLOBAL g)
|
|||||||
// Read the prefix giving the row length
|
// Read the prefix giving the row length
|
||||||
if (!fread(&Recsize, sizeof(size_t), 1, Stream)) {
|
if (!fread(&Recsize, sizeof(size_t), 1, Stream)) {
|
||||||
if (!feof(Stream)) {
|
if (!feof(Stream)) {
|
||||||
strcpy(g->Message, "Error reading line prefix\n");
|
snprintf(g->Message, sizeof(g->Message), "Error reading line prefix\n");
|
||||||
return RC_FX;
|
return RC_FX;
|
||||||
} else
|
} else
|
||||||
return RC_EF;
|
return RC_EF;
|
||||||
|
@@ -429,7 +429,7 @@ bool VCTFAM::OpenTableFile(PGLOBAL g)
|
|||||||
/*********************************************************************/
|
/*********************************************************************/
|
||||||
switch (mode) {
|
switch (mode) {
|
||||||
case MODE_READ:
|
case MODE_READ:
|
||||||
strcpy(opmode, "rb");
|
snprintf(opmode, sizeof(opmode), "rb");
|
||||||
break;
|
break;
|
||||||
case MODE_DELETE:
|
case MODE_DELETE:
|
||||||
if (!Tdbp->GetNext()) {
|
if (!Tdbp->GetNext()) {
|
||||||
@@ -437,7 +437,7 @@ bool VCTFAM::OpenTableFile(PGLOBAL g)
|
|||||||
DelRows = Cardinality(g);
|
DelRows = Cardinality(g);
|
||||||
|
|
||||||
// This will delete the whole file
|
// This will delete the whole file
|
||||||
strcpy(opmode, "wb");
|
snprintf(opmode, sizeof(opmode), "wb");
|
||||||
break;
|
break;
|
||||||
} // endif
|
} // endif
|
||||||
|
|
||||||
@@ -445,7 +445,7 @@ bool VCTFAM::OpenTableFile(PGLOBAL g)
|
|||||||
/* fall through */
|
/* fall through */
|
||||||
case MODE_UPDATE:
|
case MODE_UPDATE:
|
||||||
UseTemp = Tdbp->IsUsingTemp(g);
|
UseTemp = Tdbp->IsUsingTemp(g);
|
||||||
strcpy(opmode, (UseTemp) ? "rb" : "r+b");
|
snprintf(opmode, sizeof(opmode), (UseTemp) ? "rb" : "r+b");
|
||||||
break;
|
break;
|
||||||
case MODE_INSERT:
|
case MODE_INSERT:
|
||||||
if (MaxBlk) {
|
if (MaxBlk) {
|
||||||
@@ -453,11 +453,11 @@ bool VCTFAM::OpenTableFile(PGLOBAL g)
|
|||||||
if (MakeEmptyFile(g, To_File))
|
if (MakeEmptyFile(g, To_File))
|
||||||
return true;
|
return true;
|
||||||
|
|
||||||
strcpy(opmode, "r+b"); // Required to update empty blocks
|
snprintf(opmode, sizeof(opmode), "r+b"); // Required to update empty blocks
|
||||||
} else if (!Block || Last == Nrec)
|
} else if (!Block || Last == Nrec)
|
||||||
strcpy(opmode, "ab");
|
snprintf(opmode, sizeof(opmode), "ab");
|
||||||
else
|
else
|
||||||
strcpy(opmode, "r+b"); // Required to update the last block
|
snprintf(opmode, sizeof(opmode), "r+b"); // Required to update the last block
|
||||||
|
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
@@ -1912,7 +1912,7 @@ bool VECFAM::OpenTableFile(PGLOBAL g)
|
|||||||
/*********************************************************************/
|
/*********************************************************************/
|
||||||
switch (mode) {
|
switch (mode) {
|
||||||
case MODE_READ:
|
case MODE_READ:
|
||||||
strcpy(opmode, "rb");
|
snprintf(opmode, sizeof(opmode), "rb");
|
||||||
break;
|
break;
|
||||||
case MODE_DELETE:
|
case MODE_DELETE:
|
||||||
if (!Tdbp->GetNext()) {
|
if (!Tdbp->GetNext()) {
|
||||||
@@ -1920,7 +1920,7 @@ bool VECFAM::OpenTableFile(PGLOBAL g)
|
|||||||
DelRows = Cardinality(g);
|
DelRows = Cardinality(g);
|
||||||
|
|
||||||
// This will delete the whole file
|
// This will delete the whole file
|
||||||
strcpy(opmode, "wb");
|
snprintf(opmode, sizeof(opmode), "wb");
|
||||||
|
|
||||||
// This will stop the process by causing GetProgMax to return 0.
|
// This will stop the process by causing GetProgMax to return 0.
|
||||||
ResetTableSize(g, 0, Nrec);
|
ResetTableSize(g, 0, Nrec);
|
||||||
@@ -1931,10 +1931,10 @@ bool VECFAM::OpenTableFile(PGLOBAL g)
|
|||||||
/* fall through */
|
/* fall through */
|
||||||
case MODE_UPDATE:
|
case MODE_UPDATE:
|
||||||
UseTemp = Tdbp->IsUsingTemp(g);
|
UseTemp = Tdbp->IsUsingTemp(g);
|
||||||
strcpy(opmode, (UseTemp) ? "rb": "r+b");
|
snprintf(opmode, sizeof(opmode), (UseTemp) ? "rb": "r+b");
|
||||||
break;
|
break;
|
||||||
case MODE_INSERT:
|
case MODE_INSERT:
|
||||||
strcpy(opmode, "ab");
|
snprintf(opmode, sizeof(opmode), "ab");
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
snprintf(g->Message, sizeof(g->Message), MSG(BAD_OPEN_MODE), mode);
|
snprintf(g->Message, sizeof(g->Message), MSG(BAD_OPEN_MODE), mode);
|
||||||
|
@@ -152,7 +152,7 @@ static bool ZipFiles(PGLOBAL g, ZIPUTIL *zutp, PCSZ pat, char *buf)
|
|||||||
/*********************************************************************/
|
/*********************************************************************/
|
||||||
/* pat is a multiple file name with wildcard characters */
|
/* pat is a multiple file name with wildcard characters */
|
||||||
/*********************************************************************/
|
/*********************************************************************/
|
||||||
strcpy(filename, pat);
|
snprintf(filename, sizeof(filename), "%s", pat);
|
||||||
|
|
||||||
#if defined(_WIN32)
|
#if defined(_WIN32)
|
||||||
int rc;
|
int rc;
|
||||||
@@ -174,7 +174,7 @@ static bool ZipFiles(PGLOBAL g, ZIPUTIL *zutp, PCSZ pat, char *buf)
|
|||||||
snprintf(g->Message, sizeof(g->Message), MSG(BAD_FILE_HANDLE), filename);
|
snprintf(g->Message, sizeof(g->Message), MSG(BAD_FILE_HANDLE), filename);
|
||||||
return true;
|
return true;
|
||||||
} else {
|
} else {
|
||||||
strcpy(g->Message, "Cannot find any file to load");
|
snprintf(g->Message, sizeof(g->Message), "Cannot find any file to load");
|
||||||
return true;
|
return true;
|
||||||
} // endif rc
|
} // endif rc
|
||||||
|
|
||||||
@@ -208,7 +208,7 @@ static bool ZipFiles(PGLOBAL g, ZIPUTIL *zutp, PCSZ pat, char *buf)
|
|||||||
|
|
||||||
// Close the search handle.
|
// Close the search handle.
|
||||||
if (!FindClose(hSearch)) {
|
if (!FindClose(hSearch)) {
|
||||||
strcpy(g->Message, MSG(SRCH_CLOSE_ERR));
|
snprintf(g->Message, sizeof(g->Message), MSG(SRCH_CLOSE_ERR));
|
||||||
return true;
|
return true;
|
||||||
} // endif FindClose
|
} // endif FindClose
|
||||||
|
|
||||||
@@ -402,7 +402,7 @@ bool ZIPUTIL::OpenTable(PGLOBAL g, MODE mode, PCSZ fn, bool append)
|
|||||||
return true;
|
return true;
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
strcpy(g->Message, "Only INSERT mode supported for ZIPPING files");
|
snprintf(g->Message, sizeof(g->Message), "Only INSERT mode supported for ZIPPING files");
|
||||||
return true;
|
return true;
|
||||||
} // endif mode
|
} // endif mode
|
||||||
|
|
||||||
@@ -610,7 +610,7 @@ int UNZIPUTL::findEntry(PGLOBAL g, bool next)
|
|||||||
next = true;
|
next = true;
|
||||||
} while (true);
|
} while (true);
|
||||||
|
|
||||||
strcpy(g->Message, "FindNext logical error");
|
snprintf(g->Message, sizeof(g->Message), "FindNext logical error");
|
||||||
return RC_FX;
|
return RC_FX;
|
||||||
} // end of FindEntry
|
} // end of FindEntry
|
||||||
|
|
||||||
@@ -703,7 +703,7 @@ bool UNZIPUTL::OpenTable(PGLOBAL g, MODE mode, PCSZ fn)
|
|||||||
return true;
|
return true;
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
strcpy(g->Message, "Only READ mode supported for ZIPPED tables");
|
snprintf(g->Message, sizeof(g->Message), "Only READ mode supported for ZIPPED tables");
|
||||||
return true;
|
return true;
|
||||||
} // endif mode
|
} // endif mode
|
||||||
|
|
||||||
@@ -755,7 +755,7 @@ bool UNZIPUTL::openEntry(PGLOBAL g)
|
|||||||
try {
|
try {
|
||||||
memory = new char[size + 1];
|
memory = new char[size + 1];
|
||||||
} catch (...) {
|
} catch (...) {
|
||||||
strcpy(g->Message, "Out of memory");
|
snprintf(g->Message, sizeof(g->Message), "Out of memory");
|
||||||
return true;
|
return true;
|
||||||
} // end try/catch
|
} // end try/catch
|
||||||
|
|
||||||
@@ -1130,16 +1130,16 @@ int UZDFAM::dbfhead(PGLOBAL g, void* buf)
|
|||||||
|
|
||||||
// Check first byte to be sure of .dbf type
|
// Check first byte to be sure of .dbf type
|
||||||
if ((hdrp->Version & 0x03) != DBFTYPE) {
|
if ((hdrp->Version & 0x03) != DBFTYPE) {
|
||||||
strcpy(g->Message, MSG(NOT_A_DBF_FILE));
|
snprintf(g->Message, sizeof(g->Message), MSG(NOT_A_DBF_FILE));
|
||||||
rc = RC_INFO;
|
rc = RC_INFO;
|
||||||
|
|
||||||
if ((hdrp->Version & 0x30) == 0x30) {
|
if ((hdrp->Version & 0x30) == 0x30) {
|
||||||
strcpy(g->Message, MSG(FOXPRO_FILE));
|
snprintf(g->Message, sizeof(g->Message), MSG(FOXPRO_FILE));
|
||||||
dbc = 264; // FoxPro database container
|
dbc = 264; // FoxPro database container
|
||||||
} // endif Version
|
} // endif Version
|
||||||
|
|
||||||
} else
|
} else
|
||||||
strcpy(g->Message, MSG(DBASE_FILE));
|
snprintf(g->Message, sizeof(g->Message), MSG(DBASE_FILE));
|
||||||
|
|
||||||
// Check last byte(s) of header
|
// Check last byte(s) of header
|
||||||
endmark = (char*)hdrp + hdrp->Headlen() - dbc;
|
endmark = (char*)hdrp + hdrp->Headlen() - dbc;
|
||||||
@@ -1304,13 +1304,13 @@ bool ZIPFAM::OpenTableFile(PGLOBAL g)
|
|||||||
if (len < 0)
|
if (len < 0)
|
||||||
return true;
|
return true;
|
||||||
else if (!append && len > 0) {
|
else if (!append && len > 0) {
|
||||||
strcpy(g->Message, "No insert into existing zip file");
|
snprintf(g->Message, sizeof(g->Message), "No insert into existing zip file");
|
||||||
return true;
|
return true;
|
||||||
} else if (append && len > 0) {
|
} else if (append && len > 0) {
|
||||||
UNZIPUTL *zutp = new(g) UNZIPUTL(target, NULL, false);
|
UNZIPUTL *zutp = new(g) UNZIPUTL(target, NULL, false);
|
||||||
|
|
||||||
if (!zutp->IsInsertOk(g, filename)) {
|
if (!zutp->IsInsertOk(g, filename)) {
|
||||||
strcpy(g->Message, "No insert into existing entry");
|
snprintf(g->Message, sizeof(g->Message), "No insert into existing entry");
|
||||||
return true;
|
return true;
|
||||||
} // endif Ok
|
} // endif Ok
|
||||||
|
|
||||||
@@ -1337,7 +1337,7 @@ bool ZIPFAM::OpenTableFile(PGLOBAL g)
|
|||||||
/***********************************************************************/
|
/***********************************************************************/
|
||||||
int ZIPFAM::ReadBuffer(PGLOBAL g)
|
int ZIPFAM::ReadBuffer(PGLOBAL g)
|
||||||
{
|
{
|
||||||
strcpy(g->Message, "ReadBuffer should not been called when zipping");
|
snprintf(g->Message, sizeof(g->Message), "ReadBuffer should not been called when zipping");
|
||||||
return RC_FX;
|
return RC_FX;
|
||||||
} // end of ReadBuffer
|
} // end of ReadBuffer
|
||||||
|
|
||||||
@@ -1388,13 +1388,13 @@ bool ZPXFAM::OpenTableFile(PGLOBAL g)
|
|||||||
if (len < 0)
|
if (len < 0)
|
||||||
return true;
|
return true;
|
||||||
else if (!append && len > 0) {
|
else if (!append && len > 0) {
|
||||||
strcpy(g->Message, "No insert into existing zip file");
|
snprintf(g->Message, sizeof(g->Message), "No insert into existing zip file");
|
||||||
return true;
|
return true;
|
||||||
} else if (append && len > 0) {
|
} else if (append && len > 0) {
|
||||||
UNZIPUTL *zutp = new(g) UNZIPUTL(target, NULL, false);
|
UNZIPUTL *zutp = new(g) UNZIPUTL(target, NULL, false);
|
||||||
|
|
||||||
if (!zutp->IsInsertOk(g, filename)) {
|
if (!zutp->IsInsertOk(g, filename)) {
|
||||||
strcpy(g->Message, "No insert into existing entry");
|
snprintf(g->Message, sizeof(g->Message), "No insert into existing entry");
|
||||||
return true;
|
return true;
|
||||||
} // endif Ok
|
} // endif Ok
|
||||||
|
|
||||||
|
@@ -386,7 +386,7 @@ int FILTER::CheckColumn(PGLOBAL g, PSQL sqlp, PXOB &p, int &ag)
|
|||||||
} // endfor i
|
} // endfor i
|
||||||
|
|
||||||
if (*errmsg) {
|
if (*errmsg) {
|
||||||
strcpy(g->Message, errmsg);
|
snprintf(g->Message, sizeof(g->Message), errmsg);
|
||||||
return -1;
|
return -1;
|
||||||
} else
|
} else
|
||||||
return n;
|
return n;
|
||||||
@@ -993,7 +993,7 @@ bool FILTER::Convert(PGLOBAL g, bool having)
|
|||||||
break;
|
break;
|
||||||
case TYPE_ARRAY:
|
case TYPE_ARRAY:
|
||||||
if ((Opc != OP_IN && !Opm) || i == 0) {
|
if ((Opc != OP_IN && !Opm) || i == 0) {
|
||||||
strcpy(g->Message, MSG(BAD_ARRAY_OPER));
|
snprintf(g->Message, sizeof(g->Message), MSG(BAD_ARRAY_OPER));
|
||||||
return TRUE;
|
return TRUE;
|
||||||
} // endif
|
} // endif
|
||||||
|
|
||||||
@@ -1007,7 +1007,7 @@ bool FILTER::Convert(PGLOBAL g, bool having)
|
|||||||
goto TEST; // Filter has only one argument
|
goto TEST; // Filter has only one argument
|
||||||
} // endif i
|
} // endif i
|
||||||
|
|
||||||
strcpy(g->Message, MSG(VOID_FIRST_ARG));
|
snprintf(g->Message, sizeof(g->Message), MSG(VOID_FIRST_ARG));
|
||||||
return TRUE;
|
return TRUE;
|
||||||
} // endswitch
|
} // endswitch
|
||||||
|
|
||||||
@@ -1052,7 +1052,7 @@ bool FILTER::Convert(PGLOBAL g, bool having)
|
|||||||
} // endif Opc
|
} // endif Opc
|
||||||
|
|
||||||
if (comtype == TYPE_ERROR) {
|
if (comtype == TYPE_ERROR) {
|
||||||
strcpy(g->Message, MSG(ILL_FILTER_CONV));
|
snprintf(g->Message, sizeof(g->Message), MSG(ILL_FILTER_CONV));
|
||||||
return TRUE;
|
return TRUE;
|
||||||
} // endif
|
} // endif
|
||||||
|
|
||||||
@@ -1101,7 +1101,7 @@ bool FILTER::Convert(PGLOBAL g, bool having)
|
|||||||
|
|
||||||
break;
|
break;
|
||||||
case TYPE_FILTER:
|
case TYPE_FILTER:
|
||||||
strcpy(g->Message, MSG(UNMATCH_FIL_ARG));
|
snprintf(g->Message, sizeof(g->Message), MSG(UNMATCH_FIL_ARG));
|
||||||
return TRUE;
|
return TRUE;
|
||||||
default:
|
default:
|
||||||
// Conversion from Column, Select/Func, Expr, Scalfnc...
|
// Conversion from Column, Select/Func, Expr, Scalfnc...
|
||||||
@@ -1270,7 +1270,7 @@ bool FILTER::Eval(PGLOBAL g)
|
|||||||
ap = (PARRAY)Arg(1);
|
ap = (PARRAY)Arg(1);
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
strcpy(g->Message, MSG(IN_WITHOUT_SUB));
|
snprintf(g->Message, sizeof(g->Message), MSG(IN_WITHOUT_SUB));
|
||||||
goto FilterError;
|
goto FilterError;
|
||||||
} // endswitch Type
|
} // endswitch Type
|
||||||
|
|
||||||
|
@@ -1480,7 +1480,7 @@ void MakeAMPM(int n)
|
|||||||
n, pp->Num, pp->InFmt, pp->OutFmt);
|
n, pp->Num, pp->InFmt, pp->OutFmt);
|
||||||
#endif
|
#endif
|
||||||
pp->Index[pp->Num++] = -n;
|
pp->Index[pp->Num++] = -n;
|
||||||
sprintf(buf, "%%%ds", m);
|
snprintf(buf, sizeof(buf), "%%%ds", m);
|
||||||
MakeIn(buf);
|
MakeIn(buf);
|
||||||
|
|
||||||
if (pp->OutFmt) {
|
if (pp->OutFmt) {
|
||||||
|
@@ -1868,7 +1868,7 @@ bool ha_connect::CheckVirtualIndex(TABLE_SHARE *s)
|
|||||||
rid= (fp->option_struct) ? fp->option_struct->special : NULL;
|
rid= (fp->option_struct) ? fp->option_struct->special : NULL;
|
||||||
|
|
||||||
if (!rid || (stricmp(rid, "ROWID") && stricmp(rid, "ROWNUM"))) {
|
if (!rid || (stricmp(rid, "ROWID") && stricmp(rid, "ROWNUM"))) {
|
||||||
strcpy(g->Message, "Invalid virtual index");
|
snprintf(g->Message, sizeof(g->Message), "Invalid virtual index");
|
||||||
return true;
|
return true;
|
||||||
} // endif rowid
|
} // endif rowid
|
||||||
|
|
||||||
@@ -2014,7 +2014,7 @@ int ha_connect::OpenTable(PGLOBAL g, bool del)
|
|||||||
case MODE_INSERT:
|
case MODE_INSERT:
|
||||||
case MODE_UPDATE:
|
case MODE_UPDATE:
|
||||||
case MODE_DELETE:
|
case MODE_DELETE:
|
||||||
strcpy(g->Message, MSG(READ_ONLY));
|
snprintf(g->Message, sizeof(g->Message), MSG(READ_ONLY));
|
||||||
return HA_ERR_TABLE_READONLY;
|
return HA_ERR_TABLE_READONLY;
|
||||||
default:
|
default:
|
||||||
break;
|
break;
|
||||||
@@ -2143,7 +2143,7 @@ bool ha_connect::CheckColumnList(PGLOBAL g)
|
|||||||
htrc("Exception %d: %s\n", n, g->Message);
|
htrc("Exception %d: %s\n", n, g->Message);
|
||||||
brc= true;
|
brc= true;
|
||||||
} catch (const char *msg) {
|
} catch (const char *msg) {
|
||||||
strcpy(g->Message, msg);
|
snprintf(g->Message, sizeof(g->Message), "%s", msg);
|
||||||
brc= true;
|
brc= true;
|
||||||
} // end catch
|
} // end catch
|
||||||
|
|
||||||
@@ -2512,7 +2512,7 @@ bool ha_connect::MakeKeyWhere(PGLOBAL g, PSTRG qry, OPVAL vop, char q,
|
|||||||
ranges[1]= (end_range && !eq_range) ? &save_end_range : NULL;
|
ranges[1]= (end_range && !eq_range) ? &save_end_range : NULL;
|
||||||
|
|
||||||
if (!ranges[0] && !ranges[1]) {
|
if (!ranges[0] && !ranges[1]) {
|
||||||
strcpy(g->Message, "MakeKeyWhere: No key");
|
snprintf(g->Message, sizeof(g->Message), "MakeKeyWhere: No key");
|
||||||
return true;
|
return true;
|
||||||
} else
|
} else
|
||||||
both= ranges[0] && ranges[1];
|
both= ranges[0] && ranges[1];
|
||||||
@@ -2611,7 +2611,7 @@ bool ha_connect::MakeKeyWhere(PGLOBAL g, PSTRG qry, OPVAL vop, char q,
|
|||||||
qry->Append(')');
|
qry->Append(')');
|
||||||
|
|
||||||
if ((oom= qry->IsTruncated()))
|
if ((oom= qry->IsTruncated()))
|
||||||
strcpy(g->Message, "Out of memory");
|
snprintf(g->Message, sizeof(g->Message), "Out of memory");
|
||||||
|
|
||||||
dbug_tmp_restore_column_map(&table->write_set, old_map);
|
dbug_tmp_restore_column_map(&table->write_set, old_map);
|
||||||
return oom;
|
return oom;
|
||||||
@@ -3385,7 +3385,7 @@ const COND *ha_connect::cond_push(const COND *cond)
|
|||||||
if (trace(1))
|
if (trace(1))
|
||||||
htrc("Exception %d: %s\n", n, g->Message);
|
htrc("Exception %d: %s\n", n, g->Message);
|
||||||
} catch (const char *msg) {
|
} catch (const char *msg) {
|
||||||
strcpy(g->Message, msg);
|
snprintf(g->Message, sizeof(g->Message), "%s", msg);
|
||||||
} // end catch
|
} // end catch
|
||||||
|
|
||||||
fin:;
|
fin:;
|
||||||
@@ -3611,7 +3611,7 @@ int ha_connect::optimize(THD* thd, HA_CHECK_OPT*)
|
|||||||
htrc("Exception %d: %s\n", n, g->Message);
|
htrc("Exception %d: %s\n", n, g->Message);
|
||||||
rc= HA_ERR_INTERNAL_ERROR;
|
rc= HA_ERR_INTERNAL_ERROR;
|
||||||
} catch (const char *msg) {
|
} catch (const char *msg) {
|
||||||
strcpy(g->Message, msg);
|
snprintf(g->Message, sizeof(g->Message), "%s", msg);
|
||||||
rc= HA_ERR_INTERNAL_ERROR;
|
rc= HA_ERR_INTERNAL_ERROR;
|
||||||
} // end catch
|
} // end catch
|
||||||
|
|
||||||
@@ -4711,7 +4711,7 @@ MODE ha_connect::CheckMode(PGLOBAL g, THD *thd,
|
|||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
htrc("Unsupported sql_command=%d\n", thd_sql_command(thd));
|
htrc("Unsupported sql_command=%d\n", thd_sql_command(thd));
|
||||||
strcpy(g->Message, "CONNECT Unsupported command");
|
snprintf(g->Message, sizeof(g->Message), "CONNECT Unsupported command");
|
||||||
my_message(ER_NOT_ALLOWED_COMMAND, g->Message, MYF(0));
|
my_message(ER_NOT_ALLOWED_COMMAND, g->Message, MYF(0));
|
||||||
newmode= MODE_ERROR;
|
newmode= MODE_ERROR;
|
||||||
break;
|
break;
|
||||||
@@ -4769,7 +4769,7 @@ MODE ha_connect::CheckMode(PGLOBAL g, THD *thd,
|
|||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
htrc("Unsupported sql_command=%d\n", thd_sql_command(thd));
|
htrc("Unsupported sql_command=%d\n", thd_sql_command(thd));
|
||||||
strcpy(g->Message, "CONNECT Unsupported command");
|
snprintf(g->Message, sizeof(g->Message), "CONNECT Unsupported command");
|
||||||
my_message(ER_NOT_ALLOWED_COMMAND, g->Message, MYF(0));
|
my_message(ER_NOT_ALLOWED_COMMAND, g->Message, MYF(0));
|
||||||
newmode= MODE_ERROR;
|
newmode= MODE_ERROR;
|
||||||
break;
|
break;
|
||||||
@@ -5024,7 +5024,7 @@ int ha_connect::external_lock(THD *thd, int lock_type)
|
|||||||
xmod= MODE_ANY; // For info commands
|
xmod= MODE_ANY; // For info commands
|
||||||
DBUG_RETURN(rc);
|
DBUG_RETURN(rc);
|
||||||
} else if (check_privileges(thd, options, table->s->db.str)) {
|
} else if (check_privileges(thd, options, table->s->db.str)) {
|
||||||
strcpy(g->Message, "This operation requires the FILE privilege");
|
snprintf(g->Message, sizeof(g->Message), "This operation requires the FILE privilege");
|
||||||
htrc("%s\n", g->Message);
|
htrc("%s\n", g->Message);
|
||||||
DBUG_RETURN(HA_ERR_INTERNAL_ERROR);
|
DBUG_RETURN(HA_ERR_INTERNAL_ERROR);
|
||||||
} // endif check_privileges
|
} // endif check_privileges
|
||||||
@@ -5378,7 +5378,7 @@ bool CheckSelf(PGLOBAL g, TABLE_SHARE *s, PCSZ host,
|
|||||||
else if (port && port != (signed)GetDefaultPort())
|
else if (port && port != (signed)GetDefaultPort())
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
strcpy(g->Message, "This MySQL table is defined on itself");
|
snprintf(g->Message, sizeof(g->Message), "This MySQL table is defined on itself");
|
||||||
return true;
|
return true;
|
||||||
} // end of CheckSelf
|
} // end of CheckSelf
|
||||||
|
|
||||||
@@ -5721,7 +5721,7 @@ static int connect_assisted_discovery(handlerton *, THD* thd,
|
|||||||
} else if (topt->http) {
|
} else if (topt->http) {
|
||||||
if (ttp == TAB_UNDEF) {
|
if (ttp == TAB_UNDEF) {
|
||||||
ttr= TAB_JSON;
|
ttr= TAB_JSON;
|
||||||
strcpy(g->Message, "No table_type. Was set to JSON");
|
snprintf(g->Message, sizeof(g->Message), "No table_type. Was set to JSON");
|
||||||
push_warning(thd, Sql_condition::WARN_LEVEL_NOTE, 0, g->Message);
|
push_warning(thd, Sql_condition::WARN_LEVEL_NOTE, 0, g->Message);
|
||||||
} else
|
} else
|
||||||
ttr= ttp;
|
ttr= ttp;
|
||||||
@@ -5754,7 +5754,7 @@ static int connect_assisted_discovery(handlerton *, THD* thd,
|
|||||||
case TAB_BSON:
|
case TAB_BSON:
|
||||||
#endif // BSON_SUPPORT
|
#endif // BSON_SUPPORT
|
||||||
if (checkPrivileges(thd, ttp, topt, db)) {
|
if (checkPrivileges(thd, ttp, topt, db)) {
|
||||||
strcpy(g->Message, "This operation requires the FILE privilege");
|
snprintf(g->Message, sizeof(g->Message), "This operation requires the FILE privilege");
|
||||||
rc= HA_ERR_INTERNAL_ERROR;
|
rc= HA_ERR_INTERNAL_ERROR;
|
||||||
goto err;
|
goto err;
|
||||||
} // endif check_privileges
|
} // endif check_privileges
|
||||||
@@ -5770,7 +5770,7 @@ static int connect_assisted_discovery(handlerton *, THD* thd,
|
|||||||
char *p;
|
char *p;
|
||||||
|
|
||||||
if (!tbl) {
|
if (!tbl) {
|
||||||
strcpy(g->Message, "Missing table list");
|
snprintf(g->Message, sizeof(g->Message), "Missing table list");
|
||||||
rc= HA_ERR_INTERNAL_ERROR;
|
rc= HA_ERR_INTERNAL_ERROR;
|
||||||
goto err;
|
goto err;
|
||||||
} // endif tbl
|
} // endif tbl
|
||||||
@@ -5828,7 +5828,7 @@ static int connect_assisted_discovery(handlerton *, THD* thd,
|
|||||||
if (fnc & FNC_DRIVER) {
|
if (fnc & FNC_DRIVER) {
|
||||||
ok= true;
|
ok= true;
|
||||||
} else if (!(url= strz(g, create_info->connect_string))) {
|
} else if (!(url= strz(g, create_info->connect_string))) {
|
||||||
strcpy(g->Message, "Missing URL");
|
snprintf(g->Message, sizeof(g->Message), "Missing URL");
|
||||||
} else {
|
} else {
|
||||||
// Store JDBC additional parameters
|
// Store JDBC additional parameters
|
||||||
int rc;
|
int rc;
|
||||||
@@ -5932,7 +5932,7 @@ static int connect_assisted_discovery(handlerton *, THD* thd,
|
|||||||
if (topt->module && topt->subtype)
|
if (topt->module && topt->subtype)
|
||||||
ok= true;
|
ok= true;
|
||||||
else
|
else
|
||||||
strcpy(g->Message, "Missing OEM module or subtype");
|
snprintf(g->Message, sizeof(g->Message), "Missing OEM module or subtype");
|
||||||
|
|
||||||
break;
|
break;
|
||||||
#if defined(LIBXML2_SUPPORT) || defined(DOMDOC_SUPPORT)
|
#if defined(LIBXML2_SUPPORT) || defined(DOMDOC_SUPPORT)
|
||||||
@@ -5984,7 +5984,7 @@ static int connect_assisted_discovery(handlerton *, THD* thd,
|
|||||||
} // endif supfnc
|
} // endif supfnc
|
||||||
|
|
||||||
if (src && fnc != FNC_NO) {
|
if (src && fnc != FNC_NO) {
|
||||||
strcpy(g->Message, "Cannot make catalog table from srcdef");
|
snprintf(g->Message, sizeof(g->Message), "Cannot make catalog table from srcdef");
|
||||||
ok= false;
|
ok= false;
|
||||||
} // endif src
|
} // endif src
|
||||||
|
|
||||||
@@ -6136,7 +6136,7 @@ static int connect_assisted_discovery(handlerton *, THD* thd,
|
|||||||
qrp= OEMColumns(g, topt, tab, (char*)db, fnc == FNC_COL);
|
qrp= OEMColumns(g, topt, tab, (char*)db, fnc == FNC_COL);
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
strcpy(g->Message, "System error during assisted discovery");
|
snprintf(g->Message, sizeof(g->Message), "System error during assisted discovery");
|
||||||
break;
|
break;
|
||||||
} // endswitch ttp
|
} // endswitch ttp
|
||||||
|
|
||||||
@@ -6380,7 +6380,7 @@ static int connect_assisted_discovery(handlerton *, THD* thd,
|
|||||||
htrc("Exception %d: %s\n", n, g->Message);
|
htrc("Exception %d: %s\n", n, g->Message);
|
||||||
rc= HA_ERR_INTERNAL_ERROR;
|
rc= HA_ERR_INTERNAL_ERROR;
|
||||||
} catch (const char *msg) {
|
} catch (const char *msg) {
|
||||||
strcpy(g->Message, msg);
|
snprintf(g->Message, sizeof(g->Message), "%s", msg);
|
||||||
rc= HA_ERR_INTERNAL_ERROR;
|
rc= HA_ERR_INTERNAL_ERROR;
|
||||||
} // end catch
|
} // end catch
|
||||||
|
|
||||||
@@ -6538,7 +6538,7 @@ int ha_connect::create(const char *name, TABLE *table_arg,
|
|||||||
case TAB_PIVOT:
|
case TAB_PIVOT:
|
||||||
case TAB_OCCUR:
|
case TAB_OCCUR:
|
||||||
if (options->srcdef) {
|
if (options->srcdef) {
|
||||||
strcpy(g->Message, "Cannot check looping reference");
|
snprintf(g->Message, sizeof(g->Message), "Cannot check looping reference");
|
||||||
push_warning(thd, Sql_condition::WARN_LEVEL_WARN, 0, g->Message);
|
push_warning(thd, Sql_condition::WARN_LEVEL_WARN, 0, g->Message);
|
||||||
} else if (options->tabname) {
|
} else if (options->tabname) {
|
||||||
if (!stricmp(options->tabname, create_info->alias.str) &&
|
if (!stricmp(options->tabname, create_info->alias.str) &&
|
||||||
@@ -6551,7 +6551,7 @@ int ha_connect::create(const char *name, TABLE *table_arg,
|
|||||||
} // endif tab
|
} // endif tab
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
strcpy(g->Message, "Missing object table name or definition");
|
snprintf(g->Message, sizeof(g->Message), "Missing object table name or definition");
|
||||||
my_message(ER_UNKNOWN_ERROR, g->Message, MYF(0));
|
my_message(ER_UNKNOWN_ERROR, g->Message, MYF(0));
|
||||||
DBUG_RETURN(HA_ERR_INTERNAL_ERROR);
|
DBUG_RETURN(HA_ERR_INTERNAL_ERROR);
|
||||||
} // endif tabname
|
} // endif tabname
|
||||||
@@ -6629,14 +6629,14 @@ int ha_connect::create(const char *name, TABLE *table_arg,
|
|||||||
|
|
||||||
#if !defined(DOMDOC_SUPPORT)
|
#if !defined(DOMDOC_SUPPORT)
|
||||||
if (dom) {
|
if (dom) {
|
||||||
strcpy(g->Message, "MS-DOM not supported by this version");
|
snprintf(g->Message, sizeof(g->Message), "MS-DOM not supported by this version");
|
||||||
xsup= NULL;
|
xsup= NULL;
|
||||||
} // endif DomDoc
|
} // endif DomDoc
|
||||||
#endif // !DOMDOC_SUPPORT
|
#endif // !DOMDOC_SUPPORT
|
||||||
|
|
||||||
#if !defined(LIBXML2_SUPPORT)
|
#if !defined(LIBXML2_SUPPORT)
|
||||||
if (!dom) {
|
if (!dom) {
|
||||||
strcpy(g->Message, "libxml2 not supported by this version");
|
snprintf(g->Message, sizeof(g->Message), "libxml2 not supported by this version");
|
||||||
xsup= NULL;
|
xsup= NULL;
|
||||||
} // endif Libxml2
|
} // endif Libxml2
|
||||||
#endif // !LIBXML2_SUPPORT
|
#endif // !LIBXML2_SUPPORT
|
||||||
@@ -6681,7 +6681,7 @@ int ha_connect::create(const char *name, TABLE *table_arg,
|
|||||||
continue; // This is a virtual column
|
continue; // This is a virtual column
|
||||||
|
|
||||||
if (fp->flags & AUTO_INCREMENT_FLAG) {
|
if (fp->flags & AUTO_INCREMENT_FLAG) {
|
||||||
strcpy(g->Message, "Auto_increment is not supported yet");
|
snprintf(g->Message, sizeof(g->Message), "Auto_increment is not supported yet");
|
||||||
my_message(ER_UNKNOWN_ERROR, g->Message, MYF(0));
|
my_message(ER_UNKNOWN_ERROR, g->Message, MYF(0));
|
||||||
rc= HA_ERR_INTERNAL_ERROR;
|
rc= HA_ERR_INTERNAL_ERROR;
|
||||||
DBUG_RETURN(rc);
|
DBUG_RETURN(rc);
|
||||||
@@ -6697,7 +6697,7 @@ int ha_connect::create(const char *name, TABLE *table_arg,
|
|||||||
|
|
||||||
if (type == TAB_VIR)
|
if (type == TAB_VIR)
|
||||||
if (!fp->option_struct || !fp->option_struct->special) {
|
if (!fp->option_struct || !fp->option_struct->special) {
|
||||||
strcpy(g->Message, "Virtual tables accept only special or virtual columns");
|
snprintf(g->Message, sizeof(g->Message), "Virtual tables accept only special or virtual columns");
|
||||||
my_message(ER_UNKNOWN_ERROR, g->Message, MYF(0));
|
my_message(ER_UNKNOWN_ERROR, g->Message, MYF(0));
|
||||||
rc= HA_ERR_INTERNAL_ERROR;
|
rc= HA_ERR_INTERNAL_ERROR;
|
||||||
DBUG_RETURN(rc);
|
DBUG_RETURN(rc);
|
||||||
@@ -6915,7 +6915,7 @@ int ha_connect::create(const char *name, TABLE *table_arg,
|
|||||||
// This is an ALTER to CONNECT from another engine.
|
// This is an ALTER to CONNECT from another engine.
|
||||||
// It cannot be accepted because the table data would be modified
|
// It cannot be accepted because the table data would be modified
|
||||||
// except when the target file does not exist.
|
// except when the target file does not exist.
|
||||||
strcpy(g->Message, "Operation denied. Table data would be modified.");
|
snprintf(g->Message, sizeof(g->Message), "Operation denied. Table data would be modified.");
|
||||||
my_message(ER_UNKNOWN_ERROR, g->Message, MYF(0));
|
my_message(ER_UNKNOWN_ERROR, g->Message, MYF(0));
|
||||||
DBUG_RETURN(HA_ERR_INTERNAL_ERROR);
|
DBUG_RETURN(HA_ERR_INTERNAL_ERROR);
|
||||||
} // endif part_info
|
} // endif part_info
|
||||||
@@ -6925,11 +6925,11 @@ int ha_connect::create(const char *name, TABLE *table_arg,
|
|||||||
// Get the index definitions
|
// Get the index definitions
|
||||||
if ((xdp= GetIndexInfo()) || sqlcom == SQLCOM_DROP_INDEX) {
|
if ((xdp= GetIndexInfo()) || sqlcom == SQLCOM_DROP_INDEX) {
|
||||||
if (options->multiple) {
|
if (options->multiple) {
|
||||||
strcpy(g->Message, "Multiple tables are not indexable");
|
snprintf(g->Message, sizeof(g->Message), "Multiple tables are not indexable");
|
||||||
my_message(ER_UNKNOWN_ERROR, g->Message, MYF(0));
|
my_message(ER_UNKNOWN_ERROR, g->Message, MYF(0));
|
||||||
rc= HA_ERR_UNSUPPORTED;
|
rc= HA_ERR_UNSUPPORTED;
|
||||||
} else if (options->compressed) {
|
} else if (options->compressed) {
|
||||||
strcpy(g->Message, "Compressed tables are not indexable");
|
snprintf(g->Message, sizeof(g->Message), "Compressed tables are not indexable");
|
||||||
my_message(ER_UNKNOWN_ERROR, g->Message, MYF(0));
|
my_message(ER_UNKNOWN_ERROR, g->Message, MYF(0));
|
||||||
rc= HA_ERR_UNSUPPORTED;
|
rc= HA_ERR_UNSUPPORTED;
|
||||||
} else if (GetIndexType(type) == 1) {
|
} else if (GetIndexType(type) == 1) {
|
||||||
@@ -7210,11 +7210,11 @@ ha_connect::check_if_supported_inplace_alter(TABLE *altered_table,
|
|||||||
!SameString(altered_table, "optname") ||
|
!SameString(altered_table, "optname") ||
|
||||||
!SameBool(altered_table, "sepindex")) {
|
!SameBool(altered_table, "sepindex")) {
|
||||||
if (newopt->multiple) {
|
if (newopt->multiple) {
|
||||||
strcpy(g->Message, "Multiple tables are not indexable");
|
snprintf(g->Message, sizeof(g->Message), "Multiple tables are not indexable");
|
||||||
my_message(ER_UNKNOWN_ERROR, g->Message, MYF(0));
|
my_message(ER_UNKNOWN_ERROR, g->Message, MYF(0));
|
||||||
DBUG_RETURN(HA_ALTER_ERROR);
|
DBUG_RETURN(HA_ALTER_ERROR);
|
||||||
} else if (newopt->compressed) {
|
} else if (newopt->compressed) {
|
||||||
strcpy(g->Message, "Compressed tables are not indexable");
|
snprintf(g->Message, sizeof(g->Message), "Compressed tables are not indexable");
|
||||||
my_message(ER_UNKNOWN_ERROR, g->Message, MYF(0));
|
my_message(ER_UNKNOWN_ERROR, g->Message, MYF(0));
|
||||||
DBUG_RETURN(HA_ALTER_ERROR);
|
DBUG_RETURN(HA_ALTER_ERROR);
|
||||||
} else if (GetIndexType(type) == 1) {
|
} else if (GetIndexType(type) == 1) {
|
||||||
@@ -7265,7 +7265,7 @@ ha_connect::check_if_supported_inplace_alter(TABLE *altered_table,
|
|||||||
tshp= NULL;
|
tshp= NULL;
|
||||||
|
|
||||||
if (FileExists(fn, false)) {
|
if (FileExists(fn, false)) {
|
||||||
strcpy(g->Message, "Operation denied. Table data would be lost.");
|
snprintf(g->Message, sizeof(g->Message), "Operation denied. Table data would be lost.");
|
||||||
my_message(ER_UNKNOWN_ERROR, g->Message, MYF(0));
|
my_message(ER_UNKNOWN_ERROR, g->Message, MYF(0));
|
||||||
DBUG_RETURN(HA_ALTER_ERROR);
|
DBUG_RETURN(HA_ALTER_ERROR);
|
||||||
} else
|
} else
|
||||||
|
@@ -167,7 +167,7 @@ bool JAVAConn::gmID(PGLOBAL g, jmethodID& mid, const char *name, const char *sig
|
|||||||
mid = env->GetMethodID(jdi, name, sig);
|
mid = env->GetMethodID(jdi, name, sig);
|
||||||
|
|
||||||
if (Check()) {
|
if (Check()) {
|
||||||
strcpy(g->Message, Msg);
|
snprintf(g->Message, sizeof(g->Message), Msg);
|
||||||
return true;
|
return true;
|
||||||
} else
|
} else
|
||||||
return false;
|
return false;
|
||||||
@@ -372,7 +372,7 @@ bool JAVAConn::Open(PGLOBAL g)
|
|||||||
rc = jvm->AttachCurrentThread((void**)&env, nullptr);
|
rc = jvm->AttachCurrentThread((void**)&env, nullptr);
|
||||||
|
|
||||||
if (rc != JNI_OK) {
|
if (rc != JNI_OK) {
|
||||||
strcpy(g->Message, "Cannot attach jvm to the current thread");
|
snprintf(g->Message, sizeof(g->Message), "Cannot attach jvm to the current thread");
|
||||||
return true;
|
return true;
|
||||||
} // endif rc
|
} // endif rc
|
||||||
|
|
||||||
@@ -456,26 +456,26 @@ bool JAVAConn::Open(PGLOBAL g)
|
|||||||
|
|
||||||
switch (rc) {
|
switch (rc) {
|
||||||
case JNI_OK:
|
case JNI_OK:
|
||||||
strcpy(g->Message, "VM successfully created");
|
snprintf(g->Message, sizeof(g->Message), "VM successfully created");
|
||||||
brc = false;
|
brc = false;
|
||||||
break;
|
break;
|
||||||
case JNI_ERR:
|
case JNI_ERR:
|
||||||
strcpy(g->Message, "Initialising JVM failed: unknown error");
|
snprintf(g->Message, sizeof(g->Message), "Initialising JVM failed: unknown error");
|
||||||
break;
|
break;
|
||||||
case JNI_EDETACHED:
|
case JNI_EDETACHED:
|
||||||
strcpy(g->Message, "Thread detached from the VM");
|
snprintf(g->Message, sizeof(g->Message), "Thread detached from the VM");
|
||||||
break;
|
break;
|
||||||
case JNI_EVERSION:
|
case JNI_EVERSION:
|
||||||
strcpy(g->Message, "JNI version error");
|
snprintf(g->Message, sizeof(g->Message), "JNI version error");
|
||||||
break;
|
break;
|
||||||
case JNI_ENOMEM:
|
case JNI_ENOMEM:
|
||||||
strcpy(g->Message, "Not enough memory");
|
snprintf(g->Message, sizeof(g->Message), "Not enough memory");
|
||||||
break;
|
break;
|
||||||
case JNI_EEXIST:
|
case JNI_EEXIST:
|
||||||
strcpy(g->Message, "VM already created");
|
snprintf(g->Message, sizeof(g->Message), "VM already created");
|
||||||
break;
|
break;
|
||||||
case JNI_EINVAL:
|
case JNI_EINVAL:
|
||||||
strcpy(g->Message, "Invalid arguments");
|
snprintf(g->Message, sizeof(g->Message), "Invalid arguments");
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
snprintf(g->Message, sizeof(g->Message), "Unknown return code %d", (int)rc);
|
snprintf(g->Message, sizeof(g->Message), "Unknown return code %d", (int)rc);
|
||||||
@@ -516,7 +516,7 @@ bool JAVAConn::Open(PGLOBAL g)
|
|||||||
rc = env->CallStaticIntMethod(jdi, alp, path);
|
rc = env->CallStaticIntMethod(jdi, alp, path);
|
||||||
|
|
||||||
if ((msg = Check(rc))) {
|
if ((msg = Check(rc))) {
|
||||||
strcpy(g->Message, msg);
|
snprintf(g->Message, sizeof(g->Message), msg);
|
||||||
env->DeleteLocalRef(path);
|
env->DeleteLocalRef(path);
|
||||||
return RC_FX;
|
return RC_FX;
|
||||||
} else switch (rc) {
|
} else switch (rc) {
|
||||||
@@ -528,7 +528,7 @@ bool JAVAConn::Open(PGLOBAL g)
|
|||||||
break;
|
break;
|
||||||
case JNI_ERR:
|
case JNI_ERR:
|
||||||
default:
|
default:
|
||||||
strcpy(g->Message, "Error adding jpath");
|
snprintf(g->Message, sizeof(g->Message), "Error adding jpath");
|
||||||
env->DeleteLocalRef(path);
|
env->DeleteLocalRef(path);
|
||||||
return RC_FX;
|
return RC_FX;
|
||||||
} // endswitch rc
|
} // endswitch rc
|
||||||
@@ -559,7 +559,7 @@ bool JAVAConn::Open(PGLOBAL g)
|
|||||||
errid = env->GetMethodID(jdi, "GetErrmsg", "()Ljava/lang/String;");
|
errid = env->GetMethodID(jdi, "GetErrmsg", "()Ljava/lang/String;");
|
||||||
|
|
||||||
if (env->ExceptionCheck()) {
|
if (env->ExceptionCheck()) {
|
||||||
strcpy(g->Message, "ERROR: method GetErrmsg() not found!");
|
snprintf(g->Message, sizeof(g->Message), "ERROR: method GetErrmsg() not found!");
|
||||||
env->ExceptionDescribe();
|
env->ExceptionDescribe();
|
||||||
env->ExceptionClear();
|
env->ExceptionClear();
|
||||||
return true;
|
return true;
|
||||||
|
@@ -879,11 +879,11 @@ int JDBConn::ExecuteCommand(PCSZ sql)
|
|||||||
snprintf(g->Message, sizeof(g->Message), "GetResult: %s", Msg);
|
snprintf(g->Message, sizeof(g->Message), "GetResult: %s", Msg);
|
||||||
rc = RC_FX;
|
rc = RC_FX;
|
||||||
} else if (m_Ncol) {
|
} else if (m_Ncol) {
|
||||||
strcpy(g->Message, "Result set column number");
|
snprintf(g->Message, sizeof(g->Message), "Result set column number");
|
||||||
rc = RC_OK; // A result set was returned
|
rc = RC_OK; // A result set was returned
|
||||||
} else {
|
} else {
|
||||||
m_Aff = (int)n; // Affected rows
|
m_Aff = (int)n; // Affected rows
|
||||||
strcpy(g->Message, "Affected rows");
|
snprintf(g->Message, sizeof(g->Message), "Affected rows");
|
||||||
rc = RC_NF;
|
rc = RC_NF;
|
||||||
} // endif ncol
|
} // endif ncol
|
||||||
|
|
||||||
@@ -903,7 +903,7 @@ int JDBConn::Fetch(int pos)
|
|||||||
|
|
||||||
if (pos) {
|
if (pos) {
|
||||||
if (!m_Scrollable) {
|
if (!m_Scrollable) {
|
||||||
strcpy(g->Message, "Cannot fetch(pos) if FORWARD ONLY");
|
snprintf(g->Message, sizeof(g->Message), "Cannot fetch(pos) if FORWARD ONLY");
|
||||||
return rc;
|
return rc;
|
||||||
} else if (gmID(m_G, fetchid, "Fetch", "(I)Z"))
|
} else if (gmID(m_G, fetchid, "Fetch", "(I)Z"))
|
||||||
return rc;
|
return rc;
|
||||||
@@ -1232,7 +1232,7 @@ int JDBConn::ExecuteSQL(void)
|
|||||||
jint n = env->CallIntMethod(job, xpid);
|
jint n = env->CallIntMethod(job, xpid);
|
||||||
|
|
||||||
if (n == -3)
|
if (n == -3)
|
||||||
strcpy(g->Message, "SQL statement is not prepared");
|
snprintf(g->Message, sizeof(g->Message), "SQL statement is not prepared");
|
||||||
else if (Check(n))
|
else if (Check(n))
|
||||||
snprintf(g->Message, sizeof(g->Message), "ExecutePrep: %s", Msg);
|
snprintf(g->Message, sizeof(g->Message), "ExecutePrep: %s", Msg);
|
||||||
else {
|
else {
|
||||||
@@ -1315,17 +1315,17 @@ bool JDBConn::SetParam(JDBCCOL *colp)
|
|||||||
break;
|
break;
|
||||||
case TYPE_DATE:
|
case TYPE_DATE:
|
||||||
if ((dat = env->FindClass("java/sql/Timestamp")) == nullptr) {
|
if ((dat = env->FindClass("java/sql/Timestamp")) == nullptr) {
|
||||||
strcpy(g->Message, "Cannot find Timestamp class");
|
snprintf(g->Message, sizeof(g->Message), "Cannot find Timestamp class");
|
||||||
return true;
|
return true;
|
||||||
} else if (!(dtc = env->GetMethodID(dat, "<init>", "(J)V"))) {
|
} else if (!(dtc = env->GetMethodID(dat, "<init>", "(J)V"))) {
|
||||||
strcpy(g->Message, "Cannot find Timestamp class constructor");
|
snprintf(g->Message, sizeof(g->Message), "Cannot find Timestamp class constructor");
|
||||||
return true;
|
return true;
|
||||||
} // endif's
|
} // endif's
|
||||||
|
|
||||||
lg = (jlong)val->GetBigintValue() * 1000;
|
lg = (jlong)val->GetBigintValue() * 1000;
|
||||||
|
|
||||||
if ((datobj = env->NewObject(dat, dtc, lg)) == nullptr) {
|
if ((datobj = env->NewObject(dat, dtc, lg)) == nullptr) {
|
||||||
strcpy(g->Message, "Cannot make Timestamp object");
|
snprintf(g->Message, sizeof(g->Message), "Cannot make Timestamp object");
|
||||||
return true;
|
return true;
|
||||||
} else if (gmID(g, setid, "SetTimestampParm", "(ILjava/sql/Timestamp;)V"))
|
} else if (gmID(g, setid, "SetTimestampParm", "(ILjava/sql/Timestamp;)V"))
|
||||||
return true;
|
return true;
|
||||||
@@ -1416,12 +1416,12 @@ bool JDBConn::SetParam(JDBCCOL *colp)
|
|||||||
int rc = ExecuteCommand(src);
|
int rc = ExecuteCommand(src);
|
||||||
|
|
||||||
if (rc == RC_NF) {
|
if (rc == RC_NF) {
|
||||||
strcpy(g->Message, "Srcdef is not returning a result set");
|
snprintf(g->Message, sizeof(g->Message), "Srcdef is not returning a result set");
|
||||||
return NULL;
|
return NULL;
|
||||||
} else if ((rc) == RC_FX) {
|
} else if ((rc) == RC_FX) {
|
||||||
return NULL;
|
return NULL;
|
||||||
} else if (m_Ncol == 0) {
|
} else if (m_Ncol == 0) {
|
||||||
strcpy(g->Message, "Invalid Srcdef");
|
snprintf(g->Message, sizeof(g->Message), "Invalid Srcdef");
|
||||||
return NULL;
|
return NULL;
|
||||||
} // endif's
|
} // endif's
|
||||||
|
|
||||||
@@ -1463,7 +1463,7 @@ bool JDBConn::SetParam(JDBCCOL *colp)
|
|||||||
if (Check())
|
if (Check())
|
||||||
snprintf(g->Message, sizeof(g->Message), "ColumnDesc: %s", Msg);
|
snprintf(g->Message, sizeof(g->Message), "ColumnDesc: %s", Msg);
|
||||||
else
|
else
|
||||||
strcpy(g->Message, "No result metadata");
|
snprintf(g->Message, sizeof(g->Message), "No result metadata");
|
||||||
|
|
||||||
env->ReleaseIntArrayElements(val, n, 0);
|
env->ReleaseIntArrayElements(val, n, 0);
|
||||||
return NULL;
|
return NULL;
|
||||||
@@ -1568,7 +1568,7 @@ bool JDBConn::SetParam(JDBCCOL *colp)
|
|||||||
|
|
||||||
// n because we no more ignore the first column
|
// n because we no more ignore the first column
|
||||||
if ((n = qrp->Nbcol) > (uint)ncol) {
|
if ((n = qrp->Nbcol) > (uint)ncol) {
|
||||||
strcpy(g->Message, MSG(COL_NUM_MISM));
|
snprintf(g->Message, sizeof(g->Message), MSG(COL_NUM_MISM));
|
||||||
return -1;
|
return -1;
|
||||||
} // endif n
|
} // endif n
|
||||||
|
|
||||||
@@ -1638,7 +1638,7 @@ bool JDBConn::SetParam(JDBCCOL *colp)
|
|||||||
PQRYRES qrp;
|
PQRYRES qrp;
|
||||||
|
|
||||||
if (!m_Rows) {
|
if (!m_Rows) {
|
||||||
strcpy(g->Message, "Void result");
|
snprintf(g->Message, sizeof(g->Message), "Void result");
|
||||||
return NULL;
|
return NULL;
|
||||||
} // endif m_Rows
|
} // endif m_Rows
|
||||||
|
|
||||||
|
@@ -264,7 +264,7 @@ bool JMgoConn::MakeCursor(PGLOBAL g, PTDB tdbp, PCSZ options,
|
|||||||
p = strrchr(Options, ']');
|
p = strrchr(Options, ']');
|
||||||
|
|
||||||
if (!p) {
|
if (!p) {
|
||||||
strcpy(g->Message, "Missing ] in pipeline");
|
snprintf(g->Message, sizeof(g->Message), "Missing ] in pipeline");
|
||||||
return true;
|
return true;
|
||||||
} else
|
} else
|
||||||
*(char*)p = 0;
|
*(char*)p = 0;
|
||||||
@@ -275,7 +275,7 @@ bool JMgoConn::MakeCursor(PGLOBAL g, PTDB tdbp, PCSZ options,
|
|||||||
s->Append(",{\"$match\":");
|
s->Append(",{\"$match\":");
|
||||||
|
|
||||||
if (MakeSelector(g, filp, s)) {
|
if (MakeSelector(g, filp, s)) {
|
||||||
strcpy(g->Message, "Failed making selector");
|
snprintf(g->Message, sizeof(g->Message), "Failed making selector");
|
||||||
return true;
|
return true;
|
||||||
} else
|
} else
|
||||||
s->Append('}');
|
s->Append('}');
|
||||||
@@ -343,7 +343,7 @@ bool JMgoConn::MakeCursor(PGLOBAL g, PTDB tdbp, PCSZ options,
|
|||||||
s->Append(',');
|
s->Append(',');
|
||||||
|
|
||||||
if (MakeSelector(g, filp, s)) {
|
if (MakeSelector(g, filp, s)) {
|
||||||
strcpy(g->Message, "Failed making selector");
|
snprintf(g->Message, sizeof(g->Message), "Failed making selector");
|
||||||
return true;
|
return true;
|
||||||
} // endif Selector
|
} // endif Selector
|
||||||
|
|
||||||
|
@@ -164,7 +164,7 @@ PJSON ParseJson(PGLOBAL g, char* s, size_t len, int* ptyp, bool* comma)
|
|||||||
htrc("ParseJson: s=%.10s len=%zd\n", s, len);
|
htrc("ParseJson: s=%.10s len=%zd\n", s, len);
|
||||||
|
|
||||||
if (!s || !len) {
|
if (!s || !len) {
|
||||||
strcpy(g->Message, "Void JSON object");
|
snprintf(g->Message, sizeof(g->Message), "Void JSON object");
|
||||||
return NULL;
|
return NULL;
|
||||||
} else if (comma)
|
} else if (comma)
|
||||||
*comma = false;
|
*comma = false;
|
||||||
@@ -247,7 +247,7 @@ PJSON ParseJson(PGLOBAL g, char* s, size_t len, int* ptyp, bool* comma)
|
|||||||
htrc("Exception %d: %s\n", n, g->Message);
|
htrc("Exception %d: %s\n", n, g->Message);
|
||||||
jsp = NULL;
|
jsp = NULL;
|
||||||
} catch (const char* msg) {
|
} catch (const char* msg) {
|
||||||
strcpy(g->Message, msg);
|
snprintf(g->Message, sizeof(g->Message), "%s", msg);
|
||||||
jsp = NULL;
|
jsp = NULL;
|
||||||
} // end catch
|
} // end catch
|
||||||
|
|
||||||
@@ -271,7 +271,7 @@ PSZ Serialize(PGLOBAL g, PJSON jsp, char* fn, int pretty) {
|
|||||||
jdp->dfp = GetDefaultPrec();
|
jdp->dfp = GetDefaultPrec();
|
||||||
|
|
||||||
if (!jsp) {
|
if (!jsp) {
|
||||||
safe_strcpy(g->Message, sizeof(g->Message), "Null json tree");
|
snprintf(g->Message, sizeof(g->Message), "Null json tree");
|
||||||
throw 1;
|
throw 1;
|
||||||
} else if (!fn) {
|
} else if (!fn) {
|
||||||
// Serialize to a string
|
// Serialize to a string
|
||||||
@@ -307,20 +307,25 @@ PSZ Serialize(PGLOBAL g, PJSON jsp, char* fn, int pretty) {
|
|||||||
err = jdp->SerializeValue((PJVAL)jsp);
|
err = jdp->SerializeValue((PJVAL)jsp);
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
strcpy(g->Message, "Invalid json tree");
|
snprintf(g->Message, sizeof(g->Message), "Invalid json tree");
|
||||||
} // endswitch Type
|
} // endswitch Type
|
||||||
|
|
||||||
if (fs) {
|
if (fs) {
|
||||||
fputs(EL, fs);
|
fputs(EL, fs);
|
||||||
fclose(fs);
|
fclose(fs);
|
||||||
str = (err) ? NULL : strcpy(g->Message, "Ok");
|
if(err) {
|
||||||
|
str = NULL;
|
||||||
|
} else {
|
||||||
|
snprintf(g->Message, sizeof(g->Message), "Ok");
|
||||||
|
str = g->Message;
|
||||||
|
}
|
||||||
} else if (!err) {
|
} else if (!err) {
|
||||||
str = ((JOUTSTR*)jp)->Strp;
|
str = ((JOUTSTR*)jp)->Strp;
|
||||||
jp->WriteChr('\0');
|
jp->WriteChr('\0');
|
||||||
PlugSubAlloc(g, NULL, ((JOUTSTR*)jp)->N);
|
PlugSubAlloc(g, NULL, ((JOUTSTR*)jp)->N);
|
||||||
} else {
|
} else {
|
||||||
if (!g->Message[0])
|
if (!g->Message[0])
|
||||||
strcpy(g->Message, "Error in Serialize");
|
snprintf(g->Message, sizeof(g->Message), "Error in Serialize");
|
||||||
|
|
||||||
} // endif's
|
} // endif's
|
||||||
|
|
||||||
@@ -329,7 +334,7 @@ PSZ Serialize(PGLOBAL g, PJSON jsp, char* fn, int pretty) {
|
|||||||
htrc("Exception %d: %s\n", n, g->Message);
|
htrc("Exception %d: %s\n", n, g->Message);
|
||||||
str = NULL;
|
str = NULL;
|
||||||
} catch (const char* msg) {
|
} catch (const char* msg) {
|
||||||
strcpy(g->Message, msg);
|
snprintf(g->Message, sizeof(g->Message), "%s", msg);
|
||||||
str = NULL;
|
str = NULL;
|
||||||
} // end catch
|
} // end catch
|
||||||
|
|
||||||
@@ -553,7 +558,7 @@ PJAR JDOC::ParseAsArray(PGLOBAL g, int& i, int pretty, int *ptyp)
|
|||||||
|
|
||||||
return jsp;
|
return jsp;
|
||||||
} else
|
} else
|
||||||
strcpy(g->Message, "More than one item in file");
|
snprintf(g->Message, sizeof(g->Message), "More than one item in file");
|
||||||
|
|
||||||
return NULL;
|
return NULL;
|
||||||
} // end of ParseAsArray
|
} // end of ParseAsArray
|
||||||
@@ -672,7 +677,7 @@ PJOB JDOC::ParseObject(PGLOBAL g, int& i)
|
|||||||
throw 2;
|
throw 2;
|
||||||
}; // endswitch s[i]
|
}; // endswitch s[i]
|
||||||
|
|
||||||
strcpy(g->Message, "Unexpected EOF in Object");
|
snprintf(g->Message, sizeof(g->Message), "Unexpected EOF in Object");
|
||||||
throw 2;
|
throw 2;
|
||||||
} // end of ParseObject
|
} // end of ParseObject
|
||||||
|
|
||||||
@@ -1179,7 +1184,7 @@ PSZ JOBJECT::GetText(PGLOBAL g, PSTRG text)
|
|||||||
bool JOBJECT::Merge(PGLOBAL g, PJSON jsp)
|
bool JOBJECT::Merge(PGLOBAL g, PJSON jsp)
|
||||||
{
|
{
|
||||||
if (jsp->GetType() != TYPE_JOB) {
|
if (jsp->GetType() != TYPE_JOB) {
|
||||||
strcpy(g->Message, "Second argument is not an object");
|
snprintf(g->Message, sizeof(g->Message), "Second argument is not an object");
|
||||||
return true;
|
return true;
|
||||||
} // endif Type
|
} // endif Type
|
||||||
|
|
||||||
@@ -1353,7 +1358,7 @@ PJVAL JARRAY::AddArrayValue(PGLOBAL g, PJVAL jvp, int *x)
|
|||||||
bool JARRAY::Merge(PGLOBAL g, PJSON jsp)
|
bool JARRAY::Merge(PGLOBAL g, PJSON jsp)
|
||||||
{
|
{
|
||||||
if (jsp->GetType() != TYPE_JAR) {
|
if (jsp->GetType() != TYPE_JAR) {
|
||||||
strcpy(g->Message, "Second argument is not an array");
|
snprintf(g->Message, sizeof(g->Message), "Second argument is not an array");
|
||||||
return true;
|
return true;
|
||||||
} // endif Type
|
} // endif Type
|
||||||
|
|
||||||
|
@@ -172,7 +172,7 @@ my_bool JSNX::SetArrayOptions(PGLOBAL g, char *p, int i, PSZ nm)
|
|||||||
case '!': jnp->Op = OP_SEP; break; // Average
|
case '!': jnp->Op = OP_SEP; break; // Average
|
||||||
case '#': jnp->Op = OP_NUM; break;
|
case '#': jnp->Op = OP_NUM; break;
|
||||||
case '*': // Expand this array
|
case '*': // Expand this array
|
||||||
strcpy(g->Message, "Expand not supported by this function");
|
snprintf(g->Message, sizeof(g->Message), "Expand not supported by this function");
|
||||||
return true;
|
return true;
|
||||||
default:
|
default:
|
||||||
snprintf(g->Message, sizeof(g->Message), "Invalid function specification %c", *p);
|
snprintf(g->Message, sizeof(g->Message), "Invalid function specification %c", *p);
|
||||||
@@ -194,7 +194,7 @@ my_bool JSNX::SetArrayOptions(PGLOBAL g, char *p, int i, PSZ nm)
|
|||||||
} // endif n
|
} // endif n
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
strcpy(g->Message, "Wrong array specification");
|
snprintf(g->Message, sizeof(g->Message), "Wrong array specification");
|
||||||
return true;
|
return true;
|
||||||
} // endif's
|
} // endif's
|
||||||
|
|
||||||
@@ -355,10 +355,10 @@ PJVAL JSNX::MakeJson(PGLOBAL g, PJSON jsp, int n)
|
|||||||
Jb = false;
|
Jb = false;
|
||||||
|
|
||||||
if (Value->IsTypeNum()) {
|
if (Value->IsTypeNum()) {
|
||||||
strcpy(g->Message, "Cannot make Json for a numeric value");
|
snprintf(g->Message, sizeof(g->Message), "Cannot make Json for a numeric value");
|
||||||
return NULL;
|
return NULL;
|
||||||
} else if (jsp->GetType() != TYPE_JAR && jsp->GetType() != TYPE_JOB) {
|
} else if (jsp->GetType() != TYPE_JAR && jsp->GetType() != TYPE_JOB) {
|
||||||
strcpy(g->Message, "Target is not an array or object");
|
snprintf(g->Message, sizeof(g->Message), "Target is not an array or object");
|
||||||
return NULL;
|
return NULL;
|
||||||
} else if (n < Nod -1) {
|
} else if (n < Nod -1) {
|
||||||
if (jsp->GetType() == TYPE_JAR) {
|
if (jsp->GetType() == TYPE_JAR) {
|
||||||
@@ -447,7 +447,7 @@ PJVAL JSNX::GetRowValue(PGLOBAL g, PJSON row, int i, my_bool b)
|
|||||||
val = new(g)JVALUE(row);
|
val = new(g)JVALUE(row);
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
strcpy(g->Message, "Unexpected object");
|
snprintf(g->Message, sizeof(g->Message), "Unexpected object");
|
||||||
val = NULL;
|
val = NULL;
|
||||||
} //endif Op
|
} //endif Op
|
||||||
|
|
||||||
@@ -497,7 +497,7 @@ PJVAL JSNX::GetRowValue(PGLOBAL g, PJSON row, int i, my_bool b)
|
|||||||
/*********************************************************************************/
|
/*********************************************************************************/
|
||||||
PVAL JSNX::ExpandArray(PGLOBAL g, PJAR arp, int n)
|
PVAL JSNX::ExpandArray(PGLOBAL g, PJAR arp, int n)
|
||||||
{
|
{
|
||||||
strcpy(g->Message, "Expand cannot be done by this function");
|
snprintf(g->Message, sizeof(g->Message), "Expand cannot be done by this function");
|
||||||
return NULL;
|
return NULL;
|
||||||
} // end of ExpandArray
|
} // end of ExpandArray
|
||||||
|
|
||||||
@@ -783,7 +783,7 @@ PJSON JSNX::GetRow(PGLOBAL g)
|
|||||||
((PJAR)row)->AddArrayValue(g, new(g)JVALUE(nwr));
|
((PJAR)row)->AddArrayValue(g, new(g)JVALUE(nwr));
|
||||||
((PJAR)row)->InitArray(g);
|
((PJAR)row)->InitArray(g);
|
||||||
} else {
|
} else {
|
||||||
strcpy(g->Message, "Wrong type when writing new row");
|
snprintf(g->Message, sizeof(g->Message), "Wrong type when writing new row");
|
||||||
nwr = NULL;
|
nwr = NULL;
|
||||||
} // endif's
|
} // endif's
|
||||||
|
|
||||||
@@ -816,7 +816,7 @@ my_bool JSNX::WriteValue(PGLOBAL g, PJVAL jvalp)
|
|||||||
case TYPE_JAR: arp = (PJAR)row; break;
|
case TYPE_JAR: arp = (PJAR)row; break;
|
||||||
case TYPE_JVAL: jvp = (PJVAL)row; break;
|
case TYPE_JVAL: jvp = (PJVAL)row; break;
|
||||||
default:
|
default:
|
||||||
strcpy(g->Message, "Invalid target type");
|
snprintf(g->Message, sizeof(g->Message), "Invalid target type");
|
||||||
return true;
|
return true;
|
||||||
} // endswitch Type
|
} // endswitch Type
|
||||||
|
|
||||||
@@ -851,7 +851,7 @@ PSZ JSNX::Locate(PGLOBAL g, PJSON jsp, PJVAL jvp, int k)
|
|||||||
g->Message[0] = 0;
|
g->Message[0] = 0;
|
||||||
|
|
||||||
if (!jsp) {
|
if (!jsp) {
|
||||||
strcpy(g->Message, "Null json tree");
|
snprintf(g->Message, sizeof(g->Message), "Null json tree");
|
||||||
return NULL;
|
return NULL;
|
||||||
} // endif jsp
|
} // endif jsp
|
||||||
|
|
||||||
@@ -878,7 +878,7 @@ PSZ JSNX::Locate(PGLOBAL g, PJSON jsp, PJVAL jvp, int k)
|
|||||||
|
|
||||||
if (err) {
|
if (err) {
|
||||||
if (!g->Message[0])
|
if (!g->Message[0])
|
||||||
strcpy(g->Message, "Invalid json tree");
|
snprintf(g->Message, sizeof(g->Message), "Invalid json tree");
|
||||||
|
|
||||||
} else if (Found) {
|
} else if (Found) {
|
||||||
Jp->WriteChr('\0');
|
Jp->WriteChr('\0');
|
||||||
@@ -892,7 +892,7 @@ PSZ JSNX::Locate(PGLOBAL g, PJSON jsp, PJVAL jvp, int k)
|
|||||||
|
|
||||||
PUSH_WARNING(g->Message);
|
PUSH_WARNING(g->Message);
|
||||||
} catch (const char *msg) {
|
} catch (const char *msg) {
|
||||||
strcpy(g->Message, msg);
|
snprintf(g->Message, sizeof(g->Message), "%s", msg);
|
||||||
} // end catch
|
} // end catch
|
||||||
|
|
||||||
return str;
|
return str;
|
||||||
@@ -972,7 +972,7 @@ PSZ JSNX::LocateAll(PGLOBAL g, PJSON jsp, PJVAL jvp, int mx)
|
|||||||
PJPN jnp;
|
PJPN jnp;
|
||||||
|
|
||||||
if (!jsp) {
|
if (!jsp) {
|
||||||
strcpy(g->Message, "Null json tree");
|
snprintf(g->Message, sizeof(g->Message), "Null json tree");
|
||||||
return NULL;
|
return NULL;
|
||||||
} // endif jsp
|
} // endif jsp
|
||||||
|
|
||||||
@@ -1011,7 +1011,7 @@ PSZ JSNX::LocateAll(PGLOBAL g, PJSON jsp, PJVAL jvp, int mx)
|
|||||||
PlugSubAlloc(g, NULL, Jp->N);
|
PlugSubAlloc(g, NULL, Jp->N);
|
||||||
str = Jp->Strp;
|
str = Jp->Strp;
|
||||||
} else if (!g->Message[0])
|
} else if (!g->Message[0])
|
||||||
strcpy(g->Message, "Invalid json tree");
|
snprintf(g->Message, sizeof(g->Message), "Invalid json tree");
|
||||||
|
|
||||||
} catch (int n) {
|
} catch (int n) {
|
||||||
if (trace(1))
|
if (trace(1))
|
||||||
@@ -1019,7 +1019,7 @@ PSZ JSNX::LocateAll(PGLOBAL g, PJSON jsp, PJVAL jvp, int mx)
|
|||||||
|
|
||||||
PUSH_WARNING(g->Message);
|
PUSH_WARNING(g->Message);
|
||||||
} catch (const char *msg) {
|
} catch (const char *msg) {
|
||||||
strcpy(g->Message, msg);
|
snprintf(g->Message, sizeof(g->Message), "%s", msg);
|
||||||
} // end catch
|
} // end catch
|
||||||
|
|
||||||
return str;
|
return str;
|
||||||
@@ -1402,7 +1402,7 @@ static my_bool CheckPath(PGLOBAL g, UDF_ARGS *args, PJSON jsp, PJVAL& jvp, int n
|
|||||||
} // endif jvp
|
} // endif jvp
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
strcpy(g->Message, "Path argument is null");
|
snprintf(g->Message, sizeof(g->Message), "Path argument is null");
|
||||||
return true;
|
return true;
|
||||||
} // endif path
|
} // endif path
|
||||||
|
|
||||||
@@ -1750,7 +1750,7 @@ my_bool CheckMemory(PGLOBAL g, UDF_INIT *initid, UDF_ARGS *args, uint n,
|
|||||||
char errmsg[MAX_STR];
|
char errmsg[MAX_STR];
|
||||||
|
|
||||||
snprintf(errmsg, sizeof(errmsg) - 1, MSG(WORK_AREA), g->Message);
|
snprintf(errmsg, sizeof(errmsg) - 1, MSG(WORK_AREA), g->Message);
|
||||||
strcpy(g->Message, errmsg);
|
snprintf(g->Message, sizeof(g->Message), "%s", errmsg);
|
||||||
return true;
|
return true;
|
||||||
} // endif SareaAlloc
|
} // endif SareaAlloc
|
||||||
|
|
||||||
@@ -3620,7 +3620,7 @@ char *jsonget_string(UDF_INIT *initid, UDF_ARGS *args, char *result,
|
|||||||
PUSH_WARNING(g->Message);
|
PUSH_WARNING(g->Message);
|
||||||
str = NULL;
|
str = NULL;
|
||||||
} catch (const char *msg) {
|
} catch (const char *msg) {
|
||||||
strcpy(g->Message, msg);
|
snprintf(g->Message, sizeof(g->Message), "%s", msg);
|
||||||
PUSH_WARNING(g->Message);
|
PUSH_WARNING(g->Message);
|
||||||
str = NULL;
|
str = NULL;
|
||||||
} // end catch
|
} // end catch
|
||||||
@@ -3980,7 +3980,7 @@ char *jsonlocate(UDF_INIT *initid, UDF_ARGS *args, char *result,
|
|||||||
*error = 1;
|
*error = 1;
|
||||||
path = NULL;
|
path = NULL;
|
||||||
} catch (const char *msg) {
|
} catch (const char *msg) {
|
||||||
strcpy(g->Message, msg);
|
snprintf(g->Message, sizeof(g->Message), "%s", msg);
|
||||||
PUSH_WARNING(g->Message);
|
PUSH_WARNING(g->Message);
|
||||||
*error = 1;
|
*error = 1;
|
||||||
path = NULL;
|
path = NULL;
|
||||||
@@ -4106,7 +4106,7 @@ char *json_locate_all(UDF_INIT *initid, UDF_ARGS *args, char *result,
|
|||||||
*error = 1;
|
*error = 1;
|
||||||
path = NULL;
|
path = NULL;
|
||||||
} catch (const char *msg) {
|
} catch (const char *msg) {
|
||||||
strcpy(g->Message, msg);
|
snprintf(g->Message, sizeof(g->Message), "%s", msg);
|
||||||
PUSH_WARNING(g->Message);
|
PUSH_WARNING(g->Message);
|
||||||
*error = 1;
|
*error = 1;
|
||||||
path = NULL;
|
path = NULL;
|
||||||
@@ -4379,7 +4379,7 @@ char *handle_item(UDF_INIT *initid, UDF_ARGS *args, char *result,
|
|||||||
PUSH_WARNING(g->Message);
|
PUSH_WARNING(g->Message);
|
||||||
str = NULL;
|
str = NULL;
|
||||||
} catch (const char *msg) {
|
} catch (const char *msg) {
|
||||||
strcpy(g->Message, msg);
|
snprintf(g->Message, sizeof(g->Message), "%s", msg);
|
||||||
PUSH_WARNING(g->Message);
|
PUSH_WARNING(g->Message);
|
||||||
str = NULL;
|
str = NULL;
|
||||||
} // end catch
|
} // end catch
|
||||||
@@ -6187,7 +6187,7 @@ bool JUP::unPretty(PGLOBAL g, int lrecl) {
|
|||||||
htrc("UnPretty: s=%.10s len=%zd lrecl=%d\n", s, len, lrecl);
|
htrc("UnPretty: s=%.10s len=%zd lrecl=%d\n", s, len, lrecl);
|
||||||
|
|
||||||
if (!s || !len) {
|
if (!s || !len) {
|
||||||
strcpy(g->Message, "Void JSON file");
|
snprintf(g->Message, sizeof(g->Message), "Void JSON file");
|
||||||
return true;
|
return true;
|
||||||
} else if (*s != '[') {
|
} else if (*s != '[') {
|
||||||
// strcpy(g->Message, "JSON file is not an array");
|
// strcpy(g->Message, "JSON file is not an array");
|
||||||
@@ -6250,7 +6250,7 @@ bool JUP::unPretty(PGLOBAL g, int lrecl) {
|
|||||||
htrc("Exception %d: %s\n", n, g->Message);
|
htrc("Exception %d: %s\n", n, g->Message);
|
||||||
rc = true;
|
rc = true;
|
||||||
} catch (const char* msg) {
|
} catch (const char* msg) {
|
||||||
strcpy(g->Message, msg);
|
snprintf(g->Message, sizeof(g->Message), "%s", msg);
|
||||||
rc = true;
|
rc = true;
|
||||||
} // end catch
|
} // end catch
|
||||||
|
|
||||||
|
@@ -57,12 +57,11 @@ void MACINFO::MakeErrorMsg(PGLOBAL g, DWORD drc)
|
|||||||
"GetAdaptersInfo: Buffer Overflow buflen=%d nbofadap=%d",
|
"GetAdaptersInfo: Buffer Overflow buflen=%d nbofadap=%d",
|
||||||
Buflen, N);
|
Buflen, N);
|
||||||
else if (drc == ERROR_INVALID_PARAMETER)
|
else if (drc == ERROR_INVALID_PARAMETER)
|
||||||
strcpy(g->Message, "GetAdaptersInfo: Invalid parameters");
|
snprintf(g->Message, sizeof(g->Message), "GetAdaptersInfo: Invalid parameters");
|
||||||
else if (drc == ERROR_NO_DATA)
|
else if (drc == ERROR_NO_DATA)
|
||||||
strcpy(g->Message,
|
snprintf(g->Message, sizeof(g->Message), "No adapter information exists for the local computer");
|
||||||
"No adapter information exists for the local computer");
|
|
||||||
else if (drc == ERROR_NOT_SUPPORTED)
|
else if (drc == ERROR_NOT_SUPPORTED)
|
||||||
strcpy(g->Message, "GetAdaptersInfo is not supported");
|
snprintf(g->Message, sizeof(g->Message), "GetAdaptersInfo is not supported");
|
||||||
else
|
else
|
||||||
FormatMessage(FORMAT_MESSAGE_FROM_SYSTEM |
|
FormatMessage(FORMAT_MESSAGE_FROM_SYSTEM |
|
||||||
FORMAT_MESSAGE_IGNORE_INSERTS, NULL, GetLastError(),
|
FORMAT_MESSAGE_IGNORE_INSERTS, NULL, GetLastError(),
|
||||||
|
@@ -1155,7 +1155,7 @@ int ODBConn::Open(PCSZ ConnectString, POPARM sop, DWORD options)
|
|||||||
|
|
||||||
if (!m_UseCnc) {
|
if (!m_UseCnc) {
|
||||||
if (DriverConnect(options)) {
|
if (DriverConnect(options)) {
|
||||||
strcpy(g->Message, MSG(CONNECT_CANCEL));
|
snprintf(g->Message, sizeof(g->Message), MSG(CONNECT_CANCEL));
|
||||||
return 0;
|
return 0;
|
||||||
} // endif
|
} // endif
|
||||||
|
|
||||||
@@ -1480,7 +1480,7 @@ int ODBConn::ExecDirectSQL(char *sql, ODBCCOL *tocols)
|
|||||||
ThrowDBX(rc, "SQLNumResultCols", hstmt);
|
ThrowDBX(rc, "SQLNumResultCols", hstmt);
|
||||||
|
|
||||||
if (ncol == 0) {
|
if (ncol == 0) {
|
||||||
strcpy(g->Message, "This Srcdef does not return a result set");
|
snprintf(g->Message, sizeof(g->Message), "This Srcdef does not return a result set");
|
||||||
return -1;
|
return -1;
|
||||||
} // endif ncol
|
} // endif ncol
|
||||||
|
|
||||||
@@ -1523,7 +1523,7 @@ int ODBConn::ExecDirectSQL(char *sql, ODBCCOL *tocols)
|
|||||||
tp = GetSQLCType(colp->GetResultType());
|
tp = GetSQLCType(colp->GetResultType());
|
||||||
|
|
||||||
if (tp == SQL_TYPE_NULL) {
|
if (tp == SQL_TYPE_NULL) {
|
||||||
sprintf(m_G->Message, MSG(INV_COLUMN_TYPE),
|
snprintf(m_G->Message, sizeof(m_G->Message), MSG(INV_COLUMN_TYPE),
|
||||||
colp->GetResultType(), SVP(colp->GetName()));
|
colp->GetResultType(), SVP(colp->GetName()));
|
||||||
ThrowDBX(m_G->Message);
|
ThrowDBX(m_G->Message);
|
||||||
} // endif tp
|
} // endif tp
|
||||||
@@ -1549,7 +1549,7 @@ int ODBConn::ExecDirectSQL(char *sql, ODBCCOL *tocols)
|
|||||||
for (int i = 0; i < MAX_NUM_OF_MSG && x->m_ErrMsg[i]; i++)
|
for (int i = 0; i < MAX_NUM_OF_MSG && x->m_ErrMsg[i]; i++)
|
||||||
htrc(x->m_ErrMsg[i]);
|
htrc(x->m_ErrMsg[i]);
|
||||||
|
|
||||||
sprintf(m_G->Message, "%s: %s", x->m_Msg, x->GetErrorMessage(0));
|
snprintf(m_G->Message, sizeof(m_G->Message), "%s: %s", x->m_Msg, x->GetErrorMessage(0));
|
||||||
|
|
||||||
if (b)
|
if (b)
|
||||||
SQLCancel(hstmt);
|
SQLCancel(hstmt);
|
||||||
@@ -1777,7 +1777,7 @@ int ODBConn::ExecuteSQL(void)
|
|||||||
|
|
||||||
if (ncol) {
|
if (ncol) {
|
||||||
// This should never happen while inserting
|
// This should never happen while inserting
|
||||||
strcpy(g->Message, "Logical error while inserting");
|
snprintf(g->Message, sizeof(g->Message), "Logical error while inserting");
|
||||||
} else {
|
} else {
|
||||||
// Insert, Update or Delete statement
|
// Insert, Update or Delete statement
|
||||||
if (!Check(rc = SQLRowCount(m_hstmt, &afrw)))
|
if (!Check(rc = SQLRowCount(m_hstmt, &afrw)))
|
||||||
@@ -1786,7 +1786,7 @@ int ODBConn::ExecuteSQL(void)
|
|||||||
} // endif ncol
|
} // endif ncol
|
||||||
|
|
||||||
} catch(DBX *x) {
|
} catch(DBX *x) {
|
||||||
sprintf(m_G->Message, "%s: %s", x->m_Msg, x->GetErrorMessage(0));
|
snprintf(m_G->Message, sizeof(m_G->Message), "%s: %s", x->m_Msg, x->GetErrorMessage(0));
|
||||||
SQLCancel(m_hstmt);
|
SQLCancel(m_hstmt);
|
||||||
rc = SQLFreeStmt(m_hstmt, SQL_DROP);
|
rc = SQLFreeStmt(m_hstmt, SQL_DROP);
|
||||||
m_hstmt = NULL;
|
m_hstmt = NULL;
|
||||||
@@ -1825,7 +1825,7 @@ bool ODBConn::BindParam(ODBCCOL *colp)
|
|||||||
ThrowDBX(rc, "SQLDescribeParam", m_hstmt);
|
ThrowDBX(rc, "SQLDescribeParam", m_hstmt);
|
||||||
|
|
||||||
} catch(DBX *x) {
|
} catch(DBX *x) {
|
||||||
sprintf(m_G->Message, "%s: %s", x->m_Msg, x->GetErrorMessage(0));
|
snprintf(m_G->Message, sizeof(m_G->Message), "%s: %s", x->m_Msg, x->GetErrorMessage(0));
|
||||||
#endif // 0
|
#endif // 0
|
||||||
colsize = colp->GetPrecision();
|
colsize = colp->GetPrecision();
|
||||||
sqlt = GetSQLType(buftype);
|
sqlt = GetSQLType(buftype);
|
||||||
@@ -1923,10 +1923,10 @@ bool ODBConn::ExecSQLcommand(char *sql)
|
|||||||
ThrowDBX(rc, "SQLRowCount", hstmt);
|
ThrowDBX(rc, "SQLRowCount", hstmt);
|
||||||
|
|
||||||
m_Tdb->AftRows = (int)afrw;
|
m_Tdb->AftRows = (int)afrw;
|
||||||
strcpy(g->Message, "Affected rows");
|
snprintf(g->Message, sizeof(g->Message), "Affected rows");
|
||||||
} else {
|
} else {
|
||||||
m_Tdb->AftRows = (int)ncol;
|
m_Tdb->AftRows = (int)ncol;
|
||||||
strcpy(g->Message, "Result set column number");
|
snprintf(g->Message, sizeof(g->Message), "Result set column number");
|
||||||
} // endif ncol
|
} // endif ncol
|
||||||
|
|
||||||
} catch(DBX *x) {
|
} catch(DBX *x) {
|
||||||
@@ -2024,7 +2024,7 @@ PQRYRES ODBConn::GetMetaData(PGLOBAL g, PCSZ dsn, PCSZ src)
|
|||||||
} // end try/catch
|
} // end try/catch
|
||||||
|
|
||||||
if (!ncol) {
|
if (!ncol) {
|
||||||
strcpy(g->Message, "Invalid Srcdef");
|
snprintf(g->Message, sizeof(g->Message), "Invalid Srcdef");
|
||||||
goto err;
|
goto err;
|
||||||
} // endif ncol
|
} // endif ncol
|
||||||
|
|
||||||
@@ -2122,7 +2122,7 @@ bool ODBConn::GetDataSources(PQRYRES qrp)
|
|||||||
} // endfor i
|
} // endfor i
|
||||||
|
|
||||||
} catch(DBX *x) {
|
} catch(DBX *x) {
|
||||||
sprintf(m_G->Message, "%s: %s", x->m_Msg, x->GetErrorMessage(0));
|
snprintf(m_G->Message, sizeof(m_G->Message), "%s: %s", x->m_Msg, x->GetErrorMessage(0));
|
||||||
rv = true;
|
rv = true;
|
||||||
} // end try/catch
|
} // end try/catch
|
||||||
|
|
||||||
@@ -2173,7 +2173,7 @@ bool ODBConn::GetDrivers(PQRYRES qrp)
|
|||||||
} // endfor n
|
} // endfor n
|
||||||
|
|
||||||
} catch(DBX *x) {
|
} catch(DBX *x) {
|
||||||
sprintf(m_G->Message, "%s: %s", x->m_Msg, x->GetErrorMessage(0));
|
snprintf(m_G->Message, sizeof(m_G->Message), "%s: %s", x->m_Msg, x->GetErrorMessage(0));
|
||||||
rv = true;
|
rv = true;
|
||||||
} // end try/catch
|
} // end try/catch
|
||||||
|
|
||||||
@@ -2517,7 +2517,7 @@ PQRYRES ODBConn::AllocateResult(PGLOBAL g)
|
|||||||
PQRYRES qrp;
|
PQRYRES qrp;
|
||||||
|
|
||||||
if (!m_Rows) {
|
if (!m_Rows) {
|
||||||
strcpy(g->Message, "Void result");
|
snprintf(g->Message, sizeof(g->Message), "Void result");
|
||||||
return NULL;
|
return NULL;
|
||||||
} // endif m_Res
|
} // endif m_Res
|
||||||
|
|
||||||
@@ -2596,7 +2596,7 @@ int ODBConn::Rewind(char *sql, ODBCCOL *tocols)
|
|||||||
|
|
||||||
rbuf = (int)crow;
|
rbuf = (int)crow;
|
||||||
} catch(DBX *x) {
|
} catch(DBX *x) {
|
||||||
sprintf(m_G->Message, "%s: %s", x->m_Msg, x->GetErrorMessage(0));
|
snprintf(m_G->Message, sizeof(m_G->Message), "%s: %s", x->m_Msg, x->GetErrorMessage(0));
|
||||||
rbuf = -1;
|
rbuf = -1;
|
||||||
} // end try/catch
|
} // end try/catch
|
||||||
|
|
||||||
|
@@ -4,6 +4,7 @@
|
|||||||
#include <string.h>
|
#include <string.h>
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
#include "osutil.h"
|
#include "osutil.h"
|
||||||
|
#include "m_string.h"
|
||||||
|
|
||||||
#ifdef _WIN32
|
#ifdef _WIN32
|
||||||
my_bool CloseFileHandle(HANDLE h)
|
my_bool CloseFileHandle(HANDLE h)
|
||||||
@@ -140,25 +141,25 @@ char *_fullpath(char *absPath, const char *relPath, size_t maxLength)
|
|||||||
char *p;
|
char *p;
|
||||||
|
|
||||||
if ( *relPath == '\\' || *relPath == '/' ) {
|
if ( *relPath == '\\' || *relPath == '/' ) {
|
||||||
strncpy(absPath, relPath, maxLength);
|
snprintf(absPath, maxLength, "%s", relPath);
|
||||||
} else if (*relPath == '~') {
|
} else if (*relPath == '~') {
|
||||||
// get the path to the home directory
|
// get the path to the home directory
|
||||||
struct passwd *pw = getpwuid(getuid());
|
struct passwd *pw = getpwuid(getuid());
|
||||||
const char *homedir = pw->pw_dir;
|
const char *homedir = pw->pw_dir;
|
||||||
|
|
||||||
if (homedir)
|
if (homedir)
|
||||||
strcat(strncpy(absPath, homedir, maxLength), relPath + 1);
|
snprintf(absPath, maxLength, "%s%s", homedir, relPath + 1);
|
||||||
else
|
else
|
||||||
strncpy(absPath, relPath, maxLength);
|
snprintf(absPath, maxLength, "%s", relPath);
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
char buff[2*_MAX_PATH];
|
char buff[2*_MAX_PATH];
|
||||||
|
|
||||||
p= getcwd(buff, _MAX_PATH);
|
p= getcwd(buff, _MAX_PATH);
|
||||||
assert(p);
|
assert(p);
|
||||||
strcat(buff,"/");
|
safe_strcat(buff, sizeof(buff), "/");
|
||||||
strcat(buff, relPath);
|
safe_strcat(buff, sizeof(buff), relPath);
|
||||||
strncpy(absPath, buff, maxLength);
|
snprintf(absPath, maxLength, "%s", buff);
|
||||||
} /* endif's relPath */
|
} /* endif's relPath */
|
||||||
|
|
||||||
p = absPath;
|
p = absPath;
|
||||||
|
@@ -381,7 +381,7 @@ char *SetPath(PGLOBAL g, const char *path)
|
|||||||
return NULL;
|
return NULL;
|
||||||
|
|
||||||
if (PlugIsAbsolutePath(path)) {
|
if (PlugIsAbsolutePath(path)) {
|
||||||
strcpy(buf, path);
|
snprintf(buf, len, "%s", path);
|
||||||
return buf;
|
return buf;
|
||||||
} // endif path
|
} // endif path
|
||||||
|
|
||||||
@@ -391,9 +391,9 @@ char *SetPath(PGLOBAL g, const char *path)
|
|||||||
#else // !_WIN32
|
#else // !_WIN32
|
||||||
const char *s = "/";
|
const char *s = "/";
|
||||||
#endif // !_WIN32
|
#endif // !_WIN32
|
||||||
strcat(strcat(strcat(strcpy(buf, "."), s), path), s);
|
snprintf(buf, len, ".%s%s%s", s, path, s);
|
||||||
} else
|
} else
|
||||||
strcpy(buf, path);
|
snprintf(buf, len, "%s", path);
|
||||||
|
|
||||||
} // endif path
|
} // endif path
|
||||||
|
|
||||||
|
@@ -74,6 +74,7 @@
|
|||||||
/***********************************************************************/
|
/***********************************************************************/
|
||||||
#define STORAGE /* Initialize global variables */
|
#define STORAGE /* Initialize global variables */
|
||||||
|
|
||||||
|
#include "m_string.h"
|
||||||
#include "osutil.h"
|
#include "osutil.h"
|
||||||
#include "global.h"
|
#include "global.h"
|
||||||
#include "plgdbsem.h"
|
#include "plgdbsem.h"
|
||||||
@@ -329,14 +330,15 @@ LPCSTR PlugSetPath(LPSTR pBuff, LPCSTR prefix, LPCSTR FileName, LPCSTR defpath)
|
|||||||
|
|
||||||
switch (*direc) {
|
switch (*direc) {
|
||||||
case '\0':
|
case '\0':
|
||||||
strcpy(direc, defdir);
|
snprintf(direc, sizeof(direc), "%s", defdir);
|
||||||
break;
|
break;
|
||||||
case '\\':
|
case '\\':
|
||||||
case '/':
|
case '/':
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
// This supposes that defdir ends with a SLASH
|
// This supposes that defdir ends with a SLASH
|
||||||
strcpy(direc, strcat(defdir, direc));
|
safe_strcat(defdir, sizeof(defdir), direc);
|
||||||
|
snprintf(direc, sizeof(direc), "%s", defdir);
|
||||||
} // endswitch
|
} // endswitch
|
||||||
|
|
||||||
_makepath(newname, drive, direc, fname, ftype);
|
_makepath(newname, drive, direc, fname, ftype);
|
||||||
@@ -607,7 +609,7 @@ char *PlugDup(PGLOBAL g, const char *str)
|
|||||||
if (str) {
|
if (str) {
|
||||||
char *sm = (char*)PlugSubAlloc(g, NULL, strlen(str) + 1);
|
char *sm = (char*)PlugSubAlloc(g, NULL, strlen(str) + 1);
|
||||||
|
|
||||||
strcpy(sm, str);
|
snprintf(sm, strlen(str) + 1, "%s", str);
|
||||||
return sm;
|
return sm;
|
||||||
} else
|
} else
|
||||||
return NULL;
|
return NULL;
|
||||||
|
@@ -48,7 +48,7 @@ JMGDISC::JMGDISC(PGLOBAL g, int *lg) : MGODISC(g, lg)
|
|||||||
bool JMGDISC::Init(PGLOBAL g)
|
bool JMGDISC::Init(PGLOBAL g)
|
||||||
{
|
{
|
||||||
if (!(Jcp = ((TDBJMG*)tmgp)->Jcp)) {
|
if (!(Jcp = ((TDBJMG*)tmgp)->Jcp)) {
|
||||||
strcpy(g->Message, "Init: Jcp is NULL");
|
snprintf(g->Message, sizeof(g->Message), "Init: Jcp is NULL");
|
||||||
return true;
|
return true;
|
||||||
} else if (Jcp->gmID(g, columnid, "ColumnDesc",
|
} else if (Jcp->gmID(g, columnid, "ColumnDesc",
|
||||||
"(Ljava/lang/Object;I[II)Ljava/lang/Object;"))
|
"(Ljava/lang/Object;I[II)Ljava/lang/Object;"))
|
||||||
@@ -86,7 +86,7 @@ bool JMGDISC::ColDesc(PGLOBAL g, jobject obj, char *pcn, char *pfmt,
|
|||||||
jintArray val = Jcp->env->NewIntArray(5);
|
jintArray val = Jcp->env->NewIntArray(5);
|
||||||
|
|
||||||
if (val == nullptr) {
|
if (val == nullptr) {
|
||||||
strcpy(g->Message, "Cannot allocate jint array");
|
snprintf(g->Message, sizeof(g->Message), "Cannot allocate jint array");
|
||||||
return true;
|
return true;
|
||||||
} else if (!ncol)
|
} else if (!ncol)
|
||||||
n = Jcp->env->GetIntArrayElements(val, 0);
|
n = Jcp->env->GetIntArrayElements(val, 0);
|
||||||
@@ -113,7 +113,7 @@ bool JMGDISC::ColDesc(PGLOBAL g, jobject obj, char *pcn, char *pfmt,
|
|||||||
z = 65 - strlen(colname);
|
z = 65 - strlen(colname);
|
||||||
strncat(strncat(colname, "_", z), key, z - 1);
|
strncat(strncat(colname, "_", z), key, z - 1);
|
||||||
} else
|
} else
|
||||||
strcpy(colname, key);
|
snprintf(colname, sizeof(colname), key);
|
||||||
|
|
||||||
if (pfmt) {
|
if (pfmt) {
|
||||||
strncpy(fmt, pfmt, 128);
|
strncpy(fmt, pfmt, 128);
|
||||||
@@ -121,7 +121,7 @@ bool JMGDISC::ColDesc(PGLOBAL g, jobject obj, char *pcn, char *pfmt,
|
|||||||
z = 129 - strlen(fmt);
|
z = 129 - strlen(fmt);
|
||||||
strncat(strncat(fmt, ".", z), key, z - 1);
|
strncat(strncat(fmt, ".", z), key, z - 1);
|
||||||
} else
|
} else
|
||||||
strcpy(fmt, key);
|
snprintf(fmt, sizeof(fmt), key);
|
||||||
|
|
||||||
if (!jres) {
|
if (!jres) {
|
||||||
bcol.Type = n[0];
|
bcol.Type = n[0];
|
||||||
@@ -318,7 +318,7 @@ bool TDBJMG::OpenDB(PGLOBAL g)
|
|||||||
/* First opening. */
|
/* First opening. */
|
||||||
/*********************************************************************/
|
/*********************************************************************/
|
||||||
if (Pipe && Mode != MODE_READ) {
|
if (Pipe && Mode != MODE_READ) {
|
||||||
strcpy(g->Message, "Pipeline tables are read only");
|
snprintf(g->Message, sizeof(g->Message), "Pipeline tables are read only");
|
||||||
return true;
|
return true;
|
||||||
} // endif Pipe
|
} // endif Pipe
|
||||||
|
|
||||||
@@ -353,7 +353,7 @@ bool TDBJMG::OpenDB(PGLOBAL g)
|
|||||||
/***********************************************************************/
|
/***********************************************************************/
|
||||||
bool TDBJMG::ReadKey(PGLOBAL g, OPVAL op, const key_range *kr)
|
bool TDBJMG::ReadKey(PGLOBAL g, OPVAL op, const key_range *kr)
|
||||||
{
|
{
|
||||||
strcpy(g->Message, "MONGO tables are not indexable");
|
snprintf(g->Message, sizeof(g->Message), "MONGO tables are not indexable");
|
||||||
return true;
|
return true;
|
||||||
} // end of ReadKey
|
} // end of ReadKey
|
||||||
|
|
||||||
@@ -601,7 +601,7 @@ bool JMGCOL::AddValue(PGLOBAL g, bson_t *doc, char *key, bool upd)
|
|||||||
} // endswitch Buf_Type
|
} // endswitch Buf_Type
|
||||||
|
|
||||||
if (!rc) {
|
if (!rc) {
|
||||||
strcpy(g->Message, "Adding value failed");
|
snprintf(g->Message, sizeof(g->Message), "Adding value failed");
|
||||||
return true;
|
return true;
|
||||||
} else
|
} else
|
||||||
return false;
|
return false;
|
||||||
|
@@ -112,7 +112,7 @@ bool MYSQLDEF::GetServerInfo(PGLOBAL g, const char *server_name)
|
|||||||
|
|
||||||
if (!server_name || !strlen(server_name)) {
|
if (!server_name || !strlen(server_name)) {
|
||||||
DBUG_PRINT("info", ("server_name not defined!"));
|
DBUG_PRINT("info", ("server_name not defined!"));
|
||||||
strcpy(g->Message, "server_name not defined!");
|
snprintf(g->Message, sizeof(g->Message), "server_name not defined!");
|
||||||
DBUG_RETURN(true);
|
DBUG_RETURN(true);
|
||||||
} // endif server_name
|
} // endif server_name
|
||||||
|
|
||||||
@@ -121,7 +121,7 @@ bool MYSQLDEF::GetServerInfo(PGLOBAL g, const char *server_name)
|
|||||||
if (!(server= get_server_by_name(mem, server_name, &server_buffer))) {
|
if (!(server= get_server_by_name(mem, server_name, &server_buffer))) {
|
||||||
DBUG_PRINT("info", ("get_server_by_name returned > 0 error condition!"));
|
DBUG_PRINT("info", ("get_server_by_name returned > 0 error condition!"));
|
||||||
/* need to come up with error handling */
|
/* need to come up with error handling */
|
||||||
strcpy(g->Message, "get_server_by_name returned > 0 error condition!");
|
snprintf(g->Message, sizeof(g->Message), "get_server_by_name returned > 0 error condition!");
|
||||||
DBUG_RETURN(true);
|
DBUG_RETURN(true);
|
||||||
} // endif server
|
} // endif server
|
||||||
|
|
||||||
@@ -214,21 +214,21 @@ bool MYSQLDEF::ParseURL(PGLOBAL g, char *url, bool b)
|
|||||||
char *sport, *scheme = url;
|
char *sport, *scheme = url;
|
||||||
|
|
||||||
if (!(Username = strstr(url, "://"))) {
|
if (!(Username = strstr(url, "://"))) {
|
||||||
strcpy(g->Message, "Connection is not an URL");
|
snprintf(g->Message, sizeof(g->Message), "Connection is not an URL");
|
||||||
return true;
|
return true;
|
||||||
} // endif User
|
} // endif User
|
||||||
|
|
||||||
scheme[Username - scheme] = 0;
|
scheme[Username - scheme] = 0;
|
||||||
|
|
||||||
if (stricmp(scheme, "mysql")) {
|
if (stricmp(scheme, "mysql")) {
|
||||||
strcpy(g->Message, "scheme must be mysql");
|
snprintf(g->Message, sizeof(g->Message), "scheme must be mysql");
|
||||||
return true;
|
return true;
|
||||||
} // endif scheme
|
} // endif scheme
|
||||||
|
|
||||||
Username += 3;
|
Username += 3;
|
||||||
|
|
||||||
if (!(Hostname = (char*)strchr(Username, '@'))) {
|
if (!(Hostname = (char*)strchr(Username, '@'))) {
|
||||||
strcpy(g->Message, "No host specified in URL");
|
snprintf(g->Message, sizeof(g->Message), "No host specified in URL");
|
||||||
return true;
|
return true;
|
||||||
} else {
|
} else {
|
||||||
*Hostname++ = 0; // End Username
|
*Hostname++ = 0; // End Username
|
||||||
@@ -240,7 +240,7 @@ bool MYSQLDEF::ParseURL(PGLOBAL g, char *url, bool b)
|
|||||||
|
|
||||||
// Make sure there isn't an extra /
|
// Make sure there isn't an extra /
|
||||||
if (strchr(pwd, '/')) {
|
if (strchr(pwd, '/')) {
|
||||||
strcpy(g->Message, "Syntax error in URL");
|
snprintf(g->Message, sizeof(g->Message), "Syntax error in URL");
|
||||||
return true;
|
return true;
|
||||||
} // endif
|
} // endif
|
||||||
|
|
||||||
@@ -256,7 +256,7 @@ bool MYSQLDEF::ParseURL(PGLOBAL g, char *url, bool b)
|
|||||||
|
|
||||||
// Make sure there isn't an extra / or @ */
|
// Make sure there isn't an extra / or @ */
|
||||||
if ((strchr(Username, '/')) || (strchr(Hostname, '@'))) {
|
if ((strchr(Username, '/')) || (strchr(Hostname, '@'))) {
|
||||||
strcpy(g->Message, "Syntax error in URL");
|
snprintf(g->Message, sizeof(g->Message), "Syntax error in URL");
|
||||||
return true;
|
return true;
|
||||||
} // endif
|
} // endif
|
||||||
|
|
||||||
@@ -268,7 +268,7 @@ bool MYSQLDEF::ParseURL(PGLOBAL g, char *url, bool b)
|
|||||||
|
|
||||||
// Make sure there's not an extra /
|
// Make sure there's not an extra /
|
||||||
if ((strchr(tabn, '/'))) {
|
if ((strchr(tabn, '/'))) {
|
||||||
strcpy(g->Message, "Syntax error in URL");
|
snprintf(g->Message, sizeof(g->Message), "Syntax error in URL");
|
||||||
return true;
|
return true;
|
||||||
} // endif /
|
} // endif /
|
||||||
|
|
||||||
@@ -574,7 +574,7 @@ bool TDBMYSQL::MakeSelect(PGLOBAL g, bool mx)
|
|||||||
len += (mx ? 256 : 1);
|
len += (mx ? 256 : 1);
|
||||||
|
|
||||||
if (Query->IsTruncated() || Query->Resize(len)) {
|
if (Query->IsTruncated() || Query->Resize(len)) {
|
||||||
strcpy(g->Message, "MakeSelect: Out of memory");
|
snprintf(g->Message, sizeof(g->Message), "MakeSelect: Out of memory");
|
||||||
return true;
|
return true;
|
||||||
} // endif Query
|
} // endif Query
|
||||||
|
|
||||||
@@ -599,7 +599,7 @@ bool TDBMYSQL::MakeInsert(PGLOBAL g)
|
|||||||
|
|
||||||
if (Prep) {
|
if (Prep) {
|
||||||
#if !defined(MYSQL_PREPARED_STATEMENTS)
|
#if !defined(MYSQL_PREPARED_STATEMENTS)
|
||||||
strcpy(g->Message, "Prepared statements not used (not supported)");
|
snprintf(g->Message, sizeof(g->Message), "Prepared statements not used (not supported)");
|
||||||
PushWarning(g, this);
|
PushWarning(g, this);
|
||||||
Prep = false;
|
Prep = false;
|
||||||
#endif // !MYSQL_PREPARED_STATEMENTS
|
#endif // !MYSQL_PREPARED_STATEMENTS
|
||||||
@@ -607,7 +607,7 @@ bool TDBMYSQL::MakeInsert(PGLOBAL g)
|
|||||||
|
|
||||||
for (colp = Columns; colp; colp = colp->GetNext())
|
for (colp = Columns; colp; colp = colp->GetNext())
|
||||||
if (colp->IsSpecial()) {
|
if (colp->IsSpecial()) {
|
||||||
strcpy(g->Message, MSG(NO_SPEC_COL));
|
snprintf(g->Message, sizeof(g->Message), MSG(NO_SPEC_COL));
|
||||||
return true;
|
return true;
|
||||||
} else {
|
} else {
|
||||||
len += (strlen(colp->GetName()) + 4);
|
len += (strlen(colp->GetName()) + 4);
|
||||||
@@ -664,7 +664,7 @@ bool TDBMYSQL::MakeInsert(PGLOBAL g)
|
|||||||
#endif // MYSQL_PREPARED_STATEMENTS
|
#endif // MYSQL_PREPARED_STATEMENTS
|
||||||
|
|
||||||
if ((oom = Query->IsTruncated()))
|
if ((oom = Query->IsTruncated()))
|
||||||
strcpy(g->Message, "MakeInsert: Out of memory");
|
snprintf(g->Message, sizeof(g->Message), "MakeInsert: Out of memory");
|
||||||
|
|
||||||
return oom;
|
return oom;
|
||||||
} // end of MakeInsert
|
} // end of MakeInsert
|
||||||
@@ -706,7 +706,7 @@ bool TDBMYSQL::MakeCommand(PGLOBAL g)
|
|||||||
Query->Append(Qrystr + (p - qrystr) + strlen(name));
|
Query->Append(Qrystr + (p - qrystr) + strlen(name));
|
||||||
|
|
||||||
if (Query->IsTruncated()) {
|
if (Query->IsTruncated()) {
|
||||||
strcpy(g->Message, "MakeCommand: Out of memory");
|
snprintf(g->Message, sizeof(g->Message), "MakeCommand: Out of memory");
|
||||||
return true;
|
return true;
|
||||||
} else
|
} else
|
||||||
strlwr(strcpy(qrystr, Query->GetStr()));
|
strlwr(strcpy(qrystr, Query->GetStr()));
|
||||||
@@ -742,7 +742,7 @@ int TDBMYSQL::MakeUpdate(PGLOBAL g)
|
|||||||
&& !stricmp(tab, Name))
|
&& !stricmp(tab, Name))
|
||||||
qc = (Quoted) ? "`" : "";
|
qc = (Quoted) ? "`" : "";
|
||||||
else {
|
else {
|
||||||
strcpy(g->Message, "Cannot use this UPDATE command");
|
snprintf(g->Message, sizeof(g->Message), "Cannot use this UPDATE command");
|
||||||
return RC_FX;
|
return RC_FX;
|
||||||
} // endif sscanf
|
} // endif sscanf
|
||||||
|
|
||||||
@@ -769,7 +769,7 @@ int TDBMYSQL::MakeDelete(PGLOBAL g)
|
|||||||
else if (sscanf(Qrystr, "%s %s %s%511c", cmd, from, tab, end) > 2)
|
else if (sscanf(Qrystr, "%s %s %s%511c", cmd, from, tab, end) > 2)
|
||||||
qc = (Quoted) ? "`" : "";
|
qc = (Quoted) ? "`" : "";
|
||||||
else {
|
else {
|
||||||
strcpy(g->Message, "Cannot use this DELETE command");
|
snprintf(g->Message, sizeof(g->Message), "Cannot use this DELETE command");
|
||||||
return RC_FX;
|
return RC_FX;
|
||||||
} // endif sscanf
|
} // endif sscanf
|
||||||
|
|
||||||
@@ -934,7 +934,7 @@ bool TDBMYSQL::OpenDB(PGLOBAL g)
|
|||||||
|
|
||||||
} else if (Mode == MODE_INSERT) {
|
} else if (Mode == MODE_INSERT) {
|
||||||
if (Srcdef) {
|
if (Srcdef) {
|
||||||
strcpy(g->Message, "No insert into anonym views");
|
snprintf(g->Message, sizeof(g->Message), "No insert into anonym views");
|
||||||
Myc.Close();
|
Myc.Close();
|
||||||
return true;
|
return true;
|
||||||
} // endif Srcdef
|
} // endif Srcdef
|
||||||
@@ -946,7 +946,7 @@ bool TDBMYSQL::OpenDB(PGLOBAL g)
|
|||||||
|
|
||||||
if (Nparm != n) {
|
if (Nparm != n) {
|
||||||
if (n >= 0) // Other errors return negative values
|
if (n >= 0) // Other errors return negative values
|
||||||
strcpy(g->Message, MSG(BAD_PARM_COUNT));
|
snprintf(g->Message, sizeof(g->Message), MSG(BAD_PARM_COUNT));
|
||||||
|
|
||||||
} else
|
} else
|
||||||
#endif // MYSQL_PREPARED_STATEMENTS
|
#endif // MYSQL_PREPARED_STATEMENTS
|
||||||
@@ -1109,7 +1109,7 @@ bool TDBMYSQL::ReadKey(PGLOBAL g, OPVAL op, const key_range *kr)
|
|||||||
|
|
||||||
if (To_CondFil)
|
if (To_CondFil)
|
||||||
if (Query->Append(" AND ") || Query->Append(To_CondFil->Body)) {
|
if (Query->Append(" AND ") || Query->Append(To_CondFil->Body)) {
|
||||||
strcpy(g->Message, "Readkey: Out of memory");
|
snprintf(g->Message, sizeof(g->Message), "Readkey: Out of memory");
|
||||||
return true;
|
return true;
|
||||||
} // endif Append
|
} // endif Append
|
||||||
|
|
||||||
@@ -1184,7 +1184,7 @@ int TDBMYSQL::WriteDB(PGLOBAL g)
|
|||||||
} // endfor colp
|
} // endfor colp
|
||||||
|
|
||||||
if (unlikely(Query->IsTruncated())) {
|
if (unlikely(Query->IsTruncated())) {
|
||||||
strcpy(g->Message, "WriteDB: Out of memory");
|
snprintf(g->Message, sizeof(g->Message), "WriteDB: Out of memory");
|
||||||
rc = RC_FX;
|
rc = RC_FX;
|
||||||
} else {
|
} else {
|
||||||
Query->RepLast(')');
|
Query->RepLast(')');
|
||||||
@@ -1530,13 +1530,13 @@ PCMD TDBMYEXC::MakeCMD(PGLOBAL g)
|
|||||||
(To_CondFil->Op == OP_EQ || To_CondFil->Op == OP_IN)) {
|
(To_CondFil->Op == OP_EQ || To_CondFil->Op == OP_IN)) {
|
||||||
xcmd = To_CondFil->Cmds;
|
xcmd = To_CondFil->Cmds;
|
||||||
} else
|
} else
|
||||||
strcpy(g->Message, "Invalid command specification filter");
|
snprintf(g->Message, sizeof(g->Message), "Invalid command specification filter");
|
||||||
|
|
||||||
} else
|
} else
|
||||||
strcpy(g->Message, "No command column in select list");
|
snprintf(g->Message, sizeof(g->Message), "No command column in select list");
|
||||||
|
|
||||||
} else if (!Srcdef)
|
} else if (!Srcdef)
|
||||||
strcpy(g->Message, "No Srcdef default command");
|
snprintf(g->Message, sizeof(g->Message), "No Srcdef default command");
|
||||||
else
|
else
|
||||||
xcmd = new(g) CMD(g, Srcdef);
|
xcmd = new(g) CMD(g, Srcdef);
|
||||||
|
|
||||||
@@ -1561,7 +1561,7 @@ int TDBMYEXC::GetMaxSize(PGLOBAL)
|
|||||||
bool TDBMYEXC::OpenDB(PGLOBAL g)
|
bool TDBMYEXC::OpenDB(PGLOBAL g)
|
||||||
{
|
{
|
||||||
if (Use == USE_OPEN) {
|
if (Use == USE_OPEN) {
|
||||||
strcpy(g->Message, "Multiple execution is not allowed");
|
snprintf(g->Message, sizeof(g->Message), "Multiple execution is not allowed");
|
||||||
return true;
|
return true;
|
||||||
} // endif use
|
} // endif use
|
||||||
|
|
||||||
@@ -1579,7 +1579,7 @@ bool TDBMYEXC::OpenDB(PGLOBAL g)
|
|||||||
Use = USE_OPEN; // Do it now in case we are recursively called
|
Use = USE_OPEN; // Do it now in case we are recursively called
|
||||||
|
|
||||||
if (Mode != MODE_READ && Mode != MODE_READX) {
|
if (Mode != MODE_READ && Mode != MODE_READX) {
|
||||||
strcpy(g->Message, "No INSERT/DELETE/UPDATE of MYSQL EXEC tables");
|
snprintf(g->Message, sizeof(g->Message), "No INSERT/DELETE/UPDATE of MYSQL EXEC tables");
|
||||||
return true;
|
return true;
|
||||||
} // endif Mode
|
} // endif Mode
|
||||||
|
|
||||||
@@ -1626,11 +1626,11 @@ int TDBMYEXC::ReadDB(PGLOBAL g)
|
|||||||
switch (rc = Myc.ExecSQLcmd(g, Query->GetStr(), &Warnings)) {
|
switch (rc = Myc.ExecSQLcmd(g, Query->GetStr(), &Warnings)) {
|
||||||
case RC_NF:
|
case RC_NF:
|
||||||
AftRows = Myc.m_Afrw;
|
AftRows = Myc.m_Afrw;
|
||||||
strcpy(g->Message, "Affected rows");
|
snprintf(g->Message, sizeof(g->Message), "Affected rows");
|
||||||
break;
|
break;
|
||||||
case RC_OK:
|
case RC_OK:
|
||||||
AftRows = Myc.m_Fields;
|
AftRows = Myc.m_Fields;
|
||||||
strcpy(g->Message, "Result set columns");
|
snprintf(g->Message, sizeof(g->Message), "Result set columns");
|
||||||
break;
|
break;
|
||||||
case RC_FX:
|
case RC_FX:
|
||||||
AftRows = Myc.m_Afrw;
|
AftRows = Myc.m_Afrw;
|
||||||
@@ -1660,7 +1660,7 @@ int TDBMYEXC::ReadDB(PGLOBAL g)
|
|||||||
/***********************************************************************/
|
/***********************************************************************/
|
||||||
int TDBMYEXC::WriteDB(PGLOBAL g)
|
int TDBMYEXC::WriteDB(PGLOBAL g)
|
||||||
{
|
{
|
||||||
strcpy(g->Message, "EXEC MYSQL tables are read only");
|
snprintf(g->Message, sizeof(g->Message), "EXEC MYSQL tables are read only");
|
||||||
return RC_FX;
|
return RC_FX;
|
||||||
} // end of WriteDB
|
} // end of WriteDB
|
||||||
|
|
||||||
|
@@ -120,7 +120,7 @@ PQRYRES PIVAID::MakePivotColumns(PGLOBAL g)
|
|||||||
uint n = strlen(Skcol);
|
uint n = strlen(Skcol);
|
||||||
|
|
||||||
skc = (char*)PlugSubAlloc(g, NULL, n + 2);
|
skc = (char*)PlugSubAlloc(g, NULL, n + 2);
|
||||||
strcpy(skc, Skcol);
|
snprintf(skc, n + 2, "%s", Skcol);
|
||||||
skc[n + 1] = 0;
|
skc[n + 1] = 0;
|
||||||
|
|
||||||
// Replace ; by nulls in skc
|
// Replace ; by nulls in skc
|
||||||
@@ -133,9 +133,9 @@ PQRYRES PIVAID::MakePivotColumns(PGLOBAL g)
|
|||||||
if (!Tabsrc && Tabname) {
|
if (!Tabsrc && Tabname) {
|
||||||
// Locate the query
|
// Locate the query
|
||||||
query = (char*)PlugSubAlloc(g, NULL, strlen(Tabname) + 26);
|
query = (char*)PlugSubAlloc(g, NULL, strlen(Tabname) + 26);
|
||||||
sprintf(query, "SELECT * FROM `%s` LIMIT 1", Tabname);
|
snprintf(query, strlen(Tabname) + 26, "SELECT * FROM `%s` LIMIT 1", Tabname);
|
||||||
} else if (!Tabsrc) {
|
} else if (!Tabsrc) {
|
||||||
strcpy(g->Message, MSG(SRC_TABLE_UNDEF));
|
snprintf(g->Message, sizeof(g->Message), MSG(SRC_TABLE_UNDEF));
|
||||||
goto err;
|
goto err;
|
||||||
} else
|
} else
|
||||||
query = (char*)Tabsrc;
|
query = (char*)Tabsrc;
|
||||||
@@ -167,7 +167,7 @@ PQRYRES PIVAID::MakePivotColumns(PGLOBAL g)
|
|||||||
Fncol = crp->Name;
|
Fncol = crp->Name;
|
||||||
|
|
||||||
if (!Fncol) {
|
if (!Fncol) {
|
||||||
strcpy(g->Message, MSG(NO_DEF_FNCCOL));
|
snprintf(g->Message, sizeof(g->Message), MSG(NO_DEF_FNCCOL));
|
||||||
goto err;
|
goto err;
|
||||||
} // endif Fncol
|
} // endif Fncol
|
||||||
|
|
||||||
@@ -180,7 +180,7 @@ PQRYRES PIVAID::MakePivotColumns(PGLOBAL g)
|
|||||||
Picol = crp->Name;
|
Picol = crp->Name;
|
||||||
|
|
||||||
if (!Picol) {
|
if (!Picol) {
|
||||||
strcpy(g->Message, MSG(NO_DEF_PIVOTCOL));
|
snprintf(g->Message, sizeof(g->Message), MSG(NO_DEF_PIVOTCOL));
|
||||||
goto err;
|
goto err;
|
||||||
} // endif Picol
|
} // endif Picol
|
||||||
|
|
||||||
@@ -206,10 +206,10 @@ PQRYRES PIVAID::MakePivotColumns(PGLOBAL g)
|
|||||||
pcrp = &crp->Next;
|
pcrp = &crp->Next;
|
||||||
|
|
||||||
if (!Rblkp) {
|
if (!Rblkp) {
|
||||||
strcpy(g->Message, MSG(NO_DEF_PIVOTCOL));
|
snprintf(g->Message, sizeof(g->Message), MSG(NO_DEF_PIVOTCOL));
|
||||||
goto err;
|
goto err;
|
||||||
} else if (!fncrp) {
|
} else if (!fncrp) {
|
||||||
strcpy(g->Message, MSG(NO_DEF_FNCCOL));
|
snprintf(g->Message, sizeof(g->Message), MSG(NO_DEF_FNCCOL));
|
||||||
goto err;
|
goto err;
|
||||||
} // endif
|
} // endif
|
||||||
|
|
||||||
@@ -302,7 +302,7 @@ PQRYRES PIVAID::MakePivotColumns(PGLOBAL g)
|
|||||||
if (trace(1))
|
if (trace(1))
|
||||||
htrc("Exception %d: %s\n", n, g->Message);
|
htrc("Exception %d: %s\n", n, g->Message);
|
||||||
} catch (const char *msg) {
|
} catch (const char *msg) {
|
||||||
strcpy(g->Message, msg);
|
snprintf(g->Message, sizeof(g->Message), "%s", msg);
|
||||||
} // end catch
|
} // end catch
|
||||||
|
|
||||||
err:
|
err:
|
||||||
@@ -443,7 +443,7 @@ bool TDBPIVOT::FindDefaultColumns(PGLOBAL g)
|
|||||||
Fncol = cdp->GetName();
|
Fncol = cdp->GetName();
|
||||||
|
|
||||||
if (!Fncol) {
|
if (!Fncol) {
|
||||||
strcpy(g->Message, MSG(NO_DEF_FNCCOL));
|
snprintf(g->Message, sizeof(g->Message), MSG(NO_DEF_FNCCOL));
|
||||||
return true;
|
return true;
|
||||||
} // endif Fncol
|
} // endif Fncol
|
||||||
|
|
||||||
@@ -456,7 +456,7 @@ bool TDBPIVOT::FindDefaultColumns(PGLOBAL g)
|
|||||||
Picol = cdp->GetName();
|
Picol = cdp->GetName();
|
||||||
|
|
||||||
if (!Picol) {
|
if (!Picol) {
|
||||||
strcpy(g->Message, MSG(NO_DEF_PIVOTCOL));
|
snprintf(g->Message, sizeof(g->Message), MSG(NO_DEF_PIVOTCOL));
|
||||||
return true;
|
return true;
|
||||||
} // endif Picol
|
} // endif Picol
|
||||||
|
|
||||||
@@ -519,7 +519,7 @@ bool TDBPIVOT::GetSourceTable(PGLOBAL g)
|
|||||||
} // endif !GBdone
|
} // endif !GBdone
|
||||||
|
|
||||||
} else if (!Tabsrc) {
|
} else if (!Tabsrc) {
|
||||||
strcpy(g->Message, MSG(SRC_TABLE_UNDEF));
|
snprintf(g->Message, sizeof(g->Message), MSG(SRC_TABLE_UNDEF));
|
||||||
return true;
|
return true;
|
||||||
} // endif
|
} // endif
|
||||||
|
|
||||||
@@ -588,18 +588,18 @@ bool TDBPIVOT::MakeViewColumns(PGLOBAL g)
|
|||||||
PTDBMY tdbp;
|
PTDBMY tdbp;
|
||||||
|
|
||||||
if (Tdbp->GetAmType() != TYPE_AM_MYSQL) {
|
if (Tdbp->GetAmType() != TYPE_AM_MYSQL) {
|
||||||
strcpy(g->Message, "View is not MySQL");
|
snprintf(g->Message, sizeof(g->Message),"View is not MySQL");
|
||||||
return true;
|
return true;
|
||||||
} else
|
} else
|
||||||
tdbp = (PTDBMY)Tdbp;
|
tdbp = (PTDBMY)Tdbp;
|
||||||
|
|
||||||
if (!Fncol && !(Fncol = tdbp->FindFieldColumn(Picol))) {
|
if (!Fncol && !(Fncol = tdbp->FindFieldColumn(Picol))) {
|
||||||
strcpy(g->Message, MSG(NO_DEF_FNCCOL));
|
snprintf(g->Message, sizeof(g->Message), MSG(NO_DEF_FNCCOL));
|
||||||
return true;
|
return true;
|
||||||
} // endif Fncol
|
} // endif Fncol
|
||||||
|
|
||||||
if (!Picol && !(Picol = tdbp->FindFieldColumn(Fncol))) {
|
if (!Picol && !(Picol = tdbp->FindFieldColumn(Fncol))) {
|
||||||
strcpy(g->Message, MSG(NO_DEF_PIVOTCOL));
|
snprintf(g->Message, sizeof(g->Message), MSG(NO_DEF_PIVOTCOL));
|
||||||
return true;
|
return true;
|
||||||
} // endif Picol
|
} // endif Picol
|
||||||
|
|
||||||
@@ -679,7 +679,7 @@ bool TDBPIVOT::OpenDB(PGLOBAL g)
|
|||||||
/*******************************************************************/
|
/*******************************************************************/
|
||||||
/* Direct access of PIVOT tables is not implemented yet. */
|
/* Direct access of PIVOT tables is not implemented yet. */
|
||||||
/*******************************************************************/
|
/*******************************************************************/
|
||||||
strcpy(g->Message, MSG(NO_PIV_DIR_ACC));
|
snprintf(g->Message, sizeof(g->Message), MSG(NO_PIV_DIR_ACC));
|
||||||
return TRUE;
|
return TRUE;
|
||||||
} // endif To_Key_Col
|
} // endif To_Key_Col
|
||||||
|
|
||||||
@@ -780,7 +780,7 @@ int TDBPIVOT::ReadDB(PGLOBAL g)
|
|||||||
|
|
||||||
if (!colp && !(colp = Dcolp)) {
|
if (!colp && !(colp = Dcolp)) {
|
||||||
if (!Accept) {
|
if (!Accept) {
|
||||||
strcpy(g->Message, MSG(NO_MATCH_COL));
|
snprintf(g->Message, sizeof(g->Message), MSG(NO_MATCH_COL));
|
||||||
return RC_FX;
|
return RC_FX;
|
||||||
} else
|
} else
|
||||||
continue;
|
continue;
|
||||||
|
@@ -84,7 +84,7 @@ bool INIDEF::DefineAM(PGLOBAL g, LPCSTR, int)
|
|||||||
PlugSetPath(p, Fn, GetPath());
|
PlugSetPath(p, Fn, GetPath());
|
||||||
Fn = p;
|
Fn = p;
|
||||||
} else {
|
} else {
|
||||||
strcpy(g->Message, MSG(MISSING_FNAME));
|
snprintf(g->Message, sizeof(g->Message), MSG(MISSING_FNAME));
|
||||||
return true;
|
return true;
|
||||||
} // endif Fn
|
} // endif Fn
|
||||||
|
|
||||||
@@ -326,7 +326,7 @@ int TDBINI::DeleteDB(PGLOBAL g, int irc)
|
|||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
if (!Section) {
|
if (!Section) {
|
||||||
strcpy(g->Message, MSG(NO_SECTION_NAME));
|
snprintf(g->Message, sizeof(g->Message), MSG(NO_SECTION_NAME));
|
||||||
return RC_FX;
|
return RC_FX;
|
||||||
} else
|
} else
|
||||||
if (!WritePrivateProfileString(Section, NULL, NULL, Ifile)) {
|
if (!WritePrivateProfileString(Section, NULL, NULL, Ifile)) {
|
||||||
@@ -514,7 +514,7 @@ void INICOL::WriteColumn(PGLOBAL g)
|
|||||||
throw 31;
|
throw 31;
|
||||||
} else if (Flag == 1) {
|
} else if (Flag == 1) {
|
||||||
if (tdbp->Mode == MODE_UPDATE) {
|
if (tdbp->Mode == MODE_UPDATE) {
|
||||||
strcpy(g->Message, MSG(NO_SEC_UPDATE));
|
snprintf(g->Message, sizeof(g->Message), MSG(NO_SEC_UPDATE));
|
||||||
throw 31;
|
throw 31;
|
||||||
} else if (*p) {
|
} else if (*p) {
|
||||||
tdbp->Section = p;
|
tdbp->Section = p;
|
||||||
@@ -523,7 +523,7 @@ void INICOL::WriteColumn(PGLOBAL g)
|
|||||||
|
|
||||||
return;
|
return;
|
||||||
} else if (!tdbp->Section) {
|
} else if (!tdbp->Section) {
|
||||||
strcpy(g->Message, MSG(SEC_NAME_FIRST));
|
snprintf(g->Message, sizeof(g->Message), MSG(SEC_NAME_FIRST));
|
||||||
throw 31;
|
throw 31;
|
||||||
} // endif's
|
} // endif's
|
||||||
|
|
||||||
@@ -752,7 +752,7 @@ int TDBXIN::DeleteDB(PGLOBAL g, int irc)
|
|||||||
} // endif
|
} // endif
|
||||||
|
|
||||||
} else if (!Section) {
|
} else if (!Section) {
|
||||||
strcpy(g->Message, MSG(NO_SECTION_NAME));
|
snprintf(g->Message, sizeof(g->Message), MSG(NO_SECTION_NAME));
|
||||||
return RC_FX;
|
return RC_FX;
|
||||||
} else
|
} else
|
||||||
if (!WritePrivateProfileString(Section, Keycur, NULL, Ifile)) {
|
if (!WritePrivateProfileString(Section, Keycur, NULL, Ifile)) {
|
||||||
@@ -840,7 +840,7 @@ void XINCOL::WriteColumn(PGLOBAL g)
|
|||||||
throw 31;
|
throw 31;
|
||||||
} else if (Flag == 1) {
|
} else if (Flag == 1) {
|
||||||
if (tdbp->Mode == MODE_UPDATE) {
|
if (tdbp->Mode == MODE_UPDATE) {
|
||||||
strcpy(g->Message, MSG(NO_SEC_UPDATE));
|
snprintf(g->Message, sizeof(g->Message), MSG(NO_SEC_UPDATE));
|
||||||
throw 31;
|
throw 31;
|
||||||
} else if (*p) {
|
} else if (*p) {
|
||||||
tdbp->Section = p;
|
tdbp->Section = p;
|
||||||
@@ -850,7 +850,7 @@ void XINCOL::WriteColumn(PGLOBAL g)
|
|||||||
return;
|
return;
|
||||||
} else if (Flag == 2) {
|
} else if (Flag == 2) {
|
||||||
if (tdbp->Mode == MODE_UPDATE) {
|
if (tdbp->Mode == MODE_UPDATE) {
|
||||||
strcpy(g->Message, MSG(NO_KEY_UPDATE));
|
snprintf(g->Message, sizeof(g->Message), MSG(NO_KEY_UPDATE));
|
||||||
throw 31;
|
throw 31;
|
||||||
} else if (*p) {
|
} else if (*p) {
|
||||||
tdbp->Keycur = p;
|
tdbp->Keycur = p;
|
||||||
@@ -859,7 +859,7 @@ void XINCOL::WriteColumn(PGLOBAL g)
|
|||||||
|
|
||||||
return;
|
return;
|
||||||
} else if (!tdbp->Section || !tdbp->Keycur) {
|
} else if (!tdbp->Section || !tdbp->Keycur) {
|
||||||
strcpy(g->Message, MSG(SEC_KEY_FIRST));
|
snprintf(g->Message, sizeof(g->Message), MSG(SEC_KEY_FIRST));
|
||||||
throw 31;
|
throw 31;
|
||||||
} // endif's
|
} // endif's
|
||||||
|
|
||||||
|
@@ -6,6 +6,7 @@
|
|||||||
#error This is a WINDOWS only table type
|
#error This is a WINDOWS only table type
|
||||||
#endif // !_WIN32
|
#endif // !_WIN32
|
||||||
#include "my_global.h"
|
#include "my_global.h"
|
||||||
|
#include "m_string.h"
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
|
|
||||||
#include "global.h"
|
#include "global.h"
|
||||||
@@ -49,7 +50,7 @@ PWMIUT InitWMI(PGLOBAL g, PCSZ nsp, PCSZ classname)
|
|||||||
else if (!stricmp(nsp, "root\\cli"))
|
else if (!stricmp(nsp, "root\\cli"))
|
||||||
classname = "Msft_CliAlias";
|
classname = "Msft_CliAlias";
|
||||||
else {
|
else {
|
||||||
strcpy(g->Message, "Missing class name");
|
safe_strcpy(g->Message, sizeof(g->Message), "Missing class name");
|
||||||
return NULL;
|
return NULL;
|
||||||
} // endif classname
|
} // endif classname
|
||||||
|
|
||||||
@@ -512,7 +513,8 @@ char *TDBWMI::MakeWQL(PGLOBAL g)
|
|||||||
ncol++;
|
ncol++;
|
||||||
|
|
||||||
if (ncol) {
|
if (ncol) {
|
||||||
colist = (char*)PlugSubAlloc(g, NULL, (NAM_LEN + 4) * ncol);
|
size_t colist_sz = (NAM_LEN + 4) * ncol;
|
||||||
|
colist = (char*)PlugSubAlloc(g, NULL, colist_sz);
|
||||||
|
|
||||||
for (colp = Columns; colp; colp = colp->GetNext())
|
for (colp = Columns; colp; colp = colp->GetNext())
|
||||||
if (!colp->IsSpecial()) {
|
if (!colp->IsSpecial()) {
|
||||||
@@ -521,10 +523,13 @@ char *TDBWMI::MakeWQL(PGLOBAL g)
|
|||||||
|
|
||||||
if (colp->GetColUse(U_P | U_J_EXT) || noloc) {
|
if (colp->GetColUse(U_P | U_J_EXT) || noloc) {
|
||||||
if (first) {
|
if (first) {
|
||||||
strcpy(colist, colp->GetName());
|
snprintf(colist, colist_sz, colp->GetName());
|
||||||
first = false;
|
first = false;
|
||||||
} else
|
} else {
|
||||||
strcat(strcat(colist, ", "), colp->GetName());
|
strcat(strcat(colist, ", "), colp->GetName());
|
||||||
|
safe_strcat(colist, colist_sz, ", ");
|
||||||
|
safe_strcat(colist, colist_sz, colp->GetName());
|
||||||
|
}
|
||||||
|
|
||||||
} // endif ColUse
|
} // endif ColUse
|
||||||
|
|
||||||
@@ -534,18 +539,19 @@ char *TDBWMI::MakeWQL(PGLOBAL g)
|
|||||||
// ncol == 0 can occur for queries such that sql count(*) from...
|
// ncol == 0 can occur for queries such that sql count(*) from...
|
||||||
// for which we will count the rows from sql * from...
|
// for which we will count the rows from sql * from...
|
||||||
colist = (char*)PlugSubAlloc(g, NULL, 2);
|
colist = (char*)PlugSubAlloc(g, NULL, 2);
|
||||||
strcpy(colist, "*");
|
snprintf(colist, 2, "*");
|
||||||
} // endif ncol
|
} // endif ncol
|
||||||
|
|
||||||
// Below 14 is length of 'select ' + length of ' from ' + 1
|
// Below 14 is length of 'select ' + length of ' from ' + 1
|
||||||
len = (strlen(colist) + strlen(Wclass) + 14);
|
len = (strlen(colist) + strlen(Wclass) + 14);
|
||||||
len += (To_CondFil ? strlen(To_CondFil->Body) + 7 : 0);
|
len += (To_CondFil ? strlen(To_CondFil->Body) + 7 : 0);
|
||||||
wql = (char*)PlugSubAlloc(g, NULL, len);
|
wql = (char*)PlugSubAlloc(g, NULL, len);
|
||||||
strcat(strcat(strcpy(wql, "SELECT "), colist), " FROM ");
|
snprintf(wql, len, "SELECT %s FROM %s", colist, Wclass);
|
||||||
strcat(wql, Wclass);
|
|
||||||
|
|
||||||
if (To_CondFil)
|
if (To_CondFil) {
|
||||||
strcat(strcat(wql, " WHERE "), To_CondFil->Body);
|
safe_strcat(wql, len, " WHERE ");
|
||||||
|
safe_strcat(wql, len, To_CondFil->Body);
|
||||||
|
}
|
||||||
|
|
||||||
return wql;
|
return wql;
|
||||||
} // end of MakeWQL
|
} // end of MakeWQL
|
||||||
@@ -654,13 +660,13 @@ bool TDBWMI::OpenDB(PGLOBAL g)
|
|||||||
/*******************************************************************/
|
/*******************************************************************/
|
||||||
/* WMI tables cannot be modified. */
|
/* WMI tables cannot be modified. */
|
||||||
/*******************************************************************/
|
/*******************************************************************/
|
||||||
strcpy(g->Message, "WMI tables are read only");
|
safe_strcpy(g->Message, sizeof(g->Message), "WMI tables are read only");
|
||||||
return true;
|
return true;
|
||||||
} // endif Mode
|
} // endif Mode
|
||||||
|
|
||||||
if (!To_CondFil && !stricmp(Wclass, "CIM_Datafile")
|
if (!To_CondFil && !stricmp(Wclass, "CIM_Datafile")
|
||||||
&& !stricmp(Nspace, "root\\cimv2")) {
|
&& !stricmp(Nspace, "root\\cimv2")) {
|
||||||
strcpy(g->Message,
|
safe_strcpy(g->Message, sizeof(g->Message),
|
||||||
"Would last forever when not filtered, use DIR table instead");
|
"Would last forever when not filtered, use DIR table instead");
|
||||||
return true;
|
return true;
|
||||||
} else
|
} else
|
||||||
@@ -697,7 +703,7 @@ int TDBWMI::ReadDB(PGLOBAL g)
|
|||||||
/***********************************************************************/
|
/***********************************************************************/
|
||||||
int TDBWMI::WriteDB(PGLOBAL g)
|
int TDBWMI::WriteDB(PGLOBAL g)
|
||||||
{
|
{
|
||||||
strcpy(g->Message, "WMI tables are read only");
|
safe_strcpy(g->Message, sizeof(g->Message), "WMI tables are read only");
|
||||||
return RC_FX;
|
return RC_FX;
|
||||||
} // end of WriteDB
|
} // end of WriteDB
|
||||||
|
|
||||||
@@ -706,7 +712,7 @@ int TDBWMI::WriteDB(PGLOBAL g)
|
|||||||
/***********************************************************************/
|
/***********************************************************************/
|
||||||
int TDBWMI::DeleteDB(PGLOBAL g, int irc)
|
int TDBWMI::DeleteDB(PGLOBAL g, int irc)
|
||||||
{
|
{
|
||||||
strcpy(g->Message, "Delete not enabled for WMI tables");
|
safe_strcpy(g->Message, sizeof(g->Message), "Delete not enabled for WMI tables");
|
||||||
return RC_FX;
|
return RC_FX;
|
||||||
} // end of DeleteDB
|
} // end of DeleteDB
|
||||||
|
|
||||||
|
@@ -140,7 +140,7 @@ PQRYRES XMLColumns(PGLOBAL g, char *db, char *tab, PTOS topt, bool info)
|
|||||||
} // endif info
|
} // endif info
|
||||||
|
|
||||||
if (GetIntegerTableOption(g, topt, "Multiple", 0)) {
|
if (GetIntegerTableOption(g, topt, "Multiple", 0)) {
|
||||||
strcpy(g->Message, "Cannot find column definition for multiple table");
|
snprintf(g->Message, sizeof(g->Message), "Cannot find column definition for multiple table");
|
||||||
return NULL;
|
return NULL;
|
||||||
} // endif Multiple
|
} // endif Multiple
|
||||||
|
|
||||||
@@ -152,7 +152,7 @@ PQRYRES XMLColumns(PGLOBAL g, char *db, char *tab, PTOS topt, bool info)
|
|||||||
fn = GetStringTableOption(g, topt, "Subtype", NULL);
|
fn = GetStringTableOption(g, topt, "Subtype", NULL);
|
||||||
|
|
||||||
if (!fn) {
|
if (!fn) {
|
||||||
strcpy(g->Message, MSG(MISSING_FNAME));
|
snprintf(g->Message, sizeof(g->Message), MSG(MISSING_FNAME));
|
||||||
return NULL;
|
return NULL;
|
||||||
} else
|
} else
|
||||||
topt->subtype = NULL;
|
topt->subtype = NULL;
|
||||||
@@ -483,12 +483,12 @@ bool XMLDEF::DefineAM(PGLOBAL g, LPCSTR am, int poff)
|
|||||||
Encoding = GetStringCatInfo(g, "Encoding", "UTF-8");
|
Encoding = GetStringCatInfo(g, "Encoding", "UTF-8");
|
||||||
|
|
||||||
if (*Fn == '?') {
|
if (*Fn == '?') {
|
||||||
strcpy(g->Message, MSG(MISSING_FNAME));
|
snprintf(g->Message, sizeof(g->Message), MSG(MISSING_FNAME));
|
||||||
return true;
|
return true;
|
||||||
} // endif fn
|
} // endif fn
|
||||||
|
|
||||||
if ((signed)GetIntCatInfo("Flag", -1) != -1) {
|
if ((signed)GetIntCatInfo("Flag", -1) != -1) {
|
||||||
strcpy(g->Message, MSG(DEPREC_FLAG));
|
snprintf(g->Message, sizeof(g->Message), MSG(DEPREC_FLAG));
|
||||||
return true;
|
return true;
|
||||||
} // endif flag
|
} // endif flag
|
||||||
|
|
||||||
@@ -567,7 +567,7 @@ PTDB XMLDEF::GetTable(PGLOBAL g, MODE m)
|
|||||||
return new(g) TDBXCT(this);
|
return new(g) TDBXCT(this);
|
||||||
|
|
||||||
if (Zipped && !(m == MODE_READ || m == MODE_ANY)) {
|
if (Zipped && !(m == MODE_READ || m == MODE_ANY)) {
|
||||||
strcpy(g->Message, "ZIpped XML tables are read only");
|
snprintf(g->Message, sizeof(g->Message), "ZIpped XML tables are read only");
|
||||||
return NULL;
|
return NULL;
|
||||||
} // endif Zipped
|
} // endif Zipped
|
||||||
|
|
||||||
@@ -857,16 +857,16 @@ bool TDBXML::Initialize(PGLOBAL g)
|
|||||||
// Get root node
|
// Get root node
|
||||||
if (!(Root = Docp->GetRoot(g))) {
|
if (!(Root = Docp->GetRoot(g))) {
|
||||||
// This should never happen as load should have failed
|
// This should never happen as load should have failed
|
||||||
strcpy(g->Message, MSG(EMPTY_DOC));
|
snprintf(g->Message, sizeof(g->Message), MSG(EMPTY_DOC));
|
||||||
goto error;
|
goto error;
|
||||||
} // endif Root
|
} // endif Root
|
||||||
|
|
||||||
// If tabname is not an Xpath,
|
// If tabname is not an Xpath,
|
||||||
// construct one that will find it anywhere
|
// construct one that will find it anywhere
|
||||||
if (!strchr(Tabname, '/'))
|
if (!strchr(Tabname, '/'))
|
||||||
strcat(strcpy(tabpath, "//"), Tabname);
|
snprintf(tabpath, sizeof(tabpath), "//%s", Tabname);
|
||||||
else
|
else
|
||||||
strcpy(tabpath, Tabname);
|
snprintf(tabpath, sizeof(tabpath), "%s", Tabname);
|
||||||
|
|
||||||
// Evaluate table xpath
|
// Evaluate table xpath
|
||||||
if ((TabNode = Root->SelectSingleNode(g, tabpath))) {
|
if ((TabNode = Root->SelectSingleNode(g, tabpath))) {
|
||||||
@@ -911,7 +911,7 @@ bool TDBXML::Initialize(PGLOBAL g)
|
|||||||
|
|
||||||
// Create the XML node
|
// Create the XML node
|
||||||
if (Docp->NewDoc(g, "1.0")) {
|
if (Docp->NewDoc(g, "1.0")) {
|
||||||
strcpy(g->Message, MSG(NEW_DOC_FAILED));
|
snprintf(g->Message, sizeof(g->Message), MSG(NEW_DOC_FAILED));
|
||||||
goto error;
|
goto error;
|
||||||
} // endif NewDoc
|
} // endif NewDoc
|
||||||
|
|
||||||
@@ -919,7 +919,7 @@ bool TDBXML::Initialize(PGLOBAL g)
|
|||||||
To_Xb = Docp->LinkXblock(g, Mode, rc, filename);
|
To_Xb = Docp->LinkXblock(g, Mode, rc, filename);
|
||||||
|
|
||||||
// Add a CONNECT comment node
|
// Add a CONNECT comment node
|
||||||
strcpy(buf, " Created by the MariaDB CONNECT Storage Engine");
|
snprintf(buf, sizeof(buf), " Created by the MariaDB CONNECT Storage Engine");
|
||||||
Docp->AddComment(g, buf);
|
Docp->AddComment(g, buf);
|
||||||
|
|
||||||
if (XmlDB) {
|
if (XmlDB) {
|
||||||
@@ -932,7 +932,7 @@ bool TDBXML::Initialize(PGLOBAL g)
|
|||||||
TabNode = Root = Docp->NewRoot(g, Tabname);
|
TabNode = Root = Docp->NewRoot(g, Tabname);
|
||||||
|
|
||||||
if (TabNode == NULL || Root == NULL) {
|
if (TabNode == NULL || Root == NULL) {
|
||||||
strcpy(g->Message, MSG(XML_INIT_ERROR));
|
snprintf(g->Message, sizeof(g->Message), MSG(XML_INIT_ERROR));
|
||||||
goto error;
|
goto error;
|
||||||
} else if (SetTabNode(g))
|
} else if (SetTabNode(g))
|
||||||
goto error;
|
goto error;
|
||||||
@@ -992,7 +992,7 @@ bool TDBXML::Initialize(PGLOBAL g)
|
|||||||
#if !defined(UNIX)
|
#if !defined(UNIX)
|
||||||
} catch(...) {
|
} catch(...) {
|
||||||
// Other errors
|
// Other errors
|
||||||
strcpy(g->Message, MSG(XMLTAB_INIT_ERR));
|
snprintf(g->Message, sizeof(g->Message), MSG(XMLTAB_INIT_ERR));
|
||||||
goto error;
|
goto error;
|
||||||
#endif
|
#endif
|
||||||
} // end of try-catches
|
} // end of try-catches
|
||||||
@@ -1037,7 +1037,7 @@ bool TDBXML::SetTabNode(PGLOBAL g)
|
|||||||
TabNode->AddText(g, "\n\t");
|
TabNode->AddText(g, "\n\t");
|
||||||
rn = TabNode->AddChildNode(g, Rowname, NULL);
|
rn = TabNode->AddChildNode(g, Rowname, NULL);
|
||||||
} else {
|
} else {
|
||||||
strcpy(g->Message, MSG(NO_ROW_NODE));
|
snprintf(g->Message, sizeof(g->Message), MSG(NO_ROW_NODE));
|
||||||
return true;
|
return true;
|
||||||
} // endif Rowname
|
} // endif Rowname
|
||||||
|
|
||||||
@@ -1293,7 +1293,7 @@ bool TDBXML::CheckRow(PGLOBAL g, bool b)
|
|||||||
TabNode->AddText(g, "\n\t");
|
TabNode->AddText(g, "\n\t");
|
||||||
RowNode = TabNode->AddChildNode(g, Rowname, RowNode);
|
RowNode = TabNode->AddChildNode(g, Rowname, RowNode);
|
||||||
} else {
|
} else {
|
||||||
strcpy(g->Message, MSG(NO_ROW_NODE));
|
snprintf(g->Message, sizeof(g->Message), MSG(NO_ROW_NODE));
|
||||||
return true;
|
return true;
|
||||||
} // endif Rowname
|
} // endif Rowname
|
||||||
}
|
}
|
||||||
@@ -1550,7 +1550,7 @@ bool XMLCOL::ParseXpath(PGLOBAL g, bool mode)
|
|||||||
if (Tdbp->Mulnode && !strncmp(p, Tdbp->Mulnode, p2 - p))
|
if (Tdbp->Mulnode && !strncmp(p, Tdbp->Mulnode, p2 - p))
|
||||||
{
|
{
|
||||||
if (!Tdbp->Xpand && mode) {
|
if (!Tdbp->Xpand && mode) {
|
||||||
strcpy(g->Message, MSG(CONCAT_SUBNODE));
|
snprintf(g->Message, sizeof(g->Message), MSG(CONCAT_SUBNODE));
|
||||||
return true;
|
return true;
|
||||||
} else
|
} else
|
||||||
Inod = i; // Index of multiple node
|
Inod = i; // Index of multiple node
|
||||||
@@ -1843,7 +1843,7 @@ void XMLCOL::WriteColumn(PGLOBAL g)
|
|||||||
} // endfor k
|
} // endfor k
|
||||||
|
|
||||||
if (ColNode == NULL) {
|
if (ColNode == NULL) {
|
||||||
strcpy(g->Message, MSG(COL_ALLOC_ERR));
|
snprintf(g->Message, sizeof(g->Message), MSG(COL_ALLOC_ERR));
|
||||||
throw (int)TYPE_AM_XML;
|
throw (int)TYPE_AM_XML;
|
||||||
} // endif ColNode
|
} // endif ColNode
|
||||||
|
|
||||||
@@ -1862,7 +1862,7 @@ void XMLCOL::WriteColumn(PGLOBAL g)
|
|||||||
AttNode = ColNode->AddProperty(g, Xname, Vxap);
|
AttNode = ColNode->AddProperty(g, Xname, Vxap);
|
||||||
|
|
||||||
if (ValNode == NULL && AttNode == NULL) {
|
if (ValNode == NULL && AttNode == NULL) {
|
||||||
strcpy(g->Message, MSG(VAL_ALLOC_ERR));
|
snprintf(g->Message, sizeof(g->Message), MSG(VAL_ALLOC_ERR));
|
||||||
throw (int)TYPE_AM_XML;
|
throw (int)TYPE_AM_XML;
|
||||||
} // endif ValNode
|
} // endif ValNode
|
||||||
|
|
||||||
@@ -2104,7 +2104,7 @@ void XMULCOL::WriteColumn(PGLOBAL g)
|
|||||||
} // endfor k
|
} // endfor k
|
||||||
|
|
||||||
if (ColNode == NULL) {
|
if (ColNode == NULL) {
|
||||||
strcpy(g->Message, MSG(COL_ALLOC_ERR));
|
snprintf(g->Message, sizeof(g->Message), MSG(COL_ALLOC_ERR));
|
||||||
throw (int)TYPE_AM_XML;
|
throw (int)TYPE_AM_XML;
|
||||||
} // endif ColNode
|
} // endif ColNode
|
||||||
|
|
||||||
@@ -2123,7 +2123,7 @@ void XMULCOL::WriteColumn(PGLOBAL g)
|
|||||||
AttNode = ColNode->AddProperty(g, Xname, Vxap);
|
AttNode = ColNode->AddProperty(g, Xname, Vxap);
|
||||||
|
|
||||||
if (ValNode == NULL && AttNode == NULL) {
|
if (ValNode == NULL && AttNode == NULL) {
|
||||||
strcpy(g->Message, MSG(VAL_ALLOC_ERR));
|
snprintf(g->Message, sizeof(g->Message), MSG(VAL_ALLOC_ERR));
|
||||||
throw (int)TYPE_AM_XML;
|
throw (int)TYPE_AM_XML;
|
||||||
} // endif ValNode
|
} // endif ValNode
|
||||||
|
|
||||||
@@ -2165,7 +2165,7 @@ void XPOSCOL::ReadColumn(PGLOBAL g)
|
|||||||
return; // Same row than the last read
|
return; // Same row than the last read
|
||||||
|
|
||||||
if (Tdbp->Clist == NULL) {
|
if (Tdbp->Clist == NULL) {
|
||||||
strcpy(g->Message, MSG(MIS_TAG_LIST));
|
snprintf(g->Message, sizeof(g->Message), MSG(MIS_TAG_LIST));
|
||||||
throw (int)TYPE_AM_XML;
|
throw (int)TYPE_AM_XML;
|
||||||
} // endif Clist
|
} // endif Clist
|
||||||
|
|
||||||
@@ -2235,7 +2235,7 @@ void XPOSCOL::WriteColumn(PGLOBAL g)
|
|||||||
/* Find the column and value nodes to update or insert. */
|
/* Find the column and value nodes to update or insert. */
|
||||||
/*********************************************************************/
|
/*********************************************************************/
|
||||||
if (Tdbp->Clist == NULL) {
|
if (Tdbp->Clist == NULL) {
|
||||||
strcpy(g->Message, MSG(MIS_TAG_LIST));
|
snprintf(g->Message, sizeof(g->Message), MSG(MIS_TAG_LIST));
|
||||||
throw (int)TYPE_AM_XML;
|
throw (int)TYPE_AM_XML;
|
||||||
} // endif Clist
|
} // endif Clist
|
||||||
|
|
||||||
|
@@ -59,7 +59,7 @@
|
|||||||
#if defined(_DEBUG)
|
#if defined(_DEBUG)
|
||||||
#define CheckType(V) if (Type != V->GetType()) { \
|
#define CheckType(V) if (Type != V->GetType()) { \
|
||||||
PGLOBAL& g = Global; \
|
PGLOBAL& g = Global; \
|
||||||
strcpy(g->Message, MSG(VALTYPE_NOMATCH)); \
|
snprintf(g->Message, sizeof(g->Message), MSG(VALTYPE_NOMATCH)); \
|
||||||
throw Type;
|
throw Type;
|
||||||
#else
|
#else
|
||||||
#define CheckType(V)
|
#define CheckType(V)
|
||||||
@@ -556,7 +556,7 @@ BYTE VALUE::TestValue(PVAL vp)
|
|||||||
/***********************************************************************/
|
/***********************************************************************/
|
||||||
bool VALUE::Compute(PGLOBAL g, PVAL *, int, OPVAL)
|
bool VALUE::Compute(PGLOBAL g, PVAL *, int, OPVAL)
|
||||||
{
|
{
|
||||||
strcpy(g->Message, "Compute not implemented for this value type");
|
snprintf(g->Message, sizeof(g->Message), "Compute not implemented for this value type");
|
||||||
return true;
|
return true;
|
||||||
} // end of Compute
|
} // end of Compute
|
||||||
|
|
||||||
@@ -1051,11 +1051,11 @@ TYPE TYPVAL<TYPE>::SafeAdd(TYPE n1, TYPE n2)
|
|||||||
|
|
||||||
if ((n2 > 0) && (n < n1)) {
|
if ((n2 > 0) && (n < n1)) {
|
||||||
// Overflow
|
// Overflow
|
||||||
strcpy(g->Message, MSG(FIX_OVFLW_ADD));
|
snprintf(g->Message, sizeof(g->Message), MSG(FIX_OVFLW_ADD));
|
||||||
throw 138;
|
throw 138;
|
||||||
} else if ((n2 < 0) && (n > n1)) {
|
} else if ((n2 < 0) && (n > n1)) {
|
||||||
// Underflow
|
// Underflow
|
||||||
strcpy(g->Message, MSG(FIX_UNFLW_ADD));
|
snprintf(g->Message, sizeof(g->Message), MSG(FIX_UNFLW_ADD));
|
||||||
throw 138;
|
throw 138;
|
||||||
} // endif's n2
|
} // endif's n2
|
||||||
|
|
||||||
@@ -1079,11 +1079,11 @@ TYPE TYPVAL<TYPE>::SafeMult(TYPE n1, TYPE n2)
|
|||||||
|
|
||||||
if (n > MinMaxVal(true)) {
|
if (n > MinMaxVal(true)) {
|
||||||
// Overflow
|
// Overflow
|
||||||
strcpy(g->Message, MSG(FIX_OVFLW_TIMES));
|
snprintf(g->Message, sizeof(g->Message), MSG(FIX_OVFLW_TIMES));
|
||||||
throw 138;
|
throw 138;
|
||||||
} else if (n < MinMaxVal(false)) {
|
} else if (n < MinMaxVal(false)) {
|
||||||
// Underflow
|
// Underflow
|
||||||
strcpy(g->Message, MSG(FIX_UNFLW_TIMES));
|
snprintf(g->Message, sizeof(g->Message), MSG(FIX_UNFLW_TIMES));
|
||||||
throw 138;
|
throw 138;
|
||||||
} // endif's n2
|
} // endif's n2
|
||||||
|
|
||||||
@@ -1119,7 +1119,7 @@ bool TYPVAL<TYPE>::Compute(PGLOBAL g, PVAL *vp, int np, OPVAL op)
|
|||||||
break;
|
break;
|
||||||
case OP_DIV:
|
case OP_DIV:
|
||||||
if (!val[1]) {
|
if (!val[1]) {
|
||||||
strcpy(g->Message, MSG(ZERO_DIVIDE));
|
snprintf(g->Message, sizeof(g->Message),MSG(ZERO_DIVIDE));
|
||||||
return true;
|
return true;
|
||||||
} // endif
|
} // endif
|
||||||
|
|
||||||
@@ -1173,7 +1173,7 @@ bool TYPVAL<TYPE>::Compall(PGLOBAL g, PVAL *vp, int np, OPVAL op)
|
|||||||
case OP_DIV:
|
case OP_DIV:
|
||||||
if (val[0]) {
|
if (val[0]) {
|
||||||
if (!val[1]) {
|
if (!val[1]) {
|
||||||
strcpy(g->Message, MSG(ZERO_DIVIDE));
|
snprintf(g->Message, sizeof(g->Message), MSG(ZERO_DIVIDE));
|
||||||
return true;
|
return true;
|
||||||
} // endif
|
} // endif
|
||||||
|
|
||||||
@@ -1190,7 +1190,7 @@ bool TYPVAL<TYPE>::Compall(PGLOBAL g, PVAL *vp, int np, OPVAL op)
|
|||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
// snprintf(g->Message, sizeof(g->Message), MSG(BAD_EXP_OPER), op);
|
// snprintf(g->Message, sizeof(g->Message), MSG(BAD_EXP_OPER), op);
|
||||||
strcpy(g->Message, "Function not supported");
|
snprintf(g->Message, sizeof(g->Message), "Function not supported");
|
||||||
return true;
|
return true;
|
||||||
} // endswitch op
|
} // endswitch op
|
||||||
|
|
||||||
@@ -1701,7 +1701,7 @@ bool TYPVAL<PSZ>::Compute(PGLOBAL g, PVAL *vp, int np, OPVAL op)
|
|||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
// snprintf(g->Message, sizeof(g->Message), MSG(BAD_EXP_OPER), op);
|
// snprintf(g->Message, sizeof(g->Message), MSG(BAD_EXP_OPER), op);
|
||||||
strcpy(g->Message, "Function not supported");
|
snprintf(g->Message, sizeof(g->Message), "Function not supported");
|
||||||
return true;
|
return true;
|
||||||
} // endswitch op
|
} // endswitch op
|
||||||
|
|
||||||
@@ -2616,7 +2616,7 @@ bool DTVAL::MakeDate(PGLOBAL g, int *val, int nval)
|
|||||||
if (MakeTime(&datm))
|
if (MakeTime(&datm))
|
||||||
{
|
{
|
||||||
if (g) {
|
if (g) {
|
||||||
strcpy(g->Message, MSG(BAD_DATETIME));
|
snprintf(g->Message, sizeof(g->Message), MSG(BAD_DATETIME));
|
||||||
rc = true;
|
rc = true;
|
||||||
} else
|
} else
|
||||||
Tval = 0;
|
Tval = 0;
|
||||||
|
@@ -45,6 +45,7 @@
|
|||||||
//nclude "array.h"
|
//nclude "array.h"
|
||||||
#include "filamtxt.h"
|
#include "filamtxt.h"
|
||||||
#include "tabdos.h"
|
#include "tabdos.h"
|
||||||
|
#include "m_string.h"
|
||||||
#if defined(VCT_SUPPORT)
|
#if defined(VCT_SUPPORT)
|
||||||
#include "tabvct.h"
|
#include "tabvct.h"
|
||||||
#endif // VCT_SUPPORT
|
#endif // VCT_SUPPORT
|
||||||
@@ -857,7 +858,8 @@ bool XINDEX::SaveIndex(PGLOBAL g, PIXDEF sxp)
|
|||||||
char fname[_MAX_FNAME];
|
char fname[_MAX_FNAME];
|
||||||
|
|
||||||
_splitpath(defp->GetOfn(), drive, direc, fname, NULL);
|
_splitpath(defp->GetOfn(), drive, direc, fname, NULL);
|
||||||
strcat(strcat(fname, "_"), Xdp->GetName());
|
safe_strcat(fname, sizeof(fname), "_");
|
||||||
|
safe_strcat(fname, sizeof(fname), Xdp->GetName());
|
||||||
_makepath(fn, drive, direc, fname, ftype);
|
_makepath(fn, drive, direc, fname, ftype);
|
||||||
sxp = NULL;
|
sxp = NULL;
|
||||||
} else {
|
} else {
|
||||||
@@ -1011,7 +1013,8 @@ bool XINDEX::Init(PGLOBAL g)
|
|||||||
char fname[_MAX_FNAME];
|
char fname[_MAX_FNAME];
|
||||||
|
|
||||||
_splitpath(defp->GetOfn(), drive, direc, fname, NULL);
|
_splitpath(defp->GetOfn(), drive, direc, fname, NULL);
|
||||||
strcat(strcat(fname, "_"), Xdp->GetName());
|
safe_strcat(fname, sizeof(fname), "_");
|
||||||
|
safe_strcat(fname, sizeof(fname), Xdp->GetName());
|
||||||
_makepath(fn, drive, direc, fname, ftype);
|
_makepath(fn, drive, direc, fname, ftype);
|
||||||
} else {
|
} else {
|
||||||
id = ID;
|
id = ID;
|
||||||
@@ -1265,7 +1268,8 @@ bool XINDEX::MapInit(PGLOBAL g)
|
|||||||
char fname[_MAX_FNAME];
|
char fname[_MAX_FNAME];
|
||||||
|
|
||||||
_splitpath(defp->GetOfn(), drive, direc, fname, NULL);
|
_splitpath(defp->GetOfn(), drive, direc, fname, NULL);
|
||||||
strcat(strcat(fname, "_"), Xdp->GetName());
|
safe_strcat(fname, sizeof(fname), "_");
|
||||||
|
safe_strcat(fname, sizeof(fname), Xdp->GetName());
|
||||||
_makepath(fn, drive, direc, fname, ftype);
|
_makepath(fn, drive, direc, fname, ftype);
|
||||||
} else {
|
} else {
|
||||||
id = ID;
|
id = ID;
|
||||||
@@ -1480,7 +1484,8 @@ bool XINDEX::GetAllSizes(PGLOBAL g,/* int &ndif,*/ int &numk)
|
|||||||
char fname[_MAX_FNAME];
|
char fname[_MAX_FNAME];
|
||||||
|
|
||||||
_splitpath(defp->GetOfn(), drive, direc, fname, NULL);
|
_splitpath(defp->GetOfn(), drive, direc, fname, NULL);
|
||||||
strcat(strcat(fname, "_"), Xdp->GetName());
|
safe_strcat(fname, sizeof(fname), "_");
|
||||||
|
safe_strcat(fname, sizeof(fname), Xdp->GetName());
|
||||||
_makepath(fn, drive, direc, fname, ftype);
|
_makepath(fn, drive, direc, fname, ftype);
|
||||||
} else {
|
} else {
|
||||||
id = ID;
|
id = ID;
|
||||||
|
Reference in New Issue
Block a user