Below is the list of changes that have just been committed into a local
5.1 repository of antony. When antony does a push these changes will
be propagated to the main repository and, within 24 hours after the
push, to the public repository.
For information on how to access the public repository
see http://dev.mysql.com/doc/mysql/en/installing-source-tree.html
ChangeSet@stripped, 2006-12-26 11:30:50-08:00, antony@stripped +14 -0
Merge ppcg5.local:/Users/antony/Work/mysql-5.1-engines
into ppcg5.local:/Users/antony/Work/mysql-5.1-engines-merge
MERGE: 1.2343.1.23
configure.in@stripped, 2006-12-26 11:30:47-08:00, antony@stripped +0 -1
fix merge conflict
MERGE: 1.404.1.2
include/mysql.h@stripped, 2006-12-26 11:27:45-08:00, antony@stripped +0 -0
Auto merged
MERGE: 1.170.1.5
mysql-test/Makefile.am@stripped, 2006-12-26 11:27:45-08:00, antony@stripped +0 -0
Auto merged
MERGE: 1.93.1.1
sql/sql_class.h@stripped, 2006-12-26 11:27:45-08:00, antony@stripped +0 -0
Auto merged
MERGE: 1.331.1.2
sql/sql_insert.cc@stripped, 2006-12-26 11:27:45-08:00, antony@stripped +0 -0
Auto merged
MERGE: 1.234.1.3
sql/sql_parse.cc@stripped, 2006-12-26 11:27:46-08:00, antony@stripped +0 -0
Auto merged
MERGE: 1.611.1.1
storage/federated/ha_federated.cc@stripped, 2006-12-26 11:27:46-08:00, antony@stripped +0
-0
Auto merged
MERGE: 1.90.1.3
storage/myisam/mi_check.c@stripped, 2006-12-26 11:27:46-08:00, antony@stripped +0 -0
Auto merged
MERGE: 1.153.1.1
storage/myisam/mi_dynrec.c@stripped, 2006-12-26 11:27:46-08:00, antony@stripped +0 -0
Auto merged
MERGE: 1.49.1.2
storage/myisam/mi_packrec.c@stripped, 2006-12-26 11:27:46-08:00, antony@stripped +0 -0
Auto merged
MERGE: 1.39.1.1
storage/myisam/mi_range.c@stripped, 2006-12-26 11:27:46-08:00, antony@stripped +0 -0
Auto merged
MERGE: 1.17.1.1
storage/myisam/mi_test1.c@stripped, 2006-12-26 11:27:46-08:00, antony@stripped +0 -0
Auto merged
MERGE: 1.30.1.1
storage/myisam/mi_write.c@stripped, 2006-12-26 11:27:46-08:00, antony@stripped +0 -0
Auto merged
MERGE: 1.61.1.1
storage/myisam/rt_split.c@stripped, 2006-12-26 11:27:46-08:00, antony@stripped +0 -0
Auto merged
MERGE: 1.16.1.1
# This is a BitKeeper patch. What follows are the unified diffs for the
# set of deltas contained in the patch. The rest of the patch, the part
# that BitKeeper cares about, is below these diffs.
# User: antony
# Host: ppcg5.local
# Root: /Users/antony/Work/mysql-5.1-engines-merge/RESYNC
--- 1.408/configure.in 2006-12-26 11:30:59 -08:00
+++ 1.409/configure.in 2006-12-26 11:30:59 -08:00
@@ -15,7 +15,6 @@ DOT_FRM_VERSION=6
# See the libtool docs for information on how to do shared lib versions.
SHARED_LIB_MAJOR_VERSION=15
SHARED_LIB_VERSION=$SHARED_LIB_MAJOR_VERSION:0:0
-
# Set all version vars based on $VERSION. How do we do this more elegant ?
# Remember that regexps needs to quote [ and ] since this is run through m4
MYSQL_NO_DASH_VERSION=`echo $VERSION | sed -e "s|[[a-z]]*-.*$||"`
--- 1.172/include/mysql.h 2006-12-26 11:30:59 -08:00
+++ 1.173/include/mysql.h 2006-12-26 11:30:59 -08:00
@@ -2,8 +2,7 @@
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
- the Free Software Foundation; either version 2 of the License, or
- (at your option) any later version.
+ the Free Software Foundation; version 2 of the License.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
@@ -85,9 +84,9 @@ extern char *mysql_unix_port;
#define IS_PRI_KEY(n) ((n) & PRI_KEY_FLAG)
#define IS_NOT_NULL(n) ((n) & NOT_NULL_FLAG)
#define IS_BLOB(n) ((n) & BLOB_FLAG)
-#define IS_NUM(t) ((t) <= FIELD_TYPE_INT24 || (t) == FIELD_TYPE_YEAR || (t) ==
FIELD_TYPE_NEWDECIMAL)
+#define IS_NUM(t) ((t) <= MYSQL_TYPE_INT24 || (t) == MYSQL_TYPE_YEAR || (t) ==
MYSQL_TYPE_NEWDECIMAL)
#define IS_NUM_FIELD(f) ((f)->flags & NUM_FLAG)
-#define INTERNAL_NUM_FIELD(f) (((f)->type <= FIELD_TYPE_INT24 &&
((f)->type != FIELD_TYPE_TIMESTAMP || (f)->length == 14 || (f)->length == 8)) ||
(f)->type == FIELD_TYPE_YEAR)
+#define INTERNAL_NUM_FIELD(f) (((f)->type <= MYSQL_TYPE_INT24 &&
((f)->type != MYSQL_TYPE_TIMESTAMP || (f)->length == 14 || (f)->length == 8)) ||
(f)->type == MYSQL_TYPE_YEAR)
typedef struct st_mysql_field {
--- 1.154/storage/myisam/mi_check.c 2006-12-26 11:30:59 -08:00
+++ 1.155/storage/myisam/mi_check.c 2006-12-26 11:30:59 -08:00
@@ -2,8 +2,7 @@
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
- the Free Software Foundation; either version 2 of the License, or
- (at your option) any later version.
+ the Free Software Foundation; version 2 of the License.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
--- 1.52/storage/myisam/mi_dynrec.c 2006-12-26 11:30:59 -08:00
+++ 1.53/storage/myisam/mi_dynrec.c 2006-12-26 11:30:59 -08:00
@@ -2,8 +2,7 @@
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
- the Free Software Foundation; either version 2 of the License, or
- (at your option) any later version.
+ the Free Software Foundation; version 2 of the License.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
--- 1.41/storage/myisam/mi_packrec.c 2006-12-26 11:30:59 -08:00
+++ 1.42/storage/myisam/mi_packrec.c 2006-12-26 11:30:59 -08:00
@@ -2,8 +2,7 @@
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
- the Free Software Foundation; either version 2 of the License, or
- (at your option) any later version.
+ the Free Software Foundation; version 2 of the License.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
--- 1.18/storage/myisam/mi_range.c 2006-12-26 11:30:59 -08:00
+++ 1.19/storage/myisam/mi_range.c 2006-12-26 11:30:59 -08:00
@@ -2,8 +2,7 @@
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
- the Free Software Foundation; either version 2 of the License, or
- (at your option) any later version.
+ the Free Software Foundation; version 2 of the License.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
--- 1.31/storage/myisam/mi_test1.c 2006-12-26 11:30:59 -08:00
+++ 1.32/storage/myisam/mi_test1.c 2006-12-26 11:30:59 -08:00
@@ -2,8 +2,7 @@
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
- the Free Software Foundation; either version 2 of the License, or
- (at your option) any later version.
+ the Free Software Foundation; version 2 of the License.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
--- 1.62/storage/myisam/mi_write.c 2006-12-26 11:30:59 -08:00
+++ 1.63/storage/myisam/mi_write.c 2006-12-26 11:30:59 -08:00
@@ -2,8 +2,7 @@
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
- the Free Software Foundation; either version 2 of the License, or
- (at your option) any later version.
+ the Free Software Foundation; version 2 of the License.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
--- 1.334/sql/sql_class.h 2006-12-26 11:30:59 -08:00
+++ 1.335/sql/sql_class.h 2006-12-26 11:30:59 -08:00
@@ -2,8 +2,7 @@
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
- the Free Software Foundation; either version 2 of the License, or
- (at your option) any later version.
+ the Free Software Foundation; version 2 of the License.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
--- 1.238/sql/sql_insert.cc 2006-12-26 11:30:59 -08:00
+++ 1.239/sql/sql_insert.cc 2006-12-26 11:30:59 -08:00
@@ -2,8 +2,7 @@
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
- the Free Software Foundation; either version 2 of the License, or
- (at your option) any later version.
+ the Free Software Foundation; version 2 of the License.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
@@ -1292,7 +1291,7 @@ int check_that_all_fields_are_given_valu
{
if (!bitmap_is_set(write_set, (*field)->field_index) &&
((*field)->flags & NO_DEFAULT_VALUE_FLAG) &&
- ((*field)->real_type() != FIELD_TYPE_ENUM))
+ ((*field)->real_type() != MYSQL_TYPE_ENUM))
{
bool view= FALSE;
if (table_list)
--- 1.614/sql/sql_parse.cc 2006-12-26 11:30:59 -08:00
+++ 1.615/sql/sql_parse.cc 2006-12-26 11:31:00 -08:00
@@ -7358,6 +7358,7 @@ bool mysql_create_index(THD *thd, TABLE_
bzero((char*) &create_info,sizeof(create_info));
create_info.db_type= 0;
create_info.default_table_charset= thd->variables.collation_database;
+ create_info.row_type= ROW_TYPE_NOT_USED;
DBUG_RETURN(mysql_alter_table(thd,table_list->db,table_list->table_name,
&create_info, table_list,
fields, keys, 0, (ORDER*)0,
@@ -7374,6 +7375,7 @@ bool mysql_drop_index(THD *thd, TABLE_LI
bzero((char*) &create_info,sizeof(create_info));
create_info.db_type= 0;
create_info.default_table_charset= thd->variables.collation_database;
+ create_info.row_type= ROW_TYPE_NOT_USED;
alter_info->clear();
alter_info->flags= ALTER_DROP_INDEX;
DBUG_RETURN(mysql_alter_table(thd,table_list->db,table_list->table_name,
--- 1.17/storage/myisam/rt_split.c 2006-12-26 11:31:00 -08:00
+++ 1.18/storage/myisam/rt_split.c 2006-12-26 11:31:00 -08:00
@@ -3,8 +3,7 @@
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
- the Free Software Foundation; either version 2 of the License, or
- (at your option) any later version.
+ the Free Software Foundation; version 2 of the License.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
--- 1.92/storage/federated/ha_federated.cc 2006-12-26 11:31:00 -08:00
+++ 1.93/storage/federated/ha_federated.cc 2006-12-26 11:31:00 -08:00
@@ -2,8 +2,7 @@
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
- the Free Software Foundation; either version 2 of the License, or
- (at your option) any later version.
+ the Free Software Foundation; version 2 of the License.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
@@ -381,8 +380,8 @@ static handler *federated_create_handler
static byte *federated_get_key(FEDERATED_SHARE *share, uint *length,
my_bool not_used __attribute__ ((unused)))
{
- *length= share->connect_string_length;
- return (byte*) share->scheme;
+ *length= share->share_key_length;
+ return (byte*) share->share_key;
}
/*
@@ -549,13 +548,14 @@ static int parse_url_error(FEDERATED_SHA
int buf_len;
DBUG_ENTER("ha_federated parse_url_error");
- if (share->scheme)
+ if (share->connection_string)
{
DBUG_PRINT("info",
- ("error: parse_url. Returning error code %d freeing share->scheme
0x%lx",
- error_num, (long) share->scheme));
- my_free((gptr) share->scheme, MYF(0));
- share->scheme= 0;
+ ("error: parse_url. Returning error code %d \
+ freeing share->connection_string %lx",
+ error_num, (long unsigned int) share->connection_string));
+ my_free((gptr) share->connection_string, MYF(0));
+ share->connection_string= 0;
}
buf_len= min(table->s->connect_string.length,
FEDERATED_QUERY_BUFFER_SIZE-1);
@@ -563,6 +563,77 @@ static int parse_url_error(FEDERATED_SHA
my_error(error_num, MYF(0), buf);
DBUG_RETURN(error_num);
}
+/*
+ retrieve server object which contains server meta-data
+ from the system table given a server's name, set share
+ connection parameter members
+*/
+int get_connection(FEDERATED_SHARE *share)
+{
+ int error_num= ER_FOREIGN_SERVER_DOESNT_EXIST;
+ char error_buffer[FEDERATED_QUERY_BUFFER_SIZE];
+ FOREIGN_SERVER *server;
+ MYSQL *mysql_conn= 0;
+ MYSQL_RES *result= 0;
+ MYSQL_ROW row= 0;
+ DBUG_ENTER("ha_federated::get_connection");
+
+ if (!(server=
+ get_server_by_name(share->connection_string)))
+ {
+ DBUG_PRINT("info", ("get_server_by_name returned > 0 error condition!"));
+ /* need to come up with error handling */
+ error_num=1;
+ goto error;
+ }
+ DBUG_PRINT("info", ("get_server_by_name returned server at %lx", (long unsigned int)
server));
+
+ /*
+ Most of these should never be empty strings, error handling will
+ need to be implemented. Also, is this the best way to set the share
+ members? Is there some allocation needed? In running this code, it works
+ except there are errors in the trace file of the share being overrun
+ at the address of the share.
+ */
+ if (server->server_name)
+ share->server_name= server->server_name;
+ share->server_name_length= server->server_name_length ?
+ server->server_name_length : 0;
+ if (server->username)
+ share->username= server->username;
+ if (server->password)
+ share->password= server->password;
+ if (server->db)
+ share->database= server->db;
+
+ share->port= server->port ? (ushort) server->port : MYSQL_PORT;
+
+ if (server->host)
+ share->hostname= server->host;
+ if (server->socket)
+ share->socket= server->socket;
+ else if (strcmp(share->hostname, my_localhost) == 0)
+ share->socket= my_strdup(MYSQL_UNIX_ADDR, MYF(0));
+ if (server->scheme)
+ share->scheme= server->scheme;
+ else
+ share->scheme= NULL;
+
+ DBUG_PRINT("info", ("share->username %s", share->username));
+ DBUG_PRINT("info", ("share->password %s", share->password));
+ DBUG_PRINT("info", ("share->hostname %s", share->hostname));
+ DBUG_PRINT("info", ("share->database %s", share->database));
+ DBUG_PRINT("info", ("share->port %d", share->port));
+ DBUG_PRINT("info", ("share->socket %s", share->socket));
+ DBUG_RETURN(0);
+
+error:
+ my_sprintf(error_buffer,
+ (error_buffer, "server name: '%s' doesn't exist!",
+ share->connection_string));
+ my_error(error_num, MYF(0), error_buffer);
+ DBUG_RETURN(error_num);
+}
/*
Parse connection info from table->s->connect_string
@@ -576,22 +647,39 @@ static int parse_url_error(FEDERATED_SHA
DESCRIPTION
Populates the share with information about the connection
to the foreign database that will serve as the data source.
- This string must be specified (currently) in the "comment" field,
+ This string must be specified (currently) in the "CONNECTION" field,
listed in the CREATE TABLE statement.
This string MUST be in the format of any of these:
- scheme://username:password@hostname:port/database/table
- scheme://username@hostname/database/table
- scheme://username@hostname:port/database/table
- scheme://username:password@hostname/database/table
+ CONNECTION="scheme://username:password@hostname:port/database/table"
+ CONNECTION="scheme://username@hostname/database/table"
+ CONNECTION="scheme://username@hostname:port/database/table"
+ CONNECTION="scheme://username:password@hostname/database/table"
+
+ _OR_
+
+ CONNECTION="connection name"
+
+
An Example:
- mysql://joe:joespass@stripped:9308/federated/testtable
+ CREATE TABLE t1 (id int(32))
+ ENGINE="FEDERATED"
+ CONNECTION="mysql://joe:joespass@stripped:9308/federated/testtable";
+
+ CREATE TABLE t2 (
+ id int(4) NOT NULL auto_increment,
+ name varchar(32) NOT NULL,
+ PRIMARY KEY(id)
+ ) ENGINE="FEDERATED" CONNECTION="my_conn";
***IMPORTANT***
- Currently, only "mysql://" is supported.
+ Currently, the Federated Storage Engine only supports connecting to another
+ MySQL Database ("scheme" of "mysql"). Connections using JDBC as well as
+ other connectors are in the planning stage.
+
'password' and 'port' are both optional.
@@ -611,87 +699,125 @@ static int parse_url(FEDERATED_SHARE *sh
share->port= 0;
share->socket= 0;
+ DBUG_PRINT("info", ("share at %lx", (long unsigned int) share));
DBUG_PRINT("info", ("Length: %d", table->s->connect_string.length));
- DBUG_PRINT("info", ("String: '%.*s'", table->s->connect_string.length,
+ DBUG_PRINT("info", ("String: '%.*s'", table->s->connect_string.length,
table->s->connect_string.str));
- share->scheme= my_strndup(table->s->connect_string.str,
- table->s->connect_string.length,
- MYF(0));
-
- share->connect_string_length= table->s->connect_string.length;
- DBUG_PRINT("info",("parse_url alloced share->scheme 0x%lx", (long)
share->scheme));
-
- /*
- remove addition of null terminator and store length
- for each string in share
- */
- if (!(share->username= strstr(share->scheme, "://")))
- goto error;
- share->scheme[share->username - share->scheme]= '\0';
-
- if (strcmp(share->scheme, "mysql") != 0)
- goto error;
-
- share->username+= 3;
+ share->connection_string= my_strndup(table->s->connect_string.str,
+ table->s->connect_string.length,
+ MYF(0));
+
+ // Add a null for later termination of table name
+ share->connection_string[table->s->connect_string.length]= 0;
+ DBUG_PRINT("info",("parse_url alloced share->connection_string %lx",
+ (long unsigned int) share->connection_string));
+
+ DBUG_PRINT("info",("share->connection_string %s",share->connection_string));
+ /* No delimiters, must be a straight connection name */
+ if ( (!strchr(share->connection_string, '/')) &&
+ (!strchr(share->connection_string, '@')) &&
+ (!strchr(share->connection_string, ';')))
+ {
- if (!(share->hostname= strchr(share->username, '@')))
- goto error;
-
- share->username[share->hostname - share->username]= '\0';
- share->hostname++;
+ DBUG_PRINT("info",
+ ("share->connection_string %s internal format \
+ share->connection_string %lx",
+ share->connection_string,
+ (long unsigned int) share->connection_string));
- if ((share->password= strchr(share->username, ':')))
- {
- share->username[share->password - share->username]= '\0';
- share->password++;
- share->username= share->username;
- /* make sure there isn't an extra / or @ */
- if ((strchr(share->password, '/') || strchr(share->hostname, '@')))
+ share->parsed= FALSE;
+ if ((error_num= get_connection(share)))
goto error;
+
/*
- Found that if the string is:
- user:@hostname:port/database/table
- Then password is a null string, so set to NULL
+ connection specifies everything but, resort to
+ expecting remote and foreign table names to match
*/
- if ((share->password[0] == '\0'))
- share->password= NULL;
+ share->table_name= table->s->table_name.str;
+ share->table_name_length= table->s->table_name.length;
+ share->table_name[share->table_name_length]= '\0';
}
else
- share->username= share->username;
+ {
+ share->parsed= TRUE;
+ // Add a null for later termination of table name
+ share->connection_string[table->s->connect_string.length]= 0;
+ share->scheme= share->connection_string;
+ DBUG_PRINT("info",("parse_url alloced share->scheme %lx",
+ (long unsigned int) share->scheme));
- /* make sure there isn't an extra / or @ */
- if ((strchr(share->username, '/')) || (strchr(share->hostname, '@')))
- goto error;
+ /*
+ remove addition of null terminator and store length
+ for each string in share
+ */
+ if (!(share->username= strstr(share->scheme, "://")))
+ goto error;
+ share->scheme[share->username - share->scheme]= '\0';
- if (!(share->database= strchr(share->hostname, '/')))
- goto error;
- share->hostname[share->database - share->hostname]= '\0';
- share->database++;
+ if (strcmp(share->scheme, "mysql") != 0)
+ goto error;
- if ((share->sport= strchr(share->hostname, ':')))
- {
- share->hostname[share->sport - share->hostname]= '\0';
- share->sport++;
- if (share->sport[0] == '\0')
- share->sport= NULL;
+ share->username+= 3;
+
+ if (!(share->hostname= strchr(share->username, '@')))
+ goto error;
+
+ share->username[share->hostname - share->username]= '\0';
+ share->hostname++;
+
+ if ((share->password= strchr(share->username, ':')))
+ {
+ share->username[share->password - share->username]= '\0';
+ share->password++;
+ share->username= share->username;
+ /* make sure there isn't an extra / or @ */
+ if ((strchr(share->password, '/') || strchr(share->hostname, '@')))
+ goto error;
+ /*
+ Found that if the string is:
+user:@hostname:port/db/table
+Then password is a null string, so set to NULL
+ */
+ if ((share->password[0] == '\0'))
+ share->password= NULL;
+ }
else
- share->port= atoi(share->sport);
- }
+ share->username= share->username;
- if (!(share->table_name= strchr(share->database, '/')))
- goto error;
- share->database[share->table_name - share->database]= '\0';
- share->table_name++;
+ /* make sure there isn't an extra / or @ */
+ if ((strchr(share->username, '/')) || (strchr(share->hostname, '@')))
+ goto error;
- share->table_name_length= strlen(share->table_name);
-
- /* make sure there's not an extra / */
- if ((strchr(share->table_name, '/')))
- goto error;
+ if (!(share->database= strchr(share->hostname, '/')))
+ goto error;
+ share->hostname[share->database - share->hostname]= '\0';
+ share->database++;
+
+ if ((share->sport= strchr(share->hostname, ':')))
+ {
+ share->hostname[share->sport - share->hostname]= '\0';
+ share->sport++;
+ if (share->sport[0] == '\0')
+ share->sport= NULL;
+ else
+ share->port= atoi(share->sport);
+ }
+
+ if (!(share->table_name= strchr(share->database, '/')))
+ goto error;
+ share->database[share->table_name - share->database]= '\0';
+ share->table_name++;
+
+ share->table_name_length= strlen(share->table_name);
+
+ /* make sure there's not an extra / */
+ if ((strchr(share->table_name, '/')))
+ goto error;
- if (share->hostname[0] == '\0')
- share->hostname= NULL;
+ if (share->hostname[0] == '\0')
+ share->hostname= NULL;
+ }
if (!share->port)
{
if (strcmp(share->hostname, my_localhost) == 0)
@@ -702,7 +828,7 @@ static int parse_url(FEDERATED_SHARE *sh
DBUG_PRINT("info",
("scheme: %s username: %s password: %s \
- hostname: %s port: %d database: %s tablename: %s",
+ hostname: %s port: %d db: %s tablename: %s",
share->scheme, share->username, share->password,
share->hostname, share->port, share->database,
share->table_name));
@@ -713,7 +839,6 @@ error:
DBUG_RETURN(parse_url_error(share, table, error_num));
}
-
/*****************************************************************************
** FEDERATED tables
*****************************************************************************/
@@ -1313,14 +1438,16 @@ static FEDERATED_SHARE *get_share(const
pthread_mutex_lock(&federated_mutex);
+ tmp_share.share_key= table_name;
+ tmp_share.share_key_length= strlen(table_name);
if (parse_url(&tmp_share, table, 0))
goto error;
/* TODO: change tmp_share.scheme to LEX_STRING object */
if (!(share= (FEDERATED_SHARE *) hash_search(&federated_open_tables,
- (byte*) tmp_share.scheme,
+ (byte*) tmp_share.share_key,
tmp_share.
- connect_string_length)))
+ share_key_length)))
{
query.set_charset(system_charset_info);
query.append(STRING_WITH_LEN("SELECT "));
@@ -1367,7 +1494,8 @@ static FEDERATED_SHARE *get_share(const
error:
pthread_mutex_unlock(&federated_mutex);
- my_free((gptr) tmp_share.scheme, MYF(MY_ALLOW_ZERO_PTR));
+ my_free((gptr) tmp_share.connection_string, MYF(MY_ALLOW_ZERO_PTR));
+ tmp_share.connection_string= 0;
my_free((gptr) share, MYF(MY_ALLOW_ZERO_PTR));
return NULL;
}
@@ -1387,8 +1515,14 @@ static int free_share(FEDERATED_SHARE *s
if (!--share->use_count)
{
hash_delete(&federated_open_tables, (byte*) share);
- my_free((gptr) share->scheme, MYF(MY_ALLOW_ZERO_PTR));
- my_free((gptr) share->socket, MYF(MY_ALLOW_ZERO_PTR));
+ if (share->parsed)
+ my_free((gptr) share->socket, MYF(MY_ALLOW_ZERO_PTR));
+ /*if (share->connection_string)
+ {
+ */
+ my_free((gptr) share->connection_string, MYF(MY_ALLOW_ZERO_PTR));
+ share->connection_string= 0;
+ /*}*/
thr_lock_delete(&share->lock);
VOID(pthread_mutex_destroy(&share->mutex));
my_free((gptr) share, MYF(0));
@@ -2708,7 +2842,9 @@ int ha_federated::create(const char *nam
if (!(retval= parse_url(&tmp_share, table_arg, 1)))
retval= check_foreign_data_source(&tmp_share, 1);
- my_free((gptr) tmp_share.scheme, MYF(MY_ALLOW_ZERO_PTR));
+ /* free this because strdup created it in parse_url */
+ my_free((gptr) tmp_share.connection_string, MYF(MY_ALLOW_ZERO_PTR));
+ tmp_share.connection_string= 0;
DBUG_RETURN(retval);
}
--- 1.94/mysql-test/Makefile.am 2006-12-26 11:31:00 -08:00
+++ 1.95/mysql-test/Makefile.am 2006-12-26 11:31:00 -08:00
@@ -2,8 +2,8 @@
#
# This library is free software; you can redistribute it and/or
# modify it under the terms of the GNU Library General Public
-# License as published by the Free Software Foundation; either
-# version 2 of the License, or (at your option) any later version.
+# License as published by the Free Software Foundation; version 2
+# of the License.
#
# This library is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
| Thread |
|---|
| • bk commit into 5.1 tree (antony:1.2368) | antony | 26 Dec |