~drizzle-trunk/drizzle/development

« back to all changes in this revision

Viewing changes to drizzled/message/statement_transform.cc

  • Committer: Monty Taylor
  • Date: 2011-02-13 17:26:39 UTC
  • mfrom: (2157.2.2 give-in-to-pkg-config)
  • mto: This revision was merged to the branch mainline in revision 2166.
  • Revision ID: mordred@inaugust.com-20110213172639-nhy7i72sfhoq13ms
Merged in pkg-config fixes.

Show diffs side-by-side

added added

removed removed

Lines of Context:
29
29
 * Statement messages to other formats, including SQL strings.
30
30
 */
31
31
 
32
 
#include <config.h>
 
32
#include "config.h"
33
33
 
34
34
#include <boost/lexical_cast.hpp>
35
 
 
36
 
#include <drizzled/charset.h>
37
 
#include <drizzled/message.h>
38
 
#include <drizzled/message/statement_transform.h>
39
 
#include <drizzled/message/transaction.pb.h>
40
 
#include <drizzled/message/access.h>
 
35
#include "drizzled/message/statement_transform.h"
 
36
#include "drizzled/message/transaction.pb.h"
 
37
#include "drizzled/message/table.pb.h"
 
38
#include "drizzled/charset.h"
 
39
#include "drizzled/charset_info.h"
 
40
#include "drizzled/global_charset_info.h"
41
41
 
42
42
#include <string>
43
43
#include <vector>
152
152
      const InsertHeader &insert_header= source.insert_header();
153
153
      const InsertData &insert_data= source.insert_data();
154
154
      size_t num_keys= insert_data.record_size();
 
155
      size_t x;
155
156
 
156
157
      if (num_keys > 1 && ! already_in_transaction)
157
158
        sql_strings.push_back("START TRANSACTION");
158
159
 
159
 
      for (size_t x= 0; x < num_keys; ++x)
 
160
      for (x= 0; x < num_keys; ++x)
160
161
      {
161
162
        string destination;
162
163
 
338
339
    }
339
340
    break;
340
341
  case Statement::RAW_SQL:
341
 
    {
342
 
      if (source.has_raw_sql_schema())
343
 
      {
344
 
        string destination("USE ");
345
 
        destination.append(source.raw_sql_schema());
346
 
        sql_strings.push_back(destination);
347
 
      }
348
 
      sql_strings.push_back(source.sql());
349
 
    }
350
 
    break;
351
342
  default:
352
343
    sql_strings.push_back(source.sql());
353
344
    break;
402
393
                                                           destination,
403
394
                                                           sql_variant);
404
395
 
 
396
  char quoted_identifier= '`';
 
397
  if (sql_variant == ANSI)
 
398
    quoted_identifier= '"';
 
399
 
405
400
  destination.append(") VALUES (");
406
401
 
407
402
  /* Add insert values */
471
466
                                                           destination,
472
467
                                                           sql_variant);
473
468
 
 
469
  char quoted_identifier= '`';
 
470
  if (sql_variant == ANSI)
 
471
    quoted_identifier= '"';
 
472
 
474
473
  destination.append(") VALUES (", 10);
475
474
 
476
475
  /* Add insert values */
886
885
    destination.append(schema.collation());
887
886
  }
888
887
 
889
 
  if (not message::is_replicated(schema))
890
 
  {
891
 
    destination.append(" REPLICATE = FALSE");
892
 
  }
893
 
 
894
 
  if (message::has_definer(schema))
895
 
  {
896
 
    destination.append(" DEFINER ");
897
 
    destination.push_back('\'');
898
 
    destination.append(message::definer(schema));
899
 
    destination.push_back('\'');
900
 
  }
901
 
 
902
888
  return NONE;
903
889
}
904
890
 
1092
1078
  if (table.has_options())
1093
1079
    (void) transformTableOptionsToSql(table.options(), destination, sql_variant);
1094
1080
 
1095
 
  if (not message::is_replicated(table))
1096
 
  {
1097
 
    destination.append(" REPLICATE = FALSE");
1098
 
  }
1099
 
 
1100
 
  if (message::has_definer(table))
1101
 
  {
1102
 
    destination.append(" DEFINER ");
1103
 
    destination.push_back('\'');
1104
 
    destination.append(message::definer(table));
1105
 
    destination.push_back('\'');
1106
 
  }
1107
 
 
1108
1081
  return NONE;
1109
1082
}
1110
1083
 
1167
1140
    destination.append(boost::lexical_cast<string>(options.avg_row_length()));
1168
1141
  }
1169
1142
 
1170
 
  if (options.has_checksum() && options.checksum())
 
1143
  if (options.has_checksum() &&
 
1144
      options.checksum())
1171
1145
    destination.append("\nCHECKSUM = TRUE");
1172
 
 
1173
 
  if (options.has_page_checksum() && options.page_checksum())
 
1146
  if (options.has_page_checksum() &&
 
1147
      options.page_checksum())
1174
1148
    destination.append("\nPAGE_CHECKSUM = TRUE");
1175
1149
 
1176
1150
  return NONE;