Below is the list of changes that have just been committed into a local
4.1 repository of mysqldev. When mysqldev 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, 2007-04-01 13:39:48+02:00, jbruehe@stripped +3 -0
lib_sql.cc:
code modified to prevent freeing of memory that wasn't malloc-ed.
Now we check if MYSQL_STMT::result was used.
(originally done by hf on 2007-02-12; re-applied for custom build)
sql_class.h:
current_stmt member added for the embedded server
(originally: hf, 2006-10-24; re-applied for custom build)
mysql.h:
member moved to the THD structure: 'current_stmt'
(originally: hf, 2006-10-24; re-applied for custom build)
include/mysql.h@stripped, 2007-04-01 13:31:18+02:00, jbruehe@stripped +0 -6
member moved to the THD structure: 'current_stmt'
(originally: hf, 2006-10-24; re-applied for custom build)
libmysqld/lib_sql.cc@stripped, 2007-04-01 13:34:25+02:00, jbruehe@stripped +34 -10
code modified to prevent freeing of memory that wasn't malloc-ed.
Now we check if MYSQL_STMT::result was used.
(originally done by hf on 2007-02-12; re-applied for custom build)
sql/sql_class.h@stripped, 2007-04-01 13:32:48+02:00, jbruehe@stripped +6 -0
current_stmt member added for the embedded server
(originally: hf, 2006-10-24; re-applied for custom build)
# 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: jbruehe
# Host: production.mysql.com
# Root: /data0/mysqldev/my/ScottLee/4.1.22-br13769/mysql-4.1-release
--- 1.143/include/mysql.h 2007-04-01 13:39:53 +02:00
+++ 1.144/include/mysql.h 2007-04-01 13:39:53 +02:00
@@ -270,12 +270,6 @@
from mysql_stmt_close if close had to cancel result set of this object.
*/
my_bool *unbuffered_fetch_owner;
- /*
- In embedded server it points to the statement that is processed
- in the current query. We store some results directly in statement
- fields then.
- */
- struct st_mysql_stmt *current_stmt;
} MYSQL;
typedef struct st_mysql_res {
--- 1.290/sql/sql_class.h 2007-04-01 13:39:53 +02:00
+++ 1.291/sql/sql_class.h 2007-04-01 13:39:53 +02:00
@@ -686,6 +686,12 @@
char *extra_data;
ulong extra_length;
String query_rest;
+ /*
+ In embedded server it points to the statement that is processed
+ in the current query. We store some results directly in statement
+ fields then.
+ */
+ struct st_mysql_stmt *current_stmt;
#endif
NET net; // client connection descriptor
MEM_ROOT warn_root; // For warnings and errors
--- 1.128/libmysqld/lib_sql.cc 2007-04-01 13:39:53 +02:00
+++ 1.129/libmysqld/lib_sql.cc 2007-04-01 13:39:53 +02:00
@@ -66,6 +66,16 @@
}
}
+
+static void emb_free_rows(THD *thd)
+{
+ if (thd->current_stmt)
+ free_root(&thd->data->alloc,MYF(0));
+ else
+ free_rows(thd->data);
+}
+
+
static my_bool
emb_advanced_command(MYSQL *mysql, enum enum_server_command command,
const char *header, ulong header_length,
@@ -78,7 +88,7 @@
if (thd->data)
{
- free_rows(thd->data);
+ emb_free_rows(thd);
thd->data= 0;
}
/* Check that we are calling the client functions in right order */
@@ -94,7 +104,7 @@
mysql->affected_rows= ~(my_ulonglong) 0;
mysql->field_count= 0;
net->last_errno= 0;
- mysql->current_stmt= stmt;
+ thd->current_stmt= stmt;
thd->store_globals(); // Fix if more than one connect
/*
@@ -243,9 +253,23 @@
int emb_read_binary_rows(MYSQL_STMT *stmt)
{
- MYSQL_DATA *data;
- if (!(data= emb_read_rows(stmt->mysql, 0, 0)))
+ MYSQL *mysql= stmt->mysql;
+ embedded_get_error(mysql);
+ if (mysql->net.last_errno)
+ {
+ set_stmt_errmsg(stmt, mysql->net.last_error,
+ mysql->net.last_errno, mysql->net.sqlstate);
return 1;
+ }
+
+ if (((THD*)mysql->thd)->data)
+ {
+ DBUG_ASSERT(((THD*) mysql->thd)->data == &stmt->result);
+ stmt->result.prev_ptr= NULL;
+ ((THD*)mysql->thd)->data= NULL;
+ }
+ else
+ stmt->result.rows= 0;
return 0;
}
@@ -260,7 +284,7 @@
*row= NULL;
if (data)
{
- free_rows(data);
+ free_root(&data->alloc,MYF(0));
((THD*)mysql->thd)->data= NULL;
}
}
@@ -276,7 +300,7 @@
{
THD *thd= (THD*)mysql->thd;
if (thd->data)
- free_rows(thd->data);
+ emb_free_rows(thd);
thread_count--;
delete thd;
mysql->thd=0;
@@ -644,8 +668,8 @@
DBUG_RETURN(0);
field_count= list->elements;
- field_alloc= mysql->current_stmt ? &mysql->current_stmt->mem_root :
- &mysql->field_alloc;
+ field_alloc= thd->current_stmt ? &thd->current_stmt->mem_root :
+ &mysql->field_alloc;
if (!(client_field= mysql->fields=
(MYSQL_FIELD *)alloc_root(field_alloc,
sizeof(MYSQL_FIELD) * field_count)))
@@ -751,8 +775,8 @@
{
MYSQL *mysql= thd->mysql;
- if (mysql->current_stmt)
- data= &mysql->current_stmt->result;
+ if (thd->current_stmt)
+ data= &thd->current_stmt->result;
else
{
if (!(data= (MYSQL_DATA*) my_malloc(sizeof(MYSQL_DATA),
| Thread |
|---|
| • bk commit into 4.1 tree (jbruehe:1.2542) | joerg | 1 Apr |