816
813
if (opt_dump_date)
819
internal::get_date(time_str, GETDATE_DATE_TIME, 0);
815
boost::posix_time::ptime time(boost::posix_time::second_clock::local_time());
820
816
fprintf(sql_file, "-- Dump completed on %s\n",
817
boost::posix_time::to_simple_string(time).c_str());
824
820
fprintf(sql_file, "-- Dump completed\n");
1079
1074
drizzle_free(&drizzle);
1080
1075
} /* dbDisconnect */
1083
Quote a table name so it can be used in "SHOW TABLES LIKE <tabname>"
1087
name name of the table
1088
buff quoted name of the table
1091
Quote \, _, ' and % characters
1093
Note: Because DRIZZLE uses the C escape syntax in strings
1094
(for example, '\n' to represent newline), you must double
1095
any '\' that you use in your LIKE strings. For example, to
1096
search for '\n', specify it as '\\n'. To search for '\', specify
1097
it as '\\\\' (the backslashes are stripped once by the parser
1098
and another time when the pattern match is done, leaving a
1099
single backslash to be matched).
1101
Example: "t\1" => "t\\\\1"
1104
static char *quote_for_like(const char *name, char *buff)
1116
else if (*name == '\'' || *name == '_' || *name == '%')
1125
1077
static int dump_all_databases()
1127
1079
drizzle_row_t row;
1216
Check if we the table is one of the table types that should be ignored:
1217
MRG_ISAM, MRG_MYISAM, if opt_delayed, if that table supports delayed inserts.
1218
If the table should be altogether ignored, it returns a true, false if it
1219
should not be ignored. If the user has selected to use INSERT DELAYED, it
1220
sets the value of the bool pointer supports_delayed_inserts to 0 if not
1221
supported, 1 if it is supported.
1225
check_if_ignore_table()
1226
table_name Table name to check
1227
table_type Type of table
1230
drizzle Drizzle connection
1231
verbose Write warning messages
1234
char (bit value) See IGNORE_ values at top
1237
char check_if_ignore_table(const char *table_name, char *table_type)
1239
char result= IGNORE_NONE;
1240
char buff[FN_REFLEN+80], show_name_buff[FN_REFLEN];
1241
//const char *number_of_rows= NULL;
1242
drizzle_result_st res;
1245
/* Check memory for quote_for_like() */
1246
assert(2*sizeof(table_name) < sizeof(show_name_buff));
1247
snprintf(buff, sizeof(buff), "show table status like %s",
1248
quote_for_like(table_name, show_name_buff));
1249
if (drizzleclient_query_with_error_report(&dcon, &res, buff, false))
1253
if (!(row= drizzle_row_next(&res)))
1256
_("Error: Couldn't read status information for table %s\n"),
1258
drizzle_result_free(&res);
1259
return(result); /* assume table is ok */
1263
// if ((number_of_rows= fetch_named_row(&res, row, "Rows")) != NULL)
1265
// total_rows= strtoul(number_of_rows, NULL, 10);
1269
If the table type matches any of these, we do support delayed inserts.
1270
Note-> we do not want to skip dumping this table if if is not one of
1271
these types, but we do want to use delayed inserts in the dump if
1272
the table type is _NOT_ one of these types
1275
strncpy(table_type, row[1], DRIZZLE_MAX_TABLE_SIZE-1);
1278
if (strcmp(table_type,"MyISAM") &&
1279
strcmp(table_type,"ARCHIVE") &&
1280
strcmp(table_type,"HEAP") &&
1281
strcmp(table_type,"MEMORY"))
1282
result= IGNORE_INSERT_DELAYED;
1285
drizzle_result_free(&res);
1289
1165
int get_server_type()
1291
1167
boost::match_flag_type flags = boost::match_default;