summaryrefslogtreecommitdiff
path: root/storage
diff options
context:
space:
mode:
authorSergei Golubchik <serg@mariadb.org>2016-04-26 23:48:18 +0200
committerSergei Golubchik <serg@mariadb.org>2016-04-26 23:48:18 +0200
commit8b1563eac8dfeedfd8f2035f0ed1f8a35115db3a (patch)
tree5cd26363985ea88e1f7ff5a2b1ff927cc8f4f60c /storage
parentcfad394776a64684f9cb010b7c63e8e749663f83 (diff)
parent10de43866fd6cd0e5d5157ef10bbd1a51f799f77 (diff)
downloadmariadb-git-8b1563eac8dfeedfd8f2035f0ed1f8a35115db3a.tar.gz
Merge branch 'connect/10.0' into 10.0
1.04.0006
Diffstat (limited to 'storage')
-rw-r--r--storage/connect/connect.cc2
-rw-r--r--storage/connect/ha_connect.cc59
-rw-r--r--storage/connect/ha_connect.h2
-rw-r--r--storage/connect/myconn.cpp11
-rw-r--r--storage/connect/myconn.h2
-rw-r--r--storage/connect/mysql-test/connect/r/mysql_index.result321
-rw-r--r--storage/connect/mysql-test/connect/r/part_table.result25
-rw-r--r--storage/connect/mysql-test/connect/r/tbl.result45
-rw-r--r--storage/connect/mysql-test/connect/t/mysql_index.test67
-rw-r--r--storage/connect/mysql-test/connect/t/part_table.test15
-rw-r--r--storage/connect/mysql-test/connect/t/tbl.test45
-rw-r--r--storage/connect/odbconn.cpp9
-rw-r--r--storage/connect/tabmysql.cpp8
-rw-r--r--storage/connect/tabodbc.cpp24
-rw-r--r--storage/connect/tabtbl.cpp4
-rw-r--r--storage/connect/tabtbl.h3
-rw-r--r--storage/connect/value.cpp35
-rw-r--r--storage/federatedx/ha_federatedx.cc26
18 files changed, 591 insertions, 112 deletions
diff --git a/storage/connect/connect.cc b/storage/connect/connect.cc
index 56a0fc4fd4f..460d47bcf62 100644
--- a/storage/connect/connect.cc
+++ b/storage/connect/connect.cc
@@ -752,7 +752,7 @@ RCODE CntIndexRead(PGLOBAL g, PTDB ptdb, OPVAL op,
return RC_FX;
} else if (x == 2) {
// Remote index
- if (ptdb->ReadKey(g, op, kr))
+ if (op != OP_SAME && ptdb->ReadKey(g, op, kr))
return RC_FX;
goto rnd;
diff --git a/storage/connect/ha_connect.cc b/storage/connect/ha_connect.cc
index dc9bf47244f..e8aa54fc87c 100644
--- a/storage/connect/ha_connect.cc
+++ b/storage/connect/ha_connect.cc
@@ -169,9 +169,9 @@
#define JSONMAX 10 // JSON Default max grp size
extern "C" {
- char version[]= "Version 1.04.0005 January 24, 2016";
+ char version[]= "Version 1.04.0006 March 12, 2016";
#if defined(__WIN__)
- char compver[]= "Version 1.04.0005 " __DATE__ " " __TIME__;
+ char compver[]= "Version 1.04.0006 " __DATE__ " " __TIME__;
char slash= '\\';
#else // !__WIN__
char slash= '/';
@@ -757,7 +757,7 @@ ha_connect::ha_connect(handlerton *hton, TABLE_SHARE *table_arg)
sdvalout= NULL;
xmod= MODE_ANY;
istable= false;
- *partname= 0;
+ memset(partname, 0, sizeof(partname));
bzero((char*) &xinfo, sizeof(XINFO));
valid_info= false;
valid_query_id= 0;
@@ -1150,7 +1150,7 @@ char *ha_connect::GetRealString(const char *s)
{
char *sv;
- if (IsPartitioned() && s) {
+ if (IsPartitioned() && s && partname && *partname) {
sv= (char*)PlugSubAlloc(xp->g, NULL, 0);
sprintf(sv, s, partname);
PlugSubAlloc(xp->g, NULL, strlen(sv) + 1);
@@ -1173,7 +1173,9 @@ char *ha_connect::GetStringOption(char *opname, char *sdef)
: table->s->connect_string;
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"))
opval= thd_query_string(table->in_use)->str;
@@ -2286,7 +2288,7 @@ bool ha_connect::MakeKeyWhere(PGLOBAL g, PSTRG qry, OPVAL vop, char q,
op= OP_EQ;
break;
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;
case HA_READ_KEY_OR_NEXT:
op= OP_GE;
@@ -3121,13 +3123,14 @@ int ha_connect::open(const char *name, int mode, uint test_if_locked)
#if defined(WITH_PARTITION_STORAGE_ENGINE)
if (table->part_info) {
if (GetStringOption("Filename") || GetStringOption("Tabname")
- || GetStringOption("Connect")) {
- strcpy(partname, decode(g, strrchr(name, '#') + 1));
+ || GetStringOption("Connect")) {
+ strncpy(partname, decode(g, strrchr(name, '#') + 1), sizeof(partname) - 1);
// 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
- strcpy(partname, strrchr(name, slash) + 1);
- part_id= &table->part_info->full_part_field_set; // Temporary
+ strncpy(partname, strrchr(name, slash) + 1, sizeof(partname) - 1);
+
+ part_id= &table->part_info->full_part_field_set; // Temporary
} // endif part_info
#endif // WITH_PARTITION_STORAGE_ENGINE
} else
@@ -5167,7 +5170,7 @@ static int connect_assisted_discovery(handlerton *, THD* thd,
fncn= topt->catfunc;
fnc= GetFuncID(fncn);
sep= topt->separator;
- spc= (!sep) ? ',' : (!strcmp(sep, "\\t")) ? '\t' : *sep;
+ spc= (!sep) ? ',' : *sep;
qch= topt->qchar ? *topt->qchar : (signed)topt->quoted >= 0 ? '"' : 0;
hdr= (int)topt->header;
tbl= topt->tablist;
@@ -5234,7 +5237,6 @@ static int connect_assisted_discovery(handlerton *, THD* thd,
goto err;
} // endif rc
-
if (!tab) {
if (ttp == TAB_TBL) {
// Make tab the first table of the list
@@ -5303,8 +5305,10 @@ static int connect_assisted_discovery(handlerton *, THD* thd,
case TAB_CSV:
if (!fn && fnc != FNC_NO)
sprintf(g->Message, "Missing %s file name", topt->type);
- else
- ok= true;
+ else if (sep && strlen(sep) > 1)
+ sprintf(g->Message, "Invalid separator %s", sep);
+ else
+ ok= true;
break;
case TAB_MYSQL:
@@ -5985,7 +5989,19 @@ int ha_connect::create(const char *name, TABLE *table_arg,
DBUG_RETURN(rc);
} // 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
for (field= table_arg->field; *field; field++) {
@@ -6136,7 +6152,7 @@ int ha_connect::create(const char *name, TABLE *table_arg,
strcpy(dbpath, name);
p= strrchr(dbpath, slash);
- strcpy(partname, ++p);
+ strncpy(partname, ++p, sizeof(partname) - 1);
strcat(strcat(strcpy(buf, p), "."), lwt);
*p= 0;
} else {
@@ -6187,7 +6203,7 @@ int ha_connect::create(const char *name, TABLE *table_arg,
#if defined(WITH_PARTITION_STORAGE_ENGINE)
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);
#endif // WITH_PARTITION_STORAGE_ENGINE
@@ -6228,8 +6244,9 @@ int ha_connect::create(const char *name, TABLE *table_arg,
#if defined(WITH_PARTITION_STORAGE_ENGINE)
if (part_info)
- strcpy(partname,
- decode(g, strrchr(name, (inward ? slash : '#')) + 1));
+ strncpy(partname,
+ decode(g, strrchr(name, (inward ? slash : '#')) + 1),
+ sizeof(partname) - 1);
#endif // WITH_PARTITION_STORAGE_ENGINE
if ((rc= optimize(table->in_use, NULL))) {
@@ -6773,7 +6790,7 @@ maria_declare_plugin(connect)
0x0104, /* version number (1.04) */
NULL, /* status variables */
connect_system_variables, /* system variables */
- "1.04.0005", /* string version */
+ "1.04.0006", /* string version */
MariaDB_PLUGIN_MATURITY_BETA /* maturity */
}
maria_declare_plugin_end;
diff --git a/storage/connect/ha_connect.h b/storage/connect/ha_connect.h
index 6d491b6ddd3..60194ac0e3c 100644
--- a/storage/connect/ha_connect.h
+++ b/storage/connect/ha_connect.h
@@ -554,7 +554,7 @@ protected:
PVAL sdvalin4; // Used to convert date values
PVAL sdvalout; // Used to convert date values
bool istable; // True for table handler
- char partname[64]; // The partition name
+ char partname[65]; // The partition name
MODE xmod; // Table mode
XINFO xinfo; // The table info structure
bool valid_info; // True if xinfo is valid
diff --git a/storage/connect/myconn.cpp b/storage/connect/myconn.cpp
index ada0109a820..e9bd64cf8e6 100644
--- a/storage/connect/myconn.cpp
+++ b/storage/connect/myconn.cpp
@@ -959,11 +959,16 @@ void MYSQLC::FreeResult(void)
/***********************************************************************/
/* Place the cursor at the beginning of the result set. */
/***********************************************************************/
-void MYSQLC::Rewind(void)
+int MYSQLC::Rewind(PGLOBAL g, PSZ sql)
{
- if (m_Res)
- DataSeek(0);
+ int rc = RC_OK;
+ if (m_Res)
+ DataSeek(0);
+ else if (sql)
+ rc = ExecSQL(g, sql);
+
+ return rc;
} // end of Rewind
/***********************************************************************/
diff --git a/storage/connect/myconn.h b/storage/connect/myconn.h
index fa34edd804c..79f095f5c93 100644
--- a/storage/connect/myconn.h
+++ b/storage/connect/myconn.h
@@ -80,7 +80,7 @@ class DllItem MYSQLC {
int Fetch(PGLOBAL g, int pos);
char *GetCharField(int i);
int GetFieldLength(int i);
- void Rewind(void);
+ int Rewind(PGLOBAL g, PSZ sql);
void FreeResult(void);
void Close(void);
diff --git a/storage/connect/mysql-test/connect/r/mysql_index.result b/storage/connect/mysql-test/connect/r/mysql_index.result
index 4ebf10802ae..dd1864529ca 100644
--- a/storage/connect/mysql-test/connect/r/mysql_index.result
+++ b/storage/connect/mysql-test/connect/r/mysql_index.result
@@ -112,3 +112,324 @@ id msg
6 Six
DROP TABLE t2;
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;
diff --git a/storage/connect/mysql-test/connect/r/part_table.result b/storage/connect/mysql-test/connect/r/part_table.result
index 122c328fa59..f3a556ae784 100644
--- a/storage/connect/mysql-test/connect/r/part_table.result
+++ b/storage/connect/mysql-test/connect/r/part_table.result
@@ -191,6 +191,31 @@ id msg
35 thirty five
81 big
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 xt2;
DROP TABLE xt3;
diff --git a/storage/connect/mysql-test/connect/r/tbl.result b/storage/connect/mysql-test/connect/r/tbl.result
index bc77516c22d..f51b4dfa57f 100644
--- a/storage/connect/mysql-test/connect/r/tbl.result
+++ b/storage/connect/mysql-test/connect/r/tbl.result
@@ -44,8 +44,8 @@ ta message
1 Testing
2 myisam table
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';
-select * from total;
+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;
tabname ta message
t1 1 Testing
t1 2 dos table
@@ -59,15 +59,15 @@ t3 3 t3
t4 1 Testing
t4 2 myisam table
t4 3 t4
-select * from total where tabname = 't2';
+SELECT * FROM total WHERE tabname = 't2';
tabname ta message
t2 1 Testing
t2 2 NULL
t2 3 t2
-select * from total where tabname = 't2' and ta = 3;
+SELECT * FROM total WHERE tabname = 't2' AND ta = 3;
tabname ta message
t2 3 t2
-select * from total where tabname in ('t1','t4');
+SELECT * FROM total WHERE tabname IN ('t1','t4');
tabname ta message
t1 1 Testing
t1 2 dos table
@@ -75,11 +75,11 @@ t1 3 t1
t4 1 Testing
t4 2 myisam table
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
t1 3 t1
t2 3 t2
-select * from total where tabname <> 't2';
+SELECT * FROM total WHERE tabname <> 't2';
tabname ta message
t1 1 Testing
t1 2 dos table
@@ -90,12 +90,12 @@ t3 3 t3
t4 1 Testing
t4 2 myisam table
t4 3 t4
-select * from total where tabname != 't2' and ta = 3;
+SELECT * FROM total WHERE tabname != 't2' AND ta = 3;
tabname ta message
t1 3 t1
t3 3 t3
t4 3 t4
-select * from total where tabname not in ('t2','t3');
+SELECT * FROM total WHERE tabname NOT IN ('t2','t3');
tabname ta message
t1 1 Testing
t1 2 dos table
@@ -103,11 +103,11 @@ t1 3 t1
t4 1 Testing
t4 2 myisam table
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
t2 3 t2
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
t1 3 t1
t2 1 Testing
@@ -117,7 +117,7 @@ t3 3 t3
t4 1 Testing
t4 2 myisam table
t4 3 t4
-select * from total where not tabname = 't2';
+SELECT * FROM total WHERE NOT tabname = 't2';
tabname ta message
t1 1 Testing
t1 2 dos table
@@ -128,7 +128,7 @@ t3 3 t3
t4 1 Testing
t4 2 myisam table
t4 3 t4
-select * from total where tabname = 't2' or tabname = 't1';
+SELECT * FROM total WHERE tabname = 't2' OR tabname = 't1';
tabname ta message
t1 1 Testing
t1 2 dos table
@@ -141,3 +141,22 @@ DROP TABLE t1;
DROP TABLE t2;
DROP TABLE t3;
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;
diff --git a/storage/connect/mysql-test/connect/t/mysql_index.test b/storage/connect/mysql-test/connect/t/mysql_index.test
index 9a162b4d8e3..81fdcad9330 100644
--- a/storage/connect/mysql-test/connect/t/mysql_index.test
+++ b/storage/connect/mysql-test/connect/t/mysql_index.test
@@ -64,3 +64,70 @@ SELECT * FROM t2;
DROP TABLE t2;
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
diff --git a/storage/connect/mysql-test/connect/t/part_table.test b/storage/connect/mysql-test/connect/t/part_table.test
index d839337ba6f..5edd5766bd6 100644
--- a/storage/connect/mysql-test/connect/t/part_table.test
+++ b/storage/connect/mysql-test/connect/t/part_table.test
@@ -82,6 +82,21 @@ SELECT * FROM t1;
DELETE FROM t1 WHERE id in (60,72);
SELECT * FROM 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 xt2;
DROP TABLE xt3;
diff --git a/storage/connect/mysql-test/connect/t/tbl.test b/storage/connect/mysql-test/connect/t/tbl.test
index 43c506c9403..3dc4b2e64b0 100644
--- a/storage/connect/mysql-test/connect/t/tbl.test
+++ b/storage/connect/mysql-test/connect/t/tbl.test
@@ -31,23 +31,40 @@ INSERT INTO t4 (message) VALUES ('Testing'),('myisam table'),('t4');
SELECT * FROM t4;
--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'
-
-select * from total;
-select * from total where tabname = 't2';
-select * from total where tabname = 't2' and ta = 3;
-select * from total where tabname in ('t1','t4');
-select * from total where ta = 3 and tabname in ('t1','t2');
-select * from total where tabname <> 't2';
-select * from total where tabname != 't2' and ta = 3;
-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 or tabname in ('t2','t4');
-select * from total where not tabname = 't2';
-select * from total where tabname = 't2' or tabname = 't1';
+--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 WHERE tabname = 't2';
+SELECT * FROM total WHERE tabname = 't2' AND ta = 3;
+SELECT * FROM total WHERE tabname IN ('t1','t4');
+SELECT * FROM total WHERE ta = 3 AND tabname IN ('t1','t2');
+SELECT * FROM total WHERE tabname <> 't2';
+SELECT * FROM total WHERE tabname != 't2' AND ta = 3;
+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 OR tabname IN ('t2','t4');
+SELECT * FROM total WHERE NOT tabname = 't2';
+SELECT * FROM total WHERE tabname = 't2' OR tabname = 't1';
DROP TABLE total;
DROP TABLE t1;
DROP TABLE t2;
DROP TABLE t3;
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;
diff --git a/storage/connect/odbconn.cpp b/storage/connect/odbconn.cpp
index cb21a8bda15..55ccbdbada1 100644
--- a/storage/connect/odbconn.cpp
+++ b/storage/connect/odbconn.cpp
@@ -1758,7 +1758,9 @@ bool ODBConn::BindParam(ODBCCOL *colp)
SQLLEN *strlen = colp->GetStrLen();
SQLRETURN rc;
+#if 0
try {
+ // This function is often not or badly implemented by data sources
rc = SQLDescribeParam(m_hstmt, n, &sqlt, &colsize, &dec, &nul);
if (!Check(rc))
@@ -1766,11 +1768,12 @@ bool ODBConn::BindParam(ODBCCOL *colp)
} catch(DBX *x) {
sprintf(m_G->Message, "%s: %s", x->m_Msg, x->GetErrorMessage(0));
+#endif // 0
colsize = colp->GetPrecision();
sqlt = GetSQLType(buftype);
- dec = IsTypeChar(buftype) ? 0 : colp->GetScale();
- nul = SQL_NULLABLE_UNKNOWN;
- } // end try/catch
+ dec = IsTypeNum(buftype) ? colp->GetScale() : 0;
+ nul = colp->IsNullable() ? SQL_NULLABLE : SQL_NO_NULLS;
+//} // end try/catch
buf = colp->GetBuffer(0);
len = IsTypeChar(buftype) ? colp->GetBuflen() : 0;
diff --git a/storage/connect/tabmysql.cpp b/storage/connect/tabmysql.cpp
index 98887269c2e..98a476bf94f 100644
--- a/storage/connect/tabmysql.cpp
+++ b/storage/connect/tabmysql.cpp
@@ -19,7 +19,7 @@
/* --------------- */
/* TABMYSQL.CPP - Source code */
/* PLGDBSEM.H - DB application declaration file */
-/* TABMYSQL.H - TABODBC classes declaration file */
+/* TABMYSQL.H - TABMYSQL classes declaration file */
/* GLOBAL.H - Global declaration file */
/* */
/* REQUIRED LIBRARIES: */
@@ -334,7 +334,7 @@ bool MYSQLDEF::DefineAM(PGLOBAL g, LPCSTR am, int)
Delayed = !!GetIntCatInfo("Delayed", 0);
} else {
// 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);
// We must get other connection parms from the calling table
@@ -857,7 +857,9 @@ bool TDBMYSQL::OpenDB(PGLOBAL g)
/*******************************************************************/
/* 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;
return false;
} // endif use
diff --git a/storage/connect/tabodbc.cpp b/storage/connect/tabodbc.cpp
index 2c039c97a30..c555f2a5abb 100644
--- a/storage/connect/tabodbc.cpp
+++ b/storage/connect/tabodbc.cpp
@@ -5,7 +5,7 @@
/* */
/* COPYRIGHT: */
/* ---------- */
-/* (C) Copyright to the author Olivier BERTRAND 2000-2015 */
+/* (C) Copyright to the author Olivier BERTRAND 2000-2016 */
/* */
/* WHAT THIS PROGRAM DOES: */
/* ----------------------- */
@@ -912,19 +912,21 @@ bool TDBODBC::OpenDB(PGLOBAL g)
if ((n = Ocp->GetResultSize(Query->GetStr(), Cnp)) < 0) {
strcpy(g->Message, "Cannot get result size");
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)))
- Memory = 2; // Must be filled
- else {
- strcpy(g->Message, "Result set memory allocation failed");
- return true;
- } // endif n
+ } else // Void result
+ Memory = 0;
- Ocp->m_Rows = 0;
- } else
+ Ocp->m_Rows = 0;
+ } else
return true;
} // endif Memory
diff --git a/storage/connect/tabtbl.cpp b/storage/connect/tabtbl.cpp
index 6b72c715517..36849146746 100644
--- a/storage/connect/tabtbl.cpp
+++ b/storage/connect/tabtbl.cpp
@@ -607,7 +607,7 @@ void TDBTBM::ResetDB(void)
for (PTABLE tabp = Tablist; tabp; tabp = tabp->GetNext())
((PTDBASE)tabp->GetTo_Tdb())->ResetDB();
- Tdbp = (PTDBASE)Tablist->GetTo_Tdb();
+ Tdbp = (Tablist) ? (PTDBASE)Tablist->GetTo_Tdb() : NULL;
Crp = 0;
} // end of ResetDB
@@ -679,7 +679,7 @@ bool TDBTBM::OpenDB(PGLOBAL g)
/* Table already open, replace it at its beginning. */
/*******************************************************************/
ResetDB();
- return Tdbp->OpenDB(g); // Re-open fist table
+ return (Tdbp) ? Tdbp->OpenDB(g) : false; // Re-open fist table
} // endif use
#if 0
diff --git a/storage/connect/tabtbl.h b/storage/connect/tabtbl.h
index 9d3f297f9e7..3a5ec45d025 100644
--- a/storage/connect/tabtbl.h
+++ b/storage/connect/tabtbl.h
@@ -138,7 +138,8 @@ class DllExport TDBTBM : public TDBTBL {
virtual void ResetDB(void);
// 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 bool OpenDB(PGLOBAL g);
virtual int ReadDB(PGLOBAL g);
diff --git a/storage/connect/value.cpp b/storage/connect/value.cpp
index 422853f7cba..64d0e13e8c4 100644
--- a/storage/connect/value.cpp
+++ b/storage/connect/value.cpp
@@ -1344,10 +1344,13 @@ bool TYPVAL<PSZ>::SetValue_pval(PVAL valp, bool chktype)
/***********************************************************************/
bool TYPVAL<PSZ>::SetValue_char(char *p, int n)
{
- bool rc;
+ bool rc = false;
- if (p && n > 0) {
- rc = n > Len;
+ if (!p || n == 0) {
+ Reset();
+ Null = Nullable;
+ } else if (p != Strp) {
+ rc = n > Len;
if ((n = MY_MIN(n, Len))) {
strncpy(Strp, p, n);
@@ -1366,10 +1369,6 @@ bool TYPVAL<PSZ>::SetValue_char(char *p, int n)
Reset();
Null = false;
- } else {
- rc = false;
- Reset();
- Null = Nullable;
} // endif p
return rc;
@@ -1380,12 +1379,12 @@ bool TYPVAL<PSZ>::SetValue_char(char *p, int n)
/***********************************************************************/
void TYPVAL<PSZ>::SetValue_psz(PSZ s)
{
- if (s) {
- strncpy(Strp, s, Len);
+ if (!s) {
+ Reset();
+ Null = Nullable;
+ } else if (s != Strp) {
+ strncpy(Strp, s, Len);
Null = false;
- } else {
- Reset();
- Null = Nullable;
} // endif s
} // end of SetValue_psz
@@ -1627,12 +1626,6 @@ int TYPVAL<PSZ>::CompareValue(PVAL vp)
return (n > 0) ? 1 : (n < 0) ? -1 : 0;
} // 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. */
/***********************************************************************/
@@ -1649,7 +1642,7 @@ bool TYPVAL<PSZ>::Compute(PGLOBAL g, PVAL *vp, int np, OPVAL op)
assert(np == 1 || np == 2);
if (np == 2)
- strncpy(Strp, p[0], Len);
+ SetValue_psz(p[0]);
if ((i = Len - (signed)strlen(Strp)) > 0)
strncat(Strp, p[np - 1], i);
@@ -1657,11 +1650,11 @@ bool TYPVAL<PSZ>::Compute(PGLOBAL g, PVAL *vp, int np, OPVAL op)
break;
case OP_MIN:
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;
case OP_MAX:
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;
default:
// sprintf(g->Message, MSG(BAD_EXP_OPER), op);
diff --git a/storage/federatedx/ha_federatedx.cc b/storage/federatedx/ha_federatedx.cc
index 9ee9a8d030f..aae26758c78 100644
--- a/storage/federatedx/ha_federatedx.cc
+++ b/storage/federatedx/ha_federatedx.cc
@@ -566,17 +566,17 @@ int get_connection(MEM_ROOT *mem_root, FEDERATEDX_SHARE *share)
at the address of the share.
*/
share->server_name_length= server->server_name_length;
- share->server_name= server->server_name;
- share->username= server->username;
- share->password= server->password;
- share->database= server->db;
+ share->server_name= const_cast<char*>(server->server_name);
+ share->username= const_cast<char*>(server->username);
+ share->password= const_cast<char*>(server->password);
+ share->database= const_cast<char*>(server->db);
share->port= server->port > MIN_PORT && server->port < 65536 ?
(ushort) server->port : MYSQL_PORT;
- share->hostname= server->host;
- if (!(share->socket= server->socket) &&
+ share->hostname= const_cast<char*>(server->host);
+ if (!(share->socket= const_cast<char*>(server->socket)) &&
!strcmp(share->hostname, my_localhost))
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->password: %s", share->password));
@@ -1319,7 +1319,7 @@ bool ha_federatedx::create_where_from_key(String *to,
break;
}
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))
goto err;
@@ -2560,9 +2560,7 @@ int ha_federatedx::index_read_idx(uchar *buf, uint index, const uchar *key,
RESULT
0 ok In this case *result will contain the result set
- table->status == 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,
@@ -2619,11 +2617,9 @@ int ha_federatedx::index_read_idx_with_result_set(uchar *buf, uint index,
insert_dynamic(&results, (uchar*) result);
*result= 0;
- table->status= STATUS_NOT_FOUND;
DBUG_RETURN(retval);
error:
- table->status= STATUS_NOT_FOUND;
my_error(retval, MYF(0), error_buffer);
DBUG_RETURN(retval);
}
@@ -2704,7 +2700,6 @@ int ha_federatedx::read_range_first(const key_range *start_key,
DBUG_RETURN(retval);
error:
- table->status= STATUS_NOT_FOUND;
DBUG_RETURN(retval);
}
@@ -2909,8 +2904,6 @@ int ha_federatedx::read_next(uchar *buf, FEDERATEDX_IO_RESULT *result)
FEDERATEDX_IO_ROW *row;
DBUG_ENTER("ha_federatedx::read_next");
- table->status= STATUS_NOT_FOUND; // For easier return
-
if ((retval= txn->acquire(share, TRUE, &io)))
DBUG_RETURN(retval);
@@ -2995,7 +2988,6 @@ int ha_federatedx::rnd_pos(uchar *buf, uchar *pos)
DBUG_RETURN(retval);
error:
- table->status= STATUS_NOT_FOUND;
DBUG_RETURN(retval);
}
@@ -3098,7 +3090,7 @@ error:
else if (remote_error_number != -1 /* error already reported */)
{
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:
tmp_txn->release(&tmp_io);