~drizzle-trunk/drizzle/development

« back to all changes in this revision

Viewing changes to drizzled/item/create.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:
132
132
  {
133
133
    if (item_list && has_named_parameters(*item_list))
134
134
    {
135
 
      my_error(ER_WRONG_PARAMETERS_TO_NATIVE_FCT, MYF(0), name.str);
 
135
      my_error(ER_WRONG_PARAMETERS_TO_NATIVE_FCT, MYF(0), name.data());
136
136
      return NULL;
137
137
    }
138
138
    return create_native(session, name, item_list);
1038
1038
 
1039
1039
Item* Create_udf_func::create(Session *session, lex_string_t name, List<Item> *item_list)
1040
1040
{
1041
 
  return create(session, plugin::Function::get(std::string(name.str, name.length)), item_list);
 
1041
  return create(session, plugin::Function::get(std::string(name.data(), name.size())), item_list);
1042
1042
}
1043
1043
 
1044
1044
Item* Create_udf_func::create(Session *session, const plugin::Function *udf, List<Item> *item_list)
1060
1060
{
1061
1061
  if (item_list && item_list->size())
1062
1062
  {
1063
 
    my_error(ER_WRONG_PARAMCOUNT_TO_FUNCTION, MYF(0), name.str);
 
1063
    my_error(ER_WRONG_PARAMCOUNT_TO_FUNCTION, MYF(0), name.data());
1064
1064
    return NULL;
1065
1065
  }
1066
1066
  return create(session);
1071
1071
  int arg_count= item_list ? item_list->size() : 0;
1072
1072
  if (arg_count != 1)
1073
1073
  {
1074
 
    my_error(ER_WRONG_PARAMCOUNT_TO_FUNCTION, MYF(0), name.str);
 
1074
    my_error(ER_WRONG_PARAMCOUNT_TO_FUNCTION, MYF(0), name.data());
1075
1075
    return NULL;
1076
1076
  }
1077
1077
 
1079
1079
 
1080
1080
  if (! param_1->is_autogenerated_name)
1081
1081
  {
1082
 
    my_error(ER_WRONG_PARAMETERS_TO_NATIVE_FCT, MYF(0), name.str);
 
1082
    my_error(ER_WRONG_PARAMETERS_TO_NATIVE_FCT, MYF(0), name.data());
1083
1083
    return NULL;
1084
1084
  }
1085
1085
 
1093
1093
  int arg_count= item_list ? item_list->size() : 0;
1094
1094
  if (arg_count != 2)
1095
1095
  {
1096
 
    my_error(ER_WRONG_PARAMCOUNT_TO_FUNCTION, MYF(0), name.str);
 
1096
    my_error(ER_WRONG_PARAMCOUNT_TO_FUNCTION, MYF(0), name.data());
1097
1097
    return NULL;
1098
1098
  }
1099
1099
 
1103
1103
  if (   (! param_1->is_autogenerated_name)
1104
1104
      || (! param_2->is_autogenerated_name))
1105
1105
  {
1106
 
    my_error(ER_WRONG_PARAMETERS_TO_NATIVE_FCT, MYF(0), name.str);
 
1106
    my_error(ER_WRONG_PARAMETERS_TO_NATIVE_FCT, MYF(0), name.data());
1107
1107
    return NULL;
1108
1108
  }
1109
1109
 
1117
1117
  int arg_count= item_list ? item_list->size() : 0;
1118
1118
  if (arg_count != 3)
1119
1119
  {
1120
 
    my_error(ER_WRONG_PARAMCOUNT_TO_FUNCTION, MYF(0), name.str);
 
1120
    my_error(ER_WRONG_PARAMCOUNT_TO_FUNCTION, MYF(0), name.data());
1121
1121
    return NULL;
1122
1122
  }
1123
1123
 
1129
1129
      || (! param_2->is_autogenerated_name)
1130
1130
      || (! param_3->is_autogenerated_name))
1131
1131
  {
1132
 
    my_error(ER_WRONG_PARAMETERS_TO_NATIVE_FCT, MYF(0), name.str);
 
1132
    my_error(ER_WRONG_PARAMETERS_TO_NATIVE_FCT, MYF(0), name.data());
1133
1133
    return NULL;
1134
1134
  }
1135
1135
 
1154
1154
  int arg_count= item_list ? item_list->size() : 0;
1155
1155
  if (arg_count < 1)
1156
1156
  {
1157
 
    my_error(ER_WRONG_PARAMCOUNT_TO_FUNCTION, MYF(0), name.str);
 
1157
    my_error(ER_WRONG_PARAMCOUNT_TO_FUNCTION, MYF(0), name.data());
1158
1158
    return NULL;
1159
1159
  }
1160
1160
 
1172
1172
  /* "WS" stands for "With Separator": this function takes 2+ arguments */
1173
1173
  if (arg_count < 2)
1174
1174
  {
1175
 
    my_error(ER_WRONG_PARAMCOUNT_TO_FUNCTION, MYF(0), name.str);
 
1175
    my_error(ER_WRONG_PARAMCOUNT_TO_FUNCTION, MYF(0), name.data());
1176
1176
    return NULL;
1177
1177
  }
1178
1178
 
1231
1231
      return new (session->mem) Item_func_export_set(param_1, param_2, param_3, param_4, param_5);
1232
1232
    }
