8
0
mirror of https://github.com/FirebirdSQL/firebird.git synced 2025-01-23 23:23:04 +01:00

Ported SQLSTATE from Vulcan.

Part II: handling of isc_arg_sql_state.
This commit is contained in:
dimitr 2008-02-24 15:02:04 +00:00
parent 6125210624
commit c1f75dcdf8
14 changed files with 28 additions and 4 deletions

View File

@ -61,7 +61,8 @@ ISC_STATUS StatusHolder::save(const ISC_STATUS* status)
case isc_arg_string:
case isc_arg_interpreted:
{
case isc_arg_sql_state:
{
const char *temp = reinterpret_cast<const char*>(*from++);
const size_t len = strlen(temp);
@ -97,6 +98,7 @@ void StatusHolder::clear()
case isc_arg_string:
case isc_arg_interpreted:
case isc_arg_sql_state:
delete[] reinterpret_cast<char*>(*ptr++);
break;

View File

@ -61,6 +61,7 @@ void fill_status(ISC_STATUS *ptr, ISC_STATUS status, va_list status_args)
}
case isc_arg_string:
case isc_arg_interpreted:
case isc_arg_sql_state:
{
*ptr++ = dupStringTemp(reinterpret_cast<char*>(va_arg(status_args, ISC_STATUS)));
break;
@ -98,6 +99,7 @@ void StringsBuffer::makePermanentVector(ISC_STATUS* perm, const ISC_STATUS* tran
break;
case isc_arg_string:
case isc_arg_interpreted:
case isc_arg_sql_state:
{
const char* temp = reinterpret_cast<char*>(*trans++);
*perm++ = (ISC_STATUS)(IPTR) (alloc(temp, strlen(temp)));
@ -169,6 +171,7 @@ void status_exception::release_vector() throw()
break;
case isc_arg_string:
case isc_arg_interpreted:
case isc_arg_sql_state:
delete[] reinterpret_cast<char*>(*ptr++);
break;
default:

View File

@ -218,6 +218,7 @@ bool ERRD_post_warning(ISC_STATUS status, ...)
break;
case isc_arg_interpreted:
case isc_arg_sql_state:
pszTmp = va_arg(args, char*);
status_vector[indx++] = reinterpret_cast<ISC_STATUS>(ERR_cstring(pszTmp));
break;

View File

@ -1281,6 +1281,7 @@ static void error_post(ISC_STATUS status, ...)
case isc_arg_string:
case isc_arg_interpreted:
case isc_arg_sql_state:
*p++ = (ISC_STATUS)(IPTR) va_arg(args, TEXT *);
break;

View File

@ -808,8 +808,9 @@ void UTLD_save_status_strings(ISC_STATUS* vector)
case isc_arg_cstring:
l = static_cast<USHORT>(*vector++);
case isc_arg_interpreted:
case isc_arg_string:
case isc_arg_interpreted:
case isc_arg_sql_state:
p = (TEXT *) * vector;
if (status != isc_arg_cstring)

View File

@ -361,6 +361,7 @@ bool ERR_post_warning(ISC_STATUS status, ...)
break;
case isc_arg_interpreted:
case isc_arg_sql_state:
status_vector[indx++] = va_arg(args, ISC_STATUS);
break;

View File

@ -902,9 +902,14 @@ static SLONG safe_interpret(char* const s, const size_t bufsize,
}
break;
case isc_arg_sql_state:
q = (const TEXT*) (*vector)[1];
sprintf(s, "SQLSTATE (%s)", q);
break;
case isc_arg_unix:
// The strerror() function returns the appropriate description
// string, or an unknown error message if the error code is unknown.
// The strerror() function returns the appropriate description string,
// or an unknown error message if the error code is unknown.
q = (const TEXT*) strerror(code);
if (legacy)
safe_strncpy(s, q, bufsize);

View File

@ -808,6 +808,7 @@ static void error(CompilerScratch* csb, ...)
case isc_arg_string:
case isc_arg_interpreted:
case isc_arg_sql_state:
*p++ = (ISC_STATUS) va_arg(args, TEXT *);
break;
@ -3393,6 +3394,7 @@ static void warning(CompilerScratch* csb, ...)
case isc_arg_string:
case isc_arg_interpreted:
case isc_arg_sql_state:
*p++ = (ISC_STATUS) va_arg(args, TEXT *);
break;

View File

@ -599,6 +599,7 @@ static ISC_STATUS error(ISC_STATUS * status_vector, ...)
case isc_arg_string:
case isc_arg_interpreted:
case isc_arg_sql_state:
*p++ = (ISC_STATUS) va_arg(args, TEXT *);
break;

View File

@ -77,6 +77,7 @@ void STUFF_STATUS_function(ISC_STATUS* status_vector, ISC_STATUS status, va_list
break;
case isc_arg_interpreted:
case isc_arg_sql_state:
*p++ = (ISC_STATUS) va_arg(args, TEXT *);
break;
@ -126,6 +127,7 @@ void PARSE_STATUS(const ISC_STATUS* status_vector, int &length, int &warning)
case isc_arg_string:
case isc_arg_number:
case isc_arg_interpreted:
case isc_arg_sql_state:
case isc_arg_vms:
case isc_arg_unix:
case isc_arg_win32:

View File

@ -5236,6 +5236,7 @@ static void check_status_vector(const ISC_STATUS* status)
case isc_arg_interpreted:
case isc_arg_string:
case isc_arg_sql_state:
length = strlen((const char*) *s);
/* This check is heuristic, not deterministic */
if (length > 1024 - 1)
@ -5844,6 +5845,7 @@ static void save_error_string(ISC_STATUS * status)
case isc_arg_interpreted:
case isc_arg_string:
case isc_arg_sql_state:
l = (ULONG) strlen(reinterpret_cast<char*>(*status)) + 1;
if (l < len)
{

View File

@ -1679,6 +1679,7 @@ static bool_t xdr_status_vector(
case isc_arg_interpreted:
case isc_arg_string:
case isc_arg_sql_state:
if (xdrs->x_op == XDR_ENCODE) {
if (!xdr_wrapstring(xdrs, reinterpret_cast<SCHAR**>(vector++)))
return FALSE;

View File

@ -679,6 +679,7 @@ void REMOTE_save_status_strings( ISC_STATUS* vector)
case isc_arg_interpreted:
case isc_arg_string:
case isc_arg_sql_state:
p = (TEXT*) *vector;
if (status != isc_arg_cstring)
l = strlen(p) + 1;

View File

@ -4721,6 +4721,7 @@ ISC_STATUS rem_port::send_response( PACKET* sendL,
continue;
case isc_arg_interpreted:
case isc_arg_sql_state:
*v++ = *status_vector++;
*v++ = *status_vector++;
continue;