mysql-test/r/federated.result:
added explain results to join test results per Timour's request.
mysql-test/t/federated.test:
Added explain to test per Timour's request
sql/ha_federated.cc:
better comment to explain why we need table->status set to 0
mysql-test/r/federated.result:
new join test results
mysql-test/t/federated.test:
new simple join tests (more to come with subsequent commits)
sql/ha_federated.cc:
This fixes joins not working. Monty discussed that having to deal
with table->status needs to be moved from the handler/storage engine
to a higher level
BitKeeper/etc/logging_ok:
Logging to logging@openlogging.org accepted
mysql-test/r/federated.result:
made sure result has SLAVE_PORT!
mysql-test/t/federated.test:
added --replace_result to a table creation that I forgot to add before
Changes to a test with a update to a table with 1001 columns, the last being a blob.
On HP, the test worked properly, but on other OSs, there's a problem with using the
blob column in an update where clause. The field method val_string(String *, char *)
should work, but doesn't seem to deal with blobd, and for some reason, cannot get
the correct value of the blob column from the byte pointer in update_row, "*old_data"
which is a byte pointer to the row in mysql format, that will be replaced with
"*new_data" (which conveniently has a field pointer to use to get values from).
Will document this.
mysql-test/r/federated.result:
New test results. These results have been tested on production and hpita2 successfully.
mysql-test/t/federated.test:
Changed blob column in this test due to some issues with HPUX handling it correctly
and other OSs not. Will document this (blobs in update where clause)
Konstja and Georg, change sets 1.1806, 1.1805. These changes has been successfully
tested on both my own workstation (Suse 9.0) and production.mysql.com.
mysql-test/r/federated.result:
new test results for error handling tests.
mysql-test/t/federated.test:
new error handling tests
sql/ha_federated.cc:
- check_foreign_data source added
- table names now enclosed in '`' to allow for '%' or other characters
- better error handling
- mysql_init now checked to see if it returns true/false, error out if false (Georg)
BitKeeper/etc/logging_ok:
Logging to logging@openlogging.org accepted
Patch #2, all coding style changes per Kostja's review
(as requested to keep style changes separate from functionality changes),
as well as changes to the test suit to no longer use hard-coded port
values in foreign table creation statement
mysql-test/r/federated.result:
Now using SLAVE_PORT as opposed to hard-coded port value
mysql-test/t/federated.test:
- changed test to use SLAVE_MYPORT
- made all standard SQL uppercase
- made test 80 cols, except blob inserts of text
sql/ha_federated.cc:
- made sure all comments and style changes were according to Kostja's
review
- combined parse_url error handling into a 'error:' block, took out
triple exclamation points.
- clarified commented documentation
- got rid of all trailing spaces
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
-New tests and results
logging_ok:
Logging to logging@openlogging.org accepted
ha_federated.h:
removed quote_data and type_quote (now in the Field class)
ha_federated.cc:
moved quote_data and type_quote to field class
field.h:
new methods quote_data and needs_quotes declared
field.cc:
new field class methods quote_data and needs_quotes (per Monty's request)
federated.test:
more tests, joins, index tests
have_federated_db.require:
new name of federated system var
federated.result:
new test results for federated handler
have_federated_db.inc:
changed name of variable in test due to change in vars
sql_analyse.cc:
over-ridden append_escaped to take (String *, char *, uint) per requirements of 'create_where_from_key' method in federated handler.
mysql_priv.h:
define over-ridden append_escaped to take arguments from 'create_where_from_key' method in federated handler
ha_federated.cc:
implemented "create_where_from_key" to deal properly with two-byte prefix and multi keys. Initial testing shows it works, but I still need to move quoting to field class and also look at changes per Segei's suggestions.
sql/mysql_priv.h:
define over-ridden append_escaped to take arguments from 'create_where_from_key' method in federated handler
sql/sql_analyse.cc:
over-ridden append_escaped to take (String *, char *, uint) per requirements of 'create_where_from_key' method in federated handler.
mysql-test/include/have_federated_db.inc:
changed name of variable in test due to change in vars
mysql-test/r/federated.result:
new test results for federated handler
mysql-test/r/have_federated_db.require:
new name of federated system var
mysql-test/t/federated.test:
more tests, joins, index tests
sql/field.cc:
new field class methods quote_data and needs_quotes (per Monty's request)
sql/field.h:
new methods quote_data and needs_quotes declared
sql/ha_federated.cc:
moved quote_data and type_quote to field class
sql/ha_federated.h:
removed quote_data and type_quote (now in the Field class)
BitKeeper/etc/logging_ok:
Logging to logging@openlogging.org accepted
mysql-test/r/federated.result:
new test results
mysql-test/t/federated.test:
added order by, group by
sql/ha_federated.cc:
- added 'scheme' to URL
- added proper escaping
- made sure &my_charset_bin is being used throughout handler
- made sure create_table catches improper URL in comment upon table creation
sql/ha_federated.h:
added scheme to share
configure.in:
inclusion of federated handler autoheader macro
mysql-test/mysql-test-run.sh:
allow usage of replication tests for federated handler
sql/Makefile.am:
inclusion of federated header and source file
sql/field.h:
overloaded method val_str() to work with fields in 'old_data' in 'update_row()'
sql/handler.cc:
added code to include federated handler
sql/handler.h:
add db type for federated
sql/mysql_priv.h:
added code for federated handler
sql/mysqld.cc:
added code for federated handler
sql/set_var.cc:
added code for federated handler