Commit 0b9ea65d authored by Olivier Bertrand's avatar Olivier Bertrand

Make source from 10.2 source

parent 9e5ca80a
...@@ -732,7 +732,7 @@ int JMgoConn::DocUpdate(PGLOBAL g, PTDB tdbp) ...@@ -732,7 +732,7 @@ int JMgoConn::DocUpdate(PGLOBAL g, PTDB tdbp)
return RC_FX; return RC_FX;
if (env->CallBooleanMethod(job, docaddid, updlist, jkey, val)) if (env->CallBooleanMethod(job, docaddid, updlist, jkey, val))
return NULL; return RC_OK;
env->DeleteLocalRef(jkey); env->DeleteLocalRef(jkey);
} // endfor colp } // endfor colp
...@@ -742,7 +742,7 @@ int JMgoConn::DocUpdate(PGLOBAL g, PTDB tdbp) ...@@ -742,7 +742,7 @@ int JMgoConn::DocUpdate(PGLOBAL g, PTDB tdbp)
jkey = env->NewStringUTF("$set"); jkey = env->NewStringUTF("$set");
if (env->CallBooleanMethod(job, docaddid, upd, jkey, updlist)) if (env->CallBooleanMethod(job, docaddid, upd, jkey, updlist))
return NULL; return RC_OK;
env->DeleteLocalRef(jkey); env->DeleteLocalRef(jkey);
......
...@@ -1403,10 +1403,20 @@ double JVALUE::GetFloat(void) ...@@ -1403,10 +1403,20 @@ double JVALUE::GetFloat(void)
/***********************************************************************/ /***********************************************************************/
/* Return the Value's String value. */ /* Return the Value's String value. */
/***********************************************************************/ /***********************************************************************/
PSZ JVALUE::GetString(void) PSZ JVALUE::GetString(PGLOBAL g)
{ {
char buf[32]; char *p;
return (Value) ? Value->GetCharString(buf) : NULL;
if (Value) {
char buf[32];
if ((p = Value->GetCharString(buf)) == buf)
p = PlugDup(g, buf);
} else
p = NULL;
return p;
} // end of GetString } // end of GetString
/***********************************************************************/ /***********************************************************************/
......
...@@ -53,6 +53,8 @@ PSZ Serialize(PGLOBAL g, PJSON jsp, char *fn, int pretty); ...@@ -53,6 +53,8 @@ PSZ Serialize(PGLOBAL g, PJSON jsp, char *fn, int pretty);
bool SerializeArray(JOUT *js, PJAR jarp, bool b); bool SerializeArray(JOUT *js, PJAR jarp, bool b);
bool SerializeObject(JOUT *js, PJOB jobp); bool SerializeObject(JOUT *js, PJOB jobp);
bool SerializeValue(JOUT *js, PJVAL jvp); bool SerializeValue(JOUT *js, PJVAL jvp);
bool IsNum(PSZ s);
char *NextChr(PSZ s, char sep);
/***********************************************************************/ /***********************************************************************/
/* Class JOUT. Used by Serialize. */ /* Class JOUT. Used by Serialize. */
...@@ -165,7 +167,7 @@ class JSON : public BLOCK { ...@@ -165,7 +167,7 @@ class JSON : public BLOCK {
virtual PJPR GetFirst(void) {X return NULL;} virtual PJPR GetFirst(void) {X return NULL;}
virtual int GetInteger(void) {X return 0;} virtual int GetInteger(void) {X return 0;}
virtual double GetFloat() {X return 0.0;} virtual double GetFloat() {X return 0.0;}
virtual PSZ GetString() {X return NULL;} virtual PSZ GetString(PGLOBAL g) {X return NULL;}
virtual PSZ GetText(PGLOBAL g, PSZ text) {X return NULL;} virtual PSZ GetText(PGLOBAL g, PSZ text) {X return NULL;}
virtual bool Merge(PGLOBAL g, PJSON jsp) { X return true; } virtual bool Merge(PGLOBAL g, PJSON jsp) { X return true; }
virtual bool SetValue(PGLOBAL g, PJVAL jvp, int i) { X return true; } virtual bool SetValue(PGLOBAL g, PJVAL jvp, int i) { X return true; }
...@@ -275,7 +277,7 @@ class JVALUE : public JSON { ...@@ -275,7 +277,7 @@ class JVALUE : public JSON {
virtual int GetInteger(void); virtual int GetInteger(void);
virtual long long GetBigint(void); virtual long long GetBigint(void);
virtual double GetFloat(void); virtual double GetFloat(void);
virtual PSZ GetString(void); virtual PSZ GetString(PGLOBAL g);
virtual PSZ GetText(PGLOBAL g, PSZ text); virtual PSZ GetText(PGLOBAL g, PSZ text);
virtual void SetValue(PJSON jsp); virtual void SetValue(PJSON jsp);
virtual void SetValue(PVAL valp) { Value = valp; Jsp = NULL; } virtual void SetValue(PVAL valp) { Value = valp; Jsp = NULL; }
......
...@@ -143,7 +143,7 @@ my_bool JSNX::SetArrayOptions(PGLOBAL g, char *p, int i, PSZ nm) ...@@ -143,7 +143,7 @@ my_bool JSNX::SetArrayOptions(PGLOBAL g, char *p, int i, PSZ nm)
jnp->Rank = B; jnp->Rank = B;
jnp->Op = OP_LE; jnp->Op = OP_LE;
} else if (!Value->IsTypeNum()) { } else if (!Value->IsTypeNum()) {
jnp->CncVal = AllocateValue(g, (void*)", ", TYPE_STRING); jnp->CncVal = AllocateValue(g, PlugDup(g, ", "), TYPE_STRING);
jnp->Op = OP_CNC; jnp->Op = OP_CNC;
} else } else
jnp->Op = OP_ADD; jnp->Op = OP_ADD;
...@@ -181,6 +181,10 @@ my_bool JSNX::SetArrayOptions(PGLOBAL g, char *p, int i, PSZ nm) ...@@ -181,6 +181,10 @@ my_bool JSNX::SetArrayOptions(PGLOBAL g, char *p, int i, PSZ nm)
if (n > 2) { if (n > 2) {
// Set concat intermediate string // Set concat intermediate string
p[n - 1] = 0; p[n - 1] = 0;
if (trace)
htrc("Concat string=%s\n", p + 1);
jnp->CncVal = AllocateValue(g, p + 1, TYPE_STRING); jnp->CncVal = AllocateValue(g, p + 1, TYPE_STRING);
} // endif n } // endif n
...@@ -242,6 +246,9 @@ my_bool JSNX::ParseJpath(PGLOBAL g) ...@@ -242,6 +246,9 @@ my_bool JSNX::ParseJpath(PGLOBAL g)
// Jpath = Name; // Jpath = Name;
return true; return true;
if (trace)
htrc("ParseJpath %s\n", SVP(Jpath));
if (!(pbuf = PlgDBDup(g, Jpath))) if (!(pbuf = PlgDBDup(g, Jpath)))
return true; return true;
...@@ -301,6 +308,12 @@ my_bool JSNX::ParseJpath(PGLOBAL g) ...@@ -301,6 +308,12 @@ my_bool JSNX::ParseJpath(PGLOBAL g)
Nod = i; Nod = i;
MulVal = AllocateValue(g, Value); MulVal = AllocateValue(g, Value);
if (trace)
for (i = 0; i < Nod; i++)
htrc("Node(%d) Key=%s Op=%d Rank=%d\n",
i, SVP(Nodes[i].Key), Nodes[i].Op, Nodes[i].Rank);
Parsed = true; Parsed = true;
return false; return false;
} // end of ParseJpath } // end of ParseJpath
...@@ -485,7 +498,7 @@ PVAL JSNX::ExpandArray(PGLOBAL g, PJAR arp, int n) ...@@ -485,7 +498,7 @@ PVAL JSNX::ExpandArray(PGLOBAL g, PJAR arp, int n)
PVAL JSNX::CalculateArray(PGLOBAL g, PJAR arp, int n) PVAL JSNX::CalculateArray(PGLOBAL g, PJAR arp, int n)
{ {
//int i, ars, nv = 0, nextsame = Tjp->NextSame; //int i, ars, nv = 0, nextsame = Tjp->NextSame;
int i, ars, nv = 0, nextsame = 0; int i, nv = 0, nextsame = 0;
my_bool err; my_bool err;
OPVAL op = Nodes[n].Op; OPVAL op = Nodes[n].Op;
PVAL val[2], vp = Nodes[n].Valp; PVAL val[2], vp = Nodes[n].Valp;
...@@ -493,11 +506,20 @@ PVAL JSNX::CalculateArray(PGLOBAL g, PJAR arp, int n) ...@@ -493,11 +506,20 @@ PVAL JSNX::CalculateArray(PGLOBAL g, PJAR arp, int n)
JVALUE jval; JVALUE jval;
vp->Reset(); vp->Reset();
ars = arp->size(); //ars = arp->size();
if (trace)
htrc("CalculateArray size=%d\n", arp->size());
// htrc("CalculateArray size=%d\n", ars);
for (i = 0; i < ars; i++) { for (i = 0; i < arp->size(); i++) {
//for (i = 0; i < ars; i++) { because compiler bug
jvrp = arp->GetValue(i); jvrp = arp->GetValue(i);
if (trace)
htrc("Value %s null=%d nv=%d\n",
jvrp->GetString(g), jvrp->IsNull() ? 1 : 0, nv);
if (!jvrp->IsNull() || (op == OP_CNC && GetJsonNull())) { if (!jvrp->IsNull() || (op == OP_CNC && GetJsonNull())) {
if (jvrp->IsNull()) { if (jvrp->IsNull()) {
jvrp->Value = AllocateValue(g, GetJsonNull(), TYPE_STRING); jvrp->Value = AllocateValue(g, GetJsonNull(), TYPE_STRING);
...@@ -514,8 +536,8 @@ PVAL JSNX::CalculateArray(PGLOBAL g, PJAR arp, int n) ...@@ -514,8 +536,8 @@ PVAL JSNX::CalculateArray(PGLOBAL g, PJAR arp, int n)
} else } else
SetJsonValue(g, MulVal, jvp, n); SetJsonValue(g, MulVal, jvp, n);
if (!MulVal->IsZero()) { if (!MulVal->IsNull()) {
switch (op) { switch (op) {
case OP_CNC: case OP_CNC:
if (Nodes[n].CncVal) { if (Nodes[n].CncVal) {
val[0] = Nodes[n].CncVal; val[0] = Nodes[n].CncVal;
...@@ -1876,7 +1898,7 @@ char *json_array_add_values(UDF_INIT *initid, UDF_ARGS *args, char *result, ...@@ -1876,7 +1898,7 @@ char *json_array_add_values(UDF_INIT *initid, UDF_ARGS *args, char *result,
PJAR arp; PJAR arp;
PJVAL jvp = MakeValue(g, args, 0, &top); PJVAL jvp = MakeValue(g, args, 0, &top);
if ((p = jvp->GetString())) { if ((p = jvp->GetString(g))) {
if (!(top = ParseJson(g, p, strlen(p)))) { if (!(top = ParseJson(g, p, strlen(p)))) {
PUSH_WARNING(g->Message); PUSH_WARNING(g->Message);
return NULL; return NULL;
...@@ -2666,7 +2688,7 @@ char *json_object_list(UDF_INIT *initid, UDF_ARGS *args, char *result, ...@@ -2666,7 +2688,7 @@ char *json_object_list(UDF_INIT *initid, UDF_ARGS *args, char *result,
PJSON jsp; PJSON jsp;
PJVAL jvp = MakeValue(g, args, 0); PJVAL jvp = MakeValue(g, args, 0);
if ((p = jvp->GetString())) { if ((p = jvp->GetString(g))) {
if (!(jsp = ParseJson(g, p, strlen(p)))) { if (!(jsp = ParseJson(g, p, strlen(p)))) {
PUSH_WARNING(g->Message); PUSH_WARNING(g->Message);
return NULL; return NULL;
...@@ -3050,7 +3072,7 @@ char *json_get_item(UDF_INIT *initid, UDF_ARGS *args, char *result, ...@@ -3050,7 +3072,7 @@ char *json_get_item(UDF_INIT *initid, UDF_ARGS *args, char *result,
} else } else
jvp = MakeValue(g, args, 0); jvp = MakeValue(g, args, 0);
if ((p = jvp->GetString())) { if ((p = jvp->GetString(g))) {
if (!(jsp = ParseJson(g, p, strlen(p)))) { if (!(jsp = ParseJson(g, p, strlen(p)))) {
PUSH_WARNING(g->Message); PUSH_WARNING(g->Message);
return NULL; return NULL;
...@@ -3165,7 +3187,7 @@ char *jsonget_string(UDF_INIT *initid, UDF_ARGS *args, char *result, ...@@ -3165,7 +3187,7 @@ char *jsonget_string(UDF_INIT *initid, UDF_ARGS *args, char *result,
} else } else
jvp = MakeValue(g, args, 0); jvp = MakeValue(g, args, 0);
if ((p = jvp->GetString())) { if ((p = jvp->GetString(g))) {
if (!(jsp = ParseJson(g, p, strlen(p)))) { if (!(jsp = ParseJson(g, p, strlen(p)))) {
PUSH_WARNING(g->Message); PUSH_WARNING(g->Message);
goto err; goto err;
...@@ -3280,7 +3302,7 @@ long long jsonget_int(UDF_INIT *initid, UDF_ARGS *args, ...@@ -3280,7 +3302,7 @@ long long jsonget_int(UDF_INIT *initid, UDF_ARGS *args,
} else } else
jvp = MakeValue(g, args, 0); jvp = MakeValue(g, args, 0);
if ((p = jvp->GetString())) { if ((p = jvp->GetString(g))) {
if (!(jsp = ParseJson(g, p, strlen(p)))) { if (!(jsp = ParseJson(g, p, strlen(p)))) {
PUSH_WARNING(g->Message); PUSH_WARNING(g->Message);
if (g->Mrr) *error = 1; if (g->Mrr) *error = 1;
...@@ -3395,7 +3417,7 @@ double jsonget_real(UDF_INIT *initid, UDF_ARGS *args, ...@@ -3395,7 +3417,7 @@ double jsonget_real(UDF_INIT *initid, UDF_ARGS *args,
} else } else
jvp = MakeValue(g, args, 0); jvp = MakeValue(g, args, 0);
if ((p = jvp->GetString())) { if ((p = jvp->GetString(g))) {
if (!(jsp = ParseJson(g, p, strlen(p)))) { if (!(jsp = ParseJson(g, p, strlen(p)))) {
PUSH_WARNING(g->Message); PUSH_WARNING(g->Message);
*is_null = 1; *is_null = 1;
...@@ -3511,7 +3533,7 @@ char *jsonlocate(UDF_INIT *initid, UDF_ARGS *args, char *result, ...@@ -3511,7 +3533,7 @@ char *jsonlocate(UDF_INIT *initid, UDF_ARGS *args, char *result,
} else } else
jvp = MakeValue(g, args, 0); jvp = MakeValue(g, args, 0);
if ((p = jvp->GetString())) { if ((p = jvp->GetString(g))) {
if (!(jsp = ParseJson(g, p, strlen(p)))) { if (!(jsp = ParseJson(g, p, strlen(p)))) {
PUSH_WARNING(g->Message); PUSH_WARNING(g->Message);
goto err; goto err;
...@@ -3635,7 +3657,7 @@ char *json_locate_all(UDF_INIT *initid, UDF_ARGS *args, char *result, ...@@ -3635,7 +3657,7 @@ char *json_locate_all(UDF_INIT *initid, UDF_ARGS *args, char *result,
} else } else
jvp = MakeValue(g, args, 0); jvp = MakeValue(g, args, 0);
if ((p = jvp->GetString())) { if ((p = jvp->GetString(g))) {
if (!(jsp = ParseJson(g, p, strlen(p)))) { if (!(jsp = ParseJson(g, p, strlen(p)))) {
PUSH_WARNING(g->Message); PUSH_WARNING(g->Message);
goto err; goto err;
...@@ -3807,7 +3829,7 @@ long long jsoncontains_path(UDF_INIT *initid, UDF_ARGS *args, char *result, ...@@ -3807,7 +3829,7 @@ long long jsoncontains_path(UDF_INIT *initid, UDF_ARGS *args, char *result,
} else } else
jvp = MakeValue(g, args, 0); jvp = MakeValue(g, args, 0);
if ((p = jvp->GetString())) { if ((p = jvp->GetString(g))) {
if (!(jsp = ParseJson(g, p, strlen(p)))) { if (!(jsp = ParseJson(g, p, strlen(p)))) {
PUSH_WARNING(g->Message); PUSH_WARNING(g->Message);
goto err; goto err;
...@@ -3894,7 +3916,7 @@ char *handle_item(UDF_INIT *initid, UDF_ARGS *args, char *result, ...@@ -3894,7 +3916,7 @@ char *handle_item(UDF_INIT *initid, UDF_ARGS *args, char *result,
} else } else
jvp = MakeValue(g, args, 0); jvp = MakeValue(g, args, 0);
if ((p = jvp->GetString())) { if ((p = jvp->GetString(g))) {
if (!(jsp = ParseJson(g, p, strlen(p)))) { if (!(jsp = ParseJson(g, p, strlen(p)))) {
throw 2; throw 2;
} // endif jsp } // endif jsp
...@@ -4230,14 +4252,14 @@ char *jfile_make(UDF_INIT *initid, UDF_ARGS *args, char *result, ...@@ -4230,14 +4252,14 @@ char *jfile_make(UDF_INIT *initid, UDF_ARGS *args, char *result,
} else } else
jvp = MakeValue(g, args, 0); jvp = MakeValue(g, args, 0);
if ((p = jvp->GetString())) { if ((p = jvp->GetString(g))) {
if (!strchr("[{ \t\r\n", *p)) { if (!strchr("[{ \t\r\n", *p)) {
// Is this a file name? // Is this a file name?
if (!(p = GetJsonFile(g, p))) { if (!(p = GetJsonFile(g, p))) {
PUSH_WARNING(g->Message); PUSH_WARNING(g->Message);
goto fin; goto fin;
} else } else
fn = jvp->GetString(); fn = jvp->GetString(g);
} // endif p } // endif p
...@@ -4380,7 +4402,7 @@ char *jbin_array_add_values(UDF_INIT *initid, UDF_ARGS *args, char *result, ...@@ -4380,7 +4402,7 @@ char *jbin_array_add_values(UDF_INIT *initid, UDF_ARGS *args, char *result,
PJVAL jvp = MakeValue(g, args, 0, &top); PJVAL jvp = MakeValue(g, args, 0, &top);
PGLOBAL gb = GetMemPtr(g, args, 0); PGLOBAL gb = GetMemPtr(g, args, 0);
if ((p = jvp->GetString())) { if ((p = jvp->GetString(g))) {
if (!(top = ParseJson(g, p, strlen(p)))) { if (!(top = ParseJson(g, p, strlen(p)))) {
PUSH_WARNING(g->Message); PUSH_WARNING(g->Message);
return NULL; return NULL;
...@@ -4918,7 +4940,7 @@ char *jbin_object_list(UDF_INIT *initid, UDF_ARGS *args, char *result, ...@@ -4918,7 +4940,7 @@ char *jbin_object_list(UDF_INIT *initid, UDF_ARGS *args, char *result,
PJSON jsp; PJSON jsp;
PJVAL jvp = MakeValue(g, args, 0); PJVAL jvp = MakeValue(g, args, 0);
if ((p = jvp->GetString())) { if ((p = jvp->GetString(g))) {
if (!(jsp = ParseJson(g, p, strlen(p)))) { if (!(jsp = ParseJson(g, p, strlen(p)))) {
PUSH_WARNING(g->Message); PUSH_WARNING(g->Message);
return NULL; return NULL;
...@@ -4989,7 +5011,7 @@ char *jbin_get_item(UDF_INIT *initid, UDF_ARGS *args, char *result, ...@@ -4989,7 +5011,7 @@ char *jbin_get_item(UDF_INIT *initid, UDF_ARGS *args, char *result,
} else } else
jvp = MakeValue(g, args, 0); jvp = MakeValue(g, args, 0);
if ((p = jvp->GetString())) { if ((p = jvp->GetString(g))) {
if (!(jsp = ParseJson(g, p, strlen(p)))) { if (!(jsp = ParseJson(g, p, strlen(p)))) {
PUSH_WARNING(g->Message); PUSH_WARNING(g->Message);
goto fin; goto fin;
...@@ -5163,7 +5185,7 @@ char *bin_handle_item(UDF_INIT *initid, UDF_ARGS *args, char *result, ...@@ -5163,7 +5185,7 @@ char *bin_handle_item(UDF_INIT *initid, UDF_ARGS *args, char *result,
} else } else
jvp = MakeValue(g, args, 0); jvp = MakeValue(g, args, 0);
if ((p = jvp->GetString())) { if ((p = jvp->GetString(g))) {
if (!(jsp = ParseJson(g, p, strlen(p)))) { if (!(jsp = ParseJson(g, p, strlen(p)))) {
PUSH_WARNING(g->Message); PUSH_WARNING(g->Message);
goto fin; goto fin;
......
...@@ -47,6 +47,7 @@ PQRYRES MGOColumns(PGLOBAL g, PCSZ db, PCSZ uri, PTOS topt, bool info) ...@@ -47,6 +47,7 @@ PQRYRES MGOColumns(PGLOBAL g, PCSZ db, PCSZ uri, PTOS topt, bool info)
unsigned int length[] = {0, 6, 8, 10, 10, 6, 6, 0}; unsigned int length[] = {0, 6, 8, 10, 10, 6, 6, 0};
int ncol = sizeof(buftyp) / sizeof(int); int ncol = sizeof(buftyp) / sizeof(int);
int i, n = 0; int i, n = 0;
PCSZ drv;
PBCOL bcp; PBCOL bcp;
MGODISC *cmgd; MGODISC *cmgd;
PQRYRES qrp; PQRYRES qrp;
...@@ -61,7 +62,7 @@ PQRYRES MGOColumns(PGLOBAL g, PCSZ db, PCSZ uri, PTOS topt, bool info) ...@@ -61,7 +62,7 @@ PQRYRES MGOColumns(PGLOBAL g, PCSZ db, PCSZ uri, PTOS topt, bool info)
/*********************************************************************/ /*********************************************************************/
/* Open MongoDB. */ /* Open MongoDB. */
/*********************************************************************/ /*********************************************************************/
PCSZ drv = GetStringTableOption(g, topt, "Driver", NULL); drv = GetStringTableOption(g, topt, "Driver", NULL);
if (drv && toupper(*drv) == 'C') { if (drv && toupper(*drv) == 'C') {
#if defined(CMGO_SUPPORT) #if defined(CMGO_SUPPORT)
...@@ -256,7 +257,7 @@ void MGODISC::AddColumn(PGLOBAL g, PCSZ colname, PCSZ fmt, int k) ...@@ -256,7 +257,7 @@ void MGODISC::AddColumn(PGLOBAL g, PCSZ colname, PCSZ fmt, int k)
if (k && *fmt && (!bcp->Fmt || strlen(bcp->Fmt) < strlen(fmt))) { if (k && *fmt && (!bcp->Fmt || strlen(bcp->Fmt) < strlen(fmt))) {
bcp->Fmt = PlugDup(g, fmt); bcp->Fmt = PlugDup(g, fmt);
length[7] = MY_MAX(length[7], strlen(fmt)); length[7] = MY_MAX(length[7], (signed)strlen(fmt));
} // endif *fmt } // endif *fmt
bcp->Len = MY_MAX(bcp->Len, bcol.Len); bcp->Len = MY_MAX(bcp->Len, bcol.Len);
...@@ -269,11 +270,11 @@ void MGODISC::AddColumn(PGLOBAL g, PCSZ colname, PCSZ fmt, int k) ...@@ -269,11 +270,11 @@ void MGODISC::AddColumn(PGLOBAL g, PCSZ colname, PCSZ fmt, int k)
*bcp = bcol; *bcp = bcol;
bcp->Cbn |= (i > 1); bcp->Cbn |= (i > 1);
bcp->Name = PlugDup(g, colname); bcp->Name = PlugDup(g, colname);
length[0] = MY_MAX(length[0], strlen(colname)); length[0] = MY_MAX(length[0], (signed)strlen(colname));
if (k) { if (k) {
bcp->Fmt = PlugDup(g, fmt); bcp->Fmt = PlugDup(g, fmt);
length[7] = MY_MAX(length[7], strlen(fmt)); length[7] = MY_MAX(length[7], (signed)strlen(fmt));
} else } else
bcp->Fmt = NULL; bcp->Fmt = NULL;
......
...@@ -139,7 +139,7 @@ PQRYRES MyColumns(PGLOBAL g, THD *thd, const char *host, const char *db, ...@@ -139,7 +139,7 @@ PQRYRES MyColumns(PGLOBAL g, THD *thd, const char *host, const char *db,
unsigned int length[] = {0, 4, 0, 4, 4, 4, 4, 4, 0, 0, 0, 0, 0}; unsigned int length[] = {0, 4, 0, 4, 4, 4, 4, 4, 0, 0, 0, 0, 0};
PCSZ fmt; PCSZ fmt;
char *fld, *colname, *chset, v, buf[128], uns[16], zero[16]; char *fld, *colname, *chset, v, buf[128], uns[16], zero[16];
int i, n, nf, ncol = sizeof(buftyp) / sizeof(int); int i, n, nf = 0, ncol = sizeof(buftyp) / sizeof(int);
int len, type, prec, rc, k = 0; int len, type, prec, rc, k = 0;
bool b; bool b;
PQRYRES qrp; PQRYRES qrp;
...@@ -160,7 +160,9 @@ PQRYRES MyColumns(PGLOBAL g, THD *thd, const char *host, const char *db, ...@@ -160,7 +160,9 @@ PQRYRES MyColumns(PGLOBAL g, THD *thd, const char *host, const char *db,
/* Do an evaluation of the result size. */ /* Do an evaluation of the result size. */
/********************************************************************/ /********************************************************************/
STRING cmd(g, 64, "SHOW FULL COLUMNS FROM "); STRING cmd(g, 64, "SHOW FULL COLUMNS FROM ");
b = cmd.Append((PSZ)table); b = cmd.Append('`');
b |= cmd.Append((PSZ)table);
b |= cmd.Append('`');
b |= cmd.Append(" FROM "); b |= cmd.Append(" FROM ");
b |= cmd.Append((PSZ)(db ? db : PlgGetUser(g)->DBName)); b |= cmd.Append((PSZ)(db ? db : PlgGetUser(g)->DBName));
......
...@@ -57,7 +57,7 @@ t1 CREATE TABLE `t1` ( ...@@ -57,7 +57,7 @@ t1 CREATE TABLE `t1` (
`name` char(10) NOT NULL, `name` char(10) NOT NULL,
`birth` date NOT NULL, `birth` date NOT NULL,
`id` char(5) NOT NULL `FIELD_FORMAT`='S', `id` char(5) NOT NULL `FIELD_FORMAT`='S',
`salary` double(9,2) NOT NULL DEFAULT 0.00 `FIELD_FORMAT`='F', `salary` double(9,2) NOT NULL DEFAULT '0.00' `FIELD_FORMAT`='F',
`dept` int(4) NOT NULL `FIELD_FORMAT`='S' `dept` int(4) NOT NULL `FIELD_FORMAT`='S'
) ENGINE=CONNECT DEFAULT CHARSET=latin1 `TABLE_TYPE`=BIN `FILE_NAME`='Testbal.dat' `OPTION_LIST`='Endian=Little' `READONLY`=NO ) ENGINE=CONNECT DEFAULT CHARSET=latin1 `TABLE_TYPE`=BIN `FILE_NAME`='Testbal.dat' `OPTION_LIST`='Endian=Little' `READONLY`=NO
INSERT INTO t1 VALUES (7777,'BILL','1973-06-30',4444,5555.555,777); INSERT INTO t1 VALUES (7777,'BILL','1973-06-30',4444,5555.555,777);
...@@ -76,7 +76,7 @@ t1 CREATE TABLE `t1` ( ...@@ -76,7 +76,7 @@ t1 CREATE TABLE `t1` (
`name` char(10) NOT NULL, `name` char(10) NOT NULL,
`birth` date NOT NULL, `birth` date NOT NULL,
`id` char(5) NOT NULL `FIELD_FORMAT`='S', `id` char(5) NOT NULL `FIELD_FORMAT`='S',
`salary` double(9,2) NOT NULL DEFAULT 0.00 `FIELD_FORMAT`='F', `salary` double(9,2) NOT NULL DEFAULT '0.00' `FIELD_FORMAT`='F',
`dept` int(4) NOT NULL `FIELD_FORMAT`='S' `dept` int(4) NOT NULL `FIELD_FORMAT`='S'
) ENGINE=CONNECT DEFAULT CHARSET=latin1 `TABLE_TYPE`=BIN `FILE_NAME`='Testbal.dat' `OPTION_LIST`='Endian=Little' `READONLY`=YES ) ENGINE=CONNECT DEFAULT CHARSET=latin1 `TABLE_TYPE`=BIN `FILE_NAME`='Testbal.dat' `OPTION_LIST`='Endian=Little' `READONLY`=YES
INSERT INTO t1 VALUES (7777,'BILL','1973-06-30',4444,5555.555,777); INSERT INTO t1 VALUES (7777,'BILL','1973-06-30',4444,5555.555,777);
......
...@@ -26,7 +26,7 @@ fname ftype size ...@@ -26,7 +26,7 @@ fname ftype size
boys .txt 282 boys .txt 282
boyswin .txt 288 boyswin .txt 288
INSERT INTO t1 VALUES ('','','',''); INSERT INTO t1 VALUES ('','','','');
ERROR 22007: Incorrect double value: '' for column 'size' at row 1 ERROR HY000: Got error 174 'COLBLK SetBuffer: undefined Access Method' from CONNECT
DROP TABLE t1; DROP TABLE t1;
CREATE TABLE t1 ENGINE=CONNECT TABLE_TYPE=DIR FILE_NAME='*.txt'; CREATE TABLE t1 ENGINE=CONNECT TABLE_TYPE=DIR FILE_NAME='*.txt';
ERROR HY000: Cannot get column info for table type DIR ERROR HY000: Cannot get column info for table type DIR
...@@ -5,8 +5,6 @@ set sql_mode=""; ...@@ -5,8 +5,6 @@ set sql_mode="";
GRANT ALL PRIVILEGES ON *.* TO user@localhost; GRANT ALL PRIVILEGES ON *.* TO user@localhost;
REVOKE FILE ON *.* FROM user@localhost; REVOKE FILE ON *.* FROM user@localhost;
set sql_mode=default; set sql_mode=default;
connect user,localhost,user,,;
connection user;
SELECT user(); SELECT user();
user() user()
user@localhost user@localhost
...@@ -35,13 +33,11 @@ DROP VIEW v1; ...@@ -35,13 +33,11 @@ DROP VIEW v1;
DROP TABLE t1; DROP TABLE t1;
CREATE TABLE t1 (sec CHAR(10) NOT NULL FLAG=1, val CHAR(10) NOT NULL) ENGINE=CONNECT TABLE_TYPE=INI FILE_NAME='t1.EXT'; CREATE TABLE t1 (sec CHAR(10) NOT NULL FLAG=1, val CHAR(10) NOT NULL) ENGINE=CONNECT TABLE_TYPE=INI FILE_NAME='t1.EXT';
ERROR 28000: Access denied for user 'user'@'localhost' (using password: NO) ERROR 28000: Access denied for user 'user'@'localhost' (using password: NO)
connection default;
SELECT user(); SELECT user();
user() user()
root@localhost root@localhost
CREATE TABLE t1 (sec CHAR(10) NOT NULL FLAG=1, val CHAR(10) NOT NULL) ENGINE=CONNECT TABLE_TYPE=INI FILE_NAME='t1.EXT'; CREATE TABLE t1 (sec CHAR(10) NOT NULL FLAG=1, val CHAR(10) NOT NULL) ENGINE=CONNECT TABLE_TYPE=INI FILE_NAME='t1.EXT';
INSERT INTO t1 VALUES ('sec1','val1'); INSERT INTO t1 VALUES ('sec1','val1');
connection user;
SELECT user(); SELECT user();
user() user()
user@localhost user@localhost
...@@ -62,12 +58,10 @@ ERROR 28000: Access denied for user 'user'@'localhost' (using password: NO) ...@@ -62,12 +58,10 @@ ERROR 28000: Access denied for user 'user'@'localhost' (using password: NO)
CREATE VIEW v1 AS SELECT * FROM t1; CREATE VIEW v1 AS SELECT * FROM t1;
ERROR 28000: Access denied for user 'user'@'localhost' (using password: NO) ERROR 28000: Access denied for user 'user'@'localhost' (using password: NO)
# Testing a VIEW created with FILE privileges but accessed with no FILE # Testing a VIEW created with FILE privileges but accessed with no FILE
connection default;
SELECT user(); SELECT user();
user() user()
root@localhost root@localhost
CREATE SQL SECURITY INVOKER VIEW v1 AS SELECT * FROM t1; CREATE SQL SECURITY INVOKER VIEW v1 AS SELECT * FROM t1;
connection user;
SELECT user(); SELECT user();
user() user()
user@localhost user@localhost
...@@ -79,8 +73,6 @@ UPDATE v1 SET val='val11'; ...@@ -79,8 +73,6 @@ UPDATE v1 SET val='val11';
ERROR 28000: Access denied for user 'user'@'localhost' (using password: NO) ERROR 28000: Access denied for user 'user'@'localhost' (using password: NO)
DELETE FROM v1; DELETE FROM v1;
ERROR 28000: Access denied for user 'user'@'localhost' (using password: NO) ERROR 28000: Access denied for user 'user'@'localhost' (using password: NO)
disconnect user;
connection default;
DROP VIEW v1; DROP VIEW v1;
DROP TABLE t1; DROP TABLE t1;
DROP USER user@localhost; DROP USER user@localhost;
......
connect master,127.0.0.1,root,,test,$MASTER_MYPORT,;
connect slave,127.0.0.1,root,,test,$SLAVE_MYPORT,;
connection master;
connection slave;
SET GLOBAL time_zone='+1:00'; SET GLOBAL time_zone='+1:00';
CREATE TABLE t1 (a int, b char(10)); CREATE TABLE t1 (a int, b char(10));
INSERT INTO t1 VALUES (NULL,NULL),(0,'test00'),(1,'test01'),(2,'test02'),(3,'test03'); INSERT INTO t1 VALUES (NULL,NULL),(0,'test00'),(1,'test01'),(2,'test02'),(3,'test03');
...@@ -15,7 +11,6 @@ NULL NULL ...@@ -15,7 +11,6 @@ NULL NULL
# #
# Testing errors # Testing errors
# #
connection master;
SET GLOBAL time_zone='+1:00'; SET GLOBAL time_zone='+1:00';
CREATE TABLE t1 ENGINE=CONNECT TABLE_TYPE=JDBC CREATE TABLE t1 ENGINE=CONNECT TABLE_TYPE=JDBC
CONNECTION='jdbc:mysql://127.0.0.1:SLAVE_PORT/test?user=unknown'; CONNECTION='jdbc:mysql://127.0.0.1:SLAVE_PORT/test?user=unknown';
...@@ -41,14 +36,10 @@ ERROR HY000: Got error 174 'ExecuteQuery: java.sql.SQLSyntaxErrorException: Unkn ...@@ -41,14 +36,10 @@ ERROR HY000: Got error 174 'ExecuteQuery: java.sql.SQLSyntaxErrorException: Unkn
DROP TABLE t1; DROP TABLE t1;
CREATE TABLE t1 (a int, b char(10)) ENGINE=CONNECT TABLE_TYPE=JDBC CREATE TABLE t1 (a int, b char(10)) ENGINE=CONNECT TABLE_TYPE=JDBC
CONNECTION='jdbc:mysql://127.0.0.1:SLAVE_PORT/test?user=root'; CONNECTION='jdbc:mysql://127.0.0.1:SLAVE_PORT/test?user=root';
connection slave;
ALTER TABLE t1 RENAME t1backup; ALTER TABLE t1 RENAME t1backup;
connection master;
SELECT * FROM t1; SELECT * FROM t1;
ERROR HY000: Got error 174 'ExecuteQuery: java.sql.SQLSyntaxErrorException: Table 'test.t1' doesn't exist' from CONNECT ERROR HY000: Got error 174 'ExecuteQuery: java.sql.SQLSyntaxErrorException: Table 'test.t1' doesn't exist' from CONNECT
connection slave;
ALTER TABLE t1backup RENAME t1; ALTER TABLE t1backup RENAME t1;
connection master;
DROP TABLE t1; DROP TABLE t1;
# #
# Testing SELECT, etc. # Testing SELECT, etc.
...@@ -117,7 +108,6 @@ NULL NULL ...@@ -117,7 +108,6 @@ NULL NULL
2 0 2 0
3 0 3 0
DROP TABLE t1; DROP TABLE t1;
connection slave;
DROP TABLE t1; DROP TABLE t1;
# #
# Testing numeric data types # Testing numeric data types
...@@ -136,7 +126,6 @@ t1 CREATE TABLE `t1` ( ...@@ -136,7 +126,6 @@ t1 CREATE TABLE `t1` (
`h` decimal(20,5) DEFAULT NULL `h` decimal(20,5) DEFAULT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1 ) ENGINE=MyISAM DEFAULT CHARSET=latin1
INSERT INTO t1 VALUES(100,3333,41235,1234567890,235000000000,3.14159265,3.14159265,3141.59265); INSERT INTO t1 VALUES(100,3333,41235,1234567890,235000000000,3.14159265,3.14159265,3141.59265);
connection master;
CREATE TABLE t1 ENGINE=CONNECT TABLE_TYPE=JDBC CREATE TABLE t1 ENGINE=CONNECT TABLE_TYPE=JDBC
CONNECTION='jdbc:mysql://127.0.0.1:SLAVE_PORT/test?user=root'; CONNECTION='jdbc:mysql://127.0.0.1:SLAVE_PORT/test?user=root';
SHOW CREATE TABLE t1; SHOW CREATE TABLE t1;
...@@ -155,7 +144,6 @@ SELECT * FROM t1; ...@@ -155,7 +144,6 @@ SELECT * FROM t1;
a b c d e f g h a b c d e f g h
100 3333 41235 1234567890 235000000000 3 3 3141.59265 100 3333 41235 1234567890 235000000000 3 3 3141.59265
DROP TABLE t1; DROP TABLE t1;
connection slave;
DROP TABLE t1; DROP TABLE t1;
# #
# Testing character data types # Testing character data types
...@@ -171,7 +159,6 @@ INSERT INTO t1 VALUES('Welcome','Hello, World'); ...@@ -171,7 +159,6 @@ INSERT INTO t1 VALUES('Welcome','Hello, World');
SELECT * FROM t1; SELECT * FROM t1;
a b a b
Welcome Hello, World Welcome Hello, World
connection master;
CREATE TABLE t1 ENGINE=CONNECT TABLE_TYPE=JDBC CREATE TABLE t1 ENGINE=CONNECT TABLE_TYPE=JDBC
CONNECTION='jdbc:mysql://127.0.0.1:SLAVE_PORT/test?user=root'; CONNECTION='jdbc:mysql://127.0.0.1:SLAVE_PORT/test?user=root';
SHOW CREATE TABLE t1; SHOW CREATE TABLE t1;
...@@ -184,7 +171,6 @@ SELECT * FROM t1; ...@@ -184,7 +171,6 @@ SELECT * FROM t1;
a b a b
Welcome Hello, World Welcome Hello, World
DROP TABLE t1; DROP TABLE t1;
connection slave;
DROP TABLE t1; DROP TABLE t1;
# #
# Testing temporal data types # Testing temporal data types
...@@ -196,7 +182,7 @@ t1 CREATE TABLE `t1` ( ...@@ -196,7 +182,7 @@ t1 CREATE TABLE `t1` (
`a` date DEFAULT NULL, `a` date DEFAULT NULL,
`b` datetime DEFAULT NULL, `b` datetime DEFAULT NULL,
`c` time DEFAULT NULL, `c` time DEFAULT NULL,
`d` timestamp NOT NULL DEFAULT current_timestamp() ON UPDATE current_timestamp(), `d` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,
`e` year(4) DEFAULT NULL `e` year(4) DEFAULT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1 ) ENGINE=MyISAM DEFAULT CHARSET=latin1
INSERT IGNORE INTO t1 VALUES('2003-05-27 10:45:23','2003-05-27 10:45:23','2003-05-27 10:45:23','2003-05-27 10:45:23','2003-05-27 10:45:23'); INSERT IGNORE INTO t1 VALUES('2003-05-27 10:45:23','2003-05-27 10:45:23','2003-05-27 10:45:23','2003-05-27 10:45:23','2003-05-27 10:45:23');
...@@ -207,7 +193,6 @@ Warning 1265 Data truncated for column 'e' at row 1 ...@@ -207,7 +193,6 @@ Warning 1265 Data truncated for column 'e' at row 1
SELECT * FROM t1; SELECT * FROM t1;
a b c d e a b c d e
2003-05-27 2003-05-27 10:45:23 10:45:23 2003-05-27 10:45:23 2003 2003-05-27 2003-05-27 10:45:23 10:45:23 2003-05-27 10:45:23 2003
connection master;
CREATE TABLE t1 ENGINE=CONNECT TABLE_TYPE=JDBC CREATE TABLE t1 ENGINE=CONNECT TABLE_TYPE=JDBC
CONNECTION='jdbc:mysql://127.0.0.1:SLAVE_PORT/test?user=root'; CONNECTION='jdbc:mysql://127.0.0.1:SLAVE_PORT/test?user=root';
SHOW CREATE TABLE t1; SHOW CREATE TABLE t1;
...@@ -216,15 +201,13 @@ t1 CREATE TABLE `t1` ( ...@@ -216,15 +201,13 @@ t1 CREATE TABLE `t1` (
`a` date DEFAULT NULL, `a` date DEFAULT NULL,
`b` datetime DEFAULT NULL, `b` datetime DEFAULT NULL,
`c` time DEFAULT NULL, `c` time DEFAULT NULL,
`d` timestamp NOT NULL DEFAULT current_timestamp() ON UPDATE current_timestamp(), `d` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,
`e` year(4) DEFAULT NULL `e` year(4) DEFAULT NULL
) ENGINE=CONNECT DEFAULT CHARSET=latin1 CONNECTION='jdbc:mysql://127.0.0.1:SLAVE_PORT/test?user=root' `TABLE_TYPE`='JDBC' ) ENGINE=CONNECT DEFAULT CHARSET=latin1 CONNECTION='jdbc:mysql://127.0.0.1:SLAVE_PORT/test?user=root' `TABLE_TYPE`='JDBC'
SELECT * FROM t1; SELECT * FROM t1;
a b c d e a b c d e
2003-05-27 2003-05-27 11:45:23 10:45:23 2003-05-27 10:45:23 2003 2003-05-27 2003-05-27 11:45:23 10:45:23 2003-05-27 10:45:23 2003
DROP TABLE t1; DROP TABLE t1;
connection slave;
DROP TABLE t1; DROP TABLE t1;
SET GLOBAL time_zone=SYSTEM; SET GLOBAL time_zone=SYSTEM;
connection master;
SET GLOBAL time_zone=SYSTEM; SET GLOBAL time_zone=SYSTEM;
...@@ -17,7 +17,7 @@ ERROR HY000: (1049) Unknown database 'unknown' ...@@ -17,7 +17,7 @@ ERROR HY000: (1049) Unknown database 'unknown'
CREATE TABLE t2 ENGINE=CONNECT TABLE_TYPE=MYSQL OPTION_LIST='host=localhost,user=root,port=PORT' DBNAME='unknown' TABNAME='t1'; CREATE TABLE t2 ENGINE=CONNECT TABLE_TYPE=MYSQL OPTION_LIST='host=localhost,user=root,port=PORT' DBNAME='unknown' TABNAME='t1';
ERROR HY000: (1049) Unknown database 'unknown' ERROR HY000: (1049) Unknown database 'unknown'
CREATE TABLE t2 ENGINE=CONNECT TABLE_TYPE=MYSQL TABNAME='unknown' OPTION_LIST='host=localhost,user=root,port=PORT'; CREATE TABLE t2 ENGINE=CONNECT TABLE_TYPE=MYSQL TABNAME='unknown' OPTION_LIST='host=localhost,user=root,port=PORT';
ERROR HY000: (1146) Table 'test.unknown' doesn't exist [SHOW FULL COLUMNS FROM unknown FROM test] ERROR HY000: (1146) Table 'test.unknown' doesn't exist [SHOW FULL COLUMNS FROM `unknown` FROM test]
SHOW CREATE TABLE t2; SHOW CREATE TABLE t2;
ERROR 42S02: Table 'test.t2' doesn't exist ERROR 42S02: Table 'test.t2' doesn't exist
CREATE TABLE t2 (x int, y char(10)) ENGINE=CONNECT TABLE_TYPE=MYSQL TABNAME='t1' OPTION_LIST='host=localhost,user=root,port=PORT'; CREATE TABLE t2 (x int, y char(10)) ENGINE=CONNECT TABLE_TYPE=MYSQL TABNAME='t1' OPTION_LIST='host=localhost,user=root,port=PORT';
......
connect master,127.0.0.1,root,,test,$MASTER_MYPORT,;
connect slave,127.0.0.1,root,,test,$SLAVE_MYPORT,;
connection master;
CREATE DATABASE connect; CREATE DATABASE connect;
connection slave;
CREATE DATABASE connect; CREATE DATABASE connect;
connection slave;
CREATE TABLE t1 ( CREATE TABLE t1 (
`id` int(20) primary key, `id` int(20) primary key,
`group` int NOT NULL default 1, `group` int NOT NULL default 1,
...@@ -12,15 +7,14 @@ CREATE TABLE t1 ( ...@@ -12,15 +7,14 @@ CREATE TABLE t1 (
`a\\` int unsigned, `a\\` int unsigned,
`name` varchar(32) default 'name') `name` varchar(32) default 'name')
DEFAULT CHARSET=latin1; DEFAULT CHARSET=latin1;
connection master;
CREATE TABLE t1 ENGINE=CONNECT TABLE_TYPE=MYSQL CREATE TABLE t1 ENGINE=CONNECT TABLE_TYPE=MYSQL
CONNECTION='mysql://root@127.0.0.1:SLAVE_PORT/test/t1'; CONNECTION='mysql://root@127.0.0.1:SLAVE_PORT/test/t1';
SHOW CREATE TABLE t1; SHOW CREATE TABLE t1;
Table Create Table Table Create Table
t1 CREATE TABLE `t1` ( t1 CREATE TABLE `t1` (
`id` int(20) NOT NULL, `id` int(20) NOT NULL,
`group` int(11) NOT NULL DEFAULT 1, `group` int(11) NOT NULL DEFAULT '1',
`a\\b` int(11) NOT NULL DEFAULT 2, `a\\b` int(11) NOT NULL DEFAULT '2',
`a\\` int(10) unsigned DEFAULT NULL, `a\\` int(10) unsigned DEFAULT NULL,
`name` varchar(32) DEFAULT 'name' `name` varchar(32) DEFAULT 'name'
) ENGINE=CONNECT DEFAULT CHARSET=latin1 CONNECTION='mysql://root@127.0.0.1:SLAVE_PORT/test/t1' `TABLE_TYPE`='MYSQL' ) ENGINE=CONNECT DEFAULT CHARSET=latin1 CONNECTION='mysql://root@127.0.0.1:SLAVE_PORT/test/t1' `TABLE_TYPE`='MYSQL'
...@@ -31,15 +25,12 @@ id group a\\b a\\ name ...@@ -31,15 +25,12 @@ id group a\\b a\\ name
1 1 2 NULL foo 1 1 2 NULL foo
2 1 2 NULL fee 2 1 2 NULL fee
DROP TABLE t1; DROP TABLE t1;
connection slave;
SELECT * FROM t1; SELECT * FROM t1;
id group a\\b a\\ name id group a\\b a\\ name
1 1 2 NULL foo 1 1 2 NULL foo
2 1 2 NULL fee 2 1 2 NULL fee
DROP TABLE t1; DROP TABLE t1;
connection master;
DROP TABLE IF EXISTS connect.t1; DROP TABLE IF EXISTS connect.t1;
DROP DATABASE IF EXISTS connect; DROP DATABASE IF EXISTS connect;
connection slave;
DROP TABLE IF EXISTS connect.t1; DROP TABLE IF EXISTS connect.t1;
DROP DATABASE IF EXISTS connect; DROP DATABASE IF EXISTS connect;
connect master,127.0.0.1,root,,test,$MASTER_MYPORT,;
connect slave,127.0.0.1,root,,test,$SLAVE_MYPORT,;
connection master;
CREATE DATABASE connect; CREATE DATABASE connect;
connection slave;
CREATE DATABASE connect; CREATE DATABASE connect;
# #
# Checking Sending Commands # Checking Sending Commands
# #
connection master;
CREATE TABLE t1 ( CREATE TABLE t1 (
command VARCHAR(128) NOT NULL, command VARCHAR(128) NOT NULL,
warnings INT(4) NOT NULL FLAG=3, warnings INT(4) NOT NULL FLAG=3,
...@@ -53,7 +48,6 @@ command warnings number message ...@@ -53,7 +48,6 @@ command warnings number message
update t1 set msg = "Five" where id = 5 0 1 Affected rows update t1 set msg = "Five" where id = 5 0 1 Affected rows
DROP PROCEDURE p1; DROP PROCEDURE p1;
DROP TABLE t1; DROP TABLE t1;
connection slave;
SELECT * FROM t1; SELECT * FROM t1;
id msg id msg
1 One 1 One
...@@ -62,9 +56,7 @@ id msg ...@@ -62,9 +56,7 @@ id msg
4 Four 4 Four
5 Five 5 Five
DROP TABLE t1; DROP TABLE t1;
connection master;
DROP TABLE IF EXISTS connect.t1; DROP TABLE IF EXISTS connect.t1;
DROP DATABASE IF EXISTS connect; DROP DATABASE IF EXISTS connect;
connection slave;
DROP TABLE IF EXISTS connect.t1; DROP TABLE IF EXISTS connect.t1;
DROP DATABASE IF EXISTS connect; DROP DATABASE IF EXISTS connect;
...@@ -5,14 +5,11 @@ set sql_mode=""; ...@@ -5,14 +5,11 @@ set sql_mode="";
GRANT ALL PRIVILEGES ON *.* TO user@localhost; GRANT ALL PRIVILEGES ON *.* TO user@localhost;
REVOKE FILE ON *.* FROM user@localhost; REVOKE FILE ON *.* FROM user@localhost;
set sql_mode=default; set sql_mode=default;
connect user,localhost,user,,;
connection user;
SELECT user(); SELECT user();
user() user()
user@localhost user@localhost
CREATE TABLE t1 (a INT NOT NULL) ENGINE=CONNECT TABLE_TYPE=MySQL OPTION_LIST='host=localhost,user=root1,port=PORT'; CREATE TABLE t1 (a INT NOT NULL) ENGINE=CONNECT TABLE_TYPE=MySQL OPTION_LIST='host=localhost,user=root1,port=PORT';
ERROR 28000: Access denied for user 'user'@'localhost' (using password: NO) ERROR 28000: Access denied for user 'user'@'localhost' (using password: NO)
connection default;
SELECT user(); SELECT user();
user() user()
root@localhost root@localhost
...@@ -24,7 +21,6 @@ a ...@@ -24,7 +21,6 @@ a
10 10
20 20
30 30
connection user;
SELECT user(); SELECT user();
user() user()
user@localhost user@localhost
...@@ -43,12 +39,10 @@ ERROR 28000: Access denied for user 'user'@'localhost' (using password: NO) ...@@ -43,12 +39,10 @@ ERROR 28000: Access denied for user 'user'@'localhost' (using password: NO)
CREATE VIEW v1 AS SELECT * FROM t1; CREATE VIEW v1 AS SELECT * FROM t1;
ERROR 28000: Access denied for user 'user'@'localhost' (using password: NO) ERROR 28000: Access denied for user 'user'@'localhost' (using password: NO)
# Testing a VIEW created with FILE privileges but accessed with no FILE # Testing a VIEW created with FILE privileges but accessed with no FILE
connection default;
SELECT user(); SELECT user();
user() user()
root@localhost root@localhost
CREATE SQL SECURITY INVOKER VIEW v1 AS SELECT * FROM t1; CREATE SQL SECURITY INVOKER VIEW v1 AS SELECT * FROM t1;
connection user;
SELECT user(); SELECT user();
user() user()
user@localhost user@localhost
...@@ -60,8 +54,6 @@ UPDATE v1 SET a=123; ...@@ -60,8 +54,6 @@ UPDATE v1 SET a=123;
ERROR 28000: Access denied for user 'user'@'localhost' (using password: NO) ERROR 28000: Access denied for user 'user'@'localhost' (using password: NO)
DELETE FROM v1; DELETE FROM v1;
ERROR 28000: Access denied for user 'user'@'localhost' (using password: NO) ERROR 28000: Access denied for user 'user'@'localhost' (using password: NO)
disconnect user;
connection default;
SELECT user(); SELECT user();
user() user()
root@localhost root@localhost
......
connect master,127.0.0.1,root,,test,$MASTER_MYPORT,;
connect slave,127.0.0.1,root,,test,$SLAVE_MYPORT,;
connection master;
CREATE DATABASE connect; CREATE DATABASE connect;
connection slave;
CREATE DATABASE connect; CREATE DATABASE connect;
connection slave;
CREATE TABLE t1 (a int, b char(10)); CREATE TABLE t1 (a int, b char(10));
INSERT INTO t1 VALUES (NULL,NULL),(0,'test00'),(1,'test01'),(2,'test02'),(3,'test03'); INSERT INTO t1 VALUES (NULL,NULL),(0,'test00'),(1,'test01'),(2,'test02'),(3,'test03');
SELECT * FROM t1; SELECT * FROM t1;
...@@ -17,7 +12,6 @@ NULL NULL ...@@ -17,7 +12,6 @@ NULL NULL
# #
# Testing errors # Testing errors
# #
connection master;
CREATE TABLE t1 ENGINE=CONNECT TABLE_TYPE=MYSQL CREATE TABLE t1 ENGINE=CONNECT TABLE_TYPE=MYSQL
CONNECTION='mysql://unknown@127.0.0.1:SLAVE_PORT/test/t1'; CONNECTION='mysql://unknown@127.0.0.1:SLAVE_PORT/test/t1';
ERROR HY000: (1045) Access denied for user 'unknown'@'localhost' (using password: NO) ERROR HY000: (1045) Access denied for user 'unknown'@'localhost' (using password: NO)
...@@ -29,7 +23,7 @@ OPTION_LIST='host=127.0.0.1,user=root,port=SLAVE_PORT' DBNAME='unknown' TABNAME= ...@@ -29,7 +23,7 @@ OPTION_LIST='host=127.0.0.1,user=root,port=SLAVE_PORT' DBNAME='unknown' TABNAME=
ERROR HY000: (1049) Unknown database 'unknown' ERROR HY000: (1049) Unknown database 'unknown'
CREATE TABLE t1 ENGINE=CONNECT TABLE_TYPE=MYSQL CREATE TABLE t1 ENGINE=CONNECT TABLE_TYPE=MYSQL
CONNECTION='mysql://root@127.0.0.1:SLAVE_PORT/test/unknown'; CONNECTION='mysql://root@127.0.0.1:SLAVE_PORT/test/unknown';
ERROR HY000: (1146) Table 'test.unknown' doesn't exist [SHOW FULL COLUMNS FROM unknown FROM test] ERROR HY000: (1146) Table 'test.unknown' doesn't exist [SHOW FULL COLUMNS FROM `unknown` FROM test]
SHOW CREATE TABLE t1; SHOW CREATE TABLE t1;
ERROR 42S02: Table 'test.t1' doesn't exist ERROR 42S02: Table 'test.t1' doesn't exist
CREATE TABLE t1 (x int, y char(10)) ENGINE=CONNECT TABLE_TYPE=MYSQL CREATE TABLE t1 (x int, y char(10)) ENGINE=CONNECT TABLE_TYPE=MYSQL
...@@ -45,14 +39,10 @@ ERROR HY000: Got error 174 '(1054) Unknown column 'x' in 'field list' [SELECT `x ...@@ -45,14 +39,10 @@ ERROR HY000: Got error 174 '(1054) Unknown column 'x' in 'field list' [SELECT `x
DROP TABLE t1; DROP TABLE t1;
CREATE TABLE t1 (a int, b char(10)) ENGINE=CONNECT TABLE_TYPE=MYSQL CREATE TABLE t1 (a int, b char(10)) ENGINE=CONNECT TABLE_TYPE=MYSQL
CONNECTION='mysql://root@127.0.0.1:SLAVE_PORT/test/t1'; CONNECTION='mysql://root@127.0.0.1:SLAVE_PORT/test/t1';
connection slave;
ALTER TABLE t1 RENAME t1backup; ALTER TABLE t1 RENAME t1backup;
connection master;
SELECT * FROM t1; SELECT * FROM t1;
ERROR HY000: Got error 174 '(1146) Table 'test.t1' doesn't exist [SELECT `a`, `b` FROM `t1`]' from CONNECT ERROR HY000: Got error 174 '(1146) Table 'test.t1' doesn't exist [SELECT `a`, `b` FROM `t1`]' from CONNECT
connection slave;
ALTER TABLE t1backup RENAME t1; ALTER TABLE t1backup RENAME t1;
connection master;
DROP TABLE t1; DROP TABLE t1;
# #
# Testing SELECT, etc. # Testing SELECT, etc.
...@@ -121,7 +111,6 @@ NULL NULL ...@@ -121,7 +111,6 @@ NULL NULL
2 0 2 0
3 0 3 0
DROP TABLE t1; DROP TABLE t1;
connection slave;
DROP TABLE t1; DROP TABLE t1;
# #
# Testing numeric data types # Testing numeric data types
...@@ -140,7 +129,6 @@ t1 CREATE TABLE `t1` ( ...@@ -140,7 +129,6 @@ t1 CREATE TABLE `t1` (
`h` decimal(20,5) DEFAULT NULL `h` decimal(20,5) DEFAULT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1 ) ENGINE=MyISAM DEFAULT CHARSET=latin1
INSERT INTO t1 VALUES(100,3333,41235,1234567890,235000000000,3.14159265,3.14159265,3141.59265); INSERT INTO t1 VALUES(100,3333,41235,1234567890,235000000000,3.14159265,3.14159265,3141.59265);
connection master;
CREATE TABLE t1 ENGINE=CONNECT TABLE_TYPE=MYSQL CREATE TABLE t1 ENGINE=CONNECT TABLE_TYPE=MYSQL
OPTION_LIST='host=127.0.0.1,user=root,port=SLAVE_PORT'; OPTION_LIST='host=127.0.0.1,user=root,port=SLAVE_PORT';
SHOW CREATE TABLE t1; SHOW CREATE TABLE t1;
...@@ -159,7 +147,6 @@ SELECT * FROM t1; ...@@ -159,7 +147,6 @@ SELECT * FROM t1;
a b c d e f g h a b c d e f g h
100 3333 41235 1234567890 235000000000 3.14159 3.14159265 3141.59265 100 3333 41235 1234567890 235000000000 3.14159 3.14159265 3141.59265
DROP TABLE t1; DROP TABLE t1;
connection slave;
DROP TABLE t1; DROP TABLE t1;
# #
# Testing character data types # Testing character data types
...@@ -175,7 +162,6 @@ INSERT INTO t1 VALUES('Welcome','Hello, World'); ...@@ -175,7 +162,6 @@ INSERT INTO t1 VALUES('Welcome','Hello, World');
SELECT * FROM t1; SELECT * FROM t1;
a b a b
Welcome Hello, World Welcome Hello, World
connection master;
CREATE TABLE t1 ENGINE=CONNECT TABLE_TYPE=MYSQL CREATE TABLE t1 ENGINE=CONNECT TABLE_TYPE=MYSQL
CONNECTION='mysql://root@127.0.0.1:SLAVE_PORT'; CONNECTION='mysql://root@127.0.0.1:SLAVE_PORT';
SHOW CREATE TABLE t1; SHOW CREATE TABLE t1;
...@@ -188,7 +174,6 @@ SELECT * FROM t1; ...@@ -188,7 +174,6 @@ SELECT * FROM t1;
a b a b
Welcome Hello, World Welcome Hello, World
DROP TABLE t1; DROP TABLE t1;
connection slave;
DROP TABLE t1; DROP TABLE t1;
# #
# Testing temporal data types # Testing temporal data types
...@@ -200,7 +185,7 @@ t1 CREATE TABLE `t1` ( ...@@ -200,7 +185,7 @@ t1 CREATE TABLE `t1` (
`a` date DEFAULT NULL, `a` date DEFAULT NULL,
`b` datetime DEFAULT NULL, `b` datetime DEFAULT NULL,
`c` time DEFAULT NULL, `c` time DEFAULT NULL,
`d` timestamp NOT NULL DEFAULT current_timestamp() ON UPDATE current_timestamp(), `d` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,
`e` year(4) DEFAULT NULL `e` year(4) DEFAULT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1 ) ENGINE=MyISAM DEFAULT CHARSET=latin1
INSERT IGNORE INTO t1 VALUES('2003-05-27 10:45:23','2003-05-27 10:45:23','2003-05-27 10:45:23','2003-05-27 10:45:23','2003-05-27 10:45:23'); INSERT IGNORE INTO t1 VALUES('2003-05-27 10:45:23','2003-05-27 10:45:23','2003-05-27 10:45:23','2003-05-27 10:45:23','2003-05-27 10:45:23');
...@@ -211,7 +196,6 @@ Warning 1265 Data truncated for column 'e' at row 1 ...@@ -211,7 +196,6 @@ Warning 1265 Data truncated for column 'e' at row 1
SELECT * FROM t1; SELECT * FROM t1;
a b c d e a b c d e
2003-05-27 2003-05-27 10:45:23 10:45:23 2003-05-27 10:45:23 2003 2003-05-27 2003-05-27 10:45:23 10:45:23 2003-05-27 10:45:23 2003
connection master;
CREATE TABLE t1 ENGINE=CONNECT TABLE_TYPE=MYSQL CREATE TABLE t1 ENGINE=CONNECT TABLE_TYPE=MYSQL
CONNECTION='mysql://root@127.0.0.1:SLAVE_PORT'; CONNECTION='mysql://root@127.0.0.1:SLAVE_PORT';
SHOW CREATE TABLE t1; SHOW CREATE TABLE t1;
...@@ -220,18 +204,15 @@ t1 CREATE TABLE `t1` ( ...@@ -220,18 +204,15 @@ t1 CREATE TABLE `t1` (
`a` date DEFAULT NULL, `a` date DEFAULT NULL,
`b` datetime DEFAULT NULL, `b` datetime DEFAULT NULL,
`c` time DEFAULT NULL, `c` time DEFAULT NULL,
`d` timestamp NOT NULL DEFAULT current_timestamp() ON UPDATE current_timestamp(), `d` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,
`e` year(4) DEFAULT NULL `e` year(4) DEFAULT NULL
) ENGINE=CONNECT DEFAULT CHARSET=latin1 CONNECTION='mysql://root@127.0.0.1:SLAVE_PORT' `TABLE_TYPE`='MYSQL' ) ENGINE=CONNECT DEFAULT CHARSET=latin1 CONNECTION='mysql://root@127.0.0.1:SLAVE_PORT' `TABLE_TYPE`='MYSQL'
SELECT * FROM t1; SELECT * FROM t1;
a b c d e a b c d e
2003-05-27 2003-05-27 10:45:23 10:45:23 2003-05-27 10:45:23 2003 2003-05-27 2003-05-27 10:45:23 10:45:23 2003-05-27 10:45:23 2003
DROP TABLE t1; DROP TABLE t1;
connection slave;
DROP TABLE t1; DROP TABLE t1;
connection master;
DROP TABLE IF EXISTS connect.t1; DROP TABLE IF EXISTS connect.t1;
DROP DATABASE IF EXISTS connect; DROP DATABASE IF EXISTS connect;
connection slave;
DROP TABLE IF EXISTS connect.t1; DROP TABLE IF EXISTS connect.t1;
DROP DATABASE IF EXISTS connect; DROP DATABASE IF EXISTS connect;
connect master,127.0.0.1,root,,test,$MASTER_MYPORT,;
connect slave,127.0.0.1,root,,test,$SLAVE_MYPORT,;
connection master;
CREATE DATABASE connect; CREATE DATABASE connect;
connection slave;
CREATE DATABASE connect; CREATE DATABASE connect;
connection default;
# #
# Checking thread TBL tables # Checking thread TBL tables
# #
...@@ -16,7 +11,6 @@ a b ...@@ -16,7 +11,6 @@ a b
1 test01 1 test01
2 test02 2 test02
3 test03 3 test03
connection master;
CREATE TABLE rt2 (a int, b char(10)); CREATE TABLE rt2 (a int, b char(10));
INSERT INTO rt2 VALUES (4,'test04'),(5,'test05'),(6,'test06'),(7,'test07'); INSERT INTO rt2 VALUES (4,'test04'),(5,'test05'),(6,'test06'),(7,'test07');
SELECT * FROM rt2; SELECT * FROM rt2;
...@@ -25,7 +19,7 @@ a b ...@@ -25,7 +19,7 @@ a b
5 test05 5 test05
6 test06 6 test06
7 test07 7 test07
connection slave; USE test;
CREATE TABLE rt3 (a int, b char(10)); CREATE TABLE rt3 (a int, b char(10));
INSERT INTO rt3 VALUES (8,'test08'),(9,'test09'),(10,'test10'),(11,'test11'); INSERT INTO rt3 VALUES (8,'test08'),(9,'test09'),(10,'test10'),(11,'test11');
SELECT * FROM rt3; SELECT * FROM rt3;
...@@ -34,7 +28,6 @@ a b ...@@ -34,7 +28,6 @@ a b
9 test09 9 test09
10 test10 10 test10
11 test11 11 test11
connection default;
CREATE TABLE t2 ENGINE=CONNECT TABLE_TYPE=MYSQL CREATE TABLE t2 ENGINE=CONNECT TABLE_TYPE=MYSQL
CONNECTION='mysql://root@localhost:MASTER_PORT/test/rt2'; CONNECTION='mysql://root@localhost:MASTER_PORT/test/rt2';
SELECT * FROM t2; SELECT * FROM t2;
...@@ -68,11 +61,8 @@ a b ...@@ -68,11 +61,8 @@ a b
2 test02 2 test02
1 test01 1 test01
0 test00 0 test00
connection master;
DROP TABLE rt2; DROP TABLE rt2;
connection slave;
DROP TABLE rt3; DROP TABLE rt3;
connection default;
DROP TABLE t1,t2,t3,total; DROP TABLE t1,t2,t3,total;
# #
# Old thread TBL tables test modified # Old thread TBL tables test modified
...@@ -110,9 +100,7 @@ v ...@@ -110,9 +100,7 @@ v
DROP TABLE total; DROP TABLE total;
DROP TABLE t1; DROP TABLE t1;
DROP TABLE t2; DROP TABLE t2;
connection master;
DROP TABLE IF EXISTS connect.t1; DROP TABLE IF EXISTS connect.t1;
DROP DATABASE IF EXISTS connect; DROP DATABASE IF EXISTS connect;
connection slave;
DROP TABLE IF EXISTS connect.t1; DROP TABLE IF EXISTS connect.t1;
DROP DATABASE IF EXISTS connect; DROP DATABASE IF EXISTS connect;
...@@ -4,8 +4,6 @@ ...@@ -4,8 +4,6 @@
CREATE USER user@localhost; CREATE USER user@localhost;
GRANT ALL PRIVILEGES ON *.* TO user@localhost; GRANT ALL PRIVILEGES ON *.* TO user@localhost;
REVOKE FILE ON *.* FROM user@localhost; REVOKE FILE ON *.* FROM user@localhost;
connect user,localhost,user,,;
connection user;
SELECT user(); SELECT user();
user() user()
user@localhost user@localhost
...@@ -34,13 +32,11 @@ DROP VIEW v1; ...@@ -34,13 +32,11 @@ DROP VIEW v1;
DROP TABLE t1; DROP TABLE t1;
CREATE TABLE t1 (a INT NOT NULL) ENGINE=CONNECT TABLE_TYPE=XML OPTION_LIST='xmlsup=domdoc,rownode=row' FILE_NAME='t1.EXT'; CREATE TABLE t1 (a INT NOT NULL) ENGINE=CONNECT TABLE_TYPE=XML OPTION_LIST='xmlsup=domdoc,rownode=row' FILE_NAME='t1.EXT';
ERROR 28000: Access denied for user 'user'@'localhost' (using password: NO) ERROR 28000: Access denied for user 'user'@'localhost' (using password: NO)
connection default;
SELECT user(); SELECT user();
user() user()
root@localhost root@localhost
CREATE TABLE t1 (a INT NOT NULL) ENGINE=CONNECT TABLE_TYPE=XML OPTION_LIST='xmlsup=domdoc,rownode=row' FILE_NAME='t1.EXT'; CREATE TABLE t1 (a INT NOT NULL) ENGINE=CONNECT TABLE_TYPE=XML OPTION_LIST='xmlsup=domdoc,rownode=row' FILE_NAME='t1.EXT';
INSERT INTO t1 VALUES (10); INSERT INTO t1 VALUES (10);
connection user;
SELECT user(); SELECT user();
user() user()
user@localhost user@localhost
...@@ -63,12 +59,10 @@ ERROR 28000: Access denied for user 'user'@'localhost' (using password: NO) ...@@ -63,12 +59,10 @@ ERROR 28000: Access denied for user 'user'@'localhost' (using password: NO)
CREATE VIEW v1 AS SELECT * FROM t1; CREATE VIEW v1 AS SELECT * FROM t1;
ERROR 28000: Access denied for user 'user'@'localhost' (using password: NO) ERROR 28000: Access denied for user 'user'@'localhost' (using password: NO)
# Testing a VIEW created with FILE privileges but accessed with no FILE # Testing a VIEW created with FILE privileges but accessed with no FILE
connection default;
SELECT user(); SELECT user();
user() user()
root@localhost root@localhost
CREATE SQL SECURITY INVOKER VIEW v1 AS SELECT * FROM t1; CREATE SQL SECURITY INVOKER VIEW v1 AS SELECT * FROM t1;
connection user;
SELECT user(); SELECT user();
user() user()
user@localhost user@localhost
...@@ -80,7 +74,6 @@ UPDATE v1 SET a=123; ...@@ -80,7 +74,6 @@ UPDATE v1 SET a=123;
ERROR 28000: Access denied for user 'user'@'localhost' (using password: NO) ERROR 28000: Access denied for user 'user'@'localhost' (using password: NO)
DELETE FROM v1; DELETE FROM v1;
ERROR 28000: Access denied for user 'user'@'localhost' (using password: NO) ERROR 28000: Access denied for user 'user'@'localhost' (using password: NO)
connection default;
SELECT user(); SELECT user();
user() user()
root@localhost root@localhost
...@@ -90,15 +83,12 @@ CREATE TABLE t1 (a INT NOT NULL) ENGINE=CONNECT TABLE_TYPE=XML OPTION_LIST='xmls ...@@ -90,15 +83,12 @@ CREATE TABLE t1 (a INT NOT NULL) ENGINE=CONNECT TABLE_TYPE=XML OPTION_LIST='xmls
Warnings: Warnings:
Warning 1105 No file name. Table will use t1.xml Warning 1105 No file name. Table will use t1.xml
INSERT INTO t1 VALUES (10); INSERT INTO t1 VALUES (10);
connection user;
SELECT user(); SELECT user();
user() user()
user@localhost user@localhost
ALTER TABLE t1 FILE_NAME='t1.EXT'; ALTER TABLE t1 FILE_NAME='t1.EXT';
ERROR 28000: Access denied for user 'user'@'localhost' (using password: NO) ERROR 28000: Access denied for user 'user'@'localhost' (using password: NO)
connection default;
DROP TABLE t1; DROP TABLE t1;
disconnect user;
DROP USER user@localhost; DROP USER user@localhost;
# #
# End of grant.inc # End of grant.inc
......
...@@ -17,7 +17,7 @@ SELECT * FROM t1 WHERE i = 5; ...@@ -17,7 +17,7 @@ SELECT * FROM t1 WHERE i = 5;
i i
5 5
ALTER TABLE t1 DROP INDEX i; ALTER TABLE t1 DROP INDEX i;
ERROR 42000: Can't DROP INDEX `i`; check that it exists ERROR 42000: Can't DROP 'i'; check that column/key exists
DROP INDEX i ON t1; DROP INDEX i ON t1;
ERROR 42000: Can't DROP INDEX `i`; check that it exists ERROR 42000: Can't DROP 'i'; check that column/key exists
DROP TABLE t1; DROP TABLE t1;
...@@ -23,7 +23,9 @@ ALTER TABLE t1 OPTION_LIST='subdir=0'; ...@@ -23,7 +23,9 @@ ALTER TABLE t1 OPTION_LIST='subdir=0';
SHOW CREATE TABLE t1; SHOW CREATE TABLE t1;
--replace_result $MYSQLD_DATADIR DATADIR/ --replace_result $MYSQLD_DATADIR DATADIR/
SELECT fname, ftype, size FROM t1 ORDER BY fname, ftype, size; SELECT fname, ftype, size FROM t1 ORDER BY fname, ftype, size;
--error ER_TRUNCATED_WRONG_VALUE_FOR_FIELD
# TODO: add a better error message
--error ER_GET_ERRMSG
INSERT INTO t1 VALUES ('','','',''); INSERT INTO t1 VALUES ('','','','');
DROP TABLE t1; DROP TABLE t1;
......
...@@ -19,6 +19,7 @@ SELECT * FROM rt2; ...@@ -19,6 +19,7 @@ SELECT * FROM rt2;
connection slave; connection slave;
USE test;
CREATE TABLE rt3 (a int, b char(10)); CREATE TABLE rt3 (a int, b char(10));
INSERT INTO rt3 VALUES (8,'test08'),(9,'test09'),(10,'test10'),(11,'test11'); INSERT INTO rt3 VALUES (8,'test08'),(9,'test09'),(10,'test10'),(11,'test11');
SELECT * FROM rt3; SELECT * FROM rt3;
......
...@@ -55,6 +55,7 @@ extern "C" HINSTANCE s_hModule; // Saved module handle ...@@ -55,6 +55,7 @@ extern "C" HINSTANCE s_hModule; // Saved module handle
TYPCONV GetTypeConv(); TYPCONV GetTypeConv();
int GetConvSize(); int GetConvSize();
void OdbcClose(PGLOBAL g, PFBLOCK fp);
/***********************************************************************/ /***********************************************************************/
/* Some macro's (should be defined elsewhere to be more accessible) */ /* Some macro's (should be defined elsewhere to be more accessible) */
...@@ -301,6 +302,13 @@ static void ResetNullValues(CATPARM *cap) ...@@ -301,6 +302,13 @@ static void ResetNullValues(CATPARM *cap)
} // end of ResetNullValues } // end of ResetNullValues
#endif #endif
/***********************************************************************/
/* Close an ODBC table after a thrown error (called by PlugCloseFile) */
/***********************************************************************/
void OdbcClose(PGLOBAL g, PFBLOCK fp) {
((ODBConn*)fp->File)->Close();
} // end of OdbcClose
/***********************************************************************/ /***********************************************************************/
/* ODBCColumns: constructs the result blocks containing all columns */ /* ODBCColumns: constructs the result blocks containing all columns */
/* of an ODBC table that will be retrieved by GetData commands. */ /* of an ODBC table that will be retrieved by GetData commands. */
......
...@@ -46,7 +46,7 @@ typedef int INT; ...@@ -46,7 +46,7 @@ typedef int INT;
sqltypes.h (through sql.h or sqlext.h). sqltypes.h (through sql.h or sqlext.h).
*/ */
typedef unsigned long DWORD; typedef unsigned long DWORD;
#endif /* !NODW */ #endif // !NODW
#undef HANDLE #undef HANDLE
typedef int HANDLE; typedef int HANDLE;
......
...@@ -68,12 +68,6 @@ ...@@ -68,12 +68,6 @@
#include "tabcol.h" // header of XTAB and COLUMN classes #include "tabcol.h" // header of XTAB and COLUMN classes
#include "valblk.h" #include "valblk.h"
#include "rcmsg.h" #include "rcmsg.h"
#if defined(ODBC_SUPPORT)
#define NODW // See comment in os.h
#include "tabext.h"
#include "odbccat.h"
#include "tabodbc.h"
#endif // ODBC_SUPPORT
#ifdef ZIP_SUPPORT #ifdef ZIP_SUPPORT
#include "filamzip.h" #include "filamzip.h"
#endif // ZIP_SUPPORT #endif // ZIP_SUPPORT
...@@ -120,6 +114,9 @@ void CloseXMLFile(PGLOBAL, PFBLOCK, bool); ...@@ -120,6 +114,9 @@ void CloseXMLFile(PGLOBAL, PFBLOCK, bool);
#include "libdoc.h" #include "libdoc.h"
#endif // LIBXML2_SUPPORT #endif // LIBXML2_SUPPORT
#ifdef ODBC_SUPPORT
void OdbcClose(PGLOBAL g, PFBLOCK fp);
#endif // ODBC_SUPPORT
/***********************************************************************/ /***********************************************************************/
/* Routines for file IO with error reporting to g->Message */ /* Routines for file IO with error reporting to g->Message */
...@@ -886,7 +883,7 @@ FILE *PlugReopenFile(PGLOBAL g, PFBLOCK fp, LPCSTR md) ...@@ -886,7 +883,7 @@ FILE *PlugReopenFile(PGLOBAL g, PFBLOCK fp, LPCSTR md)
/* Close file routine: the purpose of this routine is to avoid */ /* Close file routine: the purpose of this routine is to avoid */
/* double closing that freeze the system on some Unix platforms. */ /* double closing that freeze the system on some Unix platforms. */
/***********************************************************************/ /***********************************************************************/
int PlugCloseFile(PGLOBAL g __attribute__((unused)), PFBLOCK fp, bool all) int PlugCloseFile(PGLOBAL g, PFBLOCK fp, bool all)
{ {
int rc = 0; int rc = 0;
...@@ -937,7 +934,7 @@ int PlugCloseFile(PGLOBAL g __attribute__((unused)), PFBLOCK fp, bool all) ...@@ -937,7 +934,7 @@ int PlugCloseFile(PGLOBAL g __attribute__((unused)), PFBLOCK fp, bool all)
#endif // LIBXML2_SUPPORT #endif // LIBXML2_SUPPORT
#ifdef ODBC_SUPPORT #ifdef ODBC_SUPPORT
case TYPE_FB_ODBC: case TYPE_FB_ODBC:
((ODBConn*)fp->File)->Close(); OdbcClose(g, fp);
fp->Count = 0; fp->Count = 0;
fp->File = NULL; fp->File = NULL;
break; break;
......
...@@ -227,10 +227,10 @@ bool TABDEF::Define(PGLOBAL g, PCATLG cat, ...@@ -227,10 +227,10 @@ bool TABDEF::Define(PGLOBAL g, PCATLG cat,
{ {
int poff = 0; int poff = 0;
Name = (PSZ)name; Hc = ((MYCAT*)cat)->GetHandler();
Schema = (PSZ)schema; Name = (PSZ)name;
Schema = (PSZ)Hc->GetDBName(schema);
Cat = cat; Cat = cat;
Hc = ((MYCAT*)cat)->GetHandler();
Catfunc = GetFuncID(GetStringCatInfo(g, "Catfunc", NULL)); Catfunc = GetFuncID(GetStringCatInfo(g, "Catfunc", NULL));
Elemt = GetIntCatInfo("Elements", 0); Elemt = GetIntCatInfo("Elements", 0);
Multiple = GetIntCatInfo("Multiple", 0); Multiple = GetIntCatInfo("Multiple", 0);
......
...@@ -54,8 +54,6 @@ ...@@ -54,8 +54,6 @@
/* External functions. */ /* External functions. */
/***********************************************************************/ /***********************************************************************/
USETEMP UseTemp(void); USETEMP UseTemp(void);
bool IsNum(PSZ s);
char *NextChr(PSZ s, char sep);
char *GetJsonNull(void); char *GetJsonNull(void);
typedef struct _jncol { typedef struct _jncol {
...@@ -500,7 +498,7 @@ JSONDEF::JSONDEF(void) ...@@ -500,7 +498,7 @@ JSONDEF::JSONDEF(void)
Sep = '.'; Sep = '.';
#if defined(MONGO_SUPPORT) #if defined(MONGO_SUPPORT)
Uri = NULL; Uri = NULL;
Collname = Schema = Options = Filter = NULL; Collname = Options = Filter = NULL;
Pipe = false; Pipe = false;
Driver = NULL; Driver = NULL;
Version = 0; Version = 0;
...@@ -515,7 +513,8 @@ JSONDEF::JSONDEF(void) ...@@ -515,7 +513,8 @@ JSONDEF::JSONDEF(void)
/***********************************************************************/ /***********************************************************************/
bool JSONDEF::DefineAM(PGLOBAL g, LPCSTR, int poff) bool JSONDEF::DefineAM(PGLOBAL g, LPCSTR, int poff)
{ {
Jmode = (JMODE)GetIntCatInfo("Jmode", MODE_OBJECT); Schema = GetStringCatInfo(g, "DBname", Schema);
Jmode = (JMODE)GetIntCatInfo("Jmode", MODE_OBJECT);
Objname = GetStringCatInfo(g, "Object", NULL); Objname = GetStringCatInfo(g, "Object", NULL);
Xcol = GetStringCatInfo(g, "Expand", NULL); Xcol = GetStringCatInfo(g, "Expand", NULL);
Pretty = GetIntCatInfo("Pretty", 2); Pretty = GetIntCatInfo("Pretty", 2);
...@@ -528,7 +527,6 @@ bool JSONDEF::DefineAM(PGLOBAL g, LPCSTR, int poff) ...@@ -528,7 +527,6 @@ bool JSONDEF::DefineAM(PGLOBAL g, LPCSTR, int poff)
Collname = GetStringCatInfo(g, "Name", Collname = GetStringCatInfo(g, "Name",
(Catfunc & (FNC_TABLE | FNC_COL)) ? NULL : Name); (Catfunc & (FNC_TABLE | FNC_COL)) ? NULL : Name);
Collname = GetStringCatInfo(g, "Tabname", Collname); Collname = GetStringCatInfo(g, "Tabname", Collname);
Schema = GetStringCatInfo(g, "Dbname", "test");
Options = GetStringCatInfo(g, "Colist", NULL); Options = GetStringCatInfo(g, "Colist", NULL);
Filter = GetStringCatInfo(g, "Filter", NULL); Filter = GetStringCatInfo(g, "Filter", NULL);
Pipe = GetBoolCatInfo("Pipeline", false); Pipe = GetBoolCatInfo("Pipeline", false);
...@@ -1592,18 +1590,20 @@ PVAL JSONCOL::ExpandArray(PGLOBAL g, PJAR arp, int n) ...@@ -1592,18 +1590,20 @@ PVAL JSONCOL::ExpandArray(PGLOBAL g, PJAR arp, int n)
/***********************************************************************/ /***********************************************************************/
PVAL JSONCOL::CalculateArray(PGLOBAL g, PJAR arp, int n) PVAL JSONCOL::CalculateArray(PGLOBAL g, PJAR arp, int n)
{ {
int i, ars, nv = 0, nextsame = Tjp->NextSame; //int i, ars, nv = 0, nextsame = Tjp->NextSame;
bool err; int i, nv = 0, nextsame = Tjp->NextSame;
bool err;
OPVAL op = Nodes[n].Op; OPVAL op = Nodes[n].Op;
PVAL val[2], vp = Nodes[n].Valp; PVAL val[2], vp = Nodes[n].Valp;
PJVAL jvrp, jvp; PJVAL jvrp, jvp;
JVALUE jval; JVALUE jval;
vp->Reset(); vp->Reset();
ars = MY_MIN(Tjp->Limit, arp->size()); //ars = MY_MIN(Tjp->Limit, arp->size());
for (i = 0; i < ars; i++) { //for (i = 0; i < ars; i++) {
jvrp = arp->GetValue(i); for (i = 0; i < arp->size(); i++) {
jvrp = arp->GetValue(i);
if (!jvrp->IsNull() || (op == OP_CNC && GetJsonNull())) do { if (!jvrp->IsNull() || (op == OP_CNC && GetJsonNull())) do {
if (jvrp->IsNull()) { if (jvrp->IsNull()) {
...@@ -2278,11 +2278,7 @@ void TDBJSON::CloseDB(PGLOBAL g) ...@@ -2278,11 +2278,7 @@ void TDBJSON::CloseDB(PGLOBAL g)
TDBJCL::TDBJCL(PJDEF tdp) : TDBCAT(tdp) TDBJCL::TDBJCL(PJDEF tdp) : TDBCAT(tdp)
{ {
Topt = tdp->GetTopt(); Topt = tdp->GetTopt();
#if defined(MONGO_SUPPORT)
Db = tdp->Schema; Db = tdp->Schema;
#else
Db = NULL;
#endif
Dsn = tdp->Uri; Dsn = tdp->Uri;
} // end of TDBJCL constructor } // end of TDBJCL constructor
......
...@@ -70,7 +70,6 @@ class DllExport JSONDEF : public DOSDEF { /* Table description */ ...@@ -70,7 +70,6 @@ class DllExport JSONDEF : public DOSDEF { /* Table description */
const char *Uri; /* MongoDB connection URI */ const char *Uri; /* MongoDB connection URI */
#if defined(MONGO_SUPPORT) #if defined(MONGO_SUPPORT)
PCSZ Collname; /* External collection name */ PCSZ Collname; /* External collection name */
PCSZ Schema; /* External schema (DB) name */
PSZ Options; /* Colist ; Pipe */ PSZ Options; /* Colist ; Pipe */
PSZ Filter; /* Filter */ PSZ Filter; /* Filter */
PSZ Driver; /* MongoDB Driver (C or JAVA) */ PSZ Driver; /* MongoDB Driver (C or JAVA) */
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment