summaryrefslogtreecommitdiff
path: root/sql-common
diff options
context:
space:
mode:
authorunknown <patg@krsna.patg.net>2005-02-06 09:40:07 -0800
committerunknown <patg@krsna.patg.net>2005-02-06 09:40:07 -0800
commit6016f23f75de1c35bd8e2a3815aaf70281a1a3a2 (patch)
tree3901bfb4e27d1b116fcf6011348bca46cdcab04f /sql-common
parent2c0acb32d0769dadf68bda4fd59f6dc70adcc422 (diff)
downloadmariadb-git-6016f23f75de1c35bd8e2a3815aaf70281a1a3a2.tar.gz
WL# 2094
This patch contains all that my previous patch (1.1814) contained, with the addition of using cli_fetch_lengths for handling binary data (Bar noted this on the review of 1.1814, Guilhem suggested using cli_fetch_lenghts by making available via removal of static in method definition and declaration in mysql.h, but Konstantin had some reservations, but he said to commit the patch using this anyway, and I suppose this can be discussed. I abandoned 1.1814 because Monty made a couple fixes to my code as well as formatting changes, and I thought it would just be easier to hand-edit my changes into a fresh clone and then make a patch. The reason for using cli_fetch_lengths is so that I can correctly get the length of the field I am setting into the field. I was previously using 'strlen' but Bar pointed out this won't correctly get the length of binary data and is also less effecient. Upon testing, it was in fact verified that binary data in a blob table was being inserted correctly, but not being retrieved correctly, all due to not having the correct value for the field: (*field)->store(row[x], strlen(row[x]), &my_charset_bin); was changed to: (*field)->store(row[x], lengths[x], &my_charset_bin); lengths being a unsigned long pointer to the values of the field lengths from a MYSQL_ROW. Since the server doesn't have the function "mysql_fetch_lengths" available, I tried to use "result->lengths", but this isn't set, so I finally successfully used cli_fetch_lenghts, which does give the correct lengths, and now the binary data gets retrieved correctly. I've also run the code through indent-ex and am using Brian's vimrc to ensure correct formatting! This code passes the entire test suite, without any errors or warning on both my workstation and build.mysql.com include/mysql.h: added cli_fetch_lengths to mysql.h in order to use this function in the federated handler mysql-test/r/federated.result: - Moved countries to be created and inserted prior to federated test table - Added a test of inserting binary values into a blob table mysql-test/t/federated.test: - Moved order of countries table creation to prior to test table creation - Test insertion of binary values in a blob table sql-common/client.c: removed 'static' to allow cli_fetch_lengths to be used in the federated handler sql/ha_federated.cc: 1. share->scheme that was created in parse_url was not being freed 2. HASH federated_open_tables was being deleted, but not freed 3. 'result' from mysql_store_result was not being free in several instances 4. Fixed the problem where a table scan was being performed after index_read_idx, which didn't cause a problem because the result set from idx_read_idx was not being freed, but once the result set was properly freed, it broke update_row. Now, I'm using the bool 'scan' to determine if I need to perform a table scan, which it magically is false when the query is an update with an index. 5. Changed all stings containing the query to perform in mysql_real_query calls from string.c_ptr_quick() to string.ptr() per Monty's suggestion (better performance) 6. Fixed various cast/type/truth compile warnings. 7. Removed 'load_conn_info' and just let 'parse_url' handle it. 8. Added the use of cli_fetch_lengths, needed to fix binary values being retrieved from the database in rnd_next/convert_row_to_internal_format 9. Formatting changes by using indent-ex! sql/ha_federated.h: added scan flag, setting defaults for result and scan_flag
Diffstat (limited to 'sql-common')
-rw-r--r--sql-common/client.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/sql-common/client.c b/sql-common/client.c
index 9dcf6b3e32c..3d760c73eea 100644
--- a/sql-common/client.c
+++ b/sql-common/client.c
@@ -1121,7 +1121,7 @@ void mysql_read_default_options(struct st_mysql_options *options,
else the lengths are calculated from the offset between pointers.
**************************************************************************/
-static void cli_fetch_lengths(ulong *to, MYSQL_ROW column,
+void cli_fetch_lengths(ulong *to, MYSQL_ROW column,
unsigned int field_count)
{
ulong *prev_length;