2006-02-16 14:24:47 +01:00
|
|
|
######################################################
|
|
|
|
# By JBM 2006-02-16 So that the code is not repeated #
|
|
|
|
# in test cases and can be reused. #
|
|
|
|
######################################################
|
2009-02-19 21:37:40 +01:00
|
|
|
|
2007-12-12 18:19:24 +01:00
|
|
|
--exec $NDB_MGM --no-defaults --ndb-connectstring="$NDB_CONNECTSTRING" -e "start backup" >> $NDB_TOOLS_OUTPUT
|
2006-02-16 14:24:47 +01:00
|
|
|
|
2009-03-15 17:25:14 +01:00
|
|
|
# To find the backupid, we must dump this data to a table, and SELECT
|
|
|
|
# what we want into an outfile. This could be accomplished with grep, but
|
|
|
|
# grep isn't Windows-portable
|
|
|
|
|
|
|
|
--disable_query_log
|
|
|
|
# create a table to help us out
|
|
|
|
--disable_warnings # leave this on until done with the entire process
|
|
|
|
# cleanup
|
|
|
|
DROP TABLE IF EXISTS helper1;
|
|
|
|
CREATE TABLE helper1(c1 VARCHAR(20));
|
|
|
|
# dump raw data to file
|
|
|
|
let $ndb_backup_file1= $MYSQLTEST_VARDIR/ndb_backup_tmp.dat;
|
|
|
|
let $ndb_backup_file2= $MYSQLTEST_VARDIR/tmp.dat;
|
|
|
|
--error 0,1
|
|
|
|
--remove_file $ndb_backup_file1
|
2009-03-15 23:39:48 +01:00
|
|
|
--exec $NDB_TOOLS_DIR/ndb_select_all --ndb-connectstring="$NDB_CONNECTSTRING" -d sys --delimiter=',' SYSTAB_0 > $ndb_backup_file1
|
2009-03-15 17:25:14 +01:00
|
|
|
# load the table from the raw data file
|
|
|
|
eval LOAD DATA INFILE '$ndb_backup_file1' INTO TABLE helper1;
|
|
|
|
--remove_file $ndb_backup_file1
|
|
|
|
# output what we need
|
|
|
|
eval SELECT * FROM helper1 WHERE c1 LIKE '%520093696%'
|
|
|
|
INTO OUTFILE '$ndb_backup_file2';
|
|
|
|
# cleanup
|
|
|
|
DROP TABLE helper1;
|
|
|
|
--enable_warnings
|
|
|
|
--enable_query_log
|
|
|
|
|
|
|
|
CREATE TEMPORARY TABLE IF NOT EXISTS test.backup_info
|
|
|
|
(id INT, backup_id INT) ENGINE = MEMORY;
|
2007-03-07 07:19:37 +01:00
|
|
|
|
2009-03-15 17:25:14 +01:00
|
|
|
--replace_result $MYSQLTEST_VARDIR <MYSQLTEST_VARDIR>
|
2009-03-15 23:39:48 +01:00
|
|
|
eval LOAD DATA INFILE '$ndb_backup_file2' INTO TABLE test.backup_info FIELDS TERMINATED BY ',';
|
2009-03-15 17:25:14 +01:00
|
|
|
--remove_file $ndb_backup_file2
|
2006-02-16 14:24:47 +01:00
|
|
|
|
2007-12-12 18:19:24 +01:00
|
|
|
# Load backup id into environment variable
|
|
|
|
let the_backup_id=`SELECT backup_id from test.backup_info`;
|
2006-02-16 16:33:46 +01:00
|
|
|
|
2007-03-07 07:19:37 +01:00
|
|
|
DROP TABLE test.backup_info;
|
2006-02-16 14:24:47 +01:00
|
|
|
|