Commit 4b7bc748 authored by patg@krsna.patg.net's avatar patg@krsna.patg.net

WL #2094 Federated Storage Handler

This is the first changeset of suggested changes recommended in Kostja's 
review of my patch, 1.1846, which includes only functionality changes. 
Style changes/Documentation patch to follow.
parent e3579fa6
......@@ -499,8 +499,6 @@ MYSQL_FIELD_OFFSET STDCALL mysql_field_seek(MYSQL_RES *result,
MYSQL_FIELD_OFFSET offset);
MYSQL_ROW STDCALL mysql_fetch_row(MYSQL_RES *result);
unsigned long * STDCALL mysql_fetch_lengths(MYSQL_RES *result);
void STDCALL cli_fetch_lengths(unsigned long *to, MYSQL_ROW column,
unsigned int field_count);
MYSQL_FIELD * STDCALL mysql_fetch_field(MYSQL_RES *result);
MYSQL_RES * STDCALL mysql_list_fields(MYSQL *mysql, const char *table,
const char *wild);
......
......@@ -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
**************************************************************************/
......
......@@ -1121,7 +1121,7 @@ void mysql_read_default_options(struct st_mysql_options *options,
else the lengths are calculated from the offset between pointers.
**************************************************************************/
void cli_fetch_lengths(ulong *to, MYSQL_ROW column,
static void cli_fetch_lengths(ulong *to, MYSQL_ROW column,
unsigned int field_count)
{
ulong *prev_length;
......@@ -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
mysql_options(MYSQL *mysql,enum mysql_option option, const char *arg)
{
......
......@@ -560,10 +560,10 @@ static int parse_url(FEDERATED_SHARE *share, TABLE *table,
if (!share->port)
{
if (strcmp(share->hostname, "localhost") == 0)
share->socket= my_strdup("/tmp/mysql.sock", MYF(0));
if (strcmp(share->hostname, my_localhost) == 0)
share->socket= my_strdup(MYSQL_UNIX_ADDR, MYF(0));
else
share->port= 3306;
share->port= MYSQL_PORT;
}
DBUG_PRINT("ha_federated::parse_url",
......@@ -616,8 +616,7 @@ uint ha_federated::convert_row_to_internal_format(byte *record, MYSQL_ROW row)
DBUG_ENTER("ha_federated::convert_row_to_internal_format");
num_fields= mysql_num_fields(result);
lengths= (ulong*) my_malloc(num_fields * sizeof(ulong), MYF(0));
cli_fetch_lengths((ulong*) lengths, row, num_fields);
lengths= mysql_fetch_lengths(result);
memset(record, 0, table->s->null_bytes);
......@@ -628,8 +627,6 @@ uint ha_federated::convert_row_to_internal_format(byte *record, MYSQL_ROW row)
else
(*field)->store(row[x], lengths[x], &my_charset_bin);
}
my_free((gptr) lengths, MYF(0));
lengths= 0;
DBUG_RETURN(0);
}
......
......@@ -76,7 +76,6 @@ class ha_federated: public handler
return errorcode otherwise
*/
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);
......@@ -106,9 +105,9 @@ class ha_federated: public handler
*/
ulong table_flags() const
{
return (HA_TABLE_SCAN_ON_INDEX | HA_NOT_EXACT_COUNT |
HA_PRIMARY_KEY_IN_READ_INDEX | HA_FILE_BASED | HA_AUTO_PART_KEY |
HA_TABLE_SCAN_ON_INDEX | HA_CAN_INDEX_BLOBS);
return (HA_TABLE_SCAN_ON_INDEX | HA_NOT_EXACT_COUNT |
HA_PRIMARY_KEY_IN_READ_INDEX | HA_FILE_BASED |
HA_AUTO_PART_KEY | HA_CAN_INDEX_BLOBS);
}
/*
This is a bitmap of flags that says how the storage engine
......
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