~drizzle-trunk/drizzle/development

« back to all changes in this revision

Viewing changes to drizzled/sql_yacc.yy

  • Committer: Mark Atwood
  • Date: 2011-10-14 15:59:08 UTC
  • mfrom: (2430.1.12 refactor3a)
  • Revision ID: me@mark.atwood.name-20111014155908-whqmrmaf2grpsg5c
mergeĀ lp:~olafvdspek/drizzle/refactor3

Show diffs side-by-side

added added

removed removed

Lines of Context:
1000
1000
          ident_or_text
1001
1001
          {
1002
1002
            statement::CreateSchema *statement= (statement::CreateSchema *)Lex.statement;
1003
 
            statement->schema_message.mutable_engine()->add_options()->set_name($1.str);
 
1003
            statement->schema_message.mutable_engine()->add_options()->set_name($1.data());
1004
1004
          }
1005
1005
        | REPLICATE '=' TRUE_SYM
1006
1006
          {
1020
1020
          }
1021
1021
        | ident_or_text '=' ident_or_text
1022
1022
          {
1023
 
            parser::buildSchemaOption(&Lex, $1.str, $3);
 
1023
            parser::buildSchemaOption(&Lex, $1.data(), $3);
1024
1024
          }
1025
1025
        | ident_or_text '=' ulonglong_num
1026
1026
          {
1027
 
            parser::buildSchemaOption(&Lex, $1.str, $3);
 
1027
            parser::buildSchemaOption(&Lex, $1.data(), $3);
1028
1028
          }
1029
1029
        ;
1030
1030
 
1059
1059
custom_engine_option:
1060
1060
        ENGINE_SYM '=' ident_or_text
1061
1061
          {
1062
 
            Lex.table()->mutable_engine()->set_name($3.str);
 
1062
            Lex.table()->mutable_engine()->set_name($3.data());
1063
1063
          }
1064
1064
        | COMMENT_SYM opt_equal TEXT_STRING_sys
1065
1065
          {
1066
 
            Lex.table()->mutable_options()->set_comment($3.str);
 
1066
            Lex.table()->mutable_options()->set_comment($3.data());
1067
1067
          }
1068
1068
        | AUTO_INC opt_equal ulonglong_num
1069
1069
          {
1079
1079
          }
1080
1080
        | DEFINER TEXT_STRING_sys
1081
1081
          {
1082
 
            drizzled::identifier::User user($2.str);
 
1082
            drizzled::identifier::User user($2.data());
1083
1083
            message::set_definer(*Lex.table(), user);
1084
1084
          }
1085
1085
        | DEFINER CURRENT_USER optional_braces
1096
1096
          }
1097
1097
        |  ident_or_text '=' engine_option_value
1098
1098
          {
1099
 
            parser::buildEngineOption(&Lex, $1.str, $3);
 
1099
            parser::buildEngineOption(&Lex, $1.data(), $3);
1100
1100
          }
1101
1101
        | ident_or_text '=' ulonglong_num
1102
1102
          {
1103
 
            parser::buildEngineOption(&Lex, $1.str, $3);
 
1103
            parser::buildEngineOption(&Lex, $1.data(), $3);
1104
1104
          }
1105
1105
        | default_charset
1106
1106
        | default_collation
1150
1150
row_format_or_text:
1151
1151
          row_format
1152
1152
          {
1153
 
            $$.str= YYSession->mem.strdup($1.str, $1.length);
1154
 
            $$.length= $1.length;
 
1153
            $$.assign(YYSession->mem.strdup($1.data(), $1.length), $1.length);
1155
1154
          }
1156
1155
        ;
1157
1156
 
1186
1185
        | opt_constraint constraint_key_type opt_ident key_alg
1187
1186
          '(' key_list ')' key_options
1188
1187
          {
1189
 
            parser::buildKey(&Lex, $2, $3.str ? $3 : $1);
 
1188
            parser::buildKey(&Lex, $2, $3.data() ? $3 : $1);
1190
1189
          }
1191
1190
        | opt_constraint FOREIGN KEY_SYM opt_ident '(' key_list ')' references
