Commit 055273c1 authored by unknown's avatar unknown

Merge pgalbraith@bk-internal.mysql.com:/home/bk/mysql-5.0

into krsna.patg.net:/home/patg/mysql-5.0


sql/handler.cc:
  Auto merged
parents c4409a7c 6bb0cacd
...@@ -1115,25 +1115,6 @@ mysql_fetch_field(MYSQL_RES *result) ...@@ -1115,25 +1115,6 @@ mysql_fetch_field(MYSQL_RES *result)
} }
/**************************************************************************
Get column lengths of the current row
If one uses mysql_use_result, res->lengths contains the length information,
else the lengths are calculated from the offset between pointers.
**************************************************************************/
ulong * STDCALL
mysql_fetch_lengths(MYSQL_RES *res)
{
MYSQL_ROW column;
if (!(column=res->current_row))
return 0; /* Something is wrong */
if (res->data)
(*res->methods->fetch_lengths)(res->lengths, column, res->field_count);
return res->lengths;
}
/************************************************************************** /**************************************************************************
Move to a specific row and column Move to a specific row and column
**************************************************************************/ **************************************************************************/
......
This diff is collapsed.
This diff is collapsed.
...@@ -2628,6 +2628,25 @@ mysql_fetch_row(MYSQL_RES *res) ...@@ -2628,6 +2628,25 @@ mysql_fetch_row(MYSQL_RES *res)
} }
/**************************************************************************
Get column lengths of the current row
If one uses mysql_use_result, res->lengths contains the length information,
else the lengths are calculated from the offset between pointers.
**************************************************************************/
ulong * STDCALL
mysql_fetch_lengths(MYSQL_RES *res)
{
MYSQL_ROW column;
if (!(column=res->current_row))
return 0; /* Something is wrong */
if (res->data)
(*res->methods->fetch_lengths)(res->lengths, column, res->field_count);
return res->lengths;
}
int STDCALL int STDCALL
mysql_options(MYSQL *mysql,enum mysql_option option, const char *arg) mysql_options(MYSQL *mysql,enum mysql_option option, const char *arg)
{ {
......
This diff is collapsed.
...@@ -32,13 +32,16 @@ ...@@ -32,13 +32,16 @@
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.
*/ */
//FIX document
typedef struct st_federated_share { typedef struct st_federated_share {
char *table_name; char *table_name;
char *table_base_name; char *table_base_name;
// the primary select query to be used in rnd_init /*
the primary select query to be used in rnd_init
*/
char *select_query; char *select_query;
// remote host info, parse_url supplies /*
remote host info, parse_url supplies
*/
char *scheme; char *scheme;
char *hostname; char *hostname;
char *username; char *username;
...@@ -62,6 +65,7 @@ class ha_federated: public handler ...@@ -62,6 +65,7 @@ class ha_federated: public handler
FEDERATED_SHARE *share; /* Shared lock info */ FEDERATED_SHARE *share; /* Shared lock info */
MYSQL *mysql; MYSQL *mysql;
MYSQL_RES *result; MYSQL_RES *result;
bool scan_flag;
uint ref_length; uint ref_length;
uint fetch_num; // stores the fetch num uint fetch_num; // stores the fetch num
MYSQL_ROW_OFFSET current_position; // Current position used by ::position() MYSQL_ROW_OFFSET current_position; // Current position used by ::position()
...@@ -72,11 +76,12 @@ class ha_federated: public handler ...@@ -72,11 +76,12 @@ class ha_federated: public handler
return errorcode otherwise return errorcode otherwise
*/ */
uint convert_row_to_internal_format(byte *buf, MYSQL_ROW row); uint convert_row_to_internal_format(byte *buf, MYSQL_ROW row);
bool create_where_from_key(String *to, KEY *key_info, const byte *key, uint key_length); bool create_where_from_key(String *to, KEY *key_info,
const byte *key, uint key_length);
public: public:
ha_federated(TABLE *table): handler(table), ha_federated(TABLE *table): handler(table),
mysql(0), mysql(0), result(0), scan_flag(0),
ref_length(sizeof(MYSQL_ROW_OFFSET)), current_position(0) ref_length(sizeof(MYSQL_ROW_OFFSET)), current_position(0)
{ {
} }
...@@ -101,8 +106,8 @@ class ha_federated: public handler ...@@ -101,8 +106,8 @@ class ha_federated: public handler
ulong table_flags() const ulong table_flags() const
{ {
return (HA_TABLE_SCAN_ON_INDEX | HA_NOT_EXACT_COUNT | return (HA_TABLE_SCAN_ON_INDEX | HA_NOT_EXACT_COUNT |
HA_PRIMARY_KEY_IN_READ_INDEX | HA_FILE_BASED | HA_AUTO_PART_KEY | HA_PRIMARY_KEY_IN_READ_INDEX | HA_FILE_BASED |
HA_TABLE_SCAN_ON_INDEX | HA_CAN_INDEX_BLOBS); HA_AUTO_PART_KEY | HA_CAN_INDEX_BLOBS);
} }
/* /*
This is a bitmap of flags that says how the storage engine This is a bitmap of flags that says how the storage engine
...@@ -126,11 +131,16 @@ class ha_federated: public handler ...@@ -126,11 +131,16 @@ class ha_federated: public handler
/* /*
Called in test_quick_select to determine if indexes should be used. Called in test_quick_select to determine if indexes should be used.
*/ */
virtual double scan_time() { DBUG_PRINT("ha_federated::scan_time", ("rows %d", records)); return (double)(records*2); } virtual double scan_time()
{
DBUG_PRINT("ha_federated::scan_time",
("rows %d", records)); return (double)(records*2);
}
/* /*
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.
*/ */
virtual double read_time(uint index, uint ranges, ha_rows rows) { return (double) rows / 20.0+1; } virtual double read_time(uint index, uint ranges, ha_rows rows)
{ return (double) rows / 20.0+1; }
/* /*
Everything below are methods that we implment in ha_federated.cc. Everything below are methods that we implment in ha_federated.cc.
...@@ -173,3 +183,6 @@ class ha_federated: public handler ...@@ -173,3 +183,6 @@ class ha_federated: public handler
THR_LOCK_DATA **store_lock(THD *thd, THR_LOCK_DATA **to, THR_LOCK_DATA **store_lock(THD *thd, THR_LOCK_DATA **to,
enum thr_lock_type lock_type); //required enum thr_lock_type lock_type); //required
}; };
bool federated_db_init(void);
bool federated_db_end(void);
...@@ -395,6 +395,16 @@ int ha_init() ...@@ -395,6 +395,16 @@ int ha_init()
ha_was_inited_ok(ht++); ha_was_inited_ok(ht++);
} }
#endif #endif
#ifdef HAVE_FEDERATED_DB
if (have_federated_db == SHOW_OPTION_YES)
{
if (federated_db_init())
{
have_federated_db= SHOW_OPTION_DISABLED;
error= 1;
}
}
#endif
#ifdef HAVE_ARCHIVE_DB #ifdef HAVE_ARCHIVE_DB
if (have_archive_db == SHOW_OPTION_YES) if (have_archive_db == SHOW_OPTION_YES)
{ {
...@@ -441,6 +451,10 @@ int ha_panic(enum ha_panic_function flag) ...@@ -441,6 +451,10 @@ int ha_panic(enum ha_panic_function flag)
if (have_ndbcluster == SHOW_OPTION_YES) if (have_ndbcluster == SHOW_OPTION_YES)
error|=ndbcluster_end(); error|=ndbcluster_end();
#endif #endif
#ifdef HAVE_FEDERATED_DB
if (have_federated_db == SHOW_OPTION_YES)
error|= federated_db_end();
#endif
#ifdef HAVE_ARCHIVE_DB #ifdef HAVE_ARCHIVE_DB
if (have_archive_db == SHOW_OPTION_YES) if (have_archive_db == SHOW_OPTION_YES)
error|= archive_db_end(); error|= archive_db_end();
......
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