mirror of
https://github.com/MariaDB/server.git
synced 2025-07-27 18:02:13 +03:00
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. include/mysql.h: removed declaration of cli_fetch_lengths per Kostja's suggestion libmysql/libmysql.c: moved mysql_fetch_lengths to client.c (for server to access) per Kostja's suggestion sql-common/client.c: added back 'static' to function definition, added mysql_fetch_lengths sql/ha_federated.cc: changed to use defines as opposed to hardcoded values sql/ha_federated.h: took out duplicate table_flag, fixed a resolve mistake
This commit is contained in:
@ -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 @@ private:
|
||||
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);
|
||||
|
||||
@ -107,8 +106,8 @@ public:
|
||||
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);
|
||||
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
|
||||
|
Reference in New Issue
Block a user