1192
1191
          {
1193
 
            parser::buildForeignKey(&Lex, $1.str ? $1 : $4, $8);
 
1192
            parser::buildForeignKey(&Lex, $1.data() ? $1 : $4, $8);
1194
1193
          }
1195
1194
        | constraint opt_check_constraint
1196
1195
          {
1231
1230
 
1232
1231
            if (Lex.field())
1233
1232
            {
1234
 
              Lex.field()->set_name($1.str);
 
1233
              Lex.field()->set_name($1.data());
1235
1234
            }
1236
1235
 
1237
1236
            if (add_field_to_list(Lex.session, &$1, (enum enum_field_types) $3,
1253
1252
          }
1254
1253
        | TIMESTAMP_SYM '(' NUM ')' opt_attribute_timestamp
1255
1254
          {
1256
 
            $$=parser::buildTimestampColumn(&Lex, $3.str);
 
1255
            $$=parser::buildTimestampColumn(&Lex, $3.data());
1257
1256
          }
1258
1257
        | DATETIME_SYM opt_attribute_timestamp
1259
1258
          {
1272
1271
          }
1273
1272
        | varchar '(' NUM ')' opt_attribute_string
1274
1273
          {
1275
 
            $$= parser::buildVarcharColumn(&Lex, $3.str);
 
1274
            $$= parser::buildVarcharColumn(&Lex, $3.data());
1276
1275
          }
1277
1276
        | TEXT_SYM opt_attribute_string
1278
1277
          {
1295
1294
          }
1296
1295
        | VARBINARY '(' NUM ')' opt_attribute
1297
1296
          {
1298
 
            $$= parser::buildVarbinaryColumn(&Lex, $3.str);
 
1297
            $$= parser::buildVarbinaryColumn(&Lex, $3.data());
1299
1298
          }
1300
1299
        | real_type opt_attribute_number
1301
1300
          {
1389
1388
          /* empty */
1390
1389
          { Lex.dec=Lex.length= NULL; }
1391
1390
        | '(' NUM ')'
1392
 
          { Lex.length=$2.str; Lex.dec= NULL; }
 
1391
          { Lex.length=$2.data(); Lex.dec= NULL; }
1393
1392
        | precision
1394
1393
          {}
1395
1394
        ;
1397
1396
precision:
1398
1397
          '(' NUM ',' NUM ')'
1399
1398
          {
1400
 
            Lex.length= $2.str;
1401
 
            Lex.dec= $4.str;
 
1399
            Lex.length= $2.data();
 
1400
            Lex.dec= $4.data();
1402
1401
          }
1403
1402
        ;
1404
1403
 
1405
1404
opt_len:
1406
1405
          /* empty */ { Lex.length= NULL; /* use default length */ }
1407
 
        | '(' NUM ')' { Lex.length= $2.str; }
 
1406
        | '(' NUM ')' { Lex.length= $2.data(); }
1408
1407
        ;
1409
1408
 
1410
1409
opt_field_number_signed:
1605
1604
            statement->comment= $2;
1606
1605
 
1607
1606
            if (Lex.field())
1608
 
              Lex.field()->set_comment($2.str);
 
1607
              Lex.field()->set_comment($2.data());
1609
1608
          }
1610
1609
        ;
1611
1610
 
1612
1611
collation_name:
1613
1612
          ident_or_text
1614
1613
          {
1615
 
            if (!($$=get_charset_by_name($1.str)))
 
1614
            if (!($$=get_charset_by_name($1.data())))
1616
1615
            {
1617
 
              my_error(ER_UNKNOWN_COLLATION, MYF(0), $1.str);
 
1616
              my_error(ER_UNKNOWN_COLLATION, MYF(0), $1.data());
1618
1617
              DRIZZLE_YYABORT;
1619
1618
            }
1620
1619
          }
1790
1789
          ident { $$=new Key_part_spec($1, 0); }
1791
1790
        | ident '(' NUM ')'
1792
1791
          {
1793
 
            int key_part_len= atoi($3.str);
 
1792
            int key_part_len= atoi($3.data());
1794
1793
            if (!key_part_len)
1795
1794
            {
1796
 
              my_error(ER_KEY_PART_0, MYF(0), $1.str);
 
1795
              my_error(ER_KEY_PART_0, MYF(0), $1.data());
1797
1796
            }
1798
1797
            $$=new Key_part_spec($1, (uint) key_part_len);
1799
1798
          }
1830
1829
 
1831
1830
            Lex.col_list.clear();
1832
1831
            Lex.select_lex.init_order();
1833
 
            Lex.select_lex.db= const_cast<char*>(((TableList*) Lex.select_lex.table_list.first)->getSchemaName());
 
1832
            Lex.select_lex.db= ((TableList*) Lex.select_lex.table_list.first)->getSchemaName();
1834
1833
          }
1835
1834
          alter_commands
1836
1835
          {}
1841
1840
          default_collation_schema
1842
1841
          {
1843
1842
            Lex.name= $3;
1844
 
            if (Lex.name.str == NULL && Lex.session->copy_db_to(Lex.name.str, Lex.name.length))
1845
 
              DRIZZLE_YYABORT;
 
1843
            if (not Lex.name.data())
 
1844
            {
 
1845
              str_ref db = Lex.session->copy_db_to();
 
1846
              if (db.empty())
 
1847
                DRIZZLE_YYABORT;
 
1848
              Lex.name.assign(db.data(), db.size());
 
1849
            }
1846
1850
          }
1847
1851
        ;
1848
1852
 
1911
1915
        | CHANGE_SYM opt_column field_ident
1912
1916
          {
1913
1917
            statement::AlterTable *statement= (statement::AlterTable *)Lex.statement;
1914
 
            statement->change= $3.str;
 
1918
            statement->change= $3.data();
1915
1919
            statement->alter_info.flags.set(ALTER_CHANGE_COLUMN);
1916
1920
          }
1917
1921
          field_spec opt_place
1939
1943
                                  statement->default_value,
1940
1944
                                  statement->on_update_value,
1941
1945
                                  &statement->comment,
1942
 
                                  $3.str, &Lex.interval_list, Lex.charset))
 
