1
0
mirror of https://github.com/MariaDB/server.git synced 2025-08-07 00:04:31 +03:00

Finished merging wl5986 started by Igor.

This commit is contained in:
unknown
2013-06-19 14:32:14 +03:00
parent 2534521f9a
commit dfcc502ab5
21 changed files with 1814 additions and 1849 deletions

View File

@@ -1001,3 +1001,32 @@ uint32 convert_error_message(char *to, uint32 to_length, CHARSET_INFO *to_cs,
*errors= error_count;
return (uint32) (to - to_start);
}
/**
Sanity check for SQLSTATEs. The function does not check if it's really an
existing SQL-state (there are just too many), it just checks string length and
looks for bad characters.
@param sqlstate the condition SQLSTATE.
@retval true if it's ok.
@retval false if it's bad.
*/
bool is_sqlstate_valid(const LEX_STRING *sqlstate)
{
if (sqlstate->length != 5)
return false;
for (int i= 0 ; i < 5 ; ++i)
{
char c = sqlstate->str[i];
if ((c < '0' || '9' < c) &&
(c < 'A' || 'Z' < c))
return false;
}
return true;
}