mirror of
https://github.com/MariaDB/server.git
synced 2025-01-30 18:41:56 +01:00
CONNECT engine fixes after 10.0 merge.
Adaptation to new API, small simplifications and bug fixes
This commit is contained in:
parent
337c1b3ee8
commit
6bd49441b5
18 changed files with 295 additions and 741 deletions
|
@ -176,7 +176,7 @@ static int dbfhead(PGLOBAL g, FILE *file, PSZ fn, DBFHEADER *buf)
|
||||||
/* DBFColumns: constructs the result blocks containing the description */
|
/* DBFColumns: constructs the result blocks containing the description */
|
||||||
/* of all the columns of a DBF file that will be retrieved by #GetData. */
|
/* of all the columns of a DBF file that will be retrieved by #GetData. */
|
||||||
/****************************************************************************/
|
/****************************************************************************/
|
||||||
PQRYRES DBFColumns(PGLOBAL g, char *fn, BOOL info)
|
PQRYRES DBFColumns(PGLOBAL g, const char *fn, BOOL info)
|
||||||
{
|
{
|
||||||
static int dbtype[] = {DB_CHAR, DB_SHORT, DB_CHAR,
|
static int dbtype[] = {DB_CHAR, DB_SHORT, DB_CHAR,
|
||||||
DB_INT, DB_INT, DB_SHORT};
|
DB_INT, DB_INT, DB_SHORT};
|
||||||
|
|
|
@ -19,7 +19,7 @@ typedef class DBMFAM *PDBMFAM;
|
||||||
/****************************************************************************/
|
/****************************************************************************/
|
||||||
/* Functions used externally. */
|
/* Functions used externally. */
|
||||||
/****************************************************************************/
|
/****************************************************************************/
|
||||||
PQRYRES DBFColumns(PGLOBAL g, char *fn, BOOL info);
|
PQRYRES DBFColumns(PGLOBAL g, const char *fn, BOOL info);
|
||||||
|
|
||||||
/****************************************************************************/
|
/****************************************************************************/
|
||||||
/* This is the base class for dBASE file access methods. */
|
/* This is the base class for dBASE file access methods. */
|
||||||
|
|
File diff suppressed because it is too large
Load diff
|
@ -62,6 +62,8 @@ typedef class user_connect *PCONNECT;
|
||||||
typedef struct ha_table_option_struct TOS, *PTOS;
|
typedef struct ha_table_option_struct TOS, *PTOS;
|
||||||
typedef struct ha_field_option_struct FOS, *PFOS;
|
typedef struct ha_field_option_struct FOS, *PFOS;
|
||||||
|
|
||||||
|
extern handlerton *connect_hton;
|
||||||
|
|
||||||
/** @brief
|
/** @brief
|
||||||
CONNECT_SHARE is a structure that will be shared among all open handlers.
|
CONNECT_SHARE is a structure that will be shared among all open handlers.
|
||||||
This example implements the minimum of what you will probably need.
|
This example implements the minimum of what you will probably need.
|
||||||
|
@ -71,10 +73,6 @@ typedef struct st_connect_share {
|
||||||
uint table_name_length, use_count;
|
uint table_name_length, use_count;
|
||||||
mysql_mutex_t mutex;
|
mysql_mutex_t mutex;
|
||||||
THR_LOCK lock;
|
THR_LOCK lock;
|
||||||
#if !defined(MARIADB)
|
|
||||||
PTOS table_options;
|
|
||||||
PFOS field_options;
|
|
||||||
#endif // !MARIADB
|
|
||||||
} CONNECT_SHARE;
|
} CONNECT_SHARE;
|
||||||
|
|
||||||
typedef class ha_connect *PHC;
|
typedef class ha_connect *PHC;
|
||||||
|
@ -111,8 +109,6 @@ public:
|
||||||
TABLE *GetTable(void) {return table;}
|
TABLE *GetTable(void) {return table;}
|
||||||
bool IsSameIndex(PIXDEF xp1, PIXDEF xp2);
|
bool IsSameIndex(PIXDEF xp1, PIXDEF xp2);
|
||||||
|
|
||||||
PCONNECT GetUser(THD *thd);
|
|
||||||
PGLOBAL GetPlug(THD *thd);
|
|
||||||
PTDB GetTDB(PGLOBAL g);
|
PTDB GetTDB(PGLOBAL g);
|
||||||
bool OpenTable(PGLOBAL g, bool del= false);
|
bool OpenTable(PGLOBAL g, bool del= false);
|
||||||
bool IsOpened(void);
|
bool IsOpened(void);
|
||||||
|
@ -148,9 +144,7 @@ public:
|
||||||
return (HA_NO_TRANSACTIONS | HA_REC_NOT_IN_SEQ | HA_HAS_RECORDS |
|
return (HA_NO_TRANSACTIONS | HA_REC_NOT_IN_SEQ | HA_HAS_RECORDS |
|
||||||
HA_NO_AUTO_INCREMENT | HA_NO_PREFIX_CHAR_KEYS |
|
HA_NO_AUTO_INCREMENT | HA_NO_PREFIX_CHAR_KEYS |
|
||||||
HA_NO_COPY_ON_ALTER |
|
HA_NO_COPY_ON_ALTER |
|
||||||
#if defined(MARIADB)
|
|
||||||
HA_CAN_VIRTUAL_COLUMNS |
|
HA_CAN_VIRTUAL_COLUMNS |
|
||||||
#endif // MARIADB
|
|
||||||
HA_NULL_IN_KEY | HA_BINLOG_ROW_CAPABLE | HA_BINLOG_STMT_CAPABLE);
|
HA_NULL_IN_KEY | HA_BINLOG_ROW_CAPABLE | HA_BINLOG_STMT_CAPABLE);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -361,9 +355,6 @@ const char *GetValStr(OPVAL vop, bool neg);
|
||||||
Called by delete_table and rename_table
|
Called by delete_table and rename_table
|
||||||
*/
|
*/
|
||||||
int delete_or_rename_table(const char *from, const char *to);
|
int delete_or_rename_table(const char *from, const char *to);
|
||||||
#if defined(MARIADB)
|
|
||||||
bool pre_create(THD *thd, HA_CREATE_INFO *crt_info, void *alt_info);
|
|
||||||
#endif // MARIADB
|
|
||||||
int create(const char *name, TABLE *form,
|
int create(const char *name, TABLE *form,
|
||||||
HA_CREATE_INFO *create_info); ///< required
|
HA_CREATE_INFO *create_info); ///< required
|
||||||
bool check_if_incompatible_data(HA_CREATE_INFO *info,
|
bool check_if_incompatible_data(HA_CREATE_INFO *info,
|
||||||
|
@ -375,23 +366,6 @@ const char *GetValStr(OPVAL vop, bool neg);
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
bool check_privileges(THD *thd, PTOS options);
|
bool check_privileges(THD *thd, PTOS options);
|
||||||
char *GetListOption(const char *opname, const char *oplist, const char *def= NULL);
|
|
||||||
#if defined(MARIADB)
|
|
||||||
char *encode(PGLOBAL g, char *cnm);
|
|
||||||
bool add_fields(THD *thd, void *alter_info,
|
|
||||||
LEX_STRING *field_name,
|
|
||||||
enum_field_types type,
|
|
||||||
char *length, char *decimals,
|
|
||||||
uint type_modifier,
|
|
||||||
// Item *default_value, Item *on_update_value,
|
|
||||||
LEX_STRING *comment,
|
|
||||||
// char *change,
|
|
||||||
// List<String> *interval_list,
|
|
||||||
CHARSET_INFO *cs,
|
|
||||||
// uint uint_geom_type,
|
|
||||||
void *vcol_info,
|
|
||||||
engine_option_value *create_options);
|
|
||||||
#endif // MARIADB
|
|
||||||
|
|
||||||
// Members
|
// Members
|
||||||
static ulong num; // Tracable handler number
|
static ulong num; // Tracable handler number
|
||||||
|
@ -409,10 +383,6 @@ protected:
|
||||||
bool valid_info; // True if xinfo is valid
|
bool valid_info; // True if xinfo is valid
|
||||||
bool stop; // Used when creating index
|
bool stop; // Used when creating index
|
||||||
int indexing; // Type of indexing for CONNECT
|
int indexing; // Type of indexing for CONNECT
|
||||||
#if !defined(MARIADB)
|
|
||||||
PTOS table_options;
|
|
||||||
PFOS field_options;
|
|
||||||
#endif // !MARIADB
|
|
||||||
THR_LOCK_DATA lock_data;
|
THR_LOCK_DATA lock_data;
|
||||||
|
|
||||||
public:
|
public:
|
||||||
|
|
|
@ -111,6 +111,7 @@ ERROR HY000: Cannot open DATADIR/test/t1.dbf
|
||||||
SHOW WARNINGS;
|
SHOW WARNINGS;
|
||||||
Level Code Message
|
Level Code Message
|
||||||
Error 1105 Cannot open DATADIR/test/t1.dbf
|
Error 1105 Cannot open DATADIR/test/t1.dbf
|
||||||
|
Error 1030 Got error 122 "Internal (unspecified) error in handler" from storage engine CONNECT
|
||||||
CREATE PROCEDURE test.dbf_field(in fieldno INT, in content BLOB) DETERMINISTIC
|
CREATE PROCEDURE test.dbf_field(in fieldno INT, in content BLOB) DETERMINISTIC
|
||||||
BEGIN
|
BEGIN
|
||||||
SELECT '---';
|
SELECT '---';
|
||||||
|
|
|
@ -24,7 +24,7 @@ size DOUBLE(12,0) NOT NULL flag=5
|
||||||
) ENGINE=CONNECT TABLE_TYPE=DIR FILE_NAME='*.*';
|
) ENGINE=CONNECT TABLE_TYPE=DIR FILE_NAME='*.*';
|
||||||
SELECT fname, ftype, size FROM t1 WHERE size>0;
|
SELECT fname, ftype, size FROM t1 WHERE size>0;
|
||||||
fname ftype size
|
fname ftype size
|
||||||
t1 .frm 8654
|
t1 .frm 1081
|
||||||
SELECT user();
|
SELECT user();
|
||||||
user()
|
user()
|
||||||
user@localhost
|
user@localhost
|
||||||
|
|
|
@ -106,7 +106,7 @@ Table Create Table
|
||||||
t2 CREATE TABLE `t2` (
|
t2 CREATE TABLE `t2` (
|
||||||
`a` int(11) DEFAULT NULL,
|
`a` int(11) DEFAULT NULL,
|
||||||
`b` varchar(10) DEFAULT NULL
|
`b` varchar(10) DEFAULT NULL
|
||||||
) ENGINE=CONNECT DEFAULT CHARSET=latin1 `TABLE_TYPE`=MYSQL `TABNAME`='t1' `OPTION_LIST`='host=localhost,user=root,port=PORT'
|
) ENGINE=CONNECT DEFAULT CHARSET=latin1 `TABLE_TYPE`='MYSQL' `TABNAME`='t1' `OPTION_LIST`='host=localhost,user=root,port=PORT'
|
||||||
SELECT * FROM t2;
|
SELECT * FROM t2;
|
||||||
a b
|
a b
|
||||||
NULL NULL
|
NULL NULL
|
||||||
|
@ -175,7 +175,7 @@ SHOW CREATE TABLE t2;
|
||||||
Table Create Table
|
Table Create Table
|
||||||
t2 CREATE TABLE `t2` (
|
t2 CREATE TABLE `t2` (
|
||||||
`a` smallint(6) DEFAULT NULL
|
`a` smallint(6) DEFAULT NULL
|
||||||
) ENGINE=CONNECT DEFAULT CHARSET=latin1 `TABLE_TYPE`=MYSQL `TABNAME`='t1' `OPTION_LIST`='host=localhost,user=root,port=PORT'
|
) ENGINE=CONNECT DEFAULT CHARSET=latin1 `TABLE_TYPE`='MYSQL' `TABNAME`='t1' `OPTION_LIST`='host=localhost,user=root,port=PORT'
|
||||||
SELECT * FROM t2;
|
SELECT * FROM t2;
|
||||||
a
|
a
|
||||||
DROP TABLE t2, t1;
|
DROP TABLE t2, t1;
|
||||||
|
@ -190,7 +190,7 @@ SHOW CREATE TABLE t2;
|
||||||
Table Create Table
|
Table Create Table
|
||||||
t2 CREATE TABLE `t2` (
|
t2 CREATE TABLE `t2` (
|
||||||
`a` int(9) DEFAULT NULL
|
`a` int(9) DEFAULT NULL
|
||||||
) ENGINE=CONNECT DEFAULT CHARSET=latin1 `TABLE_TYPE`=MYSQL `TABNAME`='t1' `OPTION_LIST`='host=localhost,user=root,port=PORT'
|
) ENGINE=CONNECT DEFAULT CHARSET=latin1 `TABLE_TYPE`='MYSQL' `TABNAME`='t1' `OPTION_LIST`='host=localhost,user=root,port=PORT'
|
||||||
SELECT * FROM t2;
|
SELECT * FROM t2;
|
||||||
a
|
a
|
||||||
DROP TABLE t2, t1;
|
DROP TABLE t2, t1;
|
||||||
|
@ -205,7 +205,7 @@ SHOW CREATE TABLE t2;
|
||||||
Table Create Table
|
Table Create Table
|
||||||
t2 CREATE TABLE `t2` (
|
t2 CREATE TABLE `t2` (
|
||||||
`a` int(11) DEFAULT NULL
|
`a` int(11) DEFAULT NULL
|
||||||
) ENGINE=CONNECT DEFAULT CHARSET=latin1 `TABLE_TYPE`=MYSQL `TABNAME`='t1' `OPTION_LIST`='host=localhost,user=root,port=PORT'
|
) ENGINE=CONNECT DEFAULT CHARSET=latin1 `TABLE_TYPE`='MYSQL' `TABNAME`='t1' `OPTION_LIST`='host=localhost,user=root,port=PORT'
|
||||||
SELECT * FROM t2;
|
SELECT * FROM t2;
|
||||||
a
|
a
|
||||||
DROP TABLE t2, t1;
|
DROP TABLE t2, t1;
|
||||||
|
@ -220,7 +220,7 @@ SHOW CREATE TABLE t2;
|
||||||
Table Create Table
|
Table Create Table
|
||||||
t2 CREATE TABLE `t2` (
|
t2 CREATE TABLE `t2` (
|
||||||
`a` bigint(20) DEFAULT NULL
|
`a` bigint(20) DEFAULT NULL
|
||||||
) ENGINE=CONNECT DEFAULT CHARSET=latin1 `TABLE_TYPE`=MYSQL `TABNAME`='t1' `OPTION_LIST`='host=localhost,user=root,port=PORT'
|
) ENGINE=CONNECT DEFAULT CHARSET=latin1 `TABLE_TYPE`='MYSQL' `TABNAME`='t1' `OPTION_LIST`='host=localhost,user=root,port=PORT'
|
||||||
SELECT * FROM t2;
|
SELECT * FROM t2;
|
||||||
a
|
a
|
||||||
DROP TABLE t2, t1;
|
DROP TABLE t2, t1;
|
||||||
|
@ -238,7 +238,7 @@ SHOW CREATE TABLE t2;
|
||||||
Table Create Table
|
Table Create Table
|
||||||
t2 CREATE TABLE `t2` (
|
t2 CREATE TABLE `t2` (
|
||||||
`a` varchar(10) DEFAULT NULL
|
`a` varchar(10) DEFAULT NULL
|
||||||
) ENGINE=CONNECT DEFAULT CHARSET=latin1 `TABLE_TYPE`=MYSQL `TABNAME`='t1' `OPTION_LIST`='host=localhost,user=root,port=PORT'
|
) ENGINE=CONNECT DEFAULT CHARSET=latin1 `TABLE_TYPE`='MYSQL' `TABNAME`='t1' `OPTION_LIST`='host=localhost,user=root,port=PORT'
|
||||||
SELECT * FROM t2;
|
SELECT * FROM t2;
|
||||||
a
|
a
|
||||||
DROP TABLE t2, t1;
|
DROP TABLE t2, t1;
|
||||||
|
@ -253,7 +253,7 @@ SHOW CREATE TABLE t2;
|
||||||
Table Create Table
|
Table Create Table
|
||||||
t2 CREATE TABLE `t2` (
|
t2 CREATE TABLE `t2` (
|
||||||
`a` varchar(10) DEFAULT NULL
|
`a` varchar(10) DEFAULT NULL
|
||||||
) ENGINE=CONNECT DEFAULT CHARSET=latin1 `TABLE_TYPE`=MYSQL `TABNAME`='t1' `OPTION_LIST`='host=localhost,user=root,port=PORT'
|
) ENGINE=CONNECT DEFAULT CHARSET=latin1 `TABLE_TYPE`='MYSQL' `TABNAME`='t1' `OPTION_LIST`='host=localhost,user=root,port=PORT'
|
||||||
SELECT * FROM t2;
|
SELECT * FROM t2;
|
||||||
a
|
a
|
||||||
DROP TABLE t2, t1;
|
DROP TABLE t2, t1;
|
||||||
|
@ -274,7 +274,7 @@ SHOW CREATE TABLE t2;
|
||||||
Table Create Table
|
Table Create Table
|
||||||
t2 CREATE TABLE `t2` (
|
t2 CREATE TABLE `t2` (
|
||||||
`a` date DEFAULT NULL
|
`a` date DEFAULT NULL
|
||||||
) ENGINE=CONNECT DEFAULT CHARSET=latin1 `TABLE_TYPE`=MYSQL `TABNAME`='t1' `OPTION_LIST`='host=localhost,user=root,port=PORT'
|
) ENGINE=CONNECT DEFAULT CHARSET=latin1 `TABLE_TYPE`='MYSQL' `TABNAME`='t1' `OPTION_LIST`='host=localhost,user=root,port=PORT'
|
||||||
SELECT * FROM t2;
|
SELECT * FROM t2;
|
||||||
a
|
a
|
||||||
DROP TABLE t2, t1;
|
DROP TABLE t2, t1;
|
||||||
|
|
|
@ -4,9 +4,6 @@
|
||||||
CREATE TABLE t1 (
|
CREATE TABLE t1 (
|
||||||
a INT NOT NULL,
|
a INT NOT NULL,
|
||||||
message CHAR(10)) ENGINE=connect;
|
message CHAR(10)) ENGINE=connect;
|
||||||
Warnings:
|
|
||||||
Warning 1105 No table_type. Was set to DOS
|
|
||||||
Warning 1105 No file name. Table will use t1.dos
|
|
||||||
INSERT INTO t1 VALUES (1,'Testing'),(2,'dos table'),(3,'t1');
|
INSERT INTO t1 VALUES (1,'Testing'),(2,'dos table'),(3,'t1');
|
||||||
SELECT * FROM t1;
|
SELECT * FROM t1;
|
||||||
a message
|
a message
|
||||||
|
|
|
@ -59,9 +59,6 @@ END//
|
||||||
# Testing DOS table changes
|
# Testing DOS table changes
|
||||||
#
|
#
|
||||||
CREATE TABLE t1 ENGINE=connect AS SELECT * FROM employee;
|
CREATE TABLE t1 ENGINE=connect AS SELECT * FROM employee;
|
||||||
Warnings:
|
|
||||||
Warning 1105 No table_type. Was set to DOS
|
|
||||||
Warning 1105 No file name. Table will use t1.dos
|
|
||||||
CALL test.tst_up();
|
CALL test.tst_up();
|
||||||
serialno name sex title manager department secretary salary
|
serialno name sex title manager department secretary salary
|
||||||
74200 BANCROFT 2 SALESMAN 70012 0318 24888 9600.00
|
74200 BANCROFT 2 SALESMAN 70012 0318 24888 9600.00
|
||||||
|
@ -157,9 +154,6 @@ serialno name sex title manager department secretary salary
|
||||||
# Testing DOS table changes
|
# Testing DOS table changes
|
||||||
#
|
#
|
||||||
CREATE TABLE t1 ENGINE=connect mapped=yes AS SELECT * FROM employee;
|
CREATE TABLE t1 ENGINE=connect mapped=yes AS SELECT * FROM employee;
|
||||||
Warnings:
|
|
||||||
Warning 1105 No table_type. Was set to DOS
|
|
||||||
Warning 1105 No file name. Table will use t1.dos
|
|
||||||
CALL test.tst_up();
|
CALL test.tst_up();
|
||||||
serialno name sex title manager department secretary salary
|
serialno name sex title manager department secretary salary
|
||||||
74200 BANCROFT 2 SALESMAN 70012 0318 24888 9600.00
|
74200 BANCROFT 2 SALESMAN 70012 0318 24888 9600.00
|
||||||
|
|
|
@ -94,6 +94,25 @@ enum enum_field_types PLGtoMYSQL(int type, bool dbf)
|
||||||
return mytype;
|
return mytype;
|
||||||
} // end of PLGtoMYSQL
|
} // end of PLGtoMYSQL
|
||||||
|
|
||||||
|
/************************************************************************/
|
||||||
|
/* Convert from PlugDB type to MySQL type name */
|
||||||
|
/************************************************************************/
|
||||||
|
const char *PLGtoMYSQLtype(int type, bool dbf)
|
||||||
|
{
|
||||||
|
switch (type) {
|
||||||
|
case TYPE_INT: return "INT";
|
||||||
|
case TYPE_SHORT: return "SMALLINT";
|
||||||
|
case TYPE_FLOAT: return "DOUBLE";
|
||||||
|
case TYPE_DATE: return dbf ? "DATE" : "DATETIME";
|
||||||
|
case TYPE_STRING: return "VARCHAR";
|
||||||
|
case TYPE_BIGINT: return "BIGINT";
|
||||||
|
case TYPE_TINY: return "TINYINT";
|
||||||
|
default: return "CHAR(0)";
|
||||||
|
} // endswitch mytype
|
||||||
|
|
||||||
|
return "CHAR(0)";
|
||||||
|
} // end of PLGtoMYSQL
|
||||||
|
|
||||||
/************************************************************************/
|
/************************************************************************/
|
||||||
/* Convert from MySQL type to PlugDB type number */
|
/* Convert from MySQL type to PlugDB type number */
|
||||||
/************************************************************************/
|
/************************************************************************/
|
||||||
|
|
|
@ -2,6 +2,7 @@
|
||||||
/* Prototypes of Functions used externally. */
|
/* Prototypes of Functions used externally. */
|
||||||
/***********************************************************************/
|
/***********************************************************************/
|
||||||
enum enum_field_types PLGtoMYSQL(int type, bool dbf);
|
enum enum_field_types PLGtoMYSQL(int type, bool dbf);
|
||||||
|
const char *PLGtoMYSQLtype(int type, bool dbf);
|
||||||
int MYSQLtoPLG(char *typname);
|
int MYSQLtoPLG(char *typname);
|
||||||
int MYSQLtoPLG(int mytype);
|
int MYSQLtoPLG(int mytype);
|
||||||
char *MyDateFmt(int mytype);
|
char *MyDateFmt(int mytype);
|
||||||
|
|
|
@ -34,6 +34,8 @@ class DllExport RELDEF : public BLOCK { // Relation definition block
|
||||||
PCATLG GetCat(void) {return Cat;}
|
PCATLG GetCat(void) {return Cat;}
|
||||||
virtual const char *GetType(void) = 0;
|
virtual const char *GetType(void) = 0;
|
||||||
virtual AMT GetDefType(void) = 0;
|
virtual AMT GetDefType(void) = 0;
|
||||||
|
void SetName(const char *str) { Name=(char*)str; }
|
||||||
|
void SetCat(PCATLG cat) { Cat=cat; }
|
||||||
|
|
||||||
// Methods
|
// Methods
|
||||||
virtual bool DeleteTableFile(PGLOBAL g) {return true;}
|
virtual bool DeleteTableFile(PGLOBAL g) {return true;}
|
||||||
|
|
|
@ -75,7 +75,7 @@ extern "C" int trace;
|
||||||
/* of types (TYPE_STRING < TYPE_FLOAT < TYPE_INT) (1 < 2 < 7). */
|
/* of types (TYPE_STRING < TYPE_FLOAT < TYPE_INT) (1 < 2 < 7). */
|
||||||
/* If these values are changed, this will have to be revisited. */
|
/* If these values are changed, this will have to be revisited. */
|
||||||
/***********************************************************************/
|
/***********************************************************************/
|
||||||
PQRYRES CSVColumns(PGLOBAL g, char *fn, char sep, char q,
|
PQRYRES CSVColumns(PGLOBAL g, const char *fn, char sep, char q,
|
||||||
int hdr, int mxr, bool info)
|
int hdr, int mxr, bool info)
|
||||||
{
|
{
|
||||||
static int dbtype[] = {DB_CHAR, DB_SHORT, DB_CHAR,
|
static int dbtype[] = {DB_CHAR, DB_SHORT, DB_CHAR,
|
||||||
|
|
|
@ -14,7 +14,7 @@ typedef class TDBFMT *PTDBFMT;
|
||||||
/***********************************************************************/
|
/***********************************************************************/
|
||||||
/* Functions used externally. */
|
/* Functions used externally. */
|
||||||
/***********************************************************************/
|
/***********************************************************************/
|
||||||
PQRYRES CSVColumns(PGLOBAL g, char *fn, char sep, char q,
|
PQRYRES CSVColumns(PGLOBAL g, const char *fn, char sep, char q,
|
||||||
int hdr, int mxr, bool info);
|
int hdr, int mxr, bool info);
|
||||||
|
|
||||||
/***********************************************************************/
|
/***********************************************************************/
|
||||||
|
|
|
@ -79,8 +79,6 @@
|
||||||
|
|
||||||
extern "C" int trace;
|
extern "C" int trace;
|
||||||
|
|
||||||
int open_table_def(THD *thd, TABLE_SHARE *share, uint db_flags);
|
|
||||||
|
|
||||||
/* ---------------------------- Class TBLDEF ---------------------------- */
|
/* ---------------------------- Class TBLDEF ---------------------------- */
|
||||||
|
|
||||||
/**************************************************************************/
|
/**************************************************************************/
|
||||||
|
@ -220,9 +218,8 @@ PCOL TDBTBL::InsertSpecialColumn(PGLOBAL g, PCOL scp)
|
||||||
PTDB TDBTBL::GetSubTable(PGLOBAL g, PTBL tblp, PTABLE tabp)
|
PTDB TDBTBL::GetSubTable(PGLOBAL g, PTBL tblp, PTABLE tabp)
|
||||||
{
|
{
|
||||||
char *db, key[256];
|
char *db, key[256];
|
||||||
uint k, flags;
|
uint k;
|
||||||
PTDB tdbp = NULL;
|
PTDB tdbp = NULL;
|
||||||
TABLE_LIST table_list;
|
|
||||||
TABLE_SHARE *s;
|
TABLE_SHARE *s;
|
||||||
PCATLG cat = To_Def->GetCat();
|
PCATLG cat = To_Def->GetCat();
|
||||||
PHC hc = ((MYCAT*)cat)->GetHandler();
|
PHC hc = ((MYCAT*)cat)->GetHandler();
|
||||||
|
@ -236,29 +233,17 @@ PTDB TDBTBL::GetSubTable(PGLOBAL g, PTBL tblp, PTABLE tabp)
|
||||||
else
|
else
|
||||||
db = (char*)hc->GetDBName(NULL);
|
db = (char*)hc->GetDBName(NULL);
|
||||||
|
|
||||||
table_list.init_one_table(db, strlen(db),
|
k = sprintf(key, "%s", db) + 1;
|
||||||
tblp->Name, strlen(tblp->Name),
|
k += sprintf(key + k, "%s", tblp->Name);
|
||||||
NULL, TL_IGNORE);
|
|
||||||
k = sprintf(key, "%s", db);
|
|
||||||
k += sprintf(key + ++k, "%s", tblp->Name);
|
|
||||||
key[++k] = 0;
|
key[++k] = 0;
|
||||||
|
|
||||||
if (!(s = alloc_table_share(&table_list, key, ++k))) {
|
if (!(s = alloc_table_share(db, tblp->Name, key, ++k))) {
|
||||||
strcpy(g->Message, "Error allocating share\n");
|
strcpy(g->Message, "Error allocating share\n");
|
||||||
return NULL;
|
return NULL;
|
||||||
} // endif s
|
} // endif s
|
||||||
|
|
||||||
// 1 8 16
|
if (!open_table_def(thd, s)) {
|
||||||
//flags = READ_ALL | DONT_OPEN_TABLES | DONT_OPEN_MASTER_REG;
|
if (plugin_data(s->db_plugin, handlerton*) != connect_hton) {
|
||||||
//flags = 25;
|
|
||||||
flags = 24;
|
|
||||||
|
|
||||||
if (!open_table_def(thd, s, flags)) {
|
|
||||||
#ifdef DBUG_OFF
|
|
||||||
if (stricmp(s->db_plugin->name.str, "connect")) {
|
|
||||||
#else
|
|
||||||
if (stricmp((*s->db_plugin)->name.str, "connect")) {
|
|
||||||
#endif
|
|
||||||
#if defined(MYSQL_SUPPORT)
|
#if defined(MYSQL_SUPPORT)
|
||||||
// Access sub-table via MySQL API
|
// Access sub-table via MySQL API
|
||||||
if (!(tdbp= cat->GetTable(g, tabp, MODE_READ, "MYSQL"))) {
|
if (!(tdbp= cat->GetTable(g, tabp, MODE_READ, "MYSQL"))) {
|
||||||
|
|
|
@ -92,7 +92,7 @@ user_connect::~user_connect()
|
||||||
/****************************************************************************/
|
/****************************************************************************/
|
||||||
/* Initialization. */
|
/* Initialization. */
|
||||||
/****************************************************************************/
|
/****************************************************************************/
|
||||||
bool user_connect::user_init(PHC hc)
|
bool user_connect::user_init()
|
||||||
{
|
{
|
||||||
// Initialize Plug-like environment
|
// Initialize Plug-like environment
|
||||||
PACTIVITY ap= NULL;
|
PACTIVITY ap= NULL;
|
||||||
|
@ -113,7 +113,7 @@ bool user_connect::user_init(PHC hc)
|
||||||
return true;
|
return true;
|
||||||
} // endif g->
|
} // endif g->
|
||||||
|
|
||||||
dup->Catalog= new MYCAT(hc);
|
dup->Catalog= new MYCAT(NULL);
|
||||||
|
|
||||||
ap= new ACTIVITY;
|
ap= new ACTIVITY;
|
||||||
memset(ap, 0, sizeof(ACTIVITY));
|
memset(ap, 0, sizeof(ACTIVITY));
|
||||||
|
@ -132,6 +132,13 @@ bool user_connect::user_init(PHC hc)
|
||||||
} // end of user_init
|
} // end of user_init
|
||||||
|
|
||||||
|
|
||||||
|
void user_connect::SetHandler(ha_connect *hc)
|
||||||
|
{
|
||||||
|
PDBUSER dup= (PDBUSER)g->Activityp->Aptr;
|
||||||
|
MYCAT *mc= (MYCAT*)dup->Catalog;
|
||||||
|
mc->SetHandler(hc);
|
||||||
|
}
|
||||||
|
|
||||||
/****************************************************************************/
|
/****************************************************************************/
|
||||||
/* Check whether we begin a new query and if so cleanup the previous one. */
|
/* Check whether we begin a new query and if so cleanup the previous one. */
|
||||||
/****************************************************************************/
|
/****************************************************************************/
|
||||||
|
|
|
@ -57,15 +57,15 @@ public:
|
||||||
virtual ~user_connect();
|
virtual ~user_connect();
|
||||||
|
|
||||||
// Implementation
|
// Implementation
|
||||||
bool user_init(ha_connect *hc);
|
bool user_init();
|
||||||
|
void SetHandler(ha_connect *hc);
|
||||||
bool CheckCleanup(void);
|
bool CheckCleanup(void);
|
||||||
bool CheckQueryID(void) {return thdp->query_id > last_query_id;}
|
bool CheckQueryID(void) {return thdp->query_id > last_query_id;}
|
||||||
bool CheckQuery(query_id_t vid) {return last_query_id > vid;}
|
bool CheckQuery(query_id_t vid) {return last_query_id > vid;}
|
||||||
|
|
||||||
protected:
|
|
||||||
// Members
|
// Members
|
||||||
static PCONNECT to_users; // To the chain of users
|
|
||||||
THD *thdp; // To the user thread
|
THD *thdp; // To the user thread
|
||||||
|
static PCONNECT to_users; // To the chain of users
|
||||||
PCONNECT next; // Next user in chain
|
PCONNECT next; // Next user in chain
|
||||||
PCONNECT previous; // Previous user in chain
|
PCONNECT previous; // Previous user in chain
|
||||||
PGLOBAL g; // The common handle to CONNECT
|
PGLOBAL g; // The common handle to CONNECT
|
||||||
|
|
|
@ -675,7 +675,7 @@ void *CHRBLK::GetValPtrEx(int n)
|
||||||
memcpy(Valp, Chrp + n * Long, Long);
|
memcpy(Valp, Chrp + n * Long, Long);
|
||||||
|
|
||||||
if (IsNull(n))
|
if (IsNull(n))
|
||||||
return "";
|
return const_cast<char *>("");
|
||||||
|
|
||||||
if (Blanks) {
|
if (Blanks) {
|
||||||
// The (fast) way this is done works only for blocks such
|
// The (fast) way this is done works only for blocks such
|
||||||
|
@ -857,7 +857,7 @@ void *STRBLK::GetValPtr(int n)
|
||||||
void *STRBLK::GetValPtrEx(int n)
|
void *STRBLK::GetValPtrEx(int n)
|
||||||
{
|
{
|
||||||
ChkIndx(n);
|
ChkIndx(n);
|
||||||
return (Strp[n]) ? Strp[n] : "";
|
return (Strp[n]) ? Strp[n] : const_cast<char*>("");
|
||||||
} // end of GetValPtrEx
|
} // end of GetValPtrEx
|
||||||
|
|
||||||
/***********************************************************************/
|
/***********************************************************************/
|
||||||
|
|
Loading…
Add table
Reference in a new issue