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 *p;
if (Value) {
char buf[32]; char buf[32];
return (Value) ? Value->GetCharString(buf) : NULL;
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,7 +536,7 @@ PVAL JSNX::CalculateArray(PGLOBAL g, PJAR arp, int n) ...@@ -514,7 +536,7 @@ 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) {
...@@ -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
...@@ -4,8 +4,6 @@ set sql_mode=""; ...@@ -4,8 +4,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;
connect user,localhost,user,,;
connection user;
SELECT user(); SELECT user();
user() user()
user@localhost user@localhost
...@@ -16,7 +14,6 @@ ftype CHAR(4) NOT NULL, ...@@ -16,7 +14,6 @@ ftype CHAR(4) NOT NULL,
size DOUBLE(12,0) NOT NULL flag=5 size DOUBLE(12,0) NOT NULL flag=5
) ENGINE=CONNECT TABLE_TYPE=DIR FILE_NAME='*.*'; ) ENGINE=CONNECT TABLE_TYPE=DIR FILE_NAME='*.*';
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
...@@ -29,7 +26,6 @@ size DOUBLE(12,0) NOT NULL flag=5 ...@@ -29,7 +26,6 @@ size DOUBLE(12,0) NOT NULL flag=5
SELECT fname, ftype, size FROM t1 WHERE size>0; SELECT fname, ftype, size FROM t1 WHERE size>0;
fname ftype size fname ftype size
t1 .frm 1081 t1 .frm 1081
connection user;
SELECT user(); SELECT user();
user() user()
user@localhost user@localhost
...@@ -48,12 +44,10 @@ ERROR 28000: Access denied for user 'user'@'localhost' (using password: NO) ...@@ -48,12 +44,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
...@@ -65,8 +59,6 @@ UPDATE v1 SET path=123; ...@@ -65,8 +59,6 @@ UPDATE v1 SET path=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
...@@ -82,8 +74,6 @@ DROP USER user@localhost; ...@@ -82,8 +74,6 @@ DROP USER user@localhost;
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
...@@ -112,13 +102,11 @@ DROP VIEW v1; ...@@ -112,13 +102,11 @@ DROP VIEW v1;
DROP TABLE t1; DROP TABLE t1;
CREATE TABLE t1 (a INT NOT NULL) ENGINE=CONNECT TABLE_TYPE=BIN FILE_NAME='t1.EXT'; CREATE TABLE t1 (a INT NOT NULL) ENGINE=CONNECT TABLE_TYPE=BIN 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=BIN FILE_NAME='t1.EXT'; CREATE TABLE t1 (a INT NOT NULL) ENGINE=CONNECT TABLE_TYPE=BIN 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
...@@ -141,12 +129,10 @@ ERROR 28000: Access denied for user 'user'@'localhost' (using password: NO) ...@@ -141,12 +129,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
...@@ -158,7 +144,6 @@ UPDATE v1 SET a=123; ...@@ -158,7 +144,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
...@@ -168,15 +153,12 @@ CREATE TABLE t1 (a INT NOT NULL) ENGINE=CONNECT TABLE_TYPE=BIN; ...@@ -168,15 +153,12 @@ CREATE TABLE t1 (a INT NOT NULL) ENGINE=CONNECT TABLE_TYPE=BIN;
Warnings: Warnings:
Warning 1105 No file name. Table will use t1.bin Warning 1105 No file name. Table will use t1.bin
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
...@@ -187,8 +169,6 @@ DROP USER user@localhost; ...@@ -187,8 +169,6 @@ DROP USER user@localhost;
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
...@@ -217,13 +197,11 @@ DROP VIEW v1; ...@@ -217,13 +197,11 @@ DROP VIEW v1;
DROP TABLE t1; DROP TABLE t1;
CREATE TABLE t1 (a INT NOT NULL) ENGINE=CONNECT TABLE_TYPE=CSV FILE_NAME='t1.EXT'; CREATE TABLE t1 (a INT NOT NULL) ENGINE=CONNECT TABLE_TYPE=CSV 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=CSV FILE_NAME='t1.EXT'; CREATE TABLE t1 (a INT NOT NULL) ENGINE=CONNECT TABLE_TYPE=CSV 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
...@@ -246,12 +224,10 @@ ERROR 28000: Access denied for user 'user'@'localhost' (using password: NO) ...@@ -246,12 +224,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
...@@ -263,7 +239,6 @@ UPDATE v1 SET a=123; ...@@ -263,7 +239,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
...@@ -273,15 +248,12 @@ CREATE TABLE t1 (a INT NOT NULL) ENGINE=CONNECT TABLE_TYPE=CSV; ...@@ -273,15 +248,12 @@ CREATE TABLE t1 (a INT NOT NULL) ENGINE=CONNECT TABLE_TYPE=CSV;
Warnings: Warnings:
Warning 1105 No file name. Table will use t1.csv Warning 1105 No file name. Table will use t1.csv
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
...@@ -292,8 +264,6 @@ DROP USER user@localhost; ...@@ -292,8 +264,6 @@ DROP USER user@localhost;
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
...@@ -322,13 +292,11 @@ DROP VIEW v1; ...@@ -322,13 +292,11 @@ DROP VIEW v1;
DROP TABLE t1; DROP TABLE t1;
CREATE TABLE t1 (a INT NOT NULL) ENGINE=CONNECT TABLE_TYPE=DBF FILE_NAME='t1.EXT'; CREATE TABLE t1 (a INT NOT NULL) ENGINE=CONNECT TABLE_TYPE=DBF 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=DBF FILE_NAME='t1.EXT'; CREATE TABLE t1 (a INT NOT NULL) ENGINE=CONNECT TABLE_TYPE=DBF 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
...@@ -351,12 +319,10 @@ ERROR 28000: Access denied for user 'user'@'localhost' (using password: NO) ...@@ -351,12 +319,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
...@@ -368,7 +334,6 @@ UPDATE v1 SET a=123; ...@@ -368,7 +334,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
...@@ -378,15 +343,12 @@ CREATE TABLE t1 (a INT NOT NULL) ENGINE=CONNECT TABLE_TYPE=DBF; ...@@ -378,15 +343,12 @@ CREATE TABLE t1 (a INT NOT NULL) ENGINE=CONNECT TABLE_TYPE=DBF;
Warnings: Warnings:
Warning 1105 No file name. Table will use t1.dbf Warning 1105 No file name. Table will use t1.dbf
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
...@@ -397,8 +359,6 @@ DROP USER user@localhost; ...@@ -397,8 +359,6 @@ DROP USER user@localhost;
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
...@@ -427,13 +387,11 @@ DROP VIEW v1; ...@@ -427,13 +387,11 @@ DROP VIEW v1;
DROP TABLE t1; DROP TABLE t1;
CREATE TABLE t1 (a INT NOT NULL) ENGINE=CONNECT TABLE_TYPE=FIX FILE_NAME='t1.EXT'; CREATE TABLE t1 (a INT NOT NULL) ENGINE=CONNECT TABLE_TYPE=FIX 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=FIX FILE_NAME='t1.EXT'; CREATE TABLE t1 (a INT NOT NULL) ENGINE=CONNECT TABLE_TYPE=FIX 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
...@@ -456,12 +414,10 @@ ERROR 28000: Access denied for user 'user'@'localhost' (using password: NO) ...@@ -456,12 +414,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
...@@ -473,7 +429,6 @@ UPDATE v1 SET a=123; ...@@ -473,7 +429,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
...@@ -483,15 +438,12 @@ CREATE TABLE t1 (a INT NOT NULL) ENGINE=CONNECT TABLE_TYPE=FIX; ...@@ -483,15 +438,12 @@ CREATE TABLE t1 (a INT NOT NULL) ENGINE=CONNECT TABLE_TYPE=FIX;
Warnings: Warnings:
Warning 1105 No file name. Table will use t1.fix Warning 1105 No file name. Table will use t1.fix
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
...@@ -502,8 +454,6 @@ DROP USER user@localhost; ...@@ -502,8 +454,6 @@ DROP USER user@localhost;
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
...@@ -532,13 +482,11 @@ DROP VIEW v1; ...@@ -532,13 +482,11 @@ DROP VIEW v1;
DROP TABLE t1; DROP TABLE t1;
CREATE TABLE t1 (a INT NOT NULL) ENGINE=CONNECT TABLE_TYPE=VEC MAX_ROWS=100 FILE_NAME='t1.EXT'; CREATE TABLE t1 (a INT NOT NULL) ENGINE=CONNECT TABLE_TYPE=VEC MAX_ROWS=100 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=VEC MAX_ROWS=100 FILE_NAME='t1.EXT'; CREATE TABLE t1 (a INT NOT NULL) ENGINE=CONNECT TABLE_TYPE=VEC MAX_ROWS=100 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
...@@ -561,12 +509,10 @@ ERROR 28000: Access denied for user 'user'@'localhost' (using password: NO) ...@@ -561,12 +509,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
...@@ -578,7 +524,6 @@ UPDATE v1 SET a=123; ...@@ -578,7 +524,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
...@@ -588,15 +533,12 @@ CREATE TABLE t1 (a INT NOT NULL) ENGINE=CONNECT TABLE_TYPE=VEC MAX_ROWS=100; ...@@ -588,15 +533,12 @@ CREATE TABLE t1 (a INT NOT NULL) ENGINE=CONNECT TABLE_TYPE=VEC MAX_ROWS=100;
Warnings: Warnings:
Warning 1105 No file name. Table will use t1.vec Warning 1105 No file name. Table will use t1.vec
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
......
...@@ -5,7 +5,6 @@ CREATE USER user@localhost; ...@@ -5,7 +5,6 @@ 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;
# Testing SQLCOM_SELECT # Testing SQLCOM_SELECT
connection default;
CREATE TABLE t1 (a INT) ENGINE=CONNECT TABLE_TYPE=fix FILE_NAME='t1.fix'; CREATE TABLE t1 (a INT) ENGINE=CONNECT TABLE_TYPE=fix FILE_NAME='t1.fix';
INSERT INTO t1 VALUES (10); INSERT INTO t1 VALUES (10);
CREATE SQL SECURITY INVOKER VIEW v1_invoker AS SELECT * FROM t1; CREATE SQL SECURITY INVOKER VIEW v1_invoker AS SELECT * FROM t1;
...@@ -22,7 +21,6 @@ a ...@@ -22,7 +21,6 @@ a
10 10
SELECT * FROM v1_baddefiner; SELECT * FROM v1_baddefiner;
ERROR 28000: Access denied for user 'root'@'localhost' (using password: NO) ERROR 28000: Access denied for user 'root'@'localhost' (using password: NO)
connect user,localhost,user,,;
SELECT * FROM t1; 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)
SELECT * FROM v1_invoker; SELECT * FROM v1_invoker;
...@@ -30,11 +28,9 @@ ERROR 28000: Access denied for user 'user'@'localhost' (using password: NO) ...@@ -30,11 +28,9 @@ ERROR 28000: Access denied for user 'user'@'localhost' (using password: NO)
SELECT * FROM v1_definer; SELECT * FROM v1_definer;
a a
10 10
connection default;
DROP VIEW v1_invoker, v1_definer, v1_baddefiner; DROP VIEW v1_invoker, v1_definer, v1_baddefiner;
DROP TABLE t1; DROP TABLE t1;
# Testing SQLCOM_UPDATE # Testing SQLCOM_UPDATE
connection default;
CREATE TABLE t1 (a INT) ENGINE=CONNECT TABLE_TYPE=fix FILE_NAME='t1.fix'; CREATE TABLE t1 (a INT) ENGINE=CONNECT TABLE_TYPE=fix FILE_NAME='t1.fix';
INSERT INTO t1 VALUES (10); INSERT INTO t1 VALUES (10);
CREATE SQL SECURITY INVOKER VIEW v1_invoker AS SELECT * FROM t1; CREATE SQL SECURITY INVOKER VIEW v1_invoker AS SELECT * FROM t1;
...@@ -42,17 +38,14 @@ CREATE SQL SECURITY DEFINER VIEW v1_definer AS SELECT * FROM t1; ...@@ -42,17 +38,14 @@ CREATE SQL SECURITY DEFINER VIEW v1_definer AS SELECT * FROM t1;
UPDATE t1 SET a=11; UPDATE t1 SET a=11;
UPDATE v1_invoker SET a=12; UPDATE v1_invoker SET a=12;
UPDATE v1_definer SET a=13; UPDATE v1_definer SET a=13;
connection user;
UPDATE t1 SET a=21; UPDATE t1 SET a=21;
ERROR 28000: Access denied for user 'user'@'localhost' (using password: NO) ERROR 28000: Access denied for user 'user'@'localhost' (using password: NO)
UPDATE v1_invoker SET a=22; UPDATE v1_invoker SET a=22;
ERROR 28000: Access denied for user 'user'@'localhost' (using password: NO) ERROR 28000: Access denied for user 'user'@'localhost' (using password: NO)
UPDATE v1_definer SET a=23; UPDATE v1_definer SET a=23;
connection default;
DROP VIEW v1_invoker, v1_definer; DROP VIEW v1_invoker, v1_definer;
DROP TABLE t1; DROP TABLE t1;
# Testing SQLCOM_INSERT # Testing SQLCOM_INSERT
connection default;
CREATE TABLE t1 (a INT) ENGINE=CONNECT TABLE_TYPE=fix FILE_NAME='t1.fix'; CREATE TABLE t1 (a INT) ENGINE=CONNECT TABLE_TYPE=fix FILE_NAME='t1.fix';
INSERT INTO t1 VALUES (10); INSERT INTO t1 VALUES (10);
CREATE SQL SECURITY INVOKER VIEW v1_invoker AS SELECT * FROM t1; CREATE SQL SECURITY INVOKER VIEW v1_invoker AS SELECT * FROM t1;
...@@ -60,17 +53,14 @@ CREATE SQL SECURITY DEFINER VIEW v1_definer AS SELECT * FROM t1; ...@@ -60,17 +53,14 @@ CREATE SQL SECURITY DEFINER VIEW v1_definer AS SELECT * FROM t1;
INSERT INTO t1 VALUES (11); INSERT INTO t1 VALUES (11);
INSERT INTO v1_invoker VALUES (12); INSERT INTO v1_invoker VALUES (12);
INSERT INTO v1_definer VALUES (13); INSERT INTO v1_definer VALUES (13);
connection user;
INSERT INTO t1 VALUES (21); INSERT INTO t1 VALUES (21);
ERROR 28000: Access denied for user 'user'@'localhost' (using password: NO) ERROR 28000: Access denied for user 'user'@'localhost' (using password: NO)
INSERT INTO v1_invoker VALUES (22); INSERT INTO v1_invoker VALUES (22);
ERROR 28000: Access denied for user 'user'@'localhost' (using password: NO) ERROR 28000: Access denied for user 'user'@'localhost' (using password: NO)
INSERT INTO v1_definer VALUES (23); INSERT INTO v1_definer VALUES (23);
connection default;
DROP VIEW v1_invoker, v1_definer; DROP VIEW v1_invoker, v1_definer;
DROP TABLE t1; DROP TABLE t1;
# Testing SQLCOM_REPLACE # Testing SQLCOM_REPLACE
connection default;
CREATE TABLE t1 (a INT) ENGINE=CONNECT TABLE_TYPE=fix FILE_NAME='t1.fix'; CREATE TABLE t1 (a INT) ENGINE=CONNECT TABLE_TYPE=fix FILE_NAME='t1.fix';
INSERT INTO t1 VALUES (10); INSERT INTO t1 VALUES (10);
CREATE SQL SECURITY INVOKER VIEW v1_invoker AS SELECT * FROM t1; CREATE SQL SECURITY INVOKER VIEW v1_invoker AS SELECT * FROM t1;
...@@ -81,18 +71,15 @@ REPLACE INTO v1_invoker VALUES (12); ...@@ -81,18 +71,15 @@ REPLACE INTO v1_invoker VALUES (12);
ERROR 42000: CONNECT Unsupported command ERROR 42000: CONNECT Unsupported command
REPLACE INTO v1_definer VALUES (13); REPLACE INTO v1_definer VALUES (13);
ERROR 42000: CONNECT Unsupported command ERROR 42000: CONNECT Unsupported command
connection user;
REPLACE INTO t1 VALUES (21); REPLACE INTO t1 VALUES (21);
ERROR 28000: Access denied for user 'user'@'localhost' (using password: NO) ERROR 28000: Access denied for user 'user'@'localhost' (using password: NO)
REPLACE INTO v1_invoker VALUES (22); REPLACE INTO v1_invoker VALUES (22);
ERROR 28000: Access denied for user 'user'@'localhost' (using password: NO) ERROR 28000: Access denied for user 'user'@'localhost' (using password: NO)
REPLACE INTO v1_definer VALUES (23); REPLACE INTO v1_definer VALUES (23);
ERROR 42000: CONNECT Unsupported command ERROR 42000: CONNECT Unsupported command
connection default;
DROP VIEW v1_invoker, v1_definer; DROP VIEW v1_invoker, v1_definer;
DROP TABLE t1; DROP TABLE t1;
# Testing SQLCOM_DELETE # Testing SQLCOM_DELETE
connection default;
CREATE TABLE t1 (a INT) ENGINE=CONNECT TABLE_TYPE=fix FILE_NAME='t1.fix'; CREATE TABLE t1 (a INT) ENGINE=CONNECT TABLE_TYPE=fix FILE_NAME='t1.fix';
INSERT INTO t1 VALUES (10),(11),(12),(13),(21),(22),(23); INSERT INTO t1 VALUES (10),(11),(12),(13),(21),(22),(23);
CREATE SQL SECURITY INVOKER VIEW v1_invoker AS SELECT * FROM t1; CREATE SQL SECURITY INVOKER VIEW v1_invoker AS SELECT * FROM t1;
...@@ -100,17 +87,14 @@ CREATE SQL SECURITY DEFINER VIEW v1_definer AS SELECT * FROM t1; ...@@ -100,17 +87,14 @@ CREATE SQL SECURITY DEFINER VIEW v1_definer AS SELECT * FROM t1;
DELETE FROM t1 WHERE a=11; DELETE FROM t1 WHERE a=11;
DELETE FROM v1_invoker WHERE a=12; DELETE FROM v1_invoker WHERE a=12;
DELETE FROM v1_definer WHERE a=13; DELETE FROM v1_definer WHERE a=13;
connection user;
DELETE FROM t1 WHERE a=21; DELETE FROM t1 WHERE a=21;
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_invoker WHERE a=22; DELETE FROM v1_invoker WHERE a=22;
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_definer WHERE a=23; DELETE FROM v1_definer WHERE a=23;
connection default;
DROP VIEW v1_invoker, v1_definer; DROP VIEW v1_invoker, v1_definer;
DROP TABLE t1; DROP TABLE t1;
# Testing SQLCOM_LOAD # Testing SQLCOM_LOAD
connection default;
CREATE TABLE t1 (a VARCHAR(128)) ENGINE=CONNECT TABLE_TYPE=fix FILE_NAME='t1.fix'; CREATE TABLE t1 (a VARCHAR(128)) ENGINE=CONNECT TABLE_TYPE=fix FILE_NAME='t1.fix';
INSERT INTO t1 VALUES (10); INSERT INTO t1 VALUES (10);
CREATE SQL SECURITY INVOKER VIEW v1_invoker AS SELECT * FROM t1; CREATE SQL SECURITY INVOKER VIEW v1_invoker AS SELECT * FROM t1;
...@@ -118,38 +102,29 @@ CREATE SQL SECURITY DEFINER VIEW v1_definer AS SELECT * FROM t1; ...@@ -118,38 +102,29 @@ CREATE SQL SECURITY DEFINER VIEW v1_definer AS SELECT * FROM t1;
LOAD DATA LOCAL INFILE 'MTR_SUITE_DIR/std_data/boys.txt' INTO TABLE t1; LOAD DATA LOCAL INFILE 'MTR_SUITE_DIR/std_data/boys.txt' INTO TABLE t1;
LOAD DATA LOCAL INFILE 'MTR_SUITE_DIR/std_data/boys.txt' INTO TABLE v1_invoker; LOAD DATA LOCAL INFILE 'MTR_SUITE_DIR/std_data/boys.txt' INTO TABLE v1_invoker;
LOAD DATA LOCAL INFILE 'MTR_SUITE_DIR/std_data/boys.txt' INTO TABLE v1_definer; LOAD DATA LOCAL INFILE 'MTR_SUITE_DIR/std_data/boys.txt' INTO TABLE v1_definer;
connection user;
LOAD DATA LOCAL INFILE 'MTR_SUITE_DIR/std_data/boys.txt' INTO TABLE t1; LOAD DATA LOCAL INFILE 'MTR_SUITE_DIR/std_data/boys.txt' INTO TABLE t1;
ERROR 28000: Access denied for user 'user'@'localhost' (using password: NO) ERROR 28000: Access denied for user 'user'@'localhost' (using password: NO)
LOAD DATA LOCAL INFILE 'MTR_SUITE_DIR/std_data/boys.txt' INTO TABLE v1_invoker; LOAD DATA LOCAL INFILE 'MTR_SUITE_DIR/std_data/boys.txt' INTO TABLE v1_invoker;
ERROR 28000: Access denied for user 'user'@'localhost' (using password: NO) ERROR 28000: Access denied for user 'user'@'localhost' (using password: NO)
LOAD DATA LOCAL INFILE 'MTR_SUITE_DIR/std_data/boys.txt' INTO TABLE v1_definer; LOAD DATA LOCAL INFILE 'MTR_SUITE_DIR/std_data/boys.txt' INTO TABLE v1_definer;
connection default;
DROP VIEW v1_invoker, v1_definer; DROP VIEW v1_invoker, v1_definer;
DROP TABLE t1; DROP TABLE t1;
# Testing SQLCOM_TRUNCATE # Testing SQLCOM_TRUNCATE
connection default;
CREATE TABLE t1 (a INT) ENGINE=CONNECT TABLE_TYPE=fix FILE_NAME='t1.fix'; CREATE TABLE t1 (a INT) ENGINE=CONNECT TABLE_TYPE=fix FILE_NAME='t1.fix';
INSERT INTO t1 VALUES (10); INSERT INTO t1 VALUES (10);
TRUNCATE TABLE t1; TRUNCATE TABLE t1;
INSERT INTO t1 VALUES (11); INSERT INTO t1 VALUES (11);
connection user;
TRUNCATE TABLE t1; TRUNCATE TABLE t1;
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;
# Testing SQLCOM_DROP_TABLE # Testing SQLCOM_DROP_TABLE
connection default;
CREATE TABLE t1 (a INT) ENGINE=CONNECT TABLE_TYPE=fix FILE_NAME='t1.fix'; CREATE TABLE t1 (a INT) ENGINE=CONNECT TABLE_TYPE=fix FILE_NAME='t1.fix';
INSERT INTO t1 VALUES (10); INSERT INTO t1 VALUES (10);
connection user;
DROP TABLE t1; DROP TABLE t1;
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;
# Testing SQLCOM_DROP_VIEW # Testing SQLCOM_DROP_VIEW
# DROP VIEW does not need FILE_ACL. # DROP VIEW does not need FILE_ACL.
connection default;
CREATE TABLE t1 (a INT) ENGINE=CONNECT TABLE_TYPE=fix FILE_NAME='t1.fix'; CREATE TABLE t1 (a INT) ENGINE=CONNECT TABLE_TYPE=fix FILE_NAME='t1.fix';
INSERT INTO t1 VALUES (10),(11),(12),(13),(21),(22),(23); INSERT INTO t1 VALUES (10),(11),(12),(13),(21),(22),(23);
CREATE SQL SECURITY INVOKER VIEW v1_invoker AS SELECT * FROM t1; CREATE SQL SECURITY INVOKER VIEW v1_invoker AS SELECT * FROM t1;
...@@ -157,18 +132,13 @@ CREATE SQL SECURITY DEFINER VIEW v1_definer AS SELECT * FROM t1; ...@@ -157,18 +132,13 @@ CREATE SQL SECURITY DEFINER VIEW v1_definer AS SELECT * FROM t1;
DROP VIEW v1_invoker, v1_definer; DROP VIEW v1_invoker, v1_definer;
CREATE SQL SECURITY INVOKER VIEW v1_invoker AS SELECT * FROM t1; CREATE SQL SECURITY INVOKER VIEW v1_invoker AS SELECT * FROM t1;
CREATE SQL SECURITY DEFINER VIEW v1_definer AS SELECT * FROM t1; CREATE SQL SECURITY DEFINER VIEW v1_definer AS SELECT * FROM t1;
connection user;
DROP VIEW v1_invoker; DROP VIEW v1_invoker;
DROP VIEW v1_definer; DROP VIEW v1_definer;
connection default;
DROP TABLE t1; DROP TABLE t1;
# Testing SQLCOM_CREATE_TABLE # Testing SQLCOM_CREATE_TABLE
connection user;
CREATE TABLE t1 (a INT) ENGINE=CONNECT TABLE_TYPE=fix FILE_NAME='t1.fix'; CREATE TABLE t1 (a INT) ENGINE=CONNECT TABLE_TYPE=fix FILE_NAME='t1.fix';
ERROR 28000: Access denied for user 'user'@'localhost' (using password: NO) ERROR 28000: Access denied for user 'user'@'localhost' (using password: NO)
connection default;
# Testing SQLCOM_LOCK_TABLES # Testing SQLCOM_LOCK_TABLES
connection default;
CREATE TABLE t1 (a INT) ENGINE=CONNECT TABLE_TYPE=fix FILE_NAME='t1.fix'; CREATE TABLE t1 (a INT) ENGINE=CONNECT TABLE_TYPE=fix FILE_NAME='t1.fix';
INSERT INTO t1 VALUES (10); INSERT INTO t1 VALUES (10);
CREATE SQL SECURITY INVOKER VIEW v1_invoker AS SELECT * FROM t1; CREATE SQL SECURITY INVOKER VIEW v1_invoker AS SELECT * FROM t1;
...@@ -185,7 +155,6 @@ LOCK TABLE v1_definer READ; ...@@ -185,7 +155,6 @@ LOCK TABLE v1_definer READ;
UNLOCK TABLES; UNLOCK TABLES;
LOCK TABLE v1_definer WRITE; LOCK TABLE v1_definer WRITE;
UNLOCK TABLES; UNLOCK TABLES;
connection user;
LOCK TABLE t1 READ; LOCK TABLE t1 READ;
ERROR 28000: Access denied for user 'user'@'localhost' (using password: NO) ERROR 28000: Access denied for user 'user'@'localhost' (using password: NO)
LOCK TABLE t1 WRITE; LOCK TABLE t1 WRITE;
...@@ -198,11 +167,9 @@ LOCK TABLE v1_definer READ; ...@@ -198,11 +167,9 @@ LOCK TABLE v1_definer READ;
UNLOCK TABLES; UNLOCK TABLES;
LOCK TABLE v1_definer WRITE; LOCK TABLE v1_definer WRITE;
UNLOCK TABLES; UNLOCK TABLES;
connection default;
DROP VIEW v1_invoker, v1_definer; DROP VIEW v1_invoker, v1_definer;
DROP TABLE t1; DROP TABLE t1;
# Testing SQLCOM_UPDATE_MULTI # Testing SQLCOM_UPDATE_MULTI
connection default;
CREATE TABLE t1 (a INT) ENGINE=CONNECT TABLE_TYPE=fix FILE_NAME='t1.fix'; CREATE TABLE t1 (a INT) ENGINE=CONNECT TABLE_TYPE=fix FILE_NAME='t1.fix';
CREATE TABLE t2 (a INT) ENGINE=CONNECT TABLE_TYPE=fix FILE_NAME='t2.fix'; CREATE TABLE t2 (a INT) ENGINE=CONNECT TABLE_TYPE=fix FILE_NAME='t2.fix';
CREATE TABLE t3 (a INT); CREATE TABLE t3 (a INT);
...@@ -262,7 +229,6 @@ UPDATE v2_definer a1,v1_invoker a2 SET a1.a=50 WHERE a1.a=a2.a; ...@@ -262,7 +229,6 @@ UPDATE v2_definer a1,v1_invoker a2 SET a1.a=50 WHERE a1.a=a2.a;
UPDATE v2_definer a1,v1_definer a2 SET a1.a=50 WHERE a1.a=a2.a; UPDATE v2_definer a1,v1_definer a2 SET a1.a=50 WHERE a1.a=a2.a;
UPDATE v2_definer a1,v2_invoker a2 SET a1.a=50 WHERE a1.a=a2.a; UPDATE v2_definer a1,v2_invoker a2 SET a1.a=50 WHERE a1.a=a2.a;
UPDATE v2_definer a1,v2_definer a2 SET a1.a=50 WHERE a1.a=a2.a; UPDATE v2_definer a1,v2_definer a2 SET a1.a=50 WHERE a1.a=a2.a;
connection user;
UPDATE t1 a1,t1 a2 SET a1.a=50 WHERE a1.a=a2.a; UPDATE t1 a1,t1 a2 SET a1.a=50 WHERE a1.a=a2.a;
ERROR 28000: Access denied for user 'user'@'localhost' (using password: NO) ERROR 28000: Access denied for user 'user'@'localhost' (using password: NO)
UPDATE t1 a1,t2 a2 SET a1.a=50 WHERE a1.a=a2.a; UPDATE t1 a1,t2 a2 SET a1.a=50 WHERE a1.a=a2.a;
...@@ -352,11 +318,9 @@ UPDATE v2_definer a1,v1_definer a2 SET a1.a=50 WHERE a1.a=a2.a; ...@@ -352,11 +318,9 @@ UPDATE v2_definer a1,v1_definer a2 SET a1.a=50 WHERE a1.a=a2.a;
UPDATE v2_definer a1,v2_invoker a2 SET a1.a=50 WHERE a1.a=a2.a; UPDATE v2_definer a1,v2_invoker a2 SET a1.a=50 WHERE a1.a=a2.a;
ERROR 28000: Access denied for user 'user'@'localhost' (using password: NO) ERROR 28000: Access denied for user 'user'@'localhost' (using password: NO)
UPDATE v2_definer a1,v2_definer a2 SET a1.a=50 WHERE a1.a=a2.a; UPDATE v2_definer a1,v2_definer a2 SET a1.a=50 WHERE a1.a=a2.a;
connection default;
DROP VIEW v1_invoker, v1_definer, v2_invoker, v2_definer; DROP VIEW v1_invoker, v1_definer, v2_invoker, v2_definer;
DROP TABLE t1, t2, t3; DROP TABLE t1, t2, t3;
# Testing SQLCOM_DELETE_MULTI # Testing SQLCOM_DELETE_MULTI
connection default;
CREATE TABLE t1 (a INT) ENGINE=CONNECT TABLE_TYPE=fix FILE_NAME='t1.fix'; CREATE TABLE t1 (a INT) ENGINE=CONNECT TABLE_TYPE=fix FILE_NAME='t1.fix';
CREATE TABLE t2 (a INT) ENGINE=CONNECT TABLE_TYPE=fix FILE_NAME='t2.fix'; CREATE TABLE t2 (a INT) ENGINE=CONNECT TABLE_TYPE=fix FILE_NAME='t2.fix';
CREATE TABLE t3 (a INT); CREATE TABLE t3 (a INT);
...@@ -416,7 +380,6 @@ DELETE a1 FROM v2_definer a1,v1_invoker a2 WHERE a1.a=a2.a; ...@@ -416,7 +380,6 @@ DELETE a1 FROM v2_definer a1,v1_invoker a2 WHERE a1.a=a2.a;
DELETE a1 FROM v2_definer a1,v1_definer a2 WHERE a1.a=a2.a; DELETE a1 FROM v2_definer a1,v1_definer a2 WHERE a1.a=a2.a;
DELETE a1 FROM v2_definer a1,v2_invoker a2 WHERE a1.a=a2.a; DELETE a1 FROM v2_definer a1,v2_invoker a2 WHERE a1.a=a2.a;
DELETE a1 FROM v2_definer a1,v2_definer a2 WHERE a1.a=a2.a; DELETE a1 FROM v2_definer a1,v2_definer a2 WHERE a1.a=a2.a;
connection user;
DELETE a1 FROM t1 a1,t1 a2 WHERE a1.a=a2.a; DELETE a1 FROM t1 a1,t1 a2 WHERE a1.a=a2.a;
ERROR 28000: Access denied for user 'user'@'localhost' (using password: NO) ERROR 28000: Access denied for user 'user'@'localhost' (using password: NO)
DELETE a1 FROM t1 a1,t2 a2 WHERE a1.a=a2.a; DELETE a1 FROM t1 a1,t2 a2 WHERE a1.a=a2.a;
...@@ -506,11 +469,9 @@ DELETE a1 FROM v2_definer a1,v1_definer a2 WHERE a1.a=a2.a; ...@@ -506,11 +469,9 @@ DELETE a1 FROM v2_definer a1,v1_definer a2 WHERE a1.a=a2.a;
DELETE a1 FROM v2_definer a1,v2_invoker a2 WHERE a1.a=a2.a; DELETE a1 FROM v2_definer a1,v2_invoker a2 WHERE a1.a=a2.a;
ERROR 28000: Access denied for user 'user'@'localhost' (using password: NO) ERROR 28000: Access denied for user 'user'@'localhost' (using password: NO)
DELETE a1 FROM v2_definer a1,v2_definer a2 WHERE a1.a=a2.a; DELETE a1 FROM v2_definer a1,v2_definer a2 WHERE a1.a=a2.a;
connection default;
DROP VIEW v1_invoker, v1_definer, v2_invoker, v2_definer; DROP VIEW v1_invoker, v1_definer, v2_invoker, v2_definer;
DROP TABLE t1, t2, t3; DROP TABLE t1, t2, t3;
# Testing SQLCOM_CREATE_VIEW # Testing SQLCOM_CREATE_VIEW
connection default;
CREATE TABLE t1 (a INT) ENGINE=CONNECT TABLE_TYPE=fix FILE_NAME='t1.fix'; CREATE TABLE t1 (a INT) ENGINE=CONNECT TABLE_TYPE=fix FILE_NAME='t1.fix';
INSERT INTO t1 VALUES (10); INSERT INTO t1 VALUES (10);
CREATE SQL SECURITY INVOKER VIEW v1_invoker AS SELECT * FROM t1; CREATE SQL SECURITY INVOKER VIEW v1_invoker AS SELECT * FROM t1;
...@@ -519,18 +480,15 @@ CREATE VIEW v2 AS SELECT * FROM v1_invoker; ...@@ -519,18 +480,15 @@ CREATE VIEW v2 AS SELECT * FROM v1_invoker;
DROP VIEW v2; DROP VIEW v2;
CREATE VIEW v2 AS SELECT * FROM v1_definer; CREATE VIEW v2 AS SELECT * FROM v1_definer;
DROP VIEW v2; DROP VIEW v2;
connection user;
CREATE VIEW v2 AS SELECT * FROM t1; CREATE VIEW v2 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)
CREATE VIEW v2 AS SELECT * FROM v1_invoker; CREATE VIEW v2 AS SELECT * FROM v1_invoker;
ERROR 28000: Access denied for user 'user'@'localhost' (using password: NO) ERROR 28000: Access denied for user 'user'@'localhost' (using password: NO)
CREATE VIEW v2 AS SELECT * FROM v1_definer; CREATE VIEW v2 AS SELECT * FROM v1_definer;
DROP VIEW v2; DROP VIEW v2;
connection default;
DROP VIEW v1_invoker, v1_definer; DROP VIEW v1_invoker, v1_definer;
DROP TABLE t1; DROP TABLE t1;
# Testing SQLCOM_INSERT_SELECT # Testing SQLCOM_INSERT_SELECT
connection default;
CREATE TABLE t1 (a INT) ENGINE=CONNECT TABLE_TYPE=fix FILE_NAME='t1.fix'; CREATE TABLE t1 (a INT) ENGINE=CONNECT TABLE_TYPE=fix FILE_NAME='t1.fix';
INSERT INTO t1 VALUES (10); INSERT INTO t1 VALUES (10);
CREATE SQL SECURITY INVOKER VIEW v1_invoker AS SELECT * FROM t1; CREATE SQL SECURITY INVOKER VIEW v1_invoker AS SELECT * FROM t1;
...@@ -544,7 +502,6 @@ INSERT INTO v1_invoker SELECT * FROM v1_definer WHERE a=20; ...@@ -544,7 +502,6 @@ INSERT INTO v1_invoker SELECT * FROM v1_definer WHERE a=20;
INSERT INTO v1_definer SELECT * FROM t1 WHERE a=20; INSERT INTO v1_definer SELECT * FROM t1 WHERE a=20;
INSERT INTO v1_definer SELECT * FROM v1_invoker WHERE a=20; INSERT INTO v1_definer SELECT * FROM v1_invoker WHERE a=20;
INSERT INTO v1_definer SELECT * FROM v1_definer WHERE a=20; INSERT INTO v1_definer SELECT * FROM v1_definer WHERE a=20;
connection user;
INSERT INTO t1 SELECT * FROM t1 WHERE a=20; INSERT INTO t1 SELECT * FROM t1 WHERE a=20;
ERROR 28000: Access denied for user 'user'@'localhost' (using password: NO) ERROR 28000: Access denied for user 'user'@'localhost' (using password: NO)
INSERT INTO t1 SELECT * FROM v1_invoker WHERE a=20; INSERT INTO t1 SELECT * FROM v1_invoker WHERE a=20;
...@@ -562,11 +519,9 @@ ERROR 28000: Access denied for user 'user'@'localhost' (using password: NO) ...@@ -562,11 +519,9 @@ ERROR 28000: Access denied for user 'user'@'localhost' (using password: NO)
INSERT INTO v1_definer SELECT * FROM v1_invoker WHERE a=20; INSERT INTO v1_definer SELECT * FROM v1_invoker WHERE a=20;
ERROR 28000: Access denied for user 'user'@'localhost' (using password: NO) ERROR 28000: Access denied for user 'user'@'localhost' (using password: NO)
INSERT INTO v1_definer SELECT * FROM v1_definer WHERE a=20; INSERT INTO v1_definer SELECT * FROM v1_definer WHERE a=20;
connection default;
DROP VIEW v1_invoker, v1_definer; DROP VIEW v1_invoker, v1_definer;
DROP TABLE t1; DROP TABLE t1;
# Testing SQLCOM_REPLACE_SELECT # Testing SQLCOM_REPLACE_SELECT
connection default;
CREATE TABLE t1 (a INT) ENGINE=CONNECT TABLE_TYPE=fix FILE_NAME='t1.fix'; CREATE TABLE t1 (a INT) ENGINE=CONNECT TABLE_TYPE=fix FILE_NAME='t1.fix';
INSERT INTO t1 VALUES (10); INSERT INTO t1 VALUES (10);
CREATE SQL SECURITY INVOKER VIEW v1_invoker AS SELECT * FROM t1; CREATE SQL SECURITY INVOKER VIEW v1_invoker AS SELECT * FROM t1;
...@@ -589,7 +544,6 @@ REPLACE INTO v1_definer SELECT * FROM v1_invoker WHERE a=20; ...@@ -589,7 +544,6 @@ REPLACE INTO v1_definer SELECT * FROM v1_invoker WHERE a=20;
ERROR 42000: CONNECT Unsupported command ERROR 42000: CONNECT Unsupported command
REPLACE INTO v1_definer SELECT * FROM v1_definer WHERE a=20; REPLACE INTO v1_definer SELECT * FROM v1_definer WHERE a=20;
ERROR 42000: CONNECT Unsupported command ERROR 42000: CONNECT Unsupported command
connection user;
REPLACE INTO t1 SELECT * FROM t1 WHERE a=20; REPLACE INTO t1 SELECT * FROM t1 WHERE a=20;
ERROR 28000: Access denied for user 'user'@'localhost' (using password: NO) ERROR 28000: Access denied for user 'user'@'localhost' (using password: NO)
REPLACE INTO t1 SELECT * FROM v1_invoker WHERE a=20; REPLACE INTO t1 SELECT * FROM v1_invoker WHERE a=20;
...@@ -608,11 +562,9 @@ REPLACE INTO v1_definer SELECT * FROM v1_invoker WHERE a=20; ...@@ -608,11 +562,9 @@ REPLACE INTO v1_definer SELECT * FROM v1_invoker WHERE a=20;
ERROR 42000: CONNECT Unsupported command ERROR 42000: CONNECT Unsupported command
REPLACE INTO v1_definer SELECT * FROM v1_definer WHERE a=20; REPLACE INTO v1_definer SELECT * FROM v1_definer WHERE a=20;
ERROR 42000: CONNECT Unsupported command ERROR 42000: CONNECT Unsupported command
connection default;
DROP VIEW v1_invoker, v1_definer; DROP VIEW v1_invoker, v1_definer;
DROP TABLE t1; DROP TABLE t1;
# Testing SQLCOM_RENAME_TABLE # Testing SQLCOM_RENAME_TABLE
connection default;
CREATE TABLE t1 (a INT) ENGINE=CONNECT TABLE_TYPE=fix FILE_NAME='t1.fix'; CREATE TABLE t1 (a INT) ENGINE=CONNECT TABLE_TYPE=fix FILE_NAME='t1.fix';
INSERT INTO t1 VALUES (10); INSERT INTO t1 VALUES (10);
RENAME TABLE t1 TO t2; RENAME TABLE t1 TO t2;
...@@ -622,13 +574,10 @@ t2 CREATE TABLE `t2` ( ...@@ -622,13 +574,10 @@ t2 CREATE TABLE `t2` (
`a` int(11) DEFAULT NULL `a` int(11) DEFAULT NULL
) ENGINE=CONNECT DEFAULT CHARSET=latin1 `TABLE_TYPE`=fix `FILE_NAME`='t1.fix' ) ENGINE=CONNECT DEFAULT CHARSET=latin1 `TABLE_TYPE`=fix `FILE_NAME`='t1.fix'
RENAME TABLE t2 TO t1; RENAME TABLE t2 TO t1;
connection user;
RENAME TABLE t1 TO t2; RENAME TABLE t1 TO t2;
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;
# Testing SQLCOM_ALTER_TABLE (for ALTER..RENAME) # Testing SQLCOM_ALTER_TABLE (for ALTER..RENAME)
connection default;
CREATE TABLE t1 (a INT) ENGINE=CONNECT TABLE_TYPE=fix FILE_NAME='t1.fix'; CREATE TABLE t1 (a INT) ENGINE=CONNECT TABLE_TYPE=fix FILE_NAME='t1.fix';
INSERT INTO t1 VALUES (10); INSERT INTO t1 VALUES (10);
ALTER TABLE t1 RENAME TO t2; ALTER TABLE t1 RENAME TO t2;
...@@ -638,26 +587,20 @@ t2 CREATE TABLE `t2` ( ...@@ -638,26 +587,20 @@ t2 CREATE TABLE `t2` (
`a` int(11) DEFAULT NULL `a` int(11) DEFAULT NULL
) ENGINE=CONNECT DEFAULT CHARSET=latin1 `TABLE_TYPE`=fix `FILE_NAME`='t1.fix' ) ENGINE=CONNECT DEFAULT CHARSET=latin1 `TABLE_TYPE`=fix `FILE_NAME`='t1.fix'
ALTER TABLE t2 RENAME TO t1; ALTER TABLE t2 RENAME TO t1;
connection user;
ALTER TABLE t1 RENAME TO t2; ALTER TABLE t1 RENAME TO t2;
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;
# Testing SQLCOM_ALTER_TABLE (changing ENGINE to non-CONNECT) # Testing SQLCOM_ALTER_TABLE (changing ENGINE to non-CONNECT)
connection default;
CREATE TABLE t1 (a INT) ENGINE=CONNECT TABLE_TYPE=fix FILE_NAME='t1.fix'; CREATE TABLE t1 (a INT) ENGINE=CONNECT TABLE_TYPE=fix FILE_NAME='t1.fix';
INSERT INTO t1 VALUES (10); INSERT INTO t1 VALUES (10);
ALTER TABLE t1 ENGINE=MyISAM; ALTER TABLE t1 ENGINE=MyISAM;
DROP TABLE t1; DROP TABLE t1;
CREATE TABLE t1 (a INT) ENGINE=CONNECT TABLE_TYPE=fix FILE_NAME='t1.fix'; CREATE TABLE t1 (a INT) ENGINE=CONNECT TABLE_TYPE=fix FILE_NAME='t1.fix';
INSERT INTO t1 VALUES (10); INSERT INTO t1 VALUES (10);
connection user;
ALTER TABLE t1 ENGINE=MyISAM; ALTER TABLE t1 ENGINE=MyISAM;
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;
# Testing SQLCOM_ALTER_TABLE (changing ENGINE to CONNECT) # Testing SQLCOM_ALTER_TABLE (changing ENGINE to CONNECT)
connection default;
CREATE TABLE t1 (a INT) ENGINE=MyISAM; CREATE TABLE t1 (a INT) ENGINE=MyISAM;
INSERT INTO t1 VALUES (10); INSERT INTO t1 VALUES (10);
SELECT * FROM t1; SELECT * FROM t1;
...@@ -667,83 +610,63 @@ ALTER TABLE t1 ENGINE=CONNECT TABLE_TYPE=fix FILE_NAME='t1.fix'; ...@@ -667,83 +610,63 @@ ALTER TABLE t1 ENGINE=CONNECT TABLE_TYPE=fix FILE_NAME='t1.fix';
DROP TABLE t1; DROP TABLE t1;
CREATE TABLE t1 (a INT) ENGINE=MyISAM; CREATE TABLE t1 (a INT) ENGINE=MyISAM;
INSERT INTO t1 VALUES (10); INSERT INTO t1 VALUES (10);
connection user;
ALTER TABLE t1 ENGINE=CONNECT TABLE_TYPE=fix FILE_NAME='t1.fix'; ALTER TABLE t1 ENGINE=CONNECT TABLE_TYPE=fix FILE_NAME='t1.fix';
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;
# Testing SQLCOM_OPTIMIZE # Testing SQLCOM_OPTIMIZE
connection default;
CREATE TABLE t1 (a INT NOT NULL, KEY(a)) ENGINE=CONNECT TABLE_TYPE=fix FILE_NAME='t1.fix'; CREATE TABLE t1 (a INT NOT NULL, KEY(a)) ENGINE=CONNECT TABLE_TYPE=fix FILE_NAME='t1.fix';
INSERT INTO t1 VALUES (10); INSERT INTO t1 VALUES (10);
OPTIMIZE TABLE t1; OPTIMIZE TABLE t1;
Table Op Msg_type Msg_text Table Op Msg_type Msg_text
test.t1 optimize status OK test.t1 optimize status OK
connection user;
OPTIMIZE TABLE t1; OPTIMIZE TABLE t1;
Table Op Msg_type Msg_text Table Op Msg_type Msg_text
test.t1 optimize Error Access denied for user 'user'@'localhost' (using password: NO) test.t1 optimize Error Access denied for user 'user'@'localhost' (using password: NO)
test.t1 optimize Error Got error 122 'This operation requires the FILE privilege' from CONNECT test.t1 optimize Error Got error 122 'This operation requires the FILE privilege' from CONNECT
test.t1 optimize error Corrupt test.t1 optimize error Corrupt
connection default;
DROP TABLE t1; DROP TABLE t1;
# Testing SQLCOM_ALTER_TABLE (adding columns) # Testing SQLCOM_ALTER_TABLE (adding columns)
connection default;
CREATE TABLE t1 (a INT) ENGINE=CONNECT TABLE_TYPE=fix FILE_NAME='t1.fix'; CREATE TABLE t1 (a INT) ENGINE=CONNECT TABLE_TYPE=fix FILE_NAME='t1.fix';
INSERT INTO t1 VALUES (10); INSERT INTO t1 VALUES (10);
ALTER TABLE t1 ADD b INT; ALTER TABLE t1 ADD b INT;
Warnings: Warnings:
Warning 1105 This is an outward table, table data were not modified. Warning 1105 This is an outward table, table data were not modified.
connection user;
ALTER TABLE t1 ADD c INT; ALTER TABLE t1 ADD c INT;
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;
# Testing SQLCOM_ALTER_TABLE (removing columns) # Testing SQLCOM_ALTER_TABLE (removing columns)
connection default;
CREATE TABLE t1 (a INT,b INT,c INT) ENGINE=CONNECT TABLE_TYPE=fix FILE_NAME='t1.fix'; CREATE TABLE t1 (a INT,b INT,c INT) ENGINE=CONNECT TABLE_TYPE=fix FILE_NAME='t1.fix';
INSERT INTO t1 VALUES (10,10,10); INSERT INTO t1 VALUES (10,10,10);
ALTER TABLE t1 DROP b; ALTER TABLE t1 DROP b;
Warnings: Warnings:
Warning 1105 This is an outward table, table data were not modified. Warning 1105 This is an outward table, table data were not modified.
connection user;
ALTER TABLE t1 DROP c; ALTER TABLE t1 DROP c;
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;
# Testing SQLCOM_ALTER_TABLE (adding keys) # Testing SQLCOM_ALTER_TABLE (adding keys)
connection default;
CREATE TABLE t1 (a INT NOT NULL,b INT NOT NULL) ENGINE=CONNECT TABLE_TYPE=fix FILE_NAME='t1.fix'; CREATE TABLE t1 (a INT NOT NULL,b INT NOT NULL) ENGINE=CONNECT TABLE_TYPE=fix FILE_NAME='t1.fix';
INSERT INTO t1 VALUES (10,10); INSERT INTO t1 VALUES (10,10);
ALTER TABLE t1 ADD KEY(a); ALTER TABLE t1 ADD KEY(a);
connection user;
ALTER TABLE t1 ADD KEY(b); ALTER TABLE t1 ADD KEY(b);
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;
# Testing SQLCOM_ALTER_TABLE (removing keys) # Testing SQLCOM_ALTER_TABLE (removing keys)
connection default;
CREATE TABLE t1 (a INT NOT NULL,b INT NOT NULL, KEY a(a), KEY b(b)) ENGINE=CONNECT TABLE_TYPE=fix FILE_NAME='t1.fix'; CREATE TABLE t1 (a INT NOT NULL,b INT NOT NULL, KEY a(a), KEY b(b)) ENGINE=CONNECT TABLE_TYPE=fix FILE_NAME='t1.fix';
INSERT INTO t1 VALUES (10,10); INSERT INTO t1 VALUES (10,10);
ALTER TABLE t1 DROP KEY a; ALTER TABLE t1 DROP KEY a;
connection user;
ALTER TABLE t1 DROP KEY b; ALTER TABLE t1 DROP KEY b;
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;
# Testing SQLCOM_CREATE_INDEX and SQLCOM_DROP_INDEX # Testing SQLCOM_CREATE_INDEX and SQLCOM_DROP_INDEX
connection default;
CREATE TABLE t1 (a INT NOT NULL,b INT NOT NULL) ENGINE=CONNECT TABLE_TYPE=fix FILE_NAME='t1.fix'; CREATE TABLE t1 (a INT NOT NULL,b INT NOT NULL) ENGINE=CONNECT TABLE_TYPE=fix FILE_NAME='t1.fix';
INSERT INTO t1 VALUES (10,10); INSERT INTO t1 VALUES (10,10);
CREATE INDEX a ON t1 (a); CREATE INDEX a ON t1 (a);
DROP INDEX a ON t1; DROP INDEX a ON t1;
CREATE INDEX a ON t1 (a); CREATE INDEX a ON t1 (a);
connection user;
CREATE INDEX b ON t1 (b); CREATE INDEX b ON t1 (b);
ERROR 28000: Access denied for user 'user'@'localhost' (using password: NO) ERROR 28000: Access denied for user 'user'@'localhost' (using password: NO)
DROP INDEX a ON t1; DROP INDEX a ON t1;
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;
# Testing stored procedures # Testing stored procedures
CREATE PROCEDURE p_definer() SQL SECURITY DEFINER CREATE PROCEDURE p_definer() SQL SECURITY DEFINER
...@@ -758,11 +681,9 @@ CALL p_invoker(); ...@@ -758,11 +681,9 @@ CALL p_invoker();
DROP TABLE t1; DROP TABLE t1;
CALL p_baddefiner(); CALL p_baddefiner();
ERROR 28000: Access denied for user 'user'@'localhost' (using password: NO) ERROR 28000: Access denied for user 'user'@'localhost' (using password: NO)
connection user;
CALL p_invoker(); CALL p_invoker();
ERROR 28000: Access denied for user 'user'@'localhost' (using password: NO) ERROR 28000: Access denied for user 'user'@'localhost' (using password: NO)
CALL p_definer(); CALL p_definer();
connection default;
DROP TABLE t1; DROP TABLE t1;
DROP PROCEDURE p_definer; DROP PROCEDURE p_definer;
DROP PROCEDURE p_invoker; DROP PROCEDURE p_invoker;
......
...@@ -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;
Hc = ((MYCAT*)cat)->GetHandler();
Name = (PSZ)name; Name = (PSZ)name;
Schema = (PSZ)schema; 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,6 +513,7 @@ JSONDEF::JSONDEF(void) ...@@ -515,6 +513,7 @@ JSONDEF::JSONDEF(void)
/***********************************************************************/ /***********************************************************************/
bool JSONDEF::DefineAM(PGLOBAL g, LPCSTR, int poff) bool JSONDEF::DefineAM(PGLOBAL g, LPCSTR, int poff)
{ {
Schema = GetStringCatInfo(g, "DBname", Schema);
Jmode = (JMODE)GetIntCatInfo("Jmode", MODE_OBJECT); 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);
...@@ -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,7 +1590,8 @@ PVAL JSONCOL::ExpandArray(PGLOBAL g, PJAR arp, int n) ...@@ -1592,7 +1590,8 @@ 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;
int i, nv = 0, nextsame = Tjp->NextSame;
bool err; 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;
...@@ -1600,9 +1599,10 @@ PVAL JSONCOL::CalculateArray(PGLOBAL g, PJAR arp, int n) ...@@ -1600,9 +1599,10 @@ PVAL JSONCOL::CalculateArray(PGLOBAL g, PJAR arp, int n)
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++) {
for (i = 0; i < arp->size(); i++) {
jvrp = arp->GetValue(i); jvrp = arp->GetValue(i);
if (!jvrp->IsNull() || (op == OP_CNC && GetJsonNull())) do { if (!jvrp->IsNull() || (op == OP_CNC && GetJsonNull())) do {
...@@ -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