~ubuntu-branches/ubuntu/natty/mysql-5.1/natty

« back to all changes in this revision

Viewing changes to sql/sql_load.cc

Tags: 5.1.54-1ubuntu1
* Synchronize from Debian Experimental:
* Merge from debian unstable:
  + debian/control:
     * Update maintainer according to spec.
     * Move section from "misc" to "database".
     * Added libmysqlclient16-dev an empty transitional package. 
     * Added mysql-client-core-5.1 package.
     * Suggest mailx for mysql-server-5.1
     * Add mysql-testsuite package so you can run the testsuite seperately.
  + debian/additions/my.cnf:
    * Remove language options. Error message files are located in a different directory in Mysql
      5.0. Setting the language option to use /usr/share/mysql/english breaks Mysql 5.0. Both 5.0
      and 5.1 use a different value that works. (LP: #316974)
  + Add apparmor profile:
    + debian/apparmor-profile: apparmor-profile
    + debian/rules, debian/mysql-server-5.1.files: install apparmor profile
    + debian/mysql-server-5.1.dirs: add etc/apparmor.d/fore-complain
    + debian/mysql-server-5.1.postrm: remove symlink in force-complain/ on purge.
    + debian/mysql-server-5.1.README.Debian: add apparmor documentation.
    + debian/additions/my.cnf: Add warning about apparmor. (LP: #201799)
    + debian/mysql-server-5.1.postinst: reload apparmor profiles
  * Convert the package from sysvinit to upstart:
    + debian/mysql-server-5.1.mysql.upstart: Add upstart script.
    + debian/mysql-server-5.1.mysql.init: Dropped, unused now with upstart.
    + debian/additions/mysqld_safe_syslog.cnf: Dropped, unused now with upstart.
    + debian/additons/my.cnf: Remove pid declaration and setup error logging to /var/log/mysql since
      we're not piping anything around logger anymore.
    + debian/rules, debian/mysql-server-5.1.logcheck.ignore.{paranoid,worstation},
      debian/mysql-server-5.1.logcheck.ignore.server: : Remove references to mysqld_safe
    + debian/patches/38_scripts_mysqld_safe.sh_signals.dpatch: Dropped
  * Added -fno-strict-aliasing to CFLAGS to get around mysql testsuite build failures.
  * Add Apport hook (LP: #354188):
    + debian/mysql-server-5.1.py: apport package hook
    + debian/rules: Make it installable
  * debian/mysql-server-5.1.mysql-server.logrotate: Check to see if mysql is running before
    running logrotate. (LP: #513135)
  * Make the testsuite installable. (LP: #530752)
    + debian/mysql-server-5.1.files, debian/rules: install apport package hook
  * debian/mysql-server-5.1.preinst: Set mysql user's home directory
    to /nonexistent to protect against having the /var/lib/mysql
    user-writeable. If an attacker can trick mysqld into creating
    dot files in the home directory, he could do .rhost-like attacks
    on the system. (LP: #293258)
  * debian/control: mysql-client-5.1 should depend on mysql-core-client-5.1.
    (LP: #590952)
  * debian/mysql-server.5.1.postinst: Specify the mysql user when installing 
    the mysql databases. (LP: #591875)
  * Installing mysql_config_pic in /usr/bin so users of libmysqld-pic
    can extract the appropriate compile flags. (LP: #605021) 

Show diffs side-by-side

added added

removed removed

Lines of Context:
128
128
  bool is_fifo=0;
129
129
#ifndef EMBEDDED_LIBRARY
130
130
  LOAD_FILE_INFO lf_info;
 
131
  THD::killed_state killed_status;
131
132
#endif
132
133
  char *db = table_list->db;                    // This is never null
133
134
  /*
138
139
  char *tdb= thd->db ? thd->db : db;            // Result is never null
139
140
  ulong skip_lines= ex->skip_lines;
140
141
  bool transactional_table;
141
 
  THD::killed_state killed_status= THD::NOT_KILLED;
142
142
  DBUG_ENTER("mysql_load");
143
143
 
 
144
  /*
 
145
    Bug #34283
 
146
    mysqlbinlog leaves tmpfile after termination if binlog contains
 
147
    load data infile, so in mixed mode we go to row-based for
 
148
    avoiding the problem.
 
149
  */
 
150
  thd->set_current_stmt_binlog_row_based_if_mixed();
 
151
 
144
152
#ifdef EMBEDDED_LIBRARY
145
153
  read_file_from_client  = 0; //server is always in the same process 
146
154
#endif
455
463
                    error=1;
456
464
                    thd->killed= THD::KILL_QUERY;
457
465
                  };);
458
 
  killed_status= (error == 0)? THD::NOT_KILLED : thd->killed;
 
466
 
 
467
#ifndef EMBEDDED_LIBRARY
 
468
  killed_status= (error == 0) ? THD::NOT_KILLED : thd->killed;
 
469
#endif
 
470
 
459
471
  /*
460
472
    We must invalidate the table in query cache before binlog writing and
461
473
    ha_autocommit_...
708
720
  List_iterator_fast<Item> it(fields_vars);
709
721
  Item_field *sql_field;
710
722
  TABLE *table= table_list->table;
711
 
  ulonglong id;
712
723
  bool err;
713
724
  DBUG_ENTER("read_fixed_length");
714
725
 
715
 
  id= 0;
716
 
 
717
726
  while (!read_info.read_fixed_length())
718
727
  {
719
728
    if (thd->killed)
839
848
  Item *item;
840
849
  TABLE *table= table_list->table;
841
850
  uint enclosed_length;
842
 
  ulonglong id;
843
851
  bool err;
844
852
  DBUG_ENTER("read_sep_field");
845
853
 
846
854
  enclosed_length=enclosed.length();
847
 
  id= 0;
848
855
 
849
856
  for (;;it.rewind())
850
857
  {
1109
1116
                      MYF(MY_WME)))
1110
1117
    {
1111
1118
      my_free((uchar*) buffer,MYF(0)); /* purecov: inspected */
 
1119
      buffer= NULL;
1112
1120
      error=1;
1113
1121
    }
1114
1122
    else
1135
1143
 
1136
1144
READ_INFO::~READ_INFO()
1137
1145
{
1138
 
  if (!error)
1139
 
  {
1140
 
    if (need_end_io_cache)
1141
 
      ::end_io_cache(&cache);
1142
 
    my_free((uchar*) buffer,MYF(0));
1143
 
    error=1;
1144
 
  }
 
1146
  if (!error && need_end_io_cache)
 
1147
    ::end_io_cache(&cache);
 
1148
 
 
1149
  my_free(buffer, MYF(MY_ALLOW_ZERO_PTR));
1145
1150
}
1146
1151
 
1147
1152
 
1208
1213
    while ( to < end_of_buff)
1209
1214
    {
1210
1215
      chr = GET;
1211
 
#ifdef USE_MB
1212
 
      if ((my_mbcharlen(read_charset, chr) > 1) &&
1213
 
          to+my_mbcharlen(read_charset, chr) <= end_of_buff)
1214
 
      {
1215
 
          uchar* p = (uchar*)to;
1216
 
          *to++ = chr;
1217
 
          int ml = my_mbcharlen(read_charset, chr);
1218
 
          int i;
1219
 
          for (i=1; i<ml; i++) {
1220
 
              chr = GET;
1221
 
              if (chr == my_b_EOF)
1222
 
                  goto found_eof;
1223
 
              *to++ = chr;
1224
 
          }
1225
 
          if (my_ismbchar(read_charset,
1226
 
                          (const char *)p,
1227
 
                          (const char *)to))
1228
 
            continue;
1229
 
          for (i=0; i<ml; i++)
1230
 
            PUSH((uchar) *--to);
1231
 
          chr = GET;
1232
 
      }
1233
 
#endif
1234
1216
      if (chr == my_b_EOF)
1235
1217
        goto found_eof;
1236
1218
      if (chr == escape_char)
1314
1296
          return 0;
1315
1297
        }
1316
1298
      }
 
1299
#ifdef USE_MB
 
1300
      if (my_mbcharlen(read_charset, chr) > 1 &&
 
1301
          to + my_mbcharlen(read_charset, chr) <= end_of_buff)
 
1302
      {
 
1303
        uchar* p= (uchar*) to;
 
1304
        int ml, i;
 
1305
        *to++ = chr;
 
1306
 
 
1307
        ml= my_mbcharlen(read_charset, chr);
 
1308
 
 
1309
        for (i= 1; i < ml; i++) 
 
1310
        {
 
1311
          chr= GET;
 
1312
          if (chr == my_b_EOF)
 
1313
          {
 
1314
            /*
 
1315
             Need to back up the bytes already ready from illformed
 
1316
             multi-byte char 
 
1317
            */
 
1318
            to-= i;
 
1319
            goto found_eof;
 
1320
          }
 
1321
          *to++ = chr;
 
1322
        }
 
1323
        if (my_ismbchar(read_charset,
 
1324
                        (const char *)p,
 
1325
                        (const char *)to))
 
1326
          continue;
 
1327
        for (i= 0; i < ml; i++)
 
1328
          PUSH((uchar) *--to);
 
1329
        chr= GET;
 
1330
      }
 
1331
#endif
1317
1332
      *to++ = (uchar) chr;
1318
1333
    }
1319
1334
    /*