~jlukas79/+junk/mysql-server

« back to all changes in this revision

Viewing changes to client/mysql.cc

manual merge 6.0-main --> 6.0-bka-review

Show diffs side-by-side

added added

removed removed

Lines of Context:
1283
1283
 
1284
1284
  /* terminate if no query being executed, or we already tried interrupting */
1285
1285
  if (!executing_query || interrupted_query)
1286
 
    mysql_end(sig);
 
1286
    goto err;
1287
1287
 
1288
1288
  kill_mysql= mysql_init(kill_mysql);
1289
1289
  if (!mysql_real_connect(kill_mysql,current_host, current_user, opt_password,
1290
1290
                          "", opt_mysql_port, opt_mysql_unix_port,0))
1291
 
    mysql_end(sig);
 
1291
    goto err;
1292
1292
 
1293
1293
  /* kill_buffer is always big enough because max length of %lu is 15 */
1294
1294
  sprintf(kill_buffer, "KILL /*!50000 QUERY */ %lu", mysql_thread_id(&mysql));
1297
1297
  tee_fprintf(stdout, "Query aborted by Ctrl+C\n");
1298
1298
 
1299
1299
  interrupted_query= 1;
 
1300
 
 
1301
  return;
 
1302
 
 
1303
err:
 
1304
#ifdef _WIN32
 
1305
  /*
 
1306
   When SIGINT is raised on Windows, the OS creates a new thread to handle the
 
1307
   interrupt. Once that thread completes, the main thread continues running 
 
1308
   only to find that it's resources have already been free'd when the sigint 
 
1309
   handler called mysql_end(). 
 
1310
  */
 
1311
  mysql_thread_end();
 
1312
  return;
 
1313
#else
 
1314
  mysql_end(sig);
 
1315
#endif  
1300
1316
}
1301
1317
 
1302
1318
 
1832
1848
        the very beginning of a text file when
1833
1849
        you save the file using "Unicode UTF-8" format.
1834
1850
      */
1835
 
      if (!line_number &&
 
1851
      if (line && !line_number &&
1836
1852
           (uchar) line[0] == 0xEF &&
1837
1853
           (uchar) line[1] == 0xBB &&
1838
1854
           (uchar) line[2] == 0xBF)
2112
2128
        continue;
2113
2129
      }
2114
2130
    }
2115
 
    else if (!*ml_comment && !*in_string &&
2116
 
             (end_of_line - pos) >= 10 &&
2117
 
             !my_strnncoll(charset_info, (uchar*) pos, 10,
2118
 
                           (const uchar*) "delimiter ", 10))
2119
 
    {
2120
 
      // Flush previously accepted characters
2121
 
      if (out != line)
2122
 
      {
2123
 
        buffer.append(line, (uint32) (out - line));
2124
 
        out= line;
2125
 
      }
2126
 
 
2127
 
      // Flush possible comments in the buffer
2128
 
      if (!buffer.is_empty())
2129
 
      {
2130
 
        if (com_go(&buffer, 0) > 0) // < 0 is not fatal
2131
 
          DBUG_RETURN(1);
2132
 
        buffer.length(0);
2133
 
      }
2134
 
 
2135
 
      /*
2136
 
        Delimiter wants the get rest of the given line as argument to
2137
 
        allow one to change ';' to ';;' and back
2138
 
      */
2139
 
      buffer.append(pos);
2140
 
      if (com_delimiter(&buffer, pos) > 0)
2141
 
        DBUG_RETURN(1);
2142
 
 
2143
 
      buffer.length(0);
2144
 
      break;
2145
 
    }
2146
2131
    else if (!*ml_comment && !*in_string && is_prefix(pos, delimiter))
2147
2132
    {
2148
2133
      // Found a statement. Continue parsing after the delimiter
2187
2172
    }
2188
2173
    else if (!*ml_comment && (!*in_string && (inchar == '#' ||
2189
2174
                              inchar == '-' && pos[1] == '-' &&
2190
 
                              my_isspace(charset_info,pos[2]))))
 
2175
                              /*
 
2176
                                The third byte is either whitespace or is the
 
2177
                                end of the line -- which would occur only
 
2178
                                because of the user sending newline -- which is
 
2179
                                itself whitespace and should also match.
 
2180
                              */
 
2181
                              (my_isspace(charset_info,pos[2]) ||
 
2182
                               !pos[2]))))
2191
2183
    {
2192
2184
      // Flush previously accepted characters
2193
2185
      if (out != line)