summaryrefslogtreecommitdiff
path: root/storage/connect
diff options
context:
space:
mode:
authorOlivier Bertrand <bertrandop@gmail.com>2014-08-07 19:12:45 +0200
committerOlivier Bertrand <bertrandop@gmail.com>2014-08-07 19:12:45 +0200
commitf835588cc2e32da97269cc58e97ee77b5927498a (patch)
tree8e5c53593e7e3a9db0892afefb118fd0d581e23a /storage/connect
parent0219ac1e98cc53250a8e165c4b37e83529932256 (diff)
parentb81b6d3f836feb682b963c9489f00ca1ee6a6a95 (diff)
downloadmariadb-git-f835588cc2e32da97269cc58e97ee77b5927498a.tar.gz
- Commiting merge files
Diffstat (limited to 'storage/connect')
-rw-r--r--storage/connect/connect.cc2
-rw-r--r--storage/connect/filamfix.cpp6
-rw-r--r--storage/connect/filamtxt.cpp2
-rwxr-xr-xstorage/connect/filamvct.cpp12
-rw-r--r--storage/connect/ha_connect.cc3
-rw-r--r--storage/connect/mysql-test/connect/r/alter.result11
-rw-r--r--storage/connect/mysql-test/connect/r/mysql.result21
-rw-r--r--storage/connect/mysql-test/connect/t/alter.test6
-rw-r--r--storage/connect/mysql-test/connect/t/mysql.test16
-rw-r--r--storage/connect/tabtbl.h318
10 files changed, 224 insertions, 173 deletions
diff --git a/storage/connect/connect.cc b/storage/connect/connect.cc
index 8b0aadd52c5..e495a0f62b9 100644
--- a/storage/connect/connect.cc
+++ b/storage/connect/connect.cc
@@ -197,7 +197,7 @@ PTDB CntGetTDB(PGLOBAL g, LPCSTR name, MODE mode, PHC h)
PTDB tdbp;
PTABLE tabp;
PDBUSER dup= PlgGetUser(g);
- PCATLG cat= (dup) ? dup->Catalog : NULL; // Safe over longjmp
+ volatile PCATLG cat= (dup) ? dup->Catalog : NULL; // Safe over longjmp
if (trace)
printf("CntGetTDB: name=%s mode=%d cat=%p\n", name, mode, cat);
diff --git a/storage/connect/filamfix.cpp b/storage/connect/filamfix.cpp
index 98e6520b8e0..78b6ee58b24 100644
--- a/storage/connect/filamfix.cpp
+++ b/storage/connect/filamfix.cpp
@@ -405,7 +405,7 @@ int FIXFAM::DeleteRecords(PGLOBAL g, int irc)
} else {
/*****************************************************************/
- /* Move of eventual preceeding lines is not required here. */
+ /* Move of eventual preceding lines is not required here. */
/* Set the target file as being the source file itself. */
/* Set the future Tpos, and give Spos a value to block moving. */
/*****************************************************************/
@@ -1282,7 +1282,7 @@ int BGXFAM::DeleteRecords(PGLOBAL g, int irc)
if (Tpos == Spos) {
/*******************************************************************/
- /* First line to delete. Move of eventual preceeding lines is */
+ /* First line to delete. Move of eventual preceding lines is */
/* not required here if a temporary file is not used, just the */
/* setting of future Spos and Tpos. */
/*******************************************************************/
@@ -1295,7 +1295,7 @@ int BGXFAM::DeleteRecords(PGLOBAL g, int irc)
} else {
/*****************************************************************/
- /* Move of eventual preceeding lines is not required here. */
+ /* Move of eventual preceding lines is not required here. */
/* Set the target file as being the source file itself. */
/* Set the future Tpos, and give Spos a value to block copying. */
/*****************************************************************/
diff --git a/storage/connect/filamtxt.cpp b/storage/connect/filamtxt.cpp
index 9687a52b8ef..28059d4f28a 100644
--- a/storage/connect/filamtxt.cpp
+++ b/storage/connect/filamtxt.cpp
@@ -832,7 +832,7 @@ int DOSFAM::DeleteRecords(PGLOBAL g, int irc)
} else {
/*****************************************************************/
- /* Move of eventual preceeding lines is not required here. */
+ /* Move of eventual preceding lines is not required here. */
/* Set the target file as being the source file itself. */
/* Set the future Tpos, and give Spos a value to block copying. */
/*****************************************************************/
diff --git a/storage/connect/filamvct.cpp b/storage/connect/filamvct.cpp
index 392d5b4d850..34f55cf831b 100755
--- a/storage/connect/filamvct.cpp
+++ b/storage/connect/filamvct.cpp
@@ -785,7 +785,7 @@ int VCTFAM::DeleteRecords(PGLOBAL g, int irc)
} else {
/*****************************************************************/
- /* First line to delete. Move of eventual preceeding lines is */
+ /* First line to delete. Move of eventual preceding lines is */
/* not required here, just the setting of future Spos and Tpos. */
/*****************************************************************/
T_Stream = Stream;
@@ -1601,7 +1601,7 @@ bool VCMFAM::AllocateBuffer(PGLOBAL g)
bool VCMFAM::InitInsert(PGLOBAL g)
{
int rc;
- PVCTCOL cp = (PVCTCOL)Tdbp->GetColumns();
+ volatile PVCTCOL cp = (PVCTCOL)Tdbp->GetColumns();
// We come here in MODE_INSERT only
if (Last == Nrec) {
@@ -1697,7 +1697,7 @@ int VCMFAM::DeleteRecords(PGLOBAL g, int irc)
if (Tpos == Spos) {
/*******************************************************************/
- /* First line to delete. Move of eventual preceeding lines is */
+ /* First line to delete. Move of eventual preceding lines is */
/* not required here, just setting of future Spos and Tpos. */
/*******************************************************************/
Tpos = Spos = Fpos;
@@ -2355,7 +2355,7 @@ int VECFAM::DeleteRecords(PGLOBAL g, int irc)
} else
/*****************************************************************/
- /* Move of eventual preceeding lines is not required here. */
+ /* Move of eventual preceding lines is not required here. */
/* Set the future Tpos, and give Spos a value to block copying. */
/*****************************************************************/
Spos = Tpos = Fpos;
@@ -3105,7 +3105,7 @@ int VMPFAM::DeleteRecords(PGLOBAL g, int irc)
if (Tpos == Spos) {
/*******************************************************************/
- /* First line to delete. Move of eventual preceeding lines is */
+ /* First line to delete. Move of eventual preceding lines is */
/* not required here, just setting of future Spos and Tpos. */
/*******************************************************************/
Tpos = Fpos; // Spos is set below
@@ -4091,7 +4091,7 @@ int BGVFAM::DeleteRecords(PGLOBAL g, int irc)
} else {
/*****************************************************************/
- /* Move of eventual preceeding lines is not required here. */
+ /* Move of eventual preceding lines is not required here. */
/* Set the target file as being the source file itself. */
/* Set the future Tpos, and give Spos a value to block copying. */
/*****************************************************************/
diff --git a/storage/connect/ha_connect.cc b/storage/connect/ha_connect.cc
index 3d57ae9aaaa..6f9334bb604 100644
--- a/storage/connect/ha_connect.cc
+++ b/storage/connect/ha_connect.cc
@@ -5967,7 +5967,8 @@ ha_connect::check_if_supported_inplace_alter(TABLE *altered_table,
Alter_inplace_info::ALTER_COLUMN_NAME |
Alter_inplace_info::ALTER_COLUMN_DEFAULT |
Alter_inplace_info::CHANGE_CREATE_OPTION |
- Alter_inplace_info::ALTER_RENAME | index_operations;
+ Alter_inplace_info::ALTER_RENAME |
+ Alter_inplace_info::ALTER_PARTITIONED | index_operations;
if (ha_alter_info->handler_flags & index_operations ||
!SameString(altered_table, "optname") ||
diff --git a/storage/connect/mysql-test/connect/r/alter.result b/storage/connect/mysql-test/connect/r/alter.result
index fdd1d41e190..77d775220ec 100644
--- a/storage/connect/mysql-test/connect/r/alter.result
+++ b/storage/connect/mysql-test/connect/r/alter.result
@@ -218,13 +218,22 @@ Three 3
# Changing to another engine is Ok
# However, the data file is not deleted.
#
-ALTER TABLE t1 ENGINE=MARIA;
+ALTER TABLE t1 ENGINE=ARIA;
+SHOW CREATE TABLE t1;
+Table Create Table
+t1 CREATE TABLE `t1` (
+ `d` char(10) NOT NULL /* `FLAG`=11 */,
+ `c` int(11) NOT NULL /* `FLAG`=0 */
+) ENGINE=Aria DEFAULT CHARSET=latin1 PAGE_CHECKSUM=1 /* `TABLE_TYPE`=fix `FILE_NAME`='tf1.txt' `ENDING`=1 */
+set @old_sql_mode=@@sql_mode;
+set sql_mode=ignore_bad_table_options;
SHOW CREATE TABLE t1;
Table Create Table
t1 CREATE TABLE `t1` (
`d` char(10) NOT NULL `FLAG`=11,
`c` int(11) NOT NULL `FLAG`=0
) ENGINE=Aria DEFAULT CHARSET=latin1 PAGE_CHECKSUM=1 `TABLE_TYPE`=fix `FILE_NAME`='tf1.txt' `ENDING`=1
+set sql_mode=@old_sql_mode;
SELECT * from t1;
d c
One 1
diff --git a/storage/connect/mysql-test/connect/r/mysql.result b/storage/connect/mysql-test/connect/r/mysql.result
index 51ec571486f..29f077c3d9f 100644
--- a/storage/connect/mysql-test/connect/r/mysql.result
+++ b/storage/connect/mysql-test/connect/r/mysql.result
@@ -273,3 +273,24 @@ a b c d e
255 65535 4294967295 18446744073709551615 Hello
DROP TABLE t2;
DROP TABLE t1;
+CREATE TABLE t1 (a INT);
+INSERT INTO t1 VALUES (10),(20),(30);
+CREATE TABLE t2 ENGINE=CONNECT TABLE_TYPE=MYSQL CONNECTION='mysql://root@localhost:PORT/test/t1';
+SELECT * FROM t2;
+a
+10
+20
+30
+ALTER TABLE t2 MODIFY a TINYINT;
+SHOW CREATE TABLE t2;
+Table Create Table
+t2 CREATE TABLE `t2` (
+ `a` tinyint(4) DEFAULT NULL
+) ENGINE=CONNECT DEFAULT CHARSET=latin1 CONNECTION='mysql://root@localhost:PORT/test/t1' `TABLE_TYPE`='MYSQL'
+SELECT * FROM t2;
+a
+10
+20
+30
+DROP TABLE t2;
+DROP TABLE t1;
diff --git a/storage/connect/mysql-test/connect/t/alter.test b/storage/connect/mysql-test/connect/t/alter.test
index 299381b925a..49f34996bbd 100644
--- a/storage/connect/mysql-test/connect/t/alter.test
+++ b/storage/connect/mysql-test/connect/t/alter.test
@@ -105,8 +105,12 @@ SELECT * FROM t1;
--echo # Changing to another engine is Ok
--echo # However, the data file is not deleted.
--echo #
-ALTER TABLE t1 ENGINE=MARIA;
+ALTER TABLE t1 ENGINE=ARIA;
SHOW CREATE TABLE t1;
+set @old_sql_mode=@@sql_mode;
+set sql_mode=ignore_bad_table_options;
+SHOW CREATE TABLE t1;
+set sql_mode=@old_sql_mode;
SELECT * from t1;
SELECT * from t2;
diff --git a/storage/connect/mysql-test/connect/t/mysql.test b/storage/connect/mysql-test/connect/t/mysql.test
index bcba0db753d..e245587e562 100644
--- a/storage/connect/mysql-test/connect/t/mysql.test
+++ b/storage/connect/mysql-test/connect/t/mysql.test
@@ -454,3 +454,19 @@ SELECT * FROM t2;
DROP TABLE t2;
DROP TABLE t1;
+
+#
+# MDEV-6085 ALTER TABLE looses the connection string
+#
+CREATE TABLE t1 (a INT);
+INSERT INTO t1 VALUES (10),(20),(30);
+--replace_result $PORT PORT
+--eval CREATE TABLE t2 ENGINE=CONNECT TABLE_TYPE=MYSQL CONNECTION='mysql://root@localhost:$PORT/test/t1'
+SELECT * FROM t2;
+ALTER TABLE t2 MODIFY a TINYINT;
+--replace_result $PORT PORT
+SHOW CREATE TABLE t2;
+SELECT * FROM t2;
+DROP TABLE t2;
+DROP TABLE t1;
+
diff --git a/storage/connect/tabtbl.h b/storage/connect/tabtbl.h
index a28d852f332..8bf440985ea 100644
--- a/storage/connect/tabtbl.h
+++ b/storage/connect/tabtbl.h
@@ -1,160 +1,160 @@
-/*************** TabTbl H Declares Source Code File (.H) ***************/
-/* Name: TABTBL.H Version 1.3 */
-/* */
-/* (C) Copyright to the author Olivier BERTRAND 2008-2013 */
-/* */
-/* This file contains the TDBTBL classes declares. */
-/***********************************************************************/
-#include "block.h"
-#include "colblk.h"
-#include "tabutil.h"
-
-typedef class TBLDEF *PTBLDEF;
-typedef class TDBTBL *PTDBTBL;
-typedef class TDBTBM *PTDBTBM;
-typedef class MYSQLC *PMYC;
-
-/***********************************************************************/
-/* Defines the structures used for distributed TBM tables. */
-/***********************************************************************/
-typedef struct _TBMtable *PTBMT;
-
-typedef struct _TBMtable {
- PTBMT Next; // Points to next data table struct
- PTABLE Tap; // Points to the sub table
- PGLOBAL G; // Needed in thread routine
- bool Complete; // TRUE when all results are read
- bool Ready; // TRUE when results are there
- int Rows; // Total number of rows read so far
- int ProgCur; // Current pos
- int ProgMax; // Max pos
- int Rc; // Return code
- THD *Thd;
- pthread_attr_t attr; // ???
- pthread_t Tid; // CheckOpen thread ID
- } TBMT;
-
-/***********************************************************************/
-/* TBL table. */
-/***********************************************************************/
-class DllExport TBLDEF : public PRXDEF { /* Logical table description */
- friend class TDBTBL;
- friend class TDBTBC;
- public:
- // Constructor
- TBLDEF(void);
-
- // Implementation
- virtual const char *GetType(void) {return "TBL";}
-
- // Methods
- virtual bool DefineAM(PGLOBAL g, LPCSTR am, int poff);
- virtual PTDB GetTable(PGLOBAL g, MODE m);
-
- protected:
- // Members
- bool Accept; /* TRUE if bad tables are accepted */
- bool Thread; /* Use thread for remote tables */
- int Maxerr; /* Maximum number of bad tables */
- int Ntables; /* Number of tables */
- }; // end of TBLDEF
-
-/***********************************************************************/
-/* This is the TBL Access Method class declaration. */
-/***********************************************************************/
-class DllExport TDBTBL : public TDBPRX {
- friend class TBTBLK;
- public:
- // Constructor
- TDBTBL(PTBLDEF tdp = NULL);
-
- // Implementation
- virtual AMT GetAmType(void) {return TYPE_AM_TBL;}
-
- // Methods
- virtual void ResetDB(void);
- virtual int GetRecpos(void) {return Rows;}
- virtual int GetBadLines(void) {return (int)Nbc;}
-
- // Database routines
- virtual PCOL MakeCol(PGLOBAL g, PCOLDEF cdp, PCOL cprec, int n);
+/*************** TabTbl H Declares Source Code File (.H) ***************/
+/* Name: TABTBL.H Version 1.3 */
+/* */
+/* (C) Copyright to the author Olivier BERTRAND 2008-2013 */
+/* */
+/* This file contains the TDBTBL classes declares. */
+/***********************************************************************/
+#include "block.h"
+#include "colblk.h"
+#include "tabutil.h"
+
+typedef class TBLDEF *PTBLDEF;
+typedef class TDBTBL *PTDBTBL;
+typedef class TDBTBM *PTDBTBM;
+typedef class MYSQLC *PMYC;
+
+/***********************************************************************/
+/* Defines the structures used for distributed TBM tables. */
+/***********************************************************************/
+typedef struct _TBMtable *PTBMT;
+
+typedef struct _TBMtable {
+ PTBMT Next; // Points to next data table struct
+ PTABLE Tap; // Points to the sub table
+ PGLOBAL G; // Needed in thread routine
+ bool Complete; // TRUE when all results are read
+ bool Ready; // TRUE when results are there
+ int Rows; // Total number of rows read so far
+ int ProgCur; // Current pos
+ int ProgMax; // Max pos
+ int Rc; // Return code
+ THD *Thd;
+ pthread_attr_t attr; // ???
+ pthread_t Tid; // CheckOpen thread ID
+ } TBMT;
+
+/***********************************************************************/
+/* TBL table. */
+/***********************************************************************/
+class DllExport TBLDEF : public PRXDEF { /* Logical table description */
+ friend class TDBTBL;
+ friend class TDBTBC;
+ public:
+ // Constructor
+ TBLDEF(void);
+
+ // Implementation
+ virtual const char *GetType(void) {return "TBL";}
+
+ // Methods
+ virtual bool DefineAM(PGLOBAL g, LPCSTR am, int poff);
+ virtual PTDB GetTable(PGLOBAL g, MODE m);
+
+ protected:
+ // Members
+ bool Accept; /* TRUE if bad tables are accepted */
+ bool Thread; /* Use thread for remote tables */
+ int Maxerr; /* Maximum number of bad tables */
+ int Ntables; /* Number of tables */
+ }; // end of TBLDEF
+
+/***********************************************************************/
+/* This is the TBL Access Method class declaration. */
+/***********************************************************************/
+class DllExport TDBTBL : public TDBPRX {
+ friend class TBTBLK;
+ public:
+ // Constructor
+ TDBTBL(PTBLDEF tdp = NULL);
+
+ // Implementation
+ virtual AMT GetAmType(void) {return TYPE_AM_TBL;}
+
+ // Methods
+ virtual void ResetDB(void);
+ virtual int GetRecpos(void) {return Rows;}
+ virtual int GetBadLines(void) {return (int)Nbc;}
+
+ // Database routines
+ virtual PCOL MakeCol(PGLOBAL g, PCOLDEF cdp, PCOL cprec, int n);
virtual int Cardinality(PGLOBAL g);
- virtual int GetMaxSize(PGLOBAL g);
- virtual int RowNumber(PGLOBAL g, bool b = FALSE);
- virtual PCOL InsertSpecialColumn(PGLOBAL g, PCOL scp);
- virtual bool OpenDB(PGLOBAL g);
- virtual int ReadDB(PGLOBAL g);
-
- protected:
- // Internal functions
- bool InitTableList(PGLOBAL g);
- bool TestFil(PGLOBAL g, PCFIL filp, PTABLE tabp);
-
- // Members
- PTABLE Tablist; // Points to the table list
- PTABLE CurTable; // Points to the current table
- bool Accept; // TRUE if bad tables are accepted
- int Maxerr; // Maximum number of bad tables
- int Nbc; // Number of bad connections
- int Rows; // Used for RowID
- int Crp; // Used for CurPos
- }; // end of class TDBTBL
-
-/***********************************************************************/
-/* Class TBTBLK: TDBPLG TABID special column descriptor. */
-/***********************************************************************/
-class TBTBLK : public TIDBLK {
- public:
- // The constructor must restore Value because XOBJECT has a void
- // constructor called by default that set Value to NULL
- TBTBLK(PVAL valp) {Value = valp;}
-
- // Methods
- virtual void ReadColumn(PGLOBAL g);
-
- // Fake operator new used to change TIDBLK into SDTBLK
- void * operator new(size_t size, TIDBLK *sp) {return sp;}
-
-#if !defined(__BORLANDC__)
- // Avoid warning C4291 by defining a matching dummy delete operator
- void operator delete(void *, TIDBLK*) {}
- void operator delete(void *, size_t size) {}
-#endif
-
- protected:
- // Must not have additional members
- }; // end of class TBTBLK
-
-/***********************************************************************/
-/* This is the TBM Access Method class declaration. */
-/***********************************************************************/
-class DllExport TDBTBM : public TDBTBL {
- friend class TBTBLK;
- public:
- // Constructor
- TDBTBM(PTBLDEF tdp = NULL);
-
- // Methods
- virtual void ResetDB(void);
-
- // Database routines
- 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);
-
- protected:
- // Internal functions
- bool OpenTables(PGLOBAL g);
- int ReadNextRemote(PGLOBAL g);
-
- // Members
- PTBMT Tmp; // To data table TBMT structures
- PTBMT Cmp; // Current data table PLGF (to move to TDBTBL)
- PTBMT Bmp; // To bad (unconnected) PLGF structures
- bool Done; // TRUE after first GetAllResults
- int Nrc; // Number of remote connections
- int Nlc; // Number of local connections
- }; // end of class TDBTBM
-
-pthread_handler_t ThreadOpen(void *p);
+ virtual int GetMaxSize(PGLOBAL g);
+ virtual int RowNumber(PGLOBAL g, bool b = FALSE);
+ virtual PCOL InsertSpecialColumn(PGLOBAL g, PCOL scp);
+ virtual bool OpenDB(PGLOBAL g);
+ virtual int ReadDB(PGLOBAL g);
+
+ protected:
+ // Internal functions
+ bool InitTableList(PGLOBAL g);
+ bool TestFil(PGLOBAL g, PCFIL filp, PTABLE tabp);
+
+ // Members
+ PTABLE Tablist; // Points to the table list
+ PTABLE CurTable; // Points to the current table
+ bool Accept; // TRUE if bad tables are accepted
+ int Maxerr; // Maximum number of bad tables
+ int Nbc; // Number of bad connections
+ int Rows; // Used for RowID
+ int Crp; // Used for CurPos
+ }; // end of class TDBTBL
+
+/***********************************************************************/
+/* Class TBTBLK: TDBPLG TABID special column descriptor. */
+/***********************************************************************/
+class TBTBLK : public TIDBLK {
+ public:
+ // The constructor must restore Value because XOBJECT has a void
+ // constructor called by default that set Value to NULL
+ TBTBLK(PVAL valp) {Value = valp;}
+
+ // Methods
+ virtual void ReadColumn(PGLOBAL g);
+
+ // Fake operator new used to change TIDBLK into SDTBLK
+ void * operator new(size_t size, TIDBLK *sp) {return sp;}
+
+#if !defined(__BORLANDC__)
+ // Avoid warning C4291 by defining a matching dummy delete operator
+ void operator delete(void *, TIDBLK*) {}
+ void operator delete(void *, size_t size) {}
+#endif
+
+ protected:
+ // Must not have additional members
+ }; // end of class TBTBLK
+
+/***********************************************************************/
+/* This is the TBM Access Method class declaration. */
+/***********************************************************************/
+class DllExport TDBTBM : public TDBTBL {
+ friend class TBTBLK;
+ public:
+ // Constructor
+ TDBTBM(PTBLDEF tdp = NULL);
+
+ // Methods
+ virtual void ResetDB(void);
+
+ // Database routines
+ 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);
+
+ protected:
+ // Internal functions
+ bool OpenTables(PGLOBAL g);
+ int ReadNextRemote(PGLOBAL g);
+
+ // Members
+ PTBMT Tmp; // To data table TBMT structures
+ PTBMT Cmp; // Current data table PLGF (to move to TDBTBL)
+ PTBMT Bmp; // To bad (unconnected) PLGF structures
+ bool Done; // TRUE after first GetAllResults
+ int Nrc; // Number of remote connections
+ int Nlc; // Number of local connections
+ }; // end of class TDBTBM
+
+pthread_handler_t ThreadOpen(void *p);