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:
parent
6125210624
commit
c1f75dcdf8
@ -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;
|
||||
|
||||
|
@ -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:
|
||||
|
@ -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;
|
||||
|
@ -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;
|
||||
|
||||
|
@ -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)
|
||||
|
@ -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;
|
||||
|
||||
|
@ -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);
|
||||
|
@ -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;
|
||||
|
||||
|
@ -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;
|
||||
|
||||
|
@ -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:
|
||||
|
@ -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)
|
||||
{
|
||||
|
@ -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;
|
||||
|
@ -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;
|
||||
|
@ -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;
|
||||
|
Loading…
Reference in New Issue
Block a user