summaryrefslogtreecommitdiff
path: root/sql/ha_innodb.cc
diff options
context:
space:
mode:
authorunknown <monty@mashka.mysql.fi>2003-09-11 19:06:23 +0300
committerunknown <monty@mashka.mysql.fi>2003-09-11 19:06:23 +0300
commitdd0d199ebeab47facb4d01269cda97c258491c22 (patch)
treeba442d57a65bd55a0d0fec02aa6abeae237a568b /sql/ha_innodb.cc
parentc9d1bdfac3956f5b32e338e620bd5698439bb43c (diff)
downloadmariadb-git-dd0d199ebeab47facb4d01269cda97c258491c22.tar.gz
After merge fixes.
Note that mix_innodb_myisam_binlog and union fails after this patch (Will be fixed shortly by maintaners of this code) client/mysql.cc: After merge fix include/mysql.h: Some additions to MYSQL_BIND for cleaner prepared statement code libmysql/libmysql.c: mysql_prepare_result -> mysql_get_metadata() Added test for offset overflow when using mysql_fetch_column() Cleaned up mysql_fetch_column() Optimized fetch_result() usage mysql-test/r/func_group.result: Updated results after merge mysql-test/r/func_test.result: Updated results after merge mysql-test/r/grant.result: Updated results after merge mysql-test/r/loaddata.result: Updated results after merge mysql-test/r/lowercase_table.result: Updated results after merge mysql-test/r/mix_innodb_myisam_binlog.result: Updated results after merge (note that this is still not correct; Need patch to mysqld to fix this properly) mysql-test/r/myisam.result: Updated results after merge mysql-test/r/range.result: Updated results after merge mysql-test/r/rpl_loaddata.result: Updated results after merge mysql-test/r/rpl_loaddata_rule_m.result: Updated results after merge mysql-test/r/rpl_loaddata_rule_s.result: Updated results after merge mysql-test/r/rpl_log.result: Updated results after merge mysql-test/r/union.result: Updated results after merge mysql-test/t/lowercase_table.test: Update after merge mysql-test/t/myisam.test: Update after merge mysql-test/t/union.test: Update after merge sql-bench/compare-results.sh: Fix for now output format sql/field.h: Added is_null_in_record() to make ha_innodb.cc code more general sql/ha_innodb.cc: Removed some functions that uses inernal (private) MySQL information sql/item_cmpfunc.cc: After merge fix sql/log_event.cc: After merge fix; (Some code should be checked by Guilhem) sql/opt_range.cc: Simple optimzation and after merge fixes sql/slave.cc: After merge fix sql/sql_acl.cc: After merge fix + code cleanup sql/sql_select.cc: After merge fix sql/sql_show.cc: After merge fix sql/sql_table.cc: After merge fix Cleanup of mysql_checksum_table() sql/sql_union.cc: After merge fixes. Note that after this the union test still fails; Will be fixed shortly... tests/client_test.c: mysql_prepare_result() -> mysql_get_metadata()
Diffstat (limited to 'sql/ha_innodb.cc')
-rw-r--r--sql/ha_innodb.cc95
1 files changed, 7 insertions, 88 deletions
diff --git a/sql/ha_innodb.cc b/sql/ha_innodb.cc
index bcdb01da9ca..017151dfca0 100644
--- a/sql/ha_innodb.cc
+++ b/sql/ha_innodb.cc
@@ -1540,82 +1540,6 @@ ha_innobase::close(void)
DBUG_RETURN(0);
}
-/* The following accessor functions should really be inside MySQL code! */
-
-/******************************************************************
-Gets field offset for a field in a table. */
-inline
-uint
-get_field_offset(
-/*=============*/
- /* out: offset */
- TABLE* table, /* in: MySQL table object */
- Field* field) /* in: MySQL field object */
-{
- return((uint) (field->ptr - (char*) table->record[0]));
-}
-
-/******************************************************************
-Checks if a field in a record is SQL NULL. Uses the record format
-information in table to track the null bit in record. */
-inline
-uint
-field_in_record_is_null(
-/*====================*/
- /* out: 1 if NULL, 0 otherwise */
- TABLE* table, /* in: MySQL table object */
- Field* field, /* in: MySQL field object */
- char* record) /* in: a row in MySQL format */
-{
- int null_offset;
-
- if (!field->null_ptr) {
-
- return(0);
- }
-
- null_offset = (uint) ((char*) field->null_ptr
- - (char*) table->record[0]);
-
- if (record[null_offset] & field->null_bit) {
-
- return(1);
- }
-
- return(0);
-}
-
-/******************************************************************
-Sets a field in a record to SQL NULL. Uses the record format
-information in table to track the null bit in record. */
-inline
-void
-set_field_in_record_to_null(
-/*========================*/
- TABLE* table, /* in: MySQL table object */
- Field* field, /* in: MySQL field object */
- char* record) /* in: a row in MySQL format */
-{
- int null_offset;
-
- null_offset = (uint) ((char*) field->null_ptr
- - (char*) table->record[0]);
-
- record[null_offset] = record[null_offset] | field->null_bit;
-}
-
-/******************************************************************
-Resets SQL NULL bits in a record to zero. */
-inline
-void
-reset_null_bits(
-/*============*/
- TABLE* table, /* in: MySQL table object */
- char* record) /* in: a row in MySQL format */
-{
- bzero(record, table->null_bytes);
-}
-
extern "C" {
/*****************************************************************
InnoDB uses this function is to compare two data fields for which the
@@ -1825,11 +1749,10 @@ ha_innobase::store_key_val_for_row(
blob_data = row_mysql_read_blob_ref(&blob_len,
(byte*) (record
- + (ulint)get_field_offset(table, field)),
+ + (ulint) field->offset()),
(ulint) field->pack_length());
- ut_a(get_field_offset(table, field)
- == key_part->offset);
+ ut_a(field->offset() == key_part->offset);
if (blob_len > key_part->length) {
blob_len = key_part->length;
}
@@ -2009,9 +1932,7 @@ build_template(
templ->mysql_null_bit_mask = 0;
}
- templ->mysql_col_offset = (ulint)
- get_field_offset(table, field);
-
+ templ->mysql_col_offset = (ulint) field->offset();
templ->mysql_col_len = (ulint) field->pack_length();
templ->type = get_innobase_type_from_mysql_type(field);
templ->is_unsigned = (ulint) (field->flags & UNSIGNED_FLAG);
@@ -2348,8 +2269,8 @@ calc_row_difference(
/* goto skip_field;
}*/
- o_ptr = (byte*) old_row + get_field_offset(table, field);
- n_ptr = (byte*) new_row + get_field_offset(table, field);
+ o_ptr = (byte*) old_row + field->offset();
+ n_ptr = (byte*) new_row + field->offset();
o_len = field->pack_length();
n_len = field->pack_length();
@@ -2374,13 +2295,11 @@ calc_row_difference(
}
if (field->null_ptr) {
- if (field_in_record_is_null(table, field,
- (char*) old_row)) {
+ if (field->is_null_in_record((uchar*) old_row)) {
o_len = UNIV_SQL_NULL;
}
- if (field_in_record_is_null(table, field,
- (char*) new_row)) {
+ if (field->is_null_in_record((uchar*) new_row)) {
n_len = UNIV_SQL_NULL;
}
}