1946
                                  $3.data(), &Lex.interval_list, Lex.charset))
1943
1947
              DRIZZLE_YYABORT;
1944
1948
          }
1945
1949
          opt_place
1951
1955
            message::AlterTable::AlterTableOperation *operation;
1952
1956
            operation= Lex.alter_table()->add_operations();
1953
1957
            operation->set_operation(message::AlterTable::AlterTableOperation::DROP_COLUMN);
1954
 
            operation->set_drop_name($3.str);
 
1958
            operation->set_drop_name($3.data());
1955
1959
          }
1956
1960
        | DROP FOREIGN KEY_SYM opt_ident
1957
1961
          {
1958
 
            parser::buildAddAlterDropIndex(&Lex, $4.str, true);
 
1962
            parser::buildAddAlterDropIndex(&Lex, $4.data(), true);
1959
1963
          }
1960
1964
        | DROP PRIMARY_SYM KEY_SYM
1961
1965
          {
1963
1967
          }
1964
1968
        | DROP key_or_index field_ident
1965
1969
          {
1966
 
            parser::buildAddAlterDropIndex(&Lex, $3.str);
 
1970
            parser::buildAddAlterDropIndex(&Lex, $3.data());
1967
1971
          }
1968
1972
        | DISABLE_SYM KEYS
