mirror of
https://github.com/MariaDB/server.git
synced 2025-07-30 16:24:05 +03:00
Extend max_allowed_packet to 2G in mysql and mysqldump (Bug #2105)
Don't dump data for MRG_ISAM or MRG_MYISAM tables. (Bug #1846) Ensure that 'lower_case_table_names' is always set on case insensitive file systems. (Bug #1812) One can now configure MySQL as windows service as a normal user. (Bug #1802) Database names is now compared with lower case in ON clause when lower_case_table_names is set. (Bug #1736) IGNORE ... LINES option didn't work when used with fixed length rows. (Bug #1704) Change INSERT DELAYED ... SELECT... to INSERT .... SELECT (Bug #1983) Safety fix for service 'mysql start' (Bug #1815) client/mysql.cc: Extend max_allowed_packet to 2G (Bug #2105) client/mysqldump.c: Extend max_allowed_packet to 2G (Bug #2105) Don't dump data for MRG_ISAM or MRG_MYISAM tables. (Bug #1846) configure.in: Test for file linux/config.h include/my_global.h: Portability fix (Bug #1924) mysql-test/r/insert.result: Update test results mysql-test/r/loaddata.result: Update test results mysql-test/r/lowercase_table.result: Update test results mysql-test/t/insert.test: Test INSERT ... DELAYED ... SELECT mysql-test/t/loaddata.test: Added test of LOAD DATA INFILE ... IGNORE # LINES for fixed size tables mysql-test/t/lowercase_table.test: Test mixed lower/uppercase database names sql/item.cc: Made function not inline (to make it easier to modify it without recompilation of all files) sql/item.h: Moved function to item.cc sql/mysqld.cc: Merge pidfile create code Ensure that 'lower_case_table_names' is always set on case insensitive file systems. (Bug #1812) sql/nt_servc.cc: One can now configure MySQL as windows service as a normal user. (Bug #1802) sql/sql_base.cc: Database names is now compared with lower case in ON clause when lower_case_table_names is set. (Bug #1736) sql/sql_class.h: Fixed type sql/sql_load.cc: IGNORE ... LINES option didn't work when used with fixed length rows. (Bug #1704) sql/sql_parse.cc: Change INSERT DELAYED ... SELECT... to INSERT .... SELECT strings/ctype-tis620.c: Ensure that memory is freed properly (Partly becasue of bug #1770) Bar should check the proposed patch in #1770 if we can use it support-files/mysql.server.sh: Safety fix (Bug #1815)
This commit is contained in:
@ -71,10 +71,11 @@ public:
|
||||
};
|
||||
|
||||
static int read_fixed_length(THD *thd,COPY_INFO &info,TABLE *table,
|
||||
List<Item> &fields, READ_INFO &read_info);
|
||||
List<Item> &fields, READ_INFO &read_info,
|
||||
ulong skip_lines);
|
||||
static int read_sep_field(THD *thd,COPY_INFO &info,TABLE *table,
|
||||
List<Item> &fields, READ_INFO &read_info,
|
||||
String &enclosed);
|
||||
String &enclosed, ulong skip_lines);
|
||||
|
||||
|
||||
int mysql_load(THD *thd,sql_exchange *ex,TABLE_LIST *table_list,
|
||||
@ -85,14 +86,15 @@ int mysql_load(THD *thd,sql_exchange *ex,TABLE_LIST *table_list,
|
||||
File file;
|
||||
TABLE *table;
|
||||
int error;
|
||||
String *field_term=ex->field_term,*escaped=ex->escaped,
|
||||
*enclosed=ex->enclosed;
|
||||
String *field_term=ex->field_term,*escaped=ex->escaped;
|
||||
String *enclosed=ex->enclosed;
|
||||
bool is_fifo=0;
|
||||
LOAD_FILE_INFO lf_info;
|
||||
char *db = table_list->db; // This is never null
|
||||
/* If no current database, use database where table is located */
|
||||
char *tdb= thd->db ? thd->db : db;
|
||||
bool transactional_table, log_delayed;
|
||||
ulong skip_lines= ex->skip_lines;
|
||||
DBUG_ENTER("mysql_load");
|
||||
|
||||
#ifdef EMBEDDED_LIBRARY
|
||||
@ -235,16 +237,18 @@ int mysql_load(THD *thd,sql_exchange *ex,TABLE_LIST *table_list,
|
||||
|
||||
thd->count_cuted_fields=1; /* calc cuted fields */
|
||||
thd->cuted_fields=0L;
|
||||
if (ex->line_term->length() && field_term->length())
|
||||
/* Skip lines if there is a line terminator */
|
||||
if (ex->line_term->length())
|
||||
{
|
||||
// ex->skip_lines needs to be preserved for logging
|
||||
uint skip_lines = ex->skip_lines;
|
||||
while (skip_lines--)
|
||||
/* ex->skip_lines needs to be preserved for logging */
|
||||
while (skip_lines > 0)
|
||||
{
|
||||
skip_lines--;
|
||||
if (read_info.next_line())
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if (!(error=test(read_info.error)))
|
||||
{
|
||||
uint save_time_stamp=table->time_stamp;
|
||||
@ -260,9 +264,11 @@ int mysql_load(THD *thd,sql_exchange *ex,TABLE_LIST *table_list,
|
||||
table->file->deactivate_non_unique_index((ha_rows) 0);
|
||||
table->copy_blobs=1;
|
||||
if (!field_term->length() && !enclosed->length())
|
||||
error=read_fixed_length(thd,info,table,fields,read_info);
|
||||
error=read_fixed_length(thd,info,table,fields,read_info,
|
||||
skip_lines);
|
||||
else
|
||||
error=read_sep_field(thd,info,table,fields,read_info,*enclosed);
|
||||
error=read_sep_field(thd,info,table,fields,read_info,*enclosed,
|
||||
skip_lines);
|
||||
if (table->file->extra(HA_EXTRA_NO_CACHE))
|
||||
error=1; /* purecov: inspected */
|
||||
if (table->file->activate_all_index(thd))
|
||||
@ -271,7 +277,8 @@ int mysql_load(THD *thd,sql_exchange *ex,TABLE_LIST *table_list,
|
||||
table->time_stamp=save_time_stamp;
|
||||
table->next_number_field=0;
|
||||
}
|
||||
if (file >= 0) my_close(file,MYF(0));
|
||||
if (file >= 0)
|
||||
my_close(file,MYF(0));
|
||||
free_blobs(table); /* if pack_blob was used */
|
||||
table->copy_blobs=0;
|
||||
thd->count_cuted_fields=0; /* Don`t calc cuted fields */
|
||||
@ -369,7 +376,7 @@ err:
|
||||
|
||||
static int
|
||||
read_fixed_length(THD *thd,COPY_INFO &info,TABLE *table,List<Item> &fields,
|
||||
READ_INFO &read_info)
|
||||
READ_INFO &read_info, ulong skip_lines)
|
||||
{
|
||||
List_iterator_fast<Item> it(fields);
|
||||
Item_field *sql_field;
|
||||
@ -388,6 +395,17 @@ read_fixed_length(THD *thd,COPY_INFO &info,TABLE *table,List<Item> &fields,
|
||||
my_error(ER_SERVER_SHUTDOWN,MYF(0));
|
||||
DBUG_RETURN(1);
|
||||
}
|
||||
if (skip_lines)
|
||||
{
|
||||
/*
|
||||
We could implement this with a simple seek if:
|
||||
- We are not using DATA INFILE LOCAL
|
||||
- escape character is ""
|
||||
- line starting prefix is ""
|
||||
*/
|
||||
skip_lines--;
|
||||
continue;
|
||||
}
|
||||
it.rewind();
|
||||
byte *pos=read_info.row_start;
|
||||
#ifdef HAVE_purify
|
||||
@ -444,7 +462,7 @@ read_fixed_length(THD *thd,COPY_INFO &info,TABLE *table,List<Item> &fields,
|
||||
static int
|
||||
read_sep_field(THD *thd,COPY_INFO &info,TABLE *table,
|
||||
List<Item> &fields, READ_INFO &read_info,
|
||||
String &enclosed)
|
||||
String &enclosed, ulong skip_lines)
|
||||
{
|
||||
List_iterator_fast<Item> it(fields);
|
||||
Item_field *sql_field;
|
||||
@ -494,6 +512,12 @@ read_sep_field(THD *thd,COPY_INFO &info,TABLE *table,
|
||||
}
|
||||
if (read_info.error)
|
||||
break;
|
||||
if (skip_lines)
|
||||
{
|
||||
if (!--skip_lines)
|
||||
thd->cuted_fields= 0L; // Reset warnings
|
||||
continue;
|
||||
}
|
||||
if (sql_field)
|
||||
{ // Last record
|
||||
if (sql_field == (Item_field*) fields.head())
|
||||
@ -821,7 +845,18 @@ found_eof:
|
||||
}
|
||||
|
||||
/*
|
||||
** One can't use fixed length with multi-byte charset **
|
||||
Read a row with fixed length.
|
||||
|
||||
NOTES
|
||||
The row may not be fixed size on disk if there are escape
|
||||
characters in the file.
|
||||
|
||||
IMPLEMENTATION NOTE
|
||||
One can't use fixed length with multi-byte charset **
|
||||
|
||||
RETURN
|
||||
0 ok
|
||||
1 error
|
||||
*/
|
||||
|
||||
int READ_INFO::read_fixed_length()
|
||||
|
Reference in New Issue
Block a user