Commit 8b1563ea authored by Sergei Golubchik's avatar Sergei Golubchik

Merge branch 'connect/10.0' into 10.0

1.04.0006
parents cfad3947 10de4386
...@@ -752,7 +752,7 @@ RCODE CntIndexRead(PGLOBAL g, PTDB ptdb, OPVAL op, ...@@ -752,7 +752,7 @@ RCODE CntIndexRead(PGLOBAL g, PTDB ptdb, OPVAL op,
return RC_FX; return RC_FX;
} else if (x == 2) { } else if (x == 2) {
// Remote index // Remote index
if (ptdb->ReadKey(g, op, kr)) if (op != OP_SAME && ptdb->ReadKey(g, op, kr))
return RC_FX; return RC_FX;
goto rnd; goto rnd;
......
...@@ -169,9 +169,9 @@ ...@@ -169,9 +169,9 @@
#define JSONMAX 10 // JSON Default max grp size #define JSONMAX 10 // JSON Default max grp size
extern "C" { extern "C" {
char version[]= "Version 1.04.0005 January 24, 2016"; char version[]= "Version 1.04.0006 March 12, 2016";
#if defined(__WIN__) #if defined(__WIN__)
char compver[]= "Version 1.04.0005 " __DATE__ " " __TIME__; char compver[]= "Version 1.04.0006 " __DATE__ " " __TIME__;
char slash= '\\'; char slash= '\\';
#else // !__WIN__ #else // !__WIN__
char slash= '/'; char slash= '/';
...@@ -757,7 +757,7 @@ ha_connect::ha_connect(handlerton *hton, TABLE_SHARE *table_arg) ...@@ -757,7 +757,7 @@ ha_connect::ha_connect(handlerton *hton, TABLE_SHARE *table_arg)
sdvalout= NULL; sdvalout= NULL;
xmod= MODE_ANY; xmod= MODE_ANY;
istable= false; istable= false;
*partname= 0; memset(partname, 0, sizeof(partname));
bzero((char*) &xinfo, sizeof(XINFO)); bzero((char*) &xinfo, sizeof(XINFO));
valid_info= false; valid_info= false;
valid_query_id= 0; valid_query_id= 0;
...@@ -1150,7 +1150,7 @@ char *ha_connect::GetRealString(const char *s) ...@@ -1150,7 +1150,7 @@ char *ha_connect::GetRealString(const char *s)
{ {
char *sv; char *sv;
if (IsPartitioned() && s) { if (IsPartitioned() && s && partname && *partname) {
sv= (char*)PlugSubAlloc(xp->g, NULL, 0); sv= (char*)PlugSubAlloc(xp->g, NULL, 0);
sprintf(sv, s, partname); sprintf(sv, s, partname);
PlugSubAlloc(xp->g, NULL, strlen(sv) + 1); PlugSubAlloc(xp->g, NULL, strlen(sv) + 1);
...@@ -1173,7 +1173,9 @@ char *ha_connect::GetStringOption(char *opname, char *sdef) ...@@ -1173,7 +1173,9 @@ char *ha_connect::GetStringOption(char *opname, char *sdef)
: table->s->connect_string; : table->s->connect_string;
if (cnc.length) if (cnc.length)
opval= GetRealString(strz(xp->g, cnc)); opval= strz(xp->g, cnc);
else
opval= GetListOption(xp->g, opname, options->oplist);
} else if (!stricmp(opname, "Query_String")) } else if (!stricmp(opname, "Query_String"))
opval= thd_query_string(table->in_use)->str; opval= thd_query_string(table->in_use)->str;
...@@ -2286,7 +2288,7 @@ bool ha_connect::MakeKeyWhere(PGLOBAL g, PSTRG qry, OPVAL vop, char q, ...@@ -2286,7 +2288,7 @@ bool ha_connect::MakeKeyWhere(PGLOBAL g, PSTRG qry, OPVAL vop, char q,
op= OP_EQ; op= OP_EQ;
break; break;
case HA_READ_AFTER_KEY: case HA_READ_AFTER_KEY:
op= (stlen >= len) ? (!i ? OP_GT : OP_LE) : OP_GE; op= (stlen >= len || i > 0) ? (i > 0 ? OP_LE : OP_GT) : OP_GE;
break; break;
case HA_READ_KEY_OR_NEXT: case HA_READ_KEY_OR_NEXT:
op= OP_GE; op= OP_GE;
...@@ -3121,13 +3123,14 @@ int ha_connect::open(const char *name, int mode, uint test_if_locked) ...@@ -3121,13 +3123,14 @@ int ha_connect::open(const char *name, int mode, uint test_if_locked)
#if defined(WITH_PARTITION_STORAGE_ENGINE) #if defined(WITH_PARTITION_STORAGE_ENGINE)
if (table->part_info) { if (table->part_info) {
if (GetStringOption("Filename") || GetStringOption("Tabname") if (GetStringOption("Filename") || GetStringOption("Tabname")
|| GetStringOption("Connect")) { || GetStringOption("Connect")) {
strcpy(partname, decode(g, strrchr(name, '#') + 1)); strncpy(partname, decode(g, strrchr(name, '#') + 1), sizeof(partname) - 1);
// strcpy(partname, table->part_info->curr_part_elem->partition_name); // strcpy(partname, table->part_info->curr_part_elem->partition_name);
part_id= &table->part_info->full_part_field_set; // part_id= &table->part_info->full_part_field_set;
} else // Inward table } else // Inward table
strcpy(partname, strrchr(name, slash) + 1); strncpy(partname, strrchr(name, slash) + 1, sizeof(partname) - 1);
part_id= &table->part_info->full_part_field_set; // Temporary
part_id= &table->part_info->full_part_field_set; // Temporary
} // endif part_info } // endif part_info
#endif // WITH_PARTITION_STORAGE_ENGINE #endif // WITH_PARTITION_STORAGE_ENGINE
} else } else
...@@ -5167,7 +5170,7 @@ static int connect_assisted_discovery(handlerton *, THD* thd, ...@@ -5167,7 +5170,7 @@ static int connect_assisted_discovery(handlerton *, THD* thd,
fncn= topt->catfunc; fncn= topt->catfunc;
fnc= GetFuncID(fncn); fnc= GetFuncID(fncn);
sep= topt->separator; sep= topt->separator;
spc= (!sep) ? ',' : (!strcmp(sep, "\\t")) ? '\t' : *sep; spc= (!sep) ? ',' : *sep;
qch= topt->qchar ? *topt->qchar : (signed)topt->quoted >= 0 ? '"' : 0; qch= topt->qchar ? *topt->qchar : (signed)topt->quoted >= 0 ? '"' : 0;
hdr= (int)topt->header; hdr= (int)topt->header;
tbl= topt->tablist; tbl= topt->tablist;
...@@ -5234,7 +5237,6 @@ static int connect_assisted_discovery(handlerton *, THD* thd, ...@@ -5234,7 +5237,6 @@ static int connect_assisted_discovery(handlerton *, THD* thd,
goto err; goto err;
} // endif rc } // endif rc
if (!tab) { if (!tab) {
if (ttp == TAB_TBL) { if (ttp == TAB_TBL) {
// Make tab the first table of the list // Make tab the first table of the list
...@@ -5303,8 +5305,10 @@ static int connect_assisted_discovery(handlerton *, THD* thd, ...@@ -5303,8 +5305,10 @@ static int connect_assisted_discovery(handlerton *, THD* thd,
case TAB_CSV: case TAB_CSV:
if (!fn && fnc != FNC_NO) if (!fn && fnc != FNC_NO)
sprintf(g->Message, "Missing %s file name", topt->type); sprintf(g->Message, "Missing %s file name", topt->type);
else else if (sep && strlen(sep) > 1)
ok= true; sprintf(g->Message, "Invalid separator %s", sep);
else
ok= true;
break; break;
case TAB_MYSQL: case TAB_MYSQL:
...@@ -5985,7 +5989,19 @@ int ha_connect::create(const char *name, TABLE *table_arg, ...@@ -5985,7 +5989,19 @@ int ha_connect::create(const char *name, TABLE *table_arg,
DBUG_RETURN(rc); DBUG_RETURN(rc);
} // endif lrecl } // endif lrecl
} // endif type } // endif type JSON
if (type == TAB_CSV) {
const char *sep = options->separator;
if (sep && strlen(sep) > 1) {
sprintf(g->Message, "Invalid separator %s", sep);
my_message(ER_UNKNOWN_ERROR, g->Message, MYF(0));
rc= HA_ERR_INTERNAL_ERROR;
DBUG_RETURN(rc);
} // endif sep
} // endif type CSV
// Check column types // Check column types
for (field= table_arg->field; *field; field++) { for (field= table_arg->field; *field; field++) {
...@@ -6136,7 +6152,7 @@ int ha_connect::create(const char *name, TABLE *table_arg, ...@@ -6136,7 +6152,7 @@ int ha_connect::create(const char *name, TABLE *table_arg,
strcpy(dbpath, name); strcpy(dbpath, name);
p= strrchr(dbpath, slash); p= strrchr(dbpath, slash);
strcpy(partname, ++p); strncpy(partname, ++p, sizeof(partname) - 1);
strcat(strcat(strcpy(buf, p), "."), lwt); strcat(strcat(strcpy(buf, p), "."), lwt);
*p= 0; *p= 0;
} else { } else {
...@@ -6187,7 +6203,7 @@ int ha_connect::create(const char *name, TABLE *table_arg, ...@@ -6187,7 +6203,7 @@ int ha_connect::create(const char *name, TABLE *table_arg,
#if defined(WITH_PARTITION_STORAGE_ENGINE) #if defined(WITH_PARTITION_STORAGE_ENGINE)
if (part_info && !inward) if (part_info && !inward)
strcpy(partname, decode(g, strrchr(name, '#') + 1)); strncpy(partname, decode(g, strrchr(name, '#') + 1), sizeof(partname) - 1);
// strcpy(partname, part_info->curr_part_elem->partition_name); // strcpy(partname, part_info->curr_part_elem->partition_name);
#endif // WITH_PARTITION_STORAGE_ENGINE #endif // WITH_PARTITION_STORAGE_ENGINE
...@@ -6228,8 +6244,9 @@ int ha_connect::create(const char *name, TABLE *table_arg, ...@@ -6228,8 +6244,9 @@ int ha_connect::create(const char *name, TABLE *table_arg,
#if defined(WITH_PARTITION_STORAGE_ENGINE) #if defined(WITH_PARTITION_STORAGE_ENGINE)
if (part_info) if (part_info)
strcpy(partname, strncpy(partname,
decode(g, strrchr(name, (inward ? slash : '#')) + 1)); decode(g, strrchr(name, (inward ? slash : '#')) + 1),
sizeof(partname) - 1);
#endif // WITH_PARTITION_STORAGE_ENGINE #endif // WITH_PARTITION_STORAGE_ENGINE
if ((rc= optimize(table->in_use, NULL))) { if ((rc= optimize(table->in_use, NULL))) {
...@@ -6773,7 +6790,7 @@ maria_declare_plugin(connect) ...@@ -6773,7 +6790,7 @@ maria_declare_plugin(connect)
0x0104, /* version number (1.04) */ 0x0104, /* version number (1.04) */
NULL, /* status variables */ NULL, /* status variables */
connect_system_variables, /* system variables */ connect_system_variables, /* system variables */
"1.04.0005", /* string version */ "1.04.0006", /* string version */
MariaDB_PLUGIN_MATURITY_BETA /* maturity */ MariaDB_PLUGIN_MATURITY_BETA /* maturity */
} }
maria_declare_plugin_end; maria_declare_plugin_end;
...@@ -554,7 +554,7 @@ int index_prev(uchar *buf); ...@@ -554,7 +554,7 @@ int index_prev(uchar *buf);
PVAL sdvalin4; // Used to convert date values PVAL sdvalin4; // Used to convert date values
PVAL sdvalout; // Used to convert date values PVAL sdvalout; // Used to convert date values
bool istable; // True for table handler bool istable; // True for table handler
char partname[64]; // The partition name char partname[65]; // The partition name
MODE xmod; // Table mode MODE xmod; // Table mode
XINFO xinfo; // The table info structure XINFO xinfo; // The table info structure
bool valid_info; // True if xinfo is valid bool valid_info; // True if xinfo is valid
......
...@@ -959,11 +959,16 @@ void MYSQLC::FreeResult(void) ...@@ -959,11 +959,16 @@ void MYSQLC::FreeResult(void)
/***********************************************************************/ /***********************************************************************/
/* Place the cursor at the beginning of the result set. */ /* Place the cursor at the beginning of the result set. */
/***********************************************************************/ /***********************************************************************/
void MYSQLC::Rewind(void) int MYSQLC::Rewind(PGLOBAL g, PSZ sql)
{ {
if (m_Res) int rc = RC_OK;
DataSeek(0);
if (m_Res)
DataSeek(0);
else if (sql)
rc = ExecSQL(g, sql);
return rc;
} // end of Rewind } // end of Rewind
/***********************************************************************/ /***********************************************************************/
......
...@@ -80,7 +80,7 @@ class DllItem MYSQLC { ...@@ -80,7 +80,7 @@ class DllItem MYSQLC {
int Fetch(PGLOBAL g, int pos); int Fetch(PGLOBAL g, int pos);
char *GetCharField(int i); char *GetCharField(int i);
int GetFieldLength(int i); int GetFieldLength(int i);
void Rewind(void); int Rewind(PGLOBAL g, PSZ sql);
void FreeResult(void); void FreeResult(void);
void Close(void); void Close(void);
......
...@@ -112,3 +112,324 @@ id msg ...@@ -112,3 +112,324 @@ id msg
6 Six 6 Six
DROP TABLE t2; DROP TABLE t2;
DROP TABLE t1; DROP TABLE t1;
#
# Make local FIX table with indices matricule and nom/prenom
#
CREATE TABLE t1
(
matricule INT(4) KEY NOT NULL field_format='Z',
nom VARCHAR(16) NOT NULL,
prenom VARCHAR(20) NOT NULL,
sexe SMALLINT(1) NOT NULL COMMENT 'sexe 1:M 2:F',
aanais INT(4) NOT NULL,
mmnais INT(2) NOT NULL,
ddentree DATE NOT NULL date_format='YYYYMM',
ddnom DATE NOT NULL date_format='YYYYMM',
brut INT(5) NOT NULL,
net DOUBLE(8,2) NOT NULL,
service INT(2) NOT NULL,
sitmat CHAR(1) NOT NULL,
formation CHAR(5) NOT NULL,
INDEX NP(nom,prenom)
) ENGINE=CONNECT TABLE_TYPE=FIX FILE_NAME='emp.txt' ENDING=2;
#
# Make MYSQL table with same indices
#
CREATE TABLE t2
(
matricule INT(4) KEY NOT NULL,
nom VARCHAR(16) NOT NULL,
prenom VARCHAR(20) NOT NULL,
sexe SMALLINT(1) NOT NULL,
aanais INT(4) NOT NULL,
mmnais INT(2) NOT NULL,
ddentree DATE NOT NULL date_format='YYYYMM',
ddnom DATE NOT NULL date_format='YYYYMM',
brut INT(5) NOT NULL,
net DOUBLE(8,2) NOT NULL,
service INT(2) NOT NULL,
sitmat CHAR(1) NOT NULL,
formation CHAR(5) NOT NULL,
INDEX NP(nom,prenom)
) ENGINE=CONNECT TABLE_TYPE=MYSQL CONNECTIOn='mysql://root@localhost/test/t1';
SELECT * FROM t2 limit 10;
matricule nom prenom sexe aanais mmnais ddentree ddnom brut net service sitmat formation
5745 ESCOURCHE BENEDICTE 2 1935 7 1962-12-01 1994-05-01 18345 14275.50 0 M TECHN
9692 VICENTE LAURENCE 2 1941 8 1967-10-01 1989-01-01 16212 13032.80 0 M ANGL
9146 NICOLAS ROGER 1 1941 6 1964-07-01 1995-02-01 34173 25098.65 0 M SANS
2985 TESSEREAU MARIE HELENE 2 1941 9 1967-01-01 1990-01-01 19323 14933.78 0 V SANS
3368 MOGADOR ALAIN 1 1941 1 1961-09-01 1993-11-01 43303 31420.55 0 C SANS
7394 CHAUSSEE ERIC DENIS 1 1944 9 1965-11-01 1983-12-01 32002 23583.86 0 M ANGL
4655 MAILLOT GEORGES 1 1945 5 1970-09-01 1986-12-01 24700 18541.64 0 C ANGL
2825 CAMILLE NADINE 2 1956 9 1994-01-01 1993-01-01 19494 15050.45 0 M SANS
1460 BRUYERES JEAN MARC 1 1958 8 1984-08-01 1988-05-01 20902 15980.07 0 M SANS
4974 LONES GERARD 1 1959 10 1979-01-01 1994-12-01 16081 12916.70 0 M SANS
SELECT matricule, nom, prenom FROM t2 WHERE nom IN ('FOCH','MOGADOR');
matricule nom prenom
1977 FOCH BERNADETTE
5707 FOCH DENIS
2552 FOCH FRANCK
2634 FOCH JOCELYNE
5765 FOCH ROBERT
4080 FOCH SERGE
3368 MOGADOR ALAIN
SELECT matricule, nom, prenom FROM t2 WHERE nom = 'FOCH' OR nom = 'MOGADOR';
matricule nom prenom
1977 FOCH BERNADETTE
5707 FOCH DENIS
2552 FOCH FRANCK
2634 FOCH JOCELYNE
5765 FOCH ROBERT
4080 FOCH SERGE
3368 MOGADOR ALAIN
SELECT matricule, nom, prenom FROM t2 WHERE nom < 'ADDAX';
matricule nom prenom
4552 ABBADIE MONIQUE
307 ABBAYE ANNICK
6627 ABBAYE GERALD
7961 ABBE KATIA
1340 ABBE MICHELE
9270 ABBE SOPHIE
2945 ABBEVILLE PASCAL
8596 ABEBERRY PATRICK
6399 ABEILLES RENE
8673 ABEL JEAN PIERRE
6124 ABELIAS DELIA
6314 ABERDEN EVELYNE
895 ABORD CHANTAL
2728 ABOUT CATHERINE MARIE
398 ABREUVOIR JEAN LUC
1122 ACACIAS SERGE
1644 ACARDIE BEATE
115 ACHILLE JACQUES
4038 ADAM JANICK
3395 ADAM JEAN CLAUDE
SELECT matricule, nom, prenom FROM t2 WHERE nom <= 'ABEL';
matricule nom prenom
4552 ABBADIE MONIQUE
307 ABBAYE ANNICK
6627 ABBAYE GERALD
7961 ABBE KATIA
1340 ABBE MICHELE
9270 ABBE SOPHIE
2945 ABBEVILLE PASCAL
8596 ABEBERRY PATRICK
6399 ABEILLES RENE
8673 ABEL JEAN PIERRE
SELECT matricule, nom, prenom FROM t2 WHERE nom > 'YVON';
matricule nom prenom
9742 YZENGREMER MICHEL
8738 ZILINA JEAN LOUIS
5357 ZOLA BERNARD
5441 ZOLA BRIGITTE
1325 ZOLA CHRISTINE
4859 ZORI CATHERINE
4102 ZOUAVES ALAIN
SELECT matricule, nom, prenom FROM t2 WHERE nom >= 'YVON';
matricule nom prenom
5389 YVON CAROLE
9742 YZENGREMER MICHEL
8738 ZILINA JEAN LOUIS
5357 ZOLA BERNARD
5441 ZOLA BRIGITTE
1325 ZOLA CHRISTINE
4859 ZORI CATHERINE
4102 ZOUAVES ALAIN
SELECT matricule, nom, prenom FROM t2 WHERE nom <= 'ABEL' OR nom > 'YVON';
matricule nom prenom
4552 ABBADIE MONIQUE
307 ABBAYE ANNICK
6627 ABBAYE GERALD
7961 ABBE KATIA
1340 ABBE MICHELE
9270 ABBE SOPHIE
2945 ABBEVILLE PASCAL
8596 ABEBERRY PATRICK
6399 ABEILLES RENE
8673 ABEL JEAN PIERRE
9742 YZENGREMER MICHEL
8738 ZILINA JEAN LOUIS
5357 ZOLA BERNARD
5441 ZOLA BRIGITTE
1325 ZOLA CHRISTINE
4859 ZORI CATHERINE
4102 ZOUAVES ALAIN
SELECT matricule, nom, prenom FROM t2 WHERE nom > 'HELEN' AND nom < 'HEROS';
matricule nom prenom
9096 HELENA PHILIPPE
3309 HELENE ISABELLE
8365 HELIOTROPES LISE
4666 HELLEN PIERRE
5781 HELSINKI DANIELLE
7626 HENIN PHILIPPE
4254 HENIN SERGE
2673 HENNER LILIANE
9716 HENRI JACQUES
2085 HEOL GUY PAUL
2579 HERANDIERE PIERRE
7093 HERAULTS DANIEL
4050 HERBILLON FRANCOIS
9231 HERBILLON MADELEINE
1291 HERMITAGE XAVIER
6185 HERMITTE FRANCOIS
403 HERMITTE PHILIPPE
9749 HEROLD ISABELLE
SELECT matricule, nom, prenom FROM t2 WHERE nom BETWEEN 'HELEN' AND 'HEROS';
matricule nom prenom
6199 HELEN MARTIAL
9096 HELENA PHILIPPE
3309 HELENE ISABELLE
8365 HELIOTROPES LISE
4666 HELLEN PIERRE
5781 HELSINKI DANIELLE
7626 HENIN PHILIPPE
4254 HENIN SERGE
2673 HENNER LILIANE
9716 HENRI JACQUES
2085 HEOL GUY PAUL
2579 HERANDIERE PIERRE
7093 HERAULTS DANIEL
4050 HERBILLON FRANCOIS
9231 HERBILLON MADELEINE
1291 HERMITAGE XAVIER
6185 HERMITTE FRANCOIS
403 HERMITTE PHILIPPE
9749 HEROLD ISABELLE
8445 HEROS SYLVIE
SELECT matricule, nom, prenom FROM t2 WHERE nom BETWEEN 'HELEN' AND 'HEROS' AND prenom = 'PHILIPPE';
matricule nom prenom
9096 HELENA PHILIPPE
7626 HENIN PHILIPPE
403 HERMITTE PHILIPPE
SELECT matricule, nom, prenom FROM t2 ORDER BY nom LIMIT 10;
matricule nom prenom
4552 ABBADIE MONIQUE
6627 ABBAYE GERALD
307 ABBAYE ANNICK
7961 ABBE KATIA
1340 ABBE MICHELE
9270 ABBE SOPHIE
2945 ABBEVILLE PASCAL
8596 ABEBERRY PATRICK
6399 ABEILLES RENE
8673 ABEL JEAN PIERRE
SELECT a.nom, a.prenom, b.nom FROM t1 a STRAIGHT_JOIN t2 b ON a.prenom = b.prenom WHERE a.nom = 'FOCH' AND a.nom != b.nom;
nom prenom nom
FOCH SERGE ACACIAS
FOCH ROBERT AGRIANT
FOCH JOCELYNE ALEXIS
FOCH DENIS AMBOISE
FOCH SERGE ANDALUCIA
FOCH ROBERT ANNECY
FOCH SERGE ARCACHON
FOCH JOCELYNE AUGUSTE
FOCH JOCELYNE BASSE
FOCH SERGE BEACH
FOCH FRANCK BEARN
FOCH SERGE BELLES
FOCH DENIS BERARD
FOCH DENIS BERIN
FOCH BERNADETTE BERTIN
FOCH DENIS BILLEHOU
FOCH DENIS BOILEAU
FOCH BERNADETTE BOISSY
FOCH ROBERT BONVIN
FOCH SERGE BOUTON
FOCH SERGE BREUIL
FOCH SERGE CARREFOUR
FOCH JOCELYNE CARRERE
FOCH JOCELYNE CHAPELLE
FOCH SERGE CHATEAU
FOCH ROBERT CHENIER
FOCH SERGE COLLETTE
FOCH DENIS CONNE
FOCH SERGE COOLE
FOCH DENIS COULOUBRIER
FOCH DENIS COUTURIER
FOCH ROBERT CURAT
FOCH ROBERT DAUDET
FOCH SERGE ECLUSE
FOCH SERGE EGUILLON
FOCH DENIS EPINETTES
FOCH DENIS FIGOURNAS
FOCH JOCELYNE FLEMING
FOCH JOCELYNE GAMBADES
FOCH ROBERT GIOTERAIE
FOCH SERGE GOAS
FOCH ROBERT GRAFFIANE
FOCH SERGE GREFFIER
FOCH ROBERT GUILLOTIERE
FOCH SERGE HENIN
FOCH BERNADETTE HUNTZIGER
FOCH FRANCK ILLIERS
FOCH DENIS ISTANBUL
FOCH DENIS ITALIE
FOCH SERGE JARDIN
FOCH FRANCK JEANPIERRE
FOCH JOCELYNE KENNEDY
FOCH FRANCK LABBE
FOCH DENIS LACATE
FOCH FRANCK LACOMBE
FOCH ROBERT LAMOTHE
FOCH BERNADETTE LATECOERE
FOCH BERNADETTE LEGER
FOCH SERGE LEONIE
FOCH FRANCK LEROY
FOCH SERGE LOZERE
FOCH DENIS MAROLLES
FOCH ROBERT MARRONIERS
FOCH SERGE MARSAT
FOCH SERGE MONTAGNE
FOCH FRANCK MONTALEIGNE
FOCH DENIS MONTELIER
FOCH DENIS MONTILS
FOCH BERNADETTE MONTJUSTIN
FOCH SERGE MORIZET
FOCH ROBERT NIMES
FOCH ROBERT NORD
FOCH SERGE NOVEMBRE
FOCH BERNADETTE ONZE
FOCH SERGE ORANGERIE
FOCH FRANCK ORVEAU
FOCH BERNADETTE PALMAROLE
FOCH JOCELYNE PEYBERT
FOCH ROBERT PEYNIBLOU
FOCH ROBERT PIECE
FOCH JOCELYNE PIED
FOCH ROBERT PLAGNE
FOCH SERGE PLAISANCE
FOCH BERNADETTE PLOUHARNEL
FOCH DENIS POINTE
FOCH ROBERT POMMERY
FOCH JOCELYNE PONTAROUX
FOCH DENIS PORTO
FOCH ROBERT PRESIDENT
FOCH ROBERT PUJADE
FOCH FRANCK PURPAN
FOCH ROBERT QUILICHINI
FOCH DENIS REINOTS
FOCH DENIS REMPART
FOCH SERGE RESISTANCE
FOCH SERGE RESTANQUES
FOCH ROBERT RIOU
FOCH FRANCK ROCQUENCOURT
FOCH ROBERT ROLL
FOCH ROBERT ROSSA
FOCH SERGE ROSSAYS
FOCH DENIS ROUSSIER
FOCH FRANCK RUSSIE
FOCH ROBERT SABLONS
FOCH SERGE SARTRE
FOCH SERGE SAVIGNAC
FOCH SERGE SEGUR
FOCH ROBERT STRASBOURG
FOCH ROBERT TIRE
FOCH DENIS TORTE
FOCH DENIS TOULON
FOCH ROBERT TUBY
FOCH DENIS VALMANTE
FOCH SERGE VANOEL
FOCH ROBERT VIARMES
FOCH SERGE WILSON
DROP TABLE t2;
DROP TABLE t1;
...@@ -191,6 +191,31 @@ id msg ...@@ -191,6 +191,31 @@ id msg
35 thirty five 35 thirty five
81 big 81 big
DROP TABLE t1; DROP TABLE t1;
CREATE TABLE t1 (
id INT KEY NOT NULL,
msg VARCHAR(32))
ENGINE=CONNECT TABLE_TYPE=MYSQL
OPTION_LIST='connect=mysql://root@localhost/test/xt%s'
PARTITION BY RANGE COLUMNS(id) (
PARTITION `1` VALUES LESS THAN(10),
PARTITION `2` VALUES LESS THAN(50),
PARTITION `3` VALUES LESS THAN(MAXVALUE));
Warnings:
Warning 1105 Data repartition in 1 is unchecked
Warning 1105 Data repartition in 2 is unchecked
Warning 1105 Data repartition in 3 is unchecked
SELECT * FROM t1;
id msg
4 four
7 sept
1 one
8 eight
40 forty
10 ten
11 eleven
35 thirty five
81 big
DROP TABLE t1;
DROP TABLE xt1; DROP TABLE xt1;
DROP TABLE xt2; DROP TABLE xt2;
DROP TABLE xt3; DROP TABLE xt3;
......
...@@ -44,8 +44,8 @@ ta message ...@@ -44,8 +44,8 @@ ta message
1 Testing 1 Testing
2 myisam table 2 myisam table
3 t4 3 t4
CREATE TABLE total (tabname CHAR(8) NOT NULL SPECIAL='TABID', ta TINYINT NOT NULL FLAG=1, message CHAR(20)) engine=CONNECT table_type=TBL table_list='t1,t2,t3,t4' option_list='port=PORT'; CREATE TABLE total (tabname CHAR(8) NOT NULL SPECIAL='TABID', ta TINYINT NOT NULL FLAG=1, message CHAR(20)) ENGINE=CONNECT TABLE_TYPE=TBL TABLE_LIST='t1,t2,t3,t4' OPTION_LIST='port=PORT';
select * from total; SELECT * FROM total;
tabname ta message tabname ta message
t1 1 Testing t1 1 Testing
t1 2 dos table t1 2 dos table
...@@ -59,15 +59,15 @@ t3 3 t3 ...@@ -59,15 +59,15 @@ t3 3 t3
t4 1 Testing t4 1 Testing
t4 2 myisam table t4 2 myisam table
t4 3 t4 t4 3 t4
select * from total where tabname = 't2'; SELECT * FROM total WHERE tabname = 't2';
tabname ta message tabname ta message
t2 1 Testing t2 1 Testing
t2 2 NULL t2 2 NULL
t2 3 t2 t2 3 t2
select * from total where tabname = 't2' and ta = 3; SELECT * FROM total WHERE tabname = 't2' AND ta = 3;
tabname ta message tabname ta message
t2 3 t2 t2 3 t2
select * from total where tabname in ('t1','t4'); SELECT * FROM total WHERE tabname IN ('t1','t4');
tabname ta message tabname ta message
t1 1 Testing t1 1 Testing
t1 2 dos table t1 2 dos table
...@@ -75,11 +75,11 @@ t1 3 t1 ...@@ -75,11 +75,11 @@ t1 3 t1
t4 1 Testing t4 1 Testing
t4 2 myisam table t4 2 myisam table
t4 3 t4 t4 3 t4
select * from total where ta = 3 and tabname in ('t1','t2'); SELECT * FROM total WHERE ta = 3 AND tabname IN ('t1','t2');
tabname ta message tabname ta message
t1 3 t1 t1 3 t1
t2 3 t2 t2 3 t2
select * from total where tabname <> 't2'; SELECT * FROM total WHERE tabname <> 't2';
tabname ta message tabname ta message
t1 1 Testing t1 1 Testing
t1 2 dos table t1 2 dos table
...@@ -90,12 +90,12 @@ t3 3 t3 ...@@ -90,12 +90,12 @@ t3 3 t3
t4 1 Testing t4 1 Testing
t4 2 myisam table t4 2 myisam table
t4 3 t4 t4 3 t4
select * from total where tabname != 't2' and ta = 3; SELECT * FROM total WHERE tabname != 't2' AND ta = 3;
tabname ta message tabname ta message
t1 3 t1 t1 3 t1
t3 3 t3 t3 3 t3
t4 3 t4 t4 3 t4
select * from total where tabname not in ('t2','t3'); SELECT * FROM total WHERE tabname NOT IN ('t2','t3');
tabname ta message tabname ta message
t1 1 Testing t1 1 Testing
t1 2 dos table t1 2 dos table
...@@ -103,11 +103,11 @@ t1 3 t1 ...@@ -103,11 +103,11 @@ t1 3 t1
t4 1 Testing t4 1 Testing
t4 2 myisam table t4 2 myisam table
t4 3 t4 t4 3 t4
select * from total where ta = 3 and tabname in ('t2','t3'); SELECT * FROM total WHERE ta = 3 AND tabname IN ('t2','t3');
tabname ta message tabname ta message
t2 3 t2 t2 3 t2
t3 3 t3 t3 3 t3
select * from total where ta = 3 or tabname in ('t2','t4'); SELECT * FROM total WHERE ta = 3 OR tabname IN ('t2','t4');
tabname ta message tabname ta message
t1 3 t1 t1 3 t1
t2 1 Testing t2 1 Testing
...@@ -117,7 +117,7 @@ t3 3 t3 ...@@ -117,7 +117,7 @@ t3 3 t3
t4 1 Testing t4 1 Testing
t4 2 myisam table t4 2 myisam table
t4 3 t4 t4 3 t4
select * from total where not tabname = 't2'; SELECT * FROM total WHERE NOT tabname = 't2';
tabname ta message tabname ta message
t1 1 Testing t1 1 Testing
t1 2 dos table t1 2 dos table
...@@ -128,7 +128,7 @@ t3 3 t3 ...@@ -128,7 +128,7 @@ t3 3 t3
t4 1 Testing t4 1 Testing
t4 2 myisam table t4 2 myisam table
t4 3 t4 t4 3 t4
select * from total where tabname = 't2' or tabname = 't1'; SELECT * FROM total WHERE tabname = 't2' OR tabname = 't1';
tabname ta message tabname ta message
t1 1 Testing t1 1 Testing
t1 2 dos table t1 2 dos table
...@@ -141,3 +141,22 @@ DROP TABLE t1; ...@@ -141,3 +141,22 @@ DROP TABLE t1;
DROP TABLE t2; DROP TABLE t2;
DROP TABLE t3; DROP TABLE t3;
DROP TABLE t4; DROP TABLE t4;
#
# Checking thread TBL tables
#
CREATE TABLE t1 ENGINE=CONNECT TABLE_TYPE=MYSQL SRCDEF='select 11 as v';
SELECT * FROM t1;
v
11
CREATE TABLE t2 ENGINE=CONNECT TABLE_TYPE=MYSQL SRCDEF='select 22 as v';
SELECT * FROM t2;
v
22
CREATE TABLE total (v BIGINT(20) UNSIGNED NOT NULL) ENGINE=CONNECT TABLE_TYPE=TBL TABLE_LIST='t1,t2' OPTION_LIST='thread=yes,port=PORT';;
SELECT * FROM total order by v desc;
v
22
11
DROP TABLE total;
DROP TABLE t1;
DROP TABLE t2;
...@@ -64,3 +64,70 @@ SELECT * FROM t2; ...@@ -64,3 +64,70 @@ SELECT * FROM t2;
DROP TABLE t2; DROP TABLE t2;
DROP TABLE t1; DROP TABLE t1;
let $MYSQLD_DATADIR= `select @@datadir`;
--copy_file $MTR_SUITE_DIR/std_data/emp.txt $MYSQLD_DATADIR/test/emp.txt
--echo #
--echo # Make local FIX table with indices matricule and nom/prenom
--echo #
CREATE TABLE t1
(
matricule INT(4) KEY NOT NULL field_format='Z',
nom VARCHAR(16) NOT NULL,
prenom VARCHAR(20) NOT NULL,
sexe SMALLINT(1) NOT NULL COMMENT 'sexe 1:M 2:F',
aanais INT(4) NOT NULL,
mmnais INT(2) NOT NULL,
ddentree DATE NOT NULL date_format='YYYYMM',
ddnom DATE NOT NULL date_format='YYYYMM',
brut INT(5) NOT NULL,
net DOUBLE(8,2) NOT NULL,
service INT(2) NOT NULL,
sitmat CHAR(1) NOT NULL,
formation CHAR(5) NOT NULL,
INDEX NP(nom,prenom)
) ENGINE=CONNECT TABLE_TYPE=FIX FILE_NAME='emp.txt' ENDING=2;
--echo #
--echo # Make MYSQL table with same indices
--echo #
CREATE TABLE t2
(
matricule INT(4) KEY NOT NULL,
nom VARCHAR(16) NOT NULL,
prenom VARCHAR(20) NOT NULL,
sexe SMALLINT(1) NOT NULL,
aanais INT(4) NOT NULL,
mmnais INT(2) NOT NULL,
ddentree DATE NOT NULL date_format='YYYYMM',
ddnom DATE NOT NULL date_format='YYYYMM',
brut INT(5) NOT NULL,
net DOUBLE(8,2) NOT NULL,
service INT(2) NOT NULL,
sitmat CHAR(1) NOT NULL,
formation CHAR(5) NOT NULL,
INDEX NP(nom,prenom)
) ENGINE=CONNECT TABLE_TYPE=MYSQL CONNECTIOn='mysql://root@localhost/test/t1';
SELECT * FROM t2 limit 10;
SELECT matricule, nom, prenom FROM t2 WHERE nom IN ('FOCH','MOGADOR');
SELECT matricule, nom, prenom FROM t2 WHERE nom = 'FOCH' OR nom = 'MOGADOR';
SELECT matricule, nom, prenom FROM t2 WHERE nom < 'ADDAX';
SELECT matricule, nom, prenom FROM t2 WHERE nom <= 'ABEL';
SELECT matricule, nom, prenom FROM t2 WHERE nom > 'YVON';
SELECT matricule, nom, prenom FROM t2 WHERE nom >= 'YVON';
SELECT matricule, nom, prenom FROM t2 WHERE nom <= 'ABEL' OR nom > 'YVON';
SELECT matricule, nom, prenom FROM t2 WHERE nom > 'HELEN' AND nom < 'HEROS';
SELECT matricule, nom, prenom FROM t2 WHERE nom BETWEEN 'HELEN' AND 'HEROS';
SELECT matricule, nom, prenom FROM t2 WHERE nom BETWEEN 'HELEN' AND 'HEROS' AND prenom = 'PHILIPPE';
SELECT matricule, nom, prenom FROM t2 ORDER BY nom LIMIT 10;
SELECT a.nom, a.prenom, b.nom FROM t1 a STRAIGHT_JOIN t2 b ON a.prenom = b.prenom WHERE a.nom = 'FOCH' AND a.nom != b.nom;
DROP TABLE t2;
DROP TABLE t1;
#
# Clean up
#
--remove_file $MYSQLD_DATADIR/test/emp.txt
--remove_file $MYSQLD_DATADIR/test/emp.fnx
...@@ -82,6 +82,21 @@ SELECT * FROM t1; ...@@ -82,6 +82,21 @@ SELECT * FROM t1;
DELETE FROM t1 WHERE id in (60,72); DELETE FROM t1 WHERE id in (60,72);
SELECT * FROM t1; SELECT * FROM t1;
DROP TABLE t1; DROP TABLE t1;
#
# Using a connection string
#
CREATE TABLE t1 (
id INT KEY NOT NULL,
msg VARCHAR(32))
ENGINE=CONNECT TABLE_TYPE=MYSQL
OPTION_LIST='connect=mysql://root@localhost/test/xt%s'
PARTITION BY RANGE COLUMNS(id) (
PARTITION `1` VALUES LESS THAN(10),
PARTITION `2` VALUES LESS THAN(50),
PARTITION `3` VALUES LESS THAN(MAXVALUE));
SELECT * FROM t1;
DROP TABLE t1;
DROP TABLE xt1; DROP TABLE xt1;
DROP TABLE xt2; DROP TABLE xt2;
DROP TABLE xt3; DROP TABLE xt3;
......
...@@ -31,23 +31,40 @@ INSERT INTO t4 (message) VALUES ('Testing'),('myisam table'),('t4'); ...@@ -31,23 +31,40 @@ INSERT INTO t4 (message) VALUES ('Testing'),('myisam table'),('t4');
SELECT * FROM t4; SELECT * FROM t4;
--replace_result $PORT PORT --replace_result $PORT PORT
--eval CREATE TABLE total (tabname CHAR(8) NOT NULL SPECIAL='TABID', ta TINYINT NOT NULL FLAG=1, message CHAR(20)) engine=CONNECT table_type=TBL table_list='t1,t2,t3,t4' option_list='port=$PORT' --eval CREATE TABLE total (tabname CHAR(8) NOT NULL SPECIAL='TABID', ta TINYINT NOT NULL FLAG=1, message CHAR(20)) ENGINE=CONNECT TABLE_TYPE=TBL TABLE_LIST='t1,t2,t3,t4' OPTION_LIST='port=$PORT'
select * from total; SELECT * FROM total;
select * from total where tabname = 't2'; SELECT * FROM total WHERE tabname = 't2';
select * from total where tabname = 't2' and ta = 3; SELECT * FROM total WHERE tabname = 't2' AND ta = 3;
select * from total where tabname in ('t1','t4'); SELECT * FROM total WHERE tabname IN ('t1','t4');
select * from total where ta = 3 and tabname in ('t1','t2'); SELECT * FROM total WHERE ta = 3 AND tabname IN ('t1','t2');
select * from total where tabname <> 't2'; SELECT * FROM total WHERE tabname <> 't2';
select * from total where tabname != 't2' and ta = 3; SELECT * FROM total WHERE tabname != 't2' AND ta = 3;
select * from total where tabname not in ('t2','t3'); SELECT * FROM total WHERE tabname NOT IN ('t2','t3');
select * from total where ta = 3 and tabname in ('t2','t3'); SELECT * FROM total WHERE ta = 3 AND tabname IN ('t2','t3');
select * from total where ta = 3 or tabname in ('t2','t4'); SELECT * FROM total WHERE ta = 3 OR tabname IN ('t2','t4');
select * from total where not tabname = 't2'; SELECT * FROM total WHERE NOT tabname = 't2';
select * from total where tabname = 't2' or tabname = 't1'; SELECT * FROM total WHERE tabname = 't2' OR tabname = 't1';
DROP TABLE total; DROP TABLE total;
DROP TABLE t1; DROP TABLE t1;
DROP TABLE t2; DROP TABLE t2;
DROP TABLE t3; DROP TABLE t3;
DROP TABLE t4; DROP TABLE t4;
--echo #
--echo # Checking thread TBL tables
--echo #
CREATE TABLE t1 ENGINE=CONNECT TABLE_TYPE=MYSQL SRCDEF='select 11 as v';
SELECT * FROM t1;
CREATE TABLE t2 ENGINE=CONNECT TABLE_TYPE=MYSQL SRCDEF='select 22 as v';
SELECT * FROM t2;
--replace_result $PORT PORT
--eval CREATE TABLE total (v BIGINT(20) UNSIGNED NOT NULL) ENGINE=CONNECT TABLE_TYPE=TBL TABLE_LIST='t1,t2' OPTION_LIST='thread=yes,port=$PORT';
SELECT * FROM total order by v desc;
DROP TABLE total;
DROP TABLE t1;
DROP TABLE t2;
...@@ -1758,7 +1758,9 @@ bool ODBConn::BindParam(ODBCCOL *colp) ...@@ -1758,7 +1758,9 @@ bool ODBConn::BindParam(ODBCCOL *colp)
SQLLEN *strlen = colp->GetStrLen(); SQLLEN *strlen = colp->GetStrLen();
SQLRETURN rc; SQLRETURN rc;
#if 0
try { try {
// This function is often not or badly implemented by data sources
rc = SQLDescribeParam(m_hstmt, n, &sqlt, &colsize, &dec, &nul); rc = SQLDescribeParam(m_hstmt, n, &sqlt, &colsize, &dec, &nul);
if (!Check(rc)) if (!Check(rc))
...@@ -1766,11 +1768,12 @@ bool ODBConn::BindParam(ODBCCOL *colp) ...@@ -1766,11 +1768,12 @@ bool ODBConn::BindParam(ODBCCOL *colp)
} catch(DBX *x) { } catch(DBX *x) {
sprintf(m_G->Message, "%s: %s", x->m_Msg, x->GetErrorMessage(0)); sprintf(m_G->Message, "%s: %s", x->m_Msg, x->GetErrorMessage(0));
#endif // 0
colsize = colp->GetPrecision(); colsize = colp->GetPrecision();
sqlt = GetSQLType(buftype); sqlt = GetSQLType(buftype);
dec = IsTypeChar(buftype) ? 0 : colp->GetScale(); dec = IsTypeNum(buftype) ? colp->GetScale() : 0;
nul = SQL_NULLABLE_UNKNOWN; nul = colp->IsNullable() ? SQL_NULLABLE : SQL_NO_NULLS;
} // end try/catch //} // end try/catch
buf = colp->GetBuffer(0); buf = colp->GetBuffer(0);
len = IsTypeChar(buftype) ? colp->GetBuflen() : 0; len = IsTypeChar(buftype) ? colp->GetBuflen() : 0;
......
...@@ -19,7 +19,7 @@ ...@@ -19,7 +19,7 @@
/* --------------- */ /* --------------- */
/* TABMYSQL.CPP - Source code */ /* TABMYSQL.CPP - Source code */
/* PLGDBSEM.H - DB application declaration file */ /* PLGDBSEM.H - DB application declaration file */
/* TABMYSQL.H - TABODBC classes declaration file */ /* TABMYSQL.H - TABMYSQL classes declaration file */
/* GLOBAL.H - Global declaration file */ /* GLOBAL.H - Global declaration file */
/* */ /* */
/* REQUIRED LIBRARIES: */ /* REQUIRED LIBRARIES: */
...@@ -334,7 +334,7 @@ bool MYSQLDEF::DefineAM(PGLOBAL g, LPCSTR am, int) ...@@ -334,7 +334,7 @@ bool MYSQLDEF::DefineAM(PGLOBAL g, LPCSTR am, int)
Delayed = !!GetIntCatInfo("Delayed", 0); Delayed = !!GetIntCatInfo("Delayed", 0);
} else { } else {
// MYSQL access from a PROXY table // MYSQL access from a PROXY table
Database = GetStringCatInfo(g, "Database", Schema ? Schema : (char*)"*"); Database = GetStringCatInfo(g, "Database", Schema ? Schema : PlugDup(g, "*"));
Isview = GetBoolCatInfo("View", false); Isview = GetBoolCatInfo("View", false);
// We must get other connection parms from the calling table // We must get other connection parms from the calling table
...@@ -857,7 +857,9 @@ bool TDBMYSQL::OpenDB(PGLOBAL g) ...@@ -857,7 +857,9 @@ bool TDBMYSQL::OpenDB(PGLOBAL g)
/*******************************************************************/ /*******************************************************************/
/* Table already open, just replace it at its beginning. */ /* Table already open, just replace it at its beginning. */
/*******************************************************************/ /*******************************************************************/
Myc.Rewind(); if (Myc.Rewind(g, (Mode == MODE_READX) ? Query->GetStr() : NULL) != RC_OK)
return true;
N = -1; N = -1;
return false; return false;
} // endif use } // endif use
......
...@@ -5,7 +5,7 @@ ...@@ -5,7 +5,7 @@
/* */ /* */
/* COPYRIGHT: */ /* COPYRIGHT: */
/* ---------- */ /* ---------- */
/* (C) Copyright to the author Olivier BERTRAND 2000-2015 */ /* (C) Copyright to the author Olivier BERTRAND 2000-2016 */
/* */ /* */
/* WHAT THIS PROGRAM DOES: */ /* WHAT THIS PROGRAM DOES: */
/* ----------------------- */ /* ----------------------- */
...@@ -912,19 +912,21 @@ bool TDBODBC::OpenDB(PGLOBAL g) ...@@ -912,19 +912,21 @@ bool TDBODBC::OpenDB(PGLOBAL g)
if ((n = Ocp->GetResultSize(Query->GetStr(), Cnp)) < 0) { if ((n = Ocp->GetResultSize(Query->GetStr(), Cnp)) < 0) {
strcpy(g->Message, "Cannot get result size"); strcpy(g->Message, "Cannot get result size");
return true; return true;
} // endif n } else if (n) {
Ocp->m_Rows = n;
Ocp->m_Rows = n; if ((Qrp = Ocp->AllocateResult(g)))
Memory = 2; // Must be filled
else {
strcpy(g->Message, "Result set memory allocation failed");
return true;
} // endif n
if ((Qrp = Ocp->AllocateResult(g))) } else // Void result
Memory = 2; // Must be filled Memory = 0;
else {
strcpy(g->Message, "Result set memory allocation failed");
return true;
} // endif n
Ocp->m_Rows = 0; Ocp->m_Rows = 0;
} else } else
return true; return true;
} // endif Memory } // endif Memory
......
...@@ -607,7 +607,7 @@ void TDBTBM::ResetDB(void) ...@@ -607,7 +607,7 @@ void TDBTBM::ResetDB(void)
for (PTABLE tabp = Tablist; tabp; tabp = tabp->GetNext()) for (PTABLE tabp = Tablist; tabp; tabp = tabp->GetNext())
((PTDBASE)tabp->GetTo_Tdb())->ResetDB(); ((PTDBASE)tabp->GetTo_Tdb())->ResetDB();
Tdbp = (PTDBASE)Tablist->GetTo_Tdb(); Tdbp = (Tablist) ? (PTDBASE)Tablist->GetTo_Tdb() : NULL;
Crp = 0; Crp = 0;
} // end of ResetDB } // end of ResetDB
...@@ -679,7 +679,7 @@ bool TDBTBM::OpenDB(PGLOBAL g) ...@@ -679,7 +679,7 @@ bool TDBTBM::OpenDB(PGLOBAL g)
/* Table already open, replace it at its beginning. */ /* Table already open, replace it at its beginning. */
/*******************************************************************/ /*******************************************************************/
ResetDB(); ResetDB();
return Tdbp->OpenDB(g); // Re-open fist table return (Tdbp) ? Tdbp->OpenDB(g) : false; // Re-open fist table
} // endif use } // endif use
#if 0 #if 0
......
...@@ -138,7 +138,8 @@ class DllExport TDBTBM : public TDBTBL { ...@@ -138,7 +138,8 @@ class DllExport TDBTBM : public TDBTBL {
virtual void ResetDB(void); virtual void ResetDB(void);
// Database routines // Database routines
virtual int GetMaxSize(PGLOBAL g) {return 10;} // Temporary virtual int Cardinality(PGLOBAL g) { return 10; }
virtual int GetMaxSize(PGLOBAL g) { return 10; } // Temporary
virtual int RowNumber(PGLOBAL g, bool b = FALSE); virtual int RowNumber(PGLOBAL g, bool b = FALSE);
virtual bool OpenDB(PGLOBAL g); virtual bool OpenDB(PGLOBAL g);
virtual int ReadDB(PGLOBAL g); virtual int ReadDB(PGLOBAL g);
......
...@@ -1344,10 +1344,13 @@ bool TYPVAL<PSZ>::SetValue_pval(PVAL valp, bool chktype) ...@@ -1344,10 +1344,13 @@ bool TYPVAL<PSZ>::SetValue_pval(PVAL valp, bool chktype)
/***********************************************************************/ /***********************************************************************/
bool TYPVAL<PSZ>::SetValue_char(char *p, int n) bool TYPVAL<PSZ>::SetValue_char(char *p, int n)
{ {
bool rc; bool rc = false;
if (p && n > 0) { if (!p || n == 0) {
rc = n > Len; Reset();
Null = Nullable;
} else if (p != Strp) {
rc = n > Len;
if ((n = MY_MIN(n, Len))) { if ((n = MY_MIN(n, Len))) {
strncpy(Strp, p, n); strncpy(Strp, p, n);
...@@ -1366,10 +1369,6 @@ bool TYPVAL<PSZ>::SetValue_char(char *p, int n) ...@@ -1366,10 +1369,6 @@ bool TYPVAL<PSZ>::SetValue_char(char *p, int n)
Reset(); Reset();
Null = false; Null = false;
} else {
rc = false;
Reset();
Null = Nullable;
} // endif p } // endif p
return rc; return rc;
...@@ -1380,12 +1379,12 @@ bool TYPVAL<PSZ>::SetValue_char(char *p, int n) ...@@ -1380,12 +1379,12 @@ bool TYPVAL<PSZ>::SetValue_char(char *p, int n)
/***********************************************************************/ /***********************************************************************/
void TYPVAL<PSZ>::SetValue_psz(PSZ s) void TYPVAL<PSZ>::SetValue_psz(PSZ s)
{ {
if (s) { if (!s) {
strncpy(Strp, s, Len); Reset();
Null = Nullable;
} else if (s != Strp) {
strncpy(Strp, s, Len);
Null = false; Null = false;
} else {
Reset();
Null = Nullable;
} // endif s } // endif s
} // end of SetValue_psz } // end of SetValue_psz
...@@ -1627,12 +1626,6 @@ int TYPVAL<PSZ>::CompareValue(PVAL vp) ...@@ -1627,12 +1626,6 @@ int TYPVAL<PSZ>::CompareValue(PVAL vp)
return (n > 0) ? 1 : (n < 0) ? -1 : 0; return (n > 0) ? 1 : (n < 0) ? -1 : 0;
} // end of CompareValue } // end of CompareValue
static inline void v_strcpy(char *dest, const char *src)
{
if (dest != src)
strcpy(dest, src);
}
/***********************************************************************/ /***********************************************************************/
/* Compute a function on a string. */ /* Compute a function on a string. */
/***********************************************************************/ /***********************************************************************/
...@@ -1649,7 +1642,7 @@ bool TYPVAL<PSZ>::Compute(PGLOBAL g, PVAL *vp, int np, OPVAL op) ...@@ -1649,7 +1642,7 @@ bool TYPVAL<PSZ>::Compute(PGLOBAL g, PVAL *vp, int np, OPVAL op)
assert(np == 1 || np == 2); assert(np == 1 || np == 2);
if (np == 2) if (np == 2)
strncpy(Strp, p[0], Len); SetValue_psz(p[0]);
if ((i = Len - (signed)strlen(Strp)) > 0) if ((i = Len - (signed)strlen(Strp)) > 0)
strncat(Strp, p[np - 1], i); strncat(Strp, p[np - 1], i);
...@@ -1657,11 +1650,11 @@ bool TYPVAL<PSZ>::Compute(PGLOBAL g, PVAL *vp, int np, OPVAL op) ...@@ -1657,11 +1650,11 @@ bool TYPVAL<PSZ>::Compute(PGLOBAL g, PVAL *vp, int np, OPVAL op)
break; break;
case OP_MIN: case OP_MIN:
assert(np == 2); assert(np == 2);
v_strcpy(Strp, (strcmp(p[0], p[1]) < 0) ? p[0] : p[1]); SetValue_psz((strcmp(p[0], p[1]) < 0) ? p[0] : p[1]);
break; break;
case OP_MAX: case OP_MAX:
assert(np == 2); assert(np == 2);
v_strcpy(Strp, (strcmp(p[0], p[1]) > 0) ? p[0] : p[1]); SetValue_psz((strcmp(p[0], p[1]) > 0) ? p[0] : p[1]);
break; break;
default: default:
// sprintf(g->Message, MSG(BAD_EXP_OPER), op); // sprintf(g->Message, MSG(BAD_EXP_OPER), op);
......
...@@ -566,17 +566,17 @@ int get_connection(MEM_ROOT *mem_root, FEDERATEDX_SHARE *share) ...@@ -566,17 +566,17 @@ int get_connection(MEM_ROOT *mem_root, FEDERATEDX_SHARE *share)
at the address of the share. at the address of the share.
*/ */
share->server_name_length= server->server_name_length; share->server_name_length= server->server_name_length;
share->server_name= server->server_name; share->server_name= const_cast<char*>(server->server_name);
share->username= server->username; share->username= const_cast<char*>(server->username);
share->password= server->password; share->password= const_cast<char*>(server->password);
share->database= server->db; share->database= const_cast<char*>(server->db);
share->port= server->port > MIN_PORT && server->port < 65536 ? share->port= server->port > MIN_PORT && server->port < 65536 ?
(ushort) server->port : MYSQL_PORT; (ushort) server->port : MYSQL_PORT;
share->hostname= server->host; share->hostname= const_cast<char*>(server->host);
if (!(share->socket= server->socket) && if (!(share->socket= const_cast<char*>(server->socket)) &&
!strcmp(share->hostname, my_localhost)) !strcmp(share->hostname, my_localhost))
share->socket= (char *) MYSQL_UNIX_ADDR; share->socket= (char *) MYSQL_UNIX_ADDR;
share->scheme= server->scheme; share->scheme= const_cast<char*>(server->scheme);
DBUG_PRINT("info", ("share->username: %s", share->username)); DBUG_PRINT("info", ("share->username: %s", share->username));
DBUG_PRINT("info", ("share->password: %s", share->password)); DBUG_PRINT("info", ("share->password: %s", share->password));
...@@ -1319,7 +1319,7 @@ bool ha_federatedx::create_where_from_key(String *to, ...@@ -1319,7 +1319,7 @@ bool ha_federatedx::create_where_from_key(String *to,
break; break;
} }
DBUG_PRINT("info", ("federatedx HA_READ_AFTER_KEY %d", i)); DBUG_PRINT("info", ("federatedx HA_READ_AFTER_KEY %d", i));
if (store_length >= length) /* end key */ if (store_length >= length || i > 0) /* end key */
{ {
if (emit_key_part_name(&tmp, key_part)) if (emit_key_part_name(&tmp, key_part))
goto err; goto err;
...@@ -2560,9 +2560,7 @@ int ha_federatedx::index_read_idx(uchar *buf, uint index, const uchar *key, ...@@ -2560,9 +2560,7 @@ int ha_federatedx::index_read_idx(uchar *buf, uint index, const uchar *key,
RESULT RESULT
0 ok In this case *result will contain the result set 0 ok In this case *result will contain the result set
table->status == 0
# error In this case *result will contain 0 # error In this case *result will contain 0
table->status == STATUS_NOT_FOUND
*/ */
int ha_federatedx::index_read_idx_with_result_set(uchar *buf, uint index, int ha_federatedx::index_read_idx_with_result_set(uchar *buf, uint index,
...@@ -2619,11 +2617,9 @@ int ha_federatedx::index_read_idx_with_result_set(uchar *buf, uint index, ...@@ -2619,11 +2617,9 @@ int ha_federatedx::index_read_idx_with_result_set(uchar *buf, uint index,
insert_dynamic(&results, (uchar*) result); insert_dynamic(&results, (uchar*) result);
*result= 0; *result= 0;
table->status= STATUS_NOT_FOUND;
DBUG_RETURN(retval); DBUG_RETURN(retval);
error: error:
table->status= STATUS_NOT_FOUND;
my_error(retval, MYF(0), error_buffer); my_error(retval, MYF(0), error_buffer);
DBUG_RETURN(retval); DBUG_RETURN(retval);
} }
...@@ -2704,7 +2700,6 @@ int ha_federatedx::read_range_first(const key_range *start_key, ...@@ -2704,7 +2700,6 @@ int ha_federatedx::read_range_first(const key_range *start_key,
DBUG_RETURN(retval); DBUG_RETURN(retval);
error: error:
table->status= STATUS_NOT_FOUND;
DBUG_RETURN(retval); DBUG_RETURN(retval);
} }
...@@ -2909,8 +2904,6 @@ int ha_federatedx::read_next(uchar *buf, FEDERATEDX_IO_RESULT *result) ...@@ -2909,8 +2904,6 @@ int ha_federatedx::read_next(uchar *buf, FEDERATEDX_IO_RESULT *result)
FEDERATEDX_IO_ROW *row; FEDERATEDX_IO_ROW *row;
DBUG_ENTER("ha_federatedx::read_next"); DBUG_ENTER("ha_federatedx::read_next");
table->status= STATUS_NOT_FOUND; // For easier return
if ((retval= txn->acquire(share, TRUE, &io))) if ((retval= txn->acquire(share, TRUE, &io)))
DBUG_RETURN(retval); DBUG_RETURN(retval);
...@@ -2995,7 +2988,6 @@ int ha_federatedx::rnd_pos(uchar *buf, uchar *pos) ...@@ -2995,7 +2988,6 @@ int ha_federatedx::rnd_pos(uchar *buf, uchar *pos)
DBUG_RETURN(retval); DBUG_RETURN(retval);
error: error:
table->status= STATUS_NOT_FOUND;
DBUG_RETURN(retval); DBUG_RETURN(retval);
} }
...@@ -3098,7 +3090,7 @@ int ha_federatedx::info(uint flag) ...@@ -3098,7 +3090,7 @@ int ha_federatedx::info(uint flag)
else if (remote_error_number != -1 /* error already reported */) else if (remote_error_number != -1 /* error already reported */)
{ {
error_code= remote_error_number; error_code= remote_error_number;
my_error(error_code, MYF(0), ER(error_code)); my_error(error_code, MYF(0), ER_THD(thd, error_code));
} }
fail: fail:
tmp_txn->release(&tmp_io); tmp_txn->release(&tmp_io);
......
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