diff options
author | Dmitry Lenev <dlenev@mysql.com> | 2009-10-09 18:29:51 +0400 |
---|---|---|
committer | Dmitry Lenev <dlenev@mysql.com> | 2009-10-09 18:29:51 +0400 |
commit | c0221b0e95019ede5753302fac13934aaa55c3ba (patch) | |
tree | c4607e249dbd8ca2aceceed09f6e3bd86c39c606 /sql/sql_class.cc | |
parent | 0da357645c41867552481b18b7de12806f743fe0 (diff) | |
download | mariadb-git-c0221b0e95019ede5753302fac13934aaa55c3ba.tar.gz |
This patch is prerequisite for the 2nd milestone of WL#148 "Foreign keys"
storing and restoring information about foreign keys in the .FRM files and
properly displaying it in SHOW CREATE TABLE output and I_S tables.
The idea of this patch is to change type of Key_part_spec::field_name and
Key::name to LEX_STRING in order to avoid extra strlen() calls during
semantic analysis and statement execution, particularly, in code to be
implemented on the 2nd milestone of WL#148.
Note that since we are not using LEX_STRING everywhere yet (e.g. in
Create_field and KEY) and we want to limit scope of our changes we
have to do strlen() in places where we create Key and Key_part_spec
instances from objects using plain (char*) for strings. These calls
will go away during the process of further (char*) -> LEX_STRING
refactoring.
We have introduced these changes in 6.0 and backported them to 5.5
tree to make people aware of these changes as early as possible and
to simplify merges with mysql-fk and mysql-6.1-fk trees.
No test case is needed since this patch does not introduce any
user visible changes.
sql/sql_class.cc:
Key_part_spec::field_name is now LEX_STRING. Adjusted code accordingly.
sql/sql_class.h:
Changed type of Key_part_spec::field_name and Key::name to LEX_STRING in
order to avoid extra strlen() calls in code responsible for semantic
analysis and statement execution (e.g. in future code responsible for
saving/restoring info about foreign keys).
sql/sql_lex.cc:
Moved null_lex_str from sql_yacc.yy to sql_lex.cc and added its
declaration to sql_lex.h to make it accessible in other SQL-layer
modules (e.g. sql_parse.cc).
sql/sql_lex.h:
Made null_lex_str accessible from outside of sql_lex.cc.
sql/sql_parse.cc:
Key_part_spec::field_name and Key::name are now LEX_STRING. Adjusted
code accordingly.
sql/sql_table.cc:
Adjusted code to accomodate change of type to LEX_STRING for
Key_part_spec::field_name and Key::name.
sql/sql_yacc.yy:
Now Key::name and Key_part_spec::field_name are LEX_STRINGs. Adjusted
grammar to be able properly initialize them. This should allow us to
save on some strlen() calls during later stages of statement execution.
Diffstat (limited to 'sql/sql_class.cc')
-rw-r--r-- | sql/sql_class.cc | 4 |
1 files changed, 3 insertions, 1 deletions
diff --git a/sql/sql_class.cc b/sql/sql_class.cc index e386726f51f..b764026048a 100644 --- a/sql/sql_class.cc +++ b/sql/sql_class.cc @@ -90,7 +90,9 @@ extern "C" void free_user_var(user_var_entry *entry) bool Key_part_spec::operator==(const Key_part_spec& other) const { - return length == other.length && !strcmp(field_name, other.field_name); + return length == other.length && + field_name.length == other.field_name.length && + !strcmp(field_name.str, other.field_name.str); } /** |