Fix bug #1794536 "Export cause SQL Error on MySQL in ANSI - Mode"

This commit is contained in:
Ansgar Becker
2007-09-14 08:55:24 +00:00
parent 11e7f9d82d
commit 1b9b4fb6df

View File

@ -330,7 +330,7 @@ begin
// overload the server when using "Extended Insert" // overload the server when using "Extended Insert"
data := RemoteExecQuery( data := RemoteExecQuery(
appHandles[comboOtherHost.ItemIndex], appHandles[comboOtherHost.ItemIndex],
'SHOW VARIABLES LIKE "max_allowed_packet"', 'SHOW VARIABLES LIKE ' + esc('max_allowed_packet'),
'Checking for maximum allowed SQL-packet size on server '+comboOtherHost.Text+'...' 'Checking for maximum allowed SQL-packet size on server '+comboOtherHost.Text+'...'
); );
remote_max_allowed_packet := MakeInt( data.FieldByName('Value').AsString ); remote_max_allowed_packet := MakeInt( data.FieldByName('Value').AsString );
@ -485,7 +485,7 @@ begin
if tofile then begin if tofile then begin
// Extract name part of selected target version // Extract name part of selected target version
target_version := StrToIntDef( target_versions.Names[ comboTargetCompat.ItemIndex ], SQL_VERSION_DEFAULT ); target_version := StrToIntDef( target_versions.Names[ comboTargetCompat.ItemIndex ], SQL_VERSION_DEFAULT );
max_allowed_packet := MakeInt( cwin.GetVar( 'SHOW VARIABLES LIKE ''max_allowed_packet''', 1 ) ); max_allowed_packet := MakeInt( cwin.GetVar( 'SHOW VARIABLES LIKE ' + esc('max_allowed_packet'), 1 ) );
try try
f := TFileStream.Create(EditFileName.Text, fmCreate); f := TFileStream.Create(EditFileName.Text, fmCreate);
except except
@ -502,7 +502,7 @@ begin
// Export to other database in the same window // Export to other database in the same window
if todb then begin if todb then begin
target_version := cwin.mysql_version; target_version := cwin.mysql_version;
max_allowed_packet := MakeInt( cwin.GetVar( 'SHOW VARIABLES LIKE ''max_allowed_packet''', 1 ) ); max_allowed_packet := MakeInt( cwin.GetVar( 'SHOW VARIABLES LIKE ' + esc('max_allowed_packet'), 1 ) );
DB2export := comboOtherDatabase.Text; DB2export := comboOtherDatabase.Text;
end; end;
@ -537,7 +537,7 @@ begin
wfs(f, '# Host: ' + cwin.MysqlConn.Connection.HostName ); wfs(f, '# Host: ' + cwin.MysqlConn.Connection.HostName );
wfs(f, '# Database: ' + DB2export ); wfs(f, '# Database: ' + DB2export );
wfs(f, '# Server version: ' + cwin.GetVar( 'SELECT VERSION()' ) ); wfs(f, '# Server version: ' + cwin.GetVar( 'SELECT VERSION()' ) );
wfs(f, '# Server OS: ' + cwin.GetVar( 'SHOW VARIABLES LIKE "version_compile_os"', 1 ) ); wfs(f, '# Server OS: ' + cwin.GetVar( 'SHOW VARIABLES LIKE ' + esc('version_compile_os'), 1 ) );
wfs(f, '# Target-Compatibility: ' + comboTargetCompat.Text ); wfs(f, '# Target-Compatibility: ' + comboTargetCompat.Text );
if extended_insert then if extended_insert then
begin begin
@ -552,10 +552,10 @@ begin
Set characterset to current one Set characterset to current one
} }
if cwin.mysql_version > 40100 then if cwin.mysql_version > 40100 then
current_characterset := cwin.GetVar( 'SHOW VARIABLES LIKE "character_set_connection"', 1 ) current_characterset := cwin.GetVar( 'SHOW VARIABLES LIKE ' + esc('character_set_connection'), 1 )
else if cwin.mysql_version > 40000 then else if cwin.mysql_version > 40000 then
// todo: test this, add charolation --> charset conversion table from 4.0 to 4.1+ // todo: test this, add charolation --> charset conversion table from 4.0 to 4.1+
current_characterset := cwin.GetVar( 'SHOW VARIABLES LIKE "character_set"', 1 ) current_characterset := cwin.GetVar( 'SHOW VARIABLES LIKE ' + esc('character_set'), 1 )
else else
// todo: test this // todo: test this
current_characterset := 'binary'; current_characterset := 'binary';