~drizzle-trunk/drizzle/development

« back to all changes in this revision

Viewing changes to drizzled/parser.cc

  • Committer: Olaf van der Spek
  • Date: 2011-10-06 18:18:31 UTC
  • mto: This revision was merged to the branch mainline in revision 2433.
  • Revision ID: olafvdspek@gmail.com-20111006181831-1ix5b80ry7iifbjf
Use lex_string assign(), data() and size()

Show diffs side-by-side

added added

removed removed

Lines of Context:
223
223
 
224
224
bool check_reserved_words(lex_string_t *name)
225
225
{
226
 
  if (!my_strcasecmp(system_charset_info, name->str, "GLOBAL") ||
227
 
      !my_strcasecmp(system_charset_info, name->str, "LOCAL") ||
228
 
      !my_strcasecmp(system_charset_info, name->str, "SESSION"))
 
226
  if (!my_strcasecmp(system_charset_info, name->data(), "GLOBAL") ||
 
227
      !my_strcasecmp(system_charset_info, name->data(), "LOCAL") ||
 
228
      !my_strcasecmp(system_charset_info, name->data(), "SESSION"))
229
229
    return true;
230
230
 
231
231
  return false;
305
305
{
306
306
  message::Engine::Option *opt= lex->table()->mutable_engine()->add_options();
307
307
  opt->set_name(key);
308
 
  opt->set_state(value.str, value.length);
 
308
  opt->set_state(value.data(), value.size());
309
309
}
310
310
 
311
311
void buildEngineOption(LEX *lex, const char *key, uint64_t value)
320
320
  statement::CreateSchema *statement= (statement::CreateSchema *)lex->statement;
321
321
  message::Engine::Option *opt= statement->schema_message.mutable_engine()->add_options();
322
322
  opt->set_name(key);
323
 
  opt->set_state(value.str, value.length);
 
323
  opt->set_state(value.data(), value.size());
324
324
}
325
325
 
326
326
void buildSchemaDefiner(LEX *lex, const lex_string_t &value)
327
327
{
328
328
  statement::CreateSchema *statement= (statement::CreateSchema *)lex->statement;
329
 
  identifier::User user(value.str);
 
329
  identifier::User user(value.data());
330
330
  message::set_definer(statement->schema_message, user);
331
331
}
332
332
 
348
348
{
349
349
  TableList *table= reinterpret_cast<TableList*>(lex->current_select->table_list.first);
350
350
 
351
 
  if (schema_name.length)
 
351
  if (schema_name.size())
352
352
  {
353
 
    if (my_strcasecmp(table_alias_charset, schema_name.str, table->getSchemaName()))
 
353
    if (my_strcasecmp(table_alias_charset, schema_name.data(), table->getSchemaName()))
354
354
    {
355
 
      my_error(ER_WRONG_DB_NAME, MYF(0), schema_name.str);
 
355
      my_error(ER_WRONG_DB_NAME, MYF(0), schema_name.data());
356
356
      return false;
357
357
    }
358
358
  }
359
359
 
360
 
  if (my_strcasecmp(table_alias_charset, table_name.str,
 
360
  if (my_strcasecmp(table_alias_charset, table_name.data(),
361
361
                    table->getTableName()))
362
362
  {
363
 
    my_error(ER_WRONG_TABLE_NAME, MYF(0), table_name.str);
 
363
    my_error(ER_WRONG_TABLE_NAME, MYF(0), table_name.data());
364
364
    return false;
365
365
  }
366
366
 
371
371
{
372
372
  Select_Lex *sel= lex->current_select;
373
373
 
374
 
  if (table_name.length and sel->no_table_names_allowed)
 
374
  if (table_name.size() and sel->no_table_names_allowed)
375
375
  {
376
 
    my_error(ER_TABLENAME_NOT_ALLOWED_HERE, MYF(0), table_name.str, lex->session->where());
 
376
    my_error(ER_TABLENAME_NOT_ALLOWED_HERE, MYF(0), table_name.data(), lex->session->where());
377
377
  }
378
378
 
379
379
  return sel->parsing_place != IN_HAVING || sel->get_in_sum_expr() > 0
380
 
    ? (Item*) new Item_field(lex->current_context(), schema_name.str, table_name.str, field_name.str) 
381
 
    : (Item*) new Item_ref(lex->current_context(), schema_name.str, table_name.str, field_name.str);
 
380
    ? (Item*) new Item_field(lex->current_context(), schema_name.data(), table_name.data(), field_name.data()) 
 
381
    : (Item*) new Item_ref(lex->current_context(), schema_name.data(), table_name.data(), field_name.data());
382
382
}
383
383
 
384
384
Item *buildTableWild(LEX *lex, const lex_string_t &schema_name, const lex_string_t &table_name)
385
385
{
386
386
  Select_Lex *sel= lex->current_select;
387
 
  Item *item= new Item_field(lex->current_context(), schema_name.str, table_name.str, "*");
 
387
  Item *item= new Item_field(lex->current_context(), schema_name.data(), table_name.data(), "*");
388
388
  sel->with_wild++;
389
 
 
390
389
  return item;
391
390
}
392
391