1969
1973
          {
1988
1992
          {
1989
1993
            statement::AlterTable *statement= (statement::AlterTable *)Lex.statement;
1990
1994
 
1991
 
            statement->alter_info.alter_list.push_back(AlterColumn($3.str,$6));
 
1995
            statement->alter_info.alter_list.push_back(AlterColumn($3.data(),$6));
1992
1996
            statement->alter_info.flags.set(ALTER_COLUMN_DEFAULT);
1993
1997
          }
1994
1998
        | ALTER_SYM opt_column field_ident DROP DEFAULT
1995
1999
          {
1996
2000
            statement::AlterTable *statement= (statement::AlterTable *)Lex.statement;
1997
2001
 
1998
 
            statement->alter_info.alter_list.push_back(AlterColumn($3.str, (Item*) 0));
 
2002
            statement->alter_info.alter_list.push_back(AlterColumn($3.data(), NULL));
1999
2003
            statement->alter_info.flags.set(ALTER_COLUMN_DEFAULT);
2000
2004
          }
2001
2005
        | RENAME opt_to table_ident
2002
2006
          {
2003
2007
            statement::AlterTable *statement= (statement::AlterTable *)Lex.statement;
2004
 
            size_t dummy;
2005
 
 
2006
 
            Lex.select_lex.db=$3->db.str;
2007
 
            if (Lex.select_lex.db == NULL &&
2008
 
                Lex.session->copy_db_to(Lex.select_lex.db, dummy))
 
2008
            Lex.select_lex.db= $3->db.data();
 
2009
            if (not Lex.select_lex.db)
2009
2010
            {
2010
 
              DRIZZLE_YYABORT;
 
2011
              str_ref db = Lex.session->copy_db_to();
 
2012
              if (db.empty())
 
2013
                DRIZZLE_YYABORT;
 
2014
              Lex.select_lex.db = db.data();
2011
2015
            }
2012
2016
 
2013
 
            if (check_table_name($3->table.str,$3->table.length))
 
2017
            if (check_table_name($3->table.data(), $3->table.size()))
2014
2018
            {
2015
 
              my_error(ER_WRONG_TABLE_NAME, MYF(0), $3->table.str);
 
2019
              my_error(ER_WRONG_TABLE_NAME, MYF(0), $3->table.data());
2016
2020
              DRIZZLE_YYABORT;
2017
2021
            }
2018
2022
 
2022
2026
            message::AlterTable::RenameTable *rename_operation;
2023
2027
            rename_operation= Lex.alter_table()->mutable_rename();
2024
2028
            rename_operation->set_to_schema(Lex.select_lex.db);
2025
 
            rename_operation->set_to_name(Lex.name.str);
 
2029
            rename_operation->set_to_name(Lex.name.data());
2026
2030
          }
2027
2031
        | CONVERT_SYM TO_SYM collation_name_or_default
2028
2032
          {
2068
2072
          /* empty */ {}
2069
2073
        | AFTER_SYM ident
2070
2074
          {
2071
 
            parser::storeAlterColumnPosition(&Lex, $2.str);
 
2075
            parser::storeAlterColumnPosition(&Lex, $2.data());
2072
2076
          }
2073
2077
        | FIRST_SYM
2074
2078
          {
2341
2345
 
2342
2346
            YYSession->add_item_to_list($2);
2343
2347
 
2344
 
            if ($4.str)
 
2348
            if ($4.data())
2345
2349
            {
2346
2350
              $2->is_autogenerated_name= false;
2347
 
              $2->set_name($4.str, $4.length, system_charset_info);
 
2351
              $2->set_name($4.data(), $4.size(), system_charset_info);
2348
2352
            }
2349
2353
            else if (!$2->name)
2350
2354
            {
2686
2690
        | function_call_conflict
2687
2691
        | simple_expr COLLATE_SYM ident_or_text %prec UMINUS
2688
2692
          {
2689
 
            Item *i1= new (YYSession->mem_root) Item_string($3.str,
2690
 
                                                      $3.length,
2691
 
                                                      YYSession->charset());
 
2693
            Item *i1= new (YYSession->mem_root) Item_string($3.data(), $3.size(), YYSession->charset());
2692
2694
            $$= new (YYSession->mem_root) Item_func_set_collation($1, i1);
2693
2695
          }
2694
2696
        | literal
3083
3085
function_call_generic:
3084
3086
          IDENT_sys '('
3085
3087
          {
3086
 
            const plugin::Function *udf= plugin::Function::get(std::string($1.str, $1.length));
 
3088
            const plugin::Function *udf= plugin::Function::get(to_string($1));
3087
3089
 
3088
3090
            /* Temporary placing the result of getFunction in $3 */
3089
3091
            $<udf>$= udf;
3112
3114
                        else 
3113
3115
                        {
3114
3116
              /* fix for bug 250065, from Andrew Garner <muzazzi@gmail.com> */
3115
 
              my_error(ER_SP_DOES_NOT_EXIST, MYF(0), "FUNCTION", $1.str);
 
3117
              my_error(ER_SP_DOES_NOT_EXIST, MYF(0), "FUNCTION", $1.data());
3116
3118
            }
3117
3119
 
3118
3120
            if (not ($$= item))
3150
3152
             because the syntax will not allow having an explicit name here.
3151
3153
             See WL#1017 re. udf attributes.
3152
3154
            */
3153
 
            if ($4.str)
 
3155
            if ($4.data())
3154
3156
            {
3155
3157
              $2->is_autogenerated_name= false;
3156
 
              $2->set_name($4.str, $4.length, system_charset_info);
 
3158
              $2->set_name($4.data(), $4.size(), system_charset_info);
3157
3159
            }
3158
3160
            else
3159
3161
              $2->set_name($1, (uint) ($3 - $1), YYSession->charset());
3238
3240
        | '@' opt_var_ident_type user_variable_ident opt_component
3239
3241
          {
3240
3242
            /* disallow "SELECT @@global.global.variable" */
3241
 
            if ($3.str && $4.str && parser::check_reserved_words(&$3))
 
3243
            if ($3.data() && $4.data() && parser::check_reserved_words(&$3))
3242
3244
            {
3243
3245
              parser::my_parse_error(YYSession->m_lip);
3244
3246
              DRIZZLE_YYABORT;
3811
3813
 
3812
3814
key_usage_element:
3813
3815
          ident
3814
 
          { Lex.current_select->add_index_hint(YYSession, $1.str); }
 
3816
          { Lex.current_select->add_index_hint(YYSession, $1.data()); }
3815
3817
        | PRIMARY_SYM
3816
3818
          { Lex.current_select->add_index_hint(YYSession, "PRIMARY"); }
3817
3819
        ;
3825
3827
          ident
3826
3828
          {
3827
3829
            $$= new List<String>;
3828
 
            $$->push_back(new (YYSession->mem_root) String($1.str, $1.length, system_charset_info));
 
3830
            $$->push_back(new (YYSession->mem_root) String($1.data(), $1.size(), system_charset_info));
3829
3831
          }
3830
3832
        | using_list ',' ident
3831
3833
          {
3832
 
            $1->push_back(new (YYSession->mem_root) String($3.str, $3.length, system_charset_info));
 
3834
            $1->push_back(new (YYSession->mem_root) String($3.data(), $3.size(), system_charset_info));
3833
3835
            $$= $1;
3834
3836
          }
3835
3837
        ;
4080
4082
        ;
4081
4083
 
4082
4084
limit_option:
4083
 
          ULONGLONG_NUM { $$= new Item_uint($1.str, $1.length); }
4084
 
        | LONG_NUM      { $$= new Item_uint($1.str, $1.length); }
4085
 
        | NUM           { $$= new Item_uint($1.str, $1.length); }
 
4085
          ULONGLONG_NUM { $$= new Item_uint($1.data(), $1.size()); }
 
4086
        | LONG_NUM      { $$= new Item_uint($1.data(), $1.size()); }
 
4087
        | NUM           { $$= new Item_uint($1.data(), $1.size()); }
4086
4088
        ;
4087
4089
 
4088
4090
delete_limit_clause:
4099
4101
        ;
4100
4102
 
4101
4103
ulong_num:
4102
 
          NUM           { int error; $$= (unsigned long) internal::my_strtoll10($1.str, NULL, &error); }
4103
 
        | HEX_NUM       { $$= (unsigned long) strtol($1.str, NULL, 16); }
4104
 
        | LONG_NUM      { int error; $$= (unsigned long) internal::my_strtoll10($1.str, NULL, &error); }
4105
 
        | ULONGLONG_NUM { int error; $$= (unsigned long) internal::my_strtoll10($1.str, NULL, &error); }
4106
 
        | DECIMAL_NUM   { int error; $$= (unsigned long) internal::my_strtoll10($1.str, NULL, &error); }
4107
 
        | FLOAT_NUM     { int error; $$= (unsigned long) internal::my_strtoll10($1.str, NULL, &error); }
 
4104
          NUM           { int error; $$= (unsigned long) internal::my_strtoll10($1.data(), NULL, &error); }
 
4105
        | HEX_NUM       { $$= (unsigned long) strtol($1.data(), NULL, 16); }
 
4106
        | LONG_NUM      { int error; $$= (unsigned long) internal::my_strtoll10($1.data(), NULL, &error); }
 
4107
        | ULONGLONG_NUM { int error; $$= (unsigned long) internal::my_strtoll10($1.data(), NULL, &error); }
 
4108
        | DECIMAL_NUM   { int error; $$= (unsigned long) internal::my_strtoll10($1.data(), NULL, &error); }
 
4109
        | FLOAT_NUM     { int error; $$= (unsigned long) internal::my_strtoll10($1.data(), NULL, &error); }
4108
4110
        ;
4109
4111
 
4110
4112
ulonglong_num:
4111
 
          NUM           { int error; $$= (uint64_t) internal::my_strtoll10($1.str, NULL, &error); }
4112
 
        | ULONGLONG_NUM { int error; $$= (uint64_t) internal::my_strtoll10($1.str, NULL, &error); }
4113
 
        | LONG_NUM      { int error; $$= (uint64_t) internal::my_strtoll10($1.str, NULL, &error); }
4114
 
        | DECIMAL_NUM   { int error; $$= (uint64_t) internal::my_strtoll10($1.str, NULL, &error); }
4115
 
        | FLOAT_NUM     { int error; $$= (uint64_t) internal::my_strtoll10($1.str, NULL, &error); }
 
4113
          NUM           { int error; $$= (uint64_t) internal::my_strtoll10($1.data(), NULL, &error); }
 
4114
        | ULONGLONG_NUM { int error; $$= (uint64_t) internal::my_strtoll10($1.data(), NULL, &error); }
 
4115
        | LONG_NUM      { int error; $$= (uint64_t) internal::my_strtoll10($1.data(), NULL, &error); }
 
4116
        | DECIMAL_NUM   { int error; $$= (uint64_t) internal::my_strtoll10($1.data(), NULL, &error); }
 
4117
        | FLOAT_NUM     { int error; $$= (uint64_t) internal::my_strtoll10($1.data(), NULL, &error); }
4116
4118
        ;
4117
4119
 
4118
4120
select_var_list_init:
4157
4159
          OUTFILE TEXT_STRING_filesystem
4158
4160
          {
4159
4161
            Lex.setCacheable(false);
4160
 
            Lex.exchange= new file_exchange($2.str, 0);
 
4162
            Lex.exchange= new file_exchange($2.data(), 0);
4161
4163
            Lex.result= new select_export(Lex.exchange);
4162
4164
          }
4163
4165
          opt_field_term opt_line_term
4166
4168
            if (not Lex.describe)
4167
4169
            {
4168
4170
              Lex.setCacheable(false);
4169
 
              Lex.exchange= new file_exchange($2.str,1);
 
4171
              Lex.exchange= new file_exchange($2.data(),1);
4170
4172
              Lex.result= new select_dump(Lex.exchange);
4171
4173
            }
4172
4174
          }
4203
4205
            message::AlterTable::AlterTableOperation *operation;
4204
4206
            operation= Lex.alter_table()->add_operations();
4205
4207
            operation->set_operation(message::AlterTable::AlterTableOperation::DROP_KEY);
4206
 
            operation->set_drop_name($4.str);
 
4208
            operation->set_drop_name($4.data());
4207
4209
 
4208
4210
          }
4209
4211
        | DROP DATABASE if_exists schema_name
4611
4613
 
4612
4614
opt_db:
4613
4615
          /* empty */  { $$= 0; }
4614
 
        | from_or_in ident { $$= $2.str; }
 
4616
        | from_or_in ident { $$= $2.data(); }
4615
4617
        ;
4616
4618
 
4617
4619
from_or_in:
4623
4625
          /* empty */
4624
4626
        | LIKE TEXT_STRING_sys
4625
4627
          {
4626
 
            Lex.wild= new (YYSession->mem_root) String($2.str, $2.length, system_charset_info);
 
4628
            Lex.wild= new (YYSession->mem_root) String($2.data(), $2.size(), system_charset_info);
4627
4629
          }
4628
4630
        | WHERE expr
4629
4631
          {
4666
4668
        | text_string { Lex.wild= $1; }
4667
4669
        | ident
4668
4670
          {
4669
 
            Lex.wild= new (YYSession->mem_root) String($1.str, $1.length, system_charset_info);
 
4671
            Lex.wild= new (YYSession->mem_root) String($1.data(), $1.size(), system_charset_info);
4670
4672
          }
4671
4673
        ;
4672
4674
 
4742
4744
          USE_SYM schema_name
4743
4745
          {
4744
4746
            Lex.statement= new statement::ChangeSchema(YYSession);
4745
 
            Lex.select_lex.db= $2.str;
 
4747
            Lex.select_lex.db= $2.data();
4746
4748
          }
4747
4749
        ;
4748
4750
 
4762
4764
            Lex.lock_option= $4;
4763
4765
            Lex.duplicates= DUP_ERROR;
4764
4766
            Lex.ignore= 0;
4765
 
            Lex.exchange= new file_exchange($6.str, 0, $2);
 
4767
            Lex.exchange= new file_exchange($6.data(), 0, $2);
4766
4768
          }
4767
4769
          opt_duplicate INTO
4768
4770
          {
4872
4874
        | IGNORE_SYM NUM lines_or_rows
4873
4875
          {
4874
4876
            assert(Lex.exchange != 0);
4875
 
            Lex.exchange->skip_lines= atol($2.str);
 
4877
            Lex.exchange->skip_lines= atol($2.data());
4876
4878
          }
4877
4879
        ;
4878
4880
 
4910
4912
text_literal:
4911
4913
        TEXT_STRING_literal
4912
4914
        {
4913
 
          $$ = new Item_string($1.str, $1.length, YYSession->variables.getCollation());
 
4915
          $$ = new Item_string($1.data(), $1.size(), YYSession->variables.getCollation());
4914
4916
        }
4915
4917
        | text_literal TEXT_STRING_literal
4916
4918
          {
4917
 
            ((Item_string*) $1)->append($2.str, $2.length);
 
4919
            ((Item_string*) $1)->append($2);
4918
4920
          }
4919
4921
        ;
4920
4922
 
4921
4923
text_string:
4922
4924
          TEXT_STRING_literal
4923
4925
          {
4924
 
            $$= new (YYSession->mem_root) String($1.str,
4925
 
                                             $1.length,
4926
 
                                             YYSession->variables.getCollation());
 
4926
            $$= new (YYSession->mem_root) String($1.data(), $1.size(), YYSession->variables.getCollation());
4927
4927
          }
4928
4928
        | HEX_NUM
4929
4929
          {
4930
 
            Item *tmp= new Item_hex_string($1.str, $1.length);
 
4930
            Item *tmp= new Item_hex_string($1);
4931
4931
            /*
4932
4932
              it is OK only emulate fix_fields, because we need only
4933
4933
              value of constant
4938
4938
          }
4939
4939
        | BIN_NUM
4940
4940
          {
4941
 
            Item *tmp= new Item_bin_string($1.str, $1.length);
 
4941
            Item *tmp= new Item_bin_string($1.data(), $1.size());
4942
4942
            /*
4943
4943
              it is OK only emulate fix_fields, because we need only
4944
4944
              value of constant
4968
4968
          }
4969
4969
        | FALSE_SYM { $$= new drizzled::item::False(); }
4970
4970
        | TRUE_SYM { $$= new drizzled::item::True(); }
4971
 
        | HEX_NUM { $$ = new Item_hex_string($1.str, $1.length);}
4972
 
        | BIN_NUM { $$= new Item_bin_string($1.str, $1.length); }
 
4971
        | HEX_NUM { $$ = new Item_hex_string($1);}
 
4972
        | BIN_NUM { $$= new Item_bin_string($1.data(), $1.size()); }
4973
4973
        | DATE_SYM text_literal { $$ = $2; }
4974
4974
        | TIMESTAMP_SYM text_literal { $$ = $2; }
4975
4975
        ;
4976
4976
 
4977
4977
integer_literal:
4978
4978
          text_literal { $$ = $1; }
4979
 
        | HEX_NUM { $$ = new Item_hex_string($1.str, $1.length);}
4980
 
        | BIN_NUM { $$= new Item_bin_string($1.str, $1.length); }
 
4979
        | HEX_NUM { $$ = new Item_hex_string($1);}
 
4980
        | BIN_NUM { $$= new Item_bin_string($1.data(), $1.size()); }
4981
4981
        | NUM_literal { $$ = $1; }
4982
4982
        | NULL_SYM
4983
4983
          {
5024
5024
          NUM
5025
5025
          {
5026
5026
            int error;
5027
 
            $$ = new Item_int($1.str, (int64_t) internal::my_strtoll10($1.str, NULL, &error), $1.length);
 
5027
            $$ = new Item_int($1.data(), internal::my_strtoll10($1.data(), NULL, &error), $1.size());
5028
5028
          }
5029
5029
        | LONG_NUM
5030
5030
          {
5031
5031
            int error;
5032
 
            $$ = new Item_int($1.str, (int64_t) internal::my_strtoll10($1.str, NULL, &error), $1.length);
 
5032
            $$ = new Item_int($1.data(), internal::my_strtoll10($1.data(), NULL, &error), $1.size());
5033
5033
          }
5034
5034
        | ULONGLONG_NUM
5035
 
          { $$ = new Item_uint($1.str, $1.length); }
 
5035
          { $$ = new Item_uint($1.data(), $1.size()); }
5036
5036
        | DECIMAL_NUM
5037
5037
          {
5038
 
            $$= new Item_decimal($1.str, $1.length, YYSession->charset());
 
5038
            $$= new Item_decimal($1.data(), $1.size(), YYSession->charset());
5039
5039
            if (YYSession->is_error())
5040
5040
            {
5041
5041
              DRIZZLE_YYABORT;
5043
5043
          }
5044
5044
        | FLOAT_NUM
5045
5045
          {
5046
 
            $$ = new Item_float($1.str, $1.length);
 
5046
            $$ = new Item_float($1.data(), $1.size());
5047
5047
            if (YYSession->is_error())
5048
5048
            {
5049
5049
              DRIZZLE_YYABORT;
5155
5155
          {
5156
5156
            const charset_info_st * const cs= system_charset_info;
5157
5157
            int dummy_error;
5158
 
            uint32_t wlen= cs->cset->well_formed_len(cs, $1.str,
5159
 
                                                 $1.str+$1.length,
5160
 
                                                 $1.length, &dummy_error);
5161
 
            if (wlen < $1.length)
 
5158
            uint32_t wlen= cs->cset->well_formed_len(cs, $1.begin(), $1.end(), $1.size(), &dummy_error);
 
5159
            if (wlen < $1.size())
5162
5160
            {
5163
 
              my_error(ER_INVALID_CHARACTER_STRING, MYF(0),
5164
 
                       cs->csname, $1.str + wlen);
 
5161
              my_error(ER_INVALID_CHARACTER_STRING, MYF(0), cs->csname, $1.data() + wlen);
5165
5162
              DRIZZLE_YYABORT;
5166
5163
            }
5167
5164
            $$= $1;
5193
5190
          IDENT_sys    { $$=$1; }
5194
5191
        | keyword
5195
5192
          {
5196
 
            $$.str= YYSession->mem.strdup($1.str, $1.length);
5197
 
            $$.length= $1.length;
 
5193
            $$.assign(YYSession->mem.strdup($1.data(), $1.length), $1.length);
5198
5194
          }
5199
5195
        ;
5200
5196
 
5476
5472
internal_variable_ident:
5477
5473
          keyword_exception_for_variable
5478
5474
          {
5479
 
            $$.str= YYSession->mem.strdup($1.str, $1.length);
5480
 
            $$.length= $1.length;
 
5475
            $$.assign(YYSession->mem.strdup($1.data(), $1.length), $1.length);
5481
5476
          }
5482
5477
        | IDENT_sys    { $$=$1; }
5483
5478
        ;
5488
5483
            /* We have to lookup here since local vars can shadow sysvars */
5489
5484
            {
5490
5485
              /* Not an SP local variable */
5491
 
              sys_var *tmp= find_sys_var(std::string($1.str, $1.length));
 
5486
              sys_var *tmp= find_sys_var(to_string($1));
5492
5487
              if (!tmp)
5493
5488
                DRIZZLE_YYABORT;
5494
5489
              $$.var= tmp;