summaryrefslogtreecommitdiff
path: root/sql/sp.cc
diff options
context:
space:
mode:
authorunknown <monty@mysql.com>2005-04-04 16:43:25 +0300
committerunknown <monty@mysql.com>2005-04-04 16:43:25 +0300
commitce169a5424e76969e74828d4214cfedb0a425ee5 (patch)
tree3ad1b7dadf9b015e59e0f817db58b9dbc155cb5e /sql/sp.cc
parent0c9304fd6d9b1648f3157a6a5e3f0ec536d82560 (diff)
downloadmariadb-git-ce169a5424e76969e74828d4214cfedb0a425ee5.tar.gz
Don't use -lsupc++ with gcc 3.3 and below as this gives linking problems when linking staticly
Fix that mysql.proc works with new VARCHAR fields Give warnings for wrong zero dates configure.in: Don't use -lsupc++ with gcc 3.3 and below as this gives linking problems when linking staticly mysql-test/r/func_time.result: New warnings mysql-test/r/row.result: Moved code around to get things to work with --ps-protocol Note that one on warning disappered, but it should appear again when bug #9600 is fixed mysql-test/r/strict.result: enabled more tests Added more tests mysql-test/r/union.result: Test that UNION generates correct row format mysql-test/t/row.test: Moved test to get things to work with --ps-protocol mysql-test/t/strict.test: enabled more tests Added more tests mysql-test/t/union.test: Test that UNION generates correct row format sql/item.cc: Removed compiler warning Simple cleanup sql/sp.cc: Fix that mysql.proc works with new VARCHAR fields sql/time.cc: Give warnings for wrong zero dates tests/mysql_client_test.c: More startup information
Diffstat (limited to 'sql/sp.cc')
-rw-r--r--sql/sp.cc33
1 files changed, 16 insertions, 17 deletions
diff --git a/sql/sp.cc b/sql/sp.cc
index 84169ab8172..23d389cd299 100644
--- a/sql/sp.cc
+++ b/sql/sp.cc
@@ -64,8 +64,7 @@ db_find_routine_aux(THD *thd, int type, sp_name *name,
enum thr_lock_type ltype, TABLE **tablep, bool *opened)
{
TABLE *table;
- byte key[64+64+1]; // db, name, type
- uint keylen;
+ byte key[NAME_LEN*2+4+1]; // db, name, optional key length type
DBUG_ENTER("db_find_routine_aux");
DBUG_PRINT("enter", ("type: %d name: %*s",
type, name->m_name.length, name->m_name.str));
@@ -78,20 +77,6 @@ db_find_routine_aux(THD *thd, int type, sp_name *name,
if (!mysql_proc_table_exists && ltype == TL_READ)
DBUG_RETURN(SP_OPEN_TABLE_FAILED);
- // Put the key used to read the row together
- keylen= name->m_db.length;
- if (keylen > 64)
- keylen= 64;
- memcpy(key, name->m_db.str, keylen);
- memset(key+keylen, (int)' ', 64-keylen); // Pad with space
- keylen= name->m_name.length;
- if (keylen > 64)
- keylen= 64;
- memcpy(key+64, name->m_name.str, keylen);
- memset(key+64+keylen, (int)' ', 64-keylen); // Pad with space
- key[128]= type;
- keylen= sizeof(key);
-
if (thd->lex->proc_table)
table= thd->lex->proc_table->table;
else
@@ -120,8 +105,22 @@ db_find_routine_aux(THD *thd, int type, sp_name *name,
}
mysql_proc_table_exists= 1;
+ /*
+ Create key to find row. We have to use field->store() to be able to
+ handle VARCHAR and CHAR fields.
+ Assumption here is that the three first fields in the table are
+ 'db', 'name' and 'type' and the first key is the primary key over the
+ same fields.
+ */
+ table->field[0]->store(name->m_db.str, name->m_db.length, &my_charset_bin);
+ table->field[1]->store(name->m_name.str, name->m_name.length,
+ &my_charset_bin);
+ table->field[2]->store((longlong) type);
+ key_copy(key, table->record[0], table->key_info,
+ table->key_info->key_length);
+
if (table->file->index_read_idx(table->record[0], 0,
- key, keylen,
+ key, table->key_info->key_length,
HA_READ_KEY_EXACT))
{
*tablep= NULL;