Commit dd129ed3 authored by patg@radha.local's avatar patg@radha.local

Federated Storage Engine, bug 9925 "Federated query processor (step 2 or step 3) not using logic in

WHERE statement"
parent db1fb6a7
This diff is collapsed.
...@@ -30,6 +30,42 @@ ...@@ -30,6 +30,42 @@
#define FEDERATED_QUERY_BUFFER_SIZE STRING_BUFFER_USUAL_SIZE * 5 #define FEDERATED_QUERY_BUFFER_SIZE STRING_BUFFER_USUAL_SIZE * 5
#define FEDERATED_RECORDS_IN_RANGE 2 #define FEDERATED_RECORDS_IN_RANGE 2
#define FEDERATED_INFO " SHOW TABLE STATUS LIKE "
#define FEDERATED_SELECT "SELECT "
#define FEDERATED_WHERE " WHERE "
#define FEDERATED_FROM " FROM "
#define FEDERATED_PERCENT "%"
#define FEDERATED_IS " IS "
#define FEDERATED_NULL " NULL "
#define FEDERATED_ISNULL " IS NULL "
#define FEDERATED_LIKE " LIKE "
#define FEDERATED_TRUNCATE "TRUNCATE "
#define FEDERATED_DELETE "DELETE "
#define FEDERATED_INSERT "INSERT INTO "
#define FEDERATED_LIMIT1 " LIMIT 1"
#define FEDERATED_VALUES "VALUES "
#define FEDERATED_UPDATE "UPDATE "
#define FEDERATED_SET "SET "
#define FEDERATED_AND " AND "
#define FEDERATED_CONJUNCTION ") AND ("
#define FEDERATED_OR " OR "
#define FEDERATED_NOT " NOT "
#define FEDERATED_STAR "* "
#define FEDERATED_SPACE " "
#define FEDERATED_SQUOTE "'"
#define FEDERATED_COMMA ", "
#define FEDERATED_DQOUTE '"'
#define FEDERATED_BTICK "`"
#define FEDERATED_OPENPAREN " ("
#define FEDERATED_CLOSEPAREN ") "
#define FEDERATED_NE " != "
#define FEDERATED_GT " > "
#define FEDERATED_LT " < "
#define FEDERATED_LE " <= "
#define FEDERATED_GE " >= "
#define FEDERATED_EQ " = "
#define FEDERATED_1EQ0 " 1=0"
/* /*
FEDERATED_SHARE is a structure that will be shared amoung all open handlers FEDERATED_SHARE is a structure that will be shared amoung all open handlers
The example implements the minimum of what you will probably need. The example implements the minimum of what you will probably need.
...@@ -65,7 +101,7 @@ class ha_federated: public handler ...@@ -65,7 +101,7 @@ class ha_federated: public handler
THR_LOCK_DATA lock; /* MySQL lock */ THR_LOCK_DATA lock; /* MySQL lock */
FEDERATED_SHARE *share; /* Shared lock info */ FEDERATED_SHARE *share; /* Shared lock info */
MYSQL *mysql; /* MySQL connection */ MYSQL *mysql; /* MySQL connection */
MYSQL_RES *result; MYSQL_RES *stored_result;
bool scan_flag; bool scan_flag;
uint ref_length; uint ref_length;
uint fetch_num; // stores the fetch num uint fetch_num; // stores the fetch num
...@@ -84,7 +120,7 @@ private: ...@@ -84,7 +120,7 @@ private:
public: public:
ha_federated(TABLE *table): handler(table), ha_federated(TABLE *table): handler(table),
mysql(0), result(0), scan_flag(0), mysql(0), stored_result(0), scan_flag(0),
ref_length(sizeof(MYSQL_ROW_OFFSET)), current_position(0) ref_length(sizeof(MYSQL_ROW_OFFSET)), current_position(0)
{ {
} }
...@@ -145,13 +181,18 @@ public: ...@@ -145,13 +181,18 @@ public:
double scan_time() double scan_time()
{ {
DBUG_PRINT("info", DBUG_PRINT("info",
("records %d", records)); return (double)(records*1000); ("records %d", records));
return (double)(records*1000);
} }
/* /*
The next method will never be called if you do not implement indexes. The next method will never be called if you do not implement indexes.
*/ */
double read_time(uint index, uint ranges, ha_rows rows) double read_time(uint index, uint ranges, ha_rows rows)
{ {
/*
Per Brian, this number is bugus, but this method must be implemented,
and at a later date, he intends to document this issue for handler code
*/
return (double) rows / 20.0+1; return (double) rows / 20.0+1;
} }
...@@ -190,7 +231,7 @@ public: ...@@ -190,7 +231,7 @@ public:
int rnd_init(bool scan); //required int rnd_init(bool scan); //required
int rnd_end(); int rnd_end();
int rnd_next(byte *buf); //required int rnd_next(byte *buf); //required
int rnd_pos(byte *buf, byte *pos); //required int rnd_pos(byte *buf, byte *pos); //required
void position(const byte *record); //required void position(const byte *record); //required
void info(uint); //required void info(uint); //required
......
...@@ -5370,11 +5370,11 @@ ER_SCALE_BIGGER_THAN_PRECISION 42000 S1009 ...@@ -5370,11 +5370,11 @@ ER_SCALE_BIGGER_THAN_PRECISION 42000 S1009
eng "Scale may not be larger than the precision (column '%-.64s')." eng "Scale may not be larger than the precision (column '%-.64s')."
ER_WRONG_LOCK_OF_SYSTEM_TABLE ER_WRONG_LOCK_OF_SYSTEM_TABLE
eng "You can't combine write-locking of system '%-.64s.%-.64s' table with other tables" eng "You can't combine write-locking of system '%-.64s.%-.64s' table with other tables"
ER_CONNECT_TO_FOREIGN_DATA_SRC ER_CONNECT_TO_FOREIGN_DATA_SOURCE
eng "Unable to connect to foreign data source - database '%s'!" eng "Unable to connect to foreign data source - database '%s'!"
ER_QUERY_ON_FOREIGN_DATA_SRC ER_QUERY_ON_FOREIGN_DATA_SOURCE
eng "There was a problem processing the query on the foreign data source. Data source error: '%-.64s'" eng "There was a problem processing the query on the foreign data source. Data source error: '%-.64s'"
ER_FOREIGN_DATA_SRC_DOESNT_EXIST ER_FOREIGN_DATA_SOURCE_DOESNT_EXIST
eng "The foreign data source you are trying to reference does not exist. Data source error : '%-.64s'" eng "The foreign data source you are trying to reference does not exist. Data source error : '%-.64s'"
ER_FOREIGN_DATA_STRING_INVALID_CANT_CREATE ER_FOREIGN_DATA_STRING_INVALID_CANT_CREATE
eng "Can't create federated table. The data source connection string '%-.64s' is not in the correct format" eng "Can't create federated table. The data source connection string '%-.64s' is not in the correct format"
......
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