mirror of
https://github.com/MariaDB/server.git
synced 2025-02-02 03:51:50 +01:00
Merge gbichot@bk-internal.mysql.com:/home/bk/mysql-4.0
into mysql.com:/home/mysql_src/mysql-4.0
This commit is contained in:
commit
d94cf5fbfb
1 changed files with 13 additions and 6 deletions
|
@ -891,15 +891,15 @@ void Query_log_event::print(FILE* file, bool short_form, char* last_db)
|
||||||
(ulong) thread_id, (ulong) exec_time, error_code);
|
(ulong) thread_id, (ulong) exec_time, error_code);
|
||||||
}
|
}
|
||||||
|
|
||||||
bool same_db = 0;
|
bool different_db= 1;
|
||||||
|
|
||||||
if (db && last_db)
|
if (db && last_db)
|
||||||
{
|
{
|
||||||
if (!(same_db = !memcmp(last_db, db, db_len + 1)))
|
if (different_db= memcmp(last_db, db, db_len + 1))
|
||||||
memcpy(last_db, db, db_len + 1);
|
memcpy(last_db, db, db_len + 1);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (db && db[0] && !same_db)
|
if (db && db[0] && different_db)
|
||||||
fprintf(file, "use %s;\n", db);
|
fprintf(file, "use %s;\n", db);
|
||||||
end=int10_to_str((long) when, strmov(buff,"SET TIMESTAMP="),10);
|
end=int10_to_str((long) when, strmov(buff,"SET TIMESTAMP="),10);
|
||||||
*end++=';';
|
*end++=';';
|
||||||
|
@ -1324,14 +1324,21 @@ void Load_log_event::print(FILE* file, bool short_form, char* last_db,
|
||||||
thread_id, exec_time);
|
thread_id, exec_time);
|
||||||
}
|
}
|
||||||
|
|
||||||
bool same_db = 0;
|
bool different_db= 1;
|
||||||
if (db && last_db)
|
if (db && last_db)
|
||||||
{
|
{
|
||||||
if (!(same_db = !memcmp(last_db, db, db_len + 1)))
|
/*
|
||||||
|
If the database is different from the one of the previous statement, we
|
||||||
|
need to print the "use" command, and we update the last_db.
|
||||||
|
But if commented, the "use" is going to be commented so we should not
|
||||||
|
update the last_db.
|
||||||
|
*/
|
||||||
|
if ((different_db= memcmp(last_db, db, db_len + 1)) &&
|
||||||
|
!commented)
|
||||||
memcpy(last_db, db, db_len + 1);
|
memcpy(last_db, db, db_len + 1);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (db && db[0] && !same_db)
|
if (db && db[0] && different_db)
|
||||||
fprintf(file, "%suse %s;\n",
|
fprintf(file, "%suse %s;\n",
|
||||||
commented ? "# " : "",
|
commented ? "# " : "",
|
||||||
db);
|
db);
|
||||||
|
|
Loading…
Add table
Reference in a new issue