~drizzle-trunk/drizzle/development

« back to all changes in this revision

Viewing changes to drizzled/message/statement_transform.cc

  • Committer: Brian Aker
  • Date: 2010-03-17 19:18:40 UTC
  • mto: This revision was merged to the branch mainline in revision 1354.
  • Revision ID: brian@gaz-20100317191840-9ro7fajqp6lhaqjo
Update, we now have all of the ANSI INFORMATION_SCHEMA listed.

Show diffs side-by-side

added added

removed removed

Lines of Context:
819
819
enum TransformSqlError
820
820
transformTableDefinitionToSql(const Table &table,
821
821
                              string &destination,
822
 
                              enum TransformSqlVariant sql_variant, bool with_schema)
 
822
                              enum TransformSqlVariant sql_variant)
823
823
{
824
824
  char quoted_identifier= '`';
825
825
  if (sql_variant == ANSI)
831
831
    destination.append("TEMPORARY ", 10);
832
832
  
833
833
  destination.append("TABLE ", 6);
834
 
  if (with_schema)
835
 
  {
836
 
    destination.push_back(quoted_identifier);
837
 
    destination.append(table.schema());
838
 
    destination.push_back(quoted_identifier);
839
 
    destination.push_back('.');
840
 
  }
841
834
  destination.push_back(quoted_identifier);
842
835
  destination.append(table.name());
843
836
  destination.push_back(quoted_identifier);
1119
1112
    break;
1120
1113
  case Table::Field::ENUM:
1121
1114
    {
1122
 
      size_t num_field_values= field.enumeration_values().field_value_size();
 
1115
      size_t num_field_values= field.set_options().field_value_size();
1123
1116
      destination.append(" ENUM(", 6);
1124
1117
      for (size_t x= 0; x < num_field_values; ++x)
1125
1118
      {
1126
 
        const string &type= field.enumeration_values().field_value(x);
 
1119
        const string &type= field.set_options().field_value(x);
1127
1120
 
1128
1121
        if (x != 0)
1129
1122
          destination.push_back(',');
1281
1274
  return Table::Field::INTEGER; /* unreachable */
1282
1275
}
1283
1276
 
1284
 
bool transactionContainsBulkSegment(const Transaction &transaction)
1285
 
{
1286
 
  size_t num_statements= transaction.statement_size();
1287
 
  if (num_statements == 0)
1288
 
    return false;
1289
 
 
1290
 
  /*
1291
 
   * Only INSERT, UPDATE, and DELETE statements can possibly
1292
 
   * have bulk segments.  So, we loop through the statements
1293
 
   * checking for segment_id > 1 in those specific submessages.
1294
 
   */
1295
 
  size_t x;
1296
 
  for (x= 0; x < num_statements; ++x)
1297
 
  {
1298
 
    const Statement &statement= transaction.statement(x);
1299
 
    Statement::Type type= statement.type();
1300
 
 
1301
 
    switch (type)
1302
 
    {
1303
 
      case Statement::INSERT:
1304
 
        if (statement.insert_data().segment_id() > 1)
1305
 
          return true;
1306
 
        break;
1307
 
      case Statement::UPDATE:
1308
 
        if (statement.update_data().segment_id() > 1)
1309
 
          return true;
1310
 
        break;
1311
 
      case Statement::DELETE:
1312
 
        if (statement.delete_data().segment_id() > 1)
1313
 
          return true;
1314
 
        break;
1315
 
      default:
1316
 
        break;
1317
 
    }
1318
 
  }
1319
 
  return false;
1320
 
}
1321
 
 
1322
1277
} /* namespace message */
1323
1278
} /* namespace drizzled */