This commit is contained in:
VilhoRaatikka
2014-09-01 13:57:31 +03:00
parent 20abbbdf57
commit 3c1abf4b64

View File

@ -918,35 +918,34 @@ char* skygw_get_canonical(
{ {
Item::Type itype; Item::Type itype;
itype = item->type(); if (item->name == NULL)
{
continue;
}
itype = item->type();
if (item->name != NULL && if (itype == Item::STRING_ITEM)
(itype == Item::STRING_ITEM || {
itype == Item::INT_ITEM || String tokenstr;
itype == Item::DECIMAL_ITEM || String* res = item->val_str_ascii(&tokenstr);
itype == Item::REAL_ITEM ||
itype == Item::VARBIN_ITEM || if (res->is_empty()) /*< empty string */
itype == Item::NULL_ITEM))
{
if (itype == Item::STRING_ITEM)
{ {
String tokenstr; querystr = replace_literal(querystr, "\"\"", "\"?\"");
String* res = item->val_str_ascii(&tokenstr);
if (res->is_empty()) /*< empty string */
{
querystr = replace_literal(querystr, "\"\"", "\"?\"");
}
else
{
querystr = replace_literal(querystr, res->ptr(), "?");
}
} }
else else
{ {
querystr = replace_literal(querystr, item->name, "?"); querystr = replace_literal(querystr, res->ptr(), "?");
} }
} }
else if (itype == Item::INT_ITEM ||
itype == Item::DECIMAL_ITEM ||
itype == Item::REAL_ITEM ||
itype == Item::VARBIN_ITEM ||
itype == Item::NULL_ITEM)
{
querystr = replace_literal(querystr, item->name, "?");
}
} /*< for */ } /*< for */
retblock: retblock:
return querystr; return querystr;