1233
1233
  default:
1234
 
    my_error(ER_WRONG_PARAMCOUNT_TO_FUNCTION, MYF(0), name.str);
 
1234
    my_error(ER_WRONG_PARAMCOUNT_TO_FUNCTION, MYF(0), name.data());
1235
1235
  }
1236
1236
  return NULL;
1237
1237
}
1246
1246
  int arg_count= item_list ? item_list->size() : 0;
1247
1247
  if (arg_count < 2)
1248
1248
  {
1249
 
    my_error(ER_WRONG_PARAMCOUNT_TO_FUNCTION, MYF(0), name.str);
 
1249
    my_error(ER_WRONG_PARAMCOUNT_TO_FUNCTION, MYF(0), name.data());
1250
1250
    return NULL;
1251
1251
  }
1252
1252
 
1301
1301
      return new (session->mem) Item_func_date_format(ut, param_2, 0);
1302
1302
    }
1303
1303
  default:
1304
 
    my_error(ER_WRONG_PARAMCOUNT_TO_FUNCTION, MYF(0), name.str);
 
1304
    my_error(ER_WRONG_PARAMCOUNT_TO_FUNCTION, MYF(0), name.data());
1305
1305
  }
1306
1306
  return NULL;
1307
1307
}
1316
1316
  int arg_count= item_list ? item_list->size() : 0;
1317
1317
  if (arg_count < 2)
1318
1318
  {
1319
 
    my_error(ER_WRONG_PARAMCOUNT_TO_FUNCTION, MYF(0), name.str);
 
1319
    my_error(ER_WRONG_PARAMCOUNT_TO_FUNCTION, MYF(0), name.data());
1320
1320
    return NULL;
1321
1321
  }
1322
1322
 
1377
1377
      return new (session->mem) Item_func_last_insert_id(param_1);
1378
1378
    }
1379
1379
  default:
1380
 
    my_error(ER_WRONG_PARAMCOUNT_TO_FUNCTION, MYF(0), name.str);
 
1380
    my_error(ER_WRONG_PARAMCOUNT_TO_FUNCTION, MYF(0), name.data());
1381
1381
  }
1382
1382
  return NULL;
1383
1383
}
1401
1401
  int arg_count= item_list ? item_list->size() : 0;
1402
1402
  if (arg_count < 2)
1403
1403
  {
1404
 
    my_error(ER_WRONG_PARAMCOUNT_TO_FUNCTION, MYF(0), name.str);
 
1404
    my_error(ER_WRONG_PARAMCOUNT_TO_FUNCTION, MYF(0), name.data());
1405
1405
    return NULL;
1406
1406
  }
1407
1407
 
1442
1442
      return new (session->mem) Item_func_locate(param_2, param_1, param_3);
1443
1443
    }
1444
1444
  default:
1445
 
    my_error(ER_WRONG_PARAMCOUNT_TO_FUNCTION, MYF(0), name.str);
 
1445
    my_error(ER_WRONG_PARAMCOUNT_TO_FUNCTION, MYF(0), name.data());
1446
1446
  }
1447
1447
  return NULL;
1448
1448
}
1456
1456
  int arg_count= item_list ? item_list->size() : 0;
1457
1457
  if (arg_count < 2)
1458
1458
  {
1459
 
    my_error(ER_WRONG_PARAMCOUNT_TO_FUNCTION, MYF(0), name.str);
 
1459
    my_error(ER_WRONG_PARAMCOUNT_TO_FUNCTION, MYF(0), name.data());
1460
1460
    return NULL;
1461
1461
  }
1462
1462
 
1528
1528
    return new (session->mem) Item_func_round(param_1, param_2, 0);
1529
1529
  }
1530
1530
  default:
1531
 
    my_error(ER_WRONG_PARAMCOUNT_TO_FUNCTION, MYF(0), name.str);
 
1531
    my_error(ER_WRONG_PARAMCOUNT_TO_FUNCTION, MYF(0), name.data());
1532
1532
  }
1533
1533
  return NULL;
1534
1534
}
1572
1572
  case 1:
1573
1573
    return new (session->mem) Item_func_unix_timestamp(item_list->pop());
1574
1574
  default:
1575
 
    my_error(ER_WRONG_PARAMCOUNT_TO_FUNCTION, MYF(0), name.str);
 
1575
    my_error(ER_WRONG_PARAMCOUNT_TO_FUNCTION, MYF(0), name.data());
1576
1576
  }
1577
1577
  return NULL;
1578
1578
}
1666
1666
 
1667
1667
Create_func* find_native_function_builder(lex_string_t name)
1668
1668
{
1669
 
  return find_ptr2(FunctionContainer::getMap(), name.str);
 
1669
  return find_ptr2(FunctionContainer::getMap(), name.data());
1670
1670
}
1671
1671
 
1672
1672
Item* create_func_char_cast(Session *session, Item *a, int len, const charset_info_st* cs)