mirror of
https://github.com/FirebirdSQL/firebird.git
synced 2025-01-24 05:23:03 +01:00
Small code reorganisation:
1. move two identical 'copy_status' functions from array.epp and blob.epp into utld.cpp 2. allow ERRD_punt use local instance of status-vector
This commit is contained in:
parent
d5dc56ce81
commit
3f03b1d619
@ -38,6 +38,7 @@
|
|||||||
#include <stdarg.h>
|
#include <stdarg.h>
|
||||||
#include "../jrd/ibase.h"
|
#include "../jrd/ibase.h"
|
||||||
#include "../dsql/array_proto.h"
|
#include "../dsql/array_proto.h"
|
||||||
|
#include "../dsql/utld_proto.h"
|
||||||
#include "../jrd/gds_proto.h"
|
#include "../jrd/gds_proto.h"
|
||||||
|
|
||||||
DATABASE DB = STATIC FILENAME "yachts.lnk";
|
DATABASE DB = STATIC FILENAME "yachts.lnk";
|
||||||
@ -56,7 +57,6 @@ typedef gen_t *GEN_T;
|
|||||||
|
|
||||||
static void adjust_length(ISC_ARRAY_DESC*);
|
static void adjust_length(ISC_ARRAY_DESC*);
|
||||||
static void copy_exact_name (const char*, char*, SSHORT);
|
static void copy_exact_name (const char*, char*, SSHORT);
|
||||||
static ISC_STATUS copy_status(const ISC_STATUS*, ISC_STATUS*);
|
|
||||||
static ISC_STATUS error(ISC_STATUS*, SSHORT, ...);
|
static ISC_STATUS error(ISC_STATUS*, SSHORT, ...);
|
||||||
static ISC_STATUS gen_sdl(ISC_STATUS*, const ISC_ARRAY_DESC*, SSHORT*, UCHAR**,
|
static ISC_STATUS gen_sdl(ISC_STATUS*, const ISC_ARRAY_DESC*, SSHORT*, UCHAR**,
|
||||||
SSHORT*, bool);
|
SSHORT*, bool);
|
||||||
@ -177,7 +177,7 @@ ISC_STATUS API_ROUTINE isc_array_lookup_bounds(ISC_STATUS* status,
|
|||||||
++tail;
|
++tail;
|
||||||
END_FOR
|
END_FOR
|
||||||
ON_ERROR
|
ON_ERROR
|
||||||
return copy_status(gds_status, status);
|
return UTLD_copy_status(gds_status, status);
|
||||||
END_ERROR;
|
END_ERROR;
|
||||||
|
|
||||||
return status[1];
|
return status[1];
|
||||||
@ -363,28 +363,6 @@ static void copy_exact_name (
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
static ISC_STATUS copy_status( const ISC_STATUS* from, ISC_STATUS* to)
|
|
||||||
{
|
|
||||||
/**************************************
|
|
||||||
*
|
|
||||||
* c o p y _ s t a t u s
|
|
||||||
*
|
|
||||||
**************************************
|
|
||||||
*
|
|
||||||
* Functional description
|
|
||||||
* Copy a status vector.
|
|
||||||
*
|
|
||||||
**************************************/
|
|
||||||
const ISC_STATUS status = from[1];
|
|
||||||
|
|
||||||
const ISC_STATUS* const end = from + ISC_STATUS_LENGTH;
|
|
||||||
while (from < end)
|
|
||||||
*to++ = *from++;
|
|
||||||
|
|
||||||
return status;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
static ISC_STATUS error( ISC_STATUS* status, SSHORT count, ...)
|
static ISC_STATUS error( ISC_STATUS* status, SSHORT count, ...)
|
||||||
{
|
{
|
||||||
/**************************************
|
/**************************************
|
||||||
@ -570,7 +548,7 @@ static ISC_STATUS lookup_desc(ISC_STATUS* status,
|
|||||||
|
|
||||||
END_FOR
|
END_FOR
|
||||||
ON_ERROR
|
ON_ERROR
|
||||||
return copy_status(gds_status, status);
|
return UTLD_copy_status(gds_status, status);
|
||||||
END_ERROR;
|
END_ERROR;
|
||||||
|
|
||||||
if (!flag)
|
if (!flag)
|
||||||
|
@ -35,11 +35,11 @@
|
|||||||
#include "../jrd/ibase.h"
|
#include "../jrd/ibase.h"
|
||||||
#include "../jrd/intl.h"
|
#include "../jrd/intl.h"
|
||||||
#include "../dsql/blob_proto.h"
|
#include "../dsql/blob_proto.h"
|
||||||
|
#include "../dsql/utld_proto.h"
|
||||||
|
|
||||||
DATABASE DB = STATIC "yachts.lnk";
|
DATABASE DB = STATIC "yachts.lnk";
|
||||||
|
|
||||||
static void copy_exact_name (const UCHAR*, UCHAR*, SSHORT);
|
static void copy_exact_name (const UCHAR*, UCHAR*, SSHORT);
|
||||||
static ISC_STATUS copy_status(const ISC_STATUS*, ISC_STATUS*);
|
|
||||||
static ISC_STATUS error(ISC_STATUS*, SSHORT, ...);
|
static ISC_STATUS error(ISC_STATUS*, SSHORT, ...);
|
||||||
|
|
||||||
|
|
||||||
@ -175,7 +175,7 @@ ISC_STATUS API_ROUTINE isc_blob_lookup_desc(ISC_STATUS* status,
|
|||||||
}
|
}
|
||||||
END_FOR
|
END_FOR
|
||||||
ON_ERROR
|
ON_ERROR
|
||||||
return copy_status(gds_status, status);
|
return UTLD_copy_status(gds_status, status);
|
||||||
END_ERROR;
|
END_ERROR;
|
||||||
|
|
||||||
if (!flag)
|
if (!flag)
|
||||||
@ -255,28 +255,6 @@ static void copy_exact_name (
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
static ISC_STATUS copy_status( const ISC_STATUS* from, ISC_STATUS* to)
|
|
||||||
{
|
|
||||||
/**************************************
|
|
||||||
*
|
|
||||||
* c o p y _ s t a t u s
|
|
||||||
*
|
|
||||||
**************************************
|
|
||||||
*
|
|
||||||
* Functional description
|
|
||||||
* Copy a status vector.
|
|
||||||
*
|
|
||||||
**************************************/
|
|
||||||
const ISC_STATUS status = from[1];
|
|
||||||
|
|
||||||
const ISC_STATUS* const end = from + ISC_STATUS_LENGTH;
|
|
||||||
while (from < end)
|
|
||||||
*to++ = *from++;
|
|
||||||
|
|
||||||
return status;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
static ISC_STATUS error( ISC_STATUS* status, SSHORT count, ...)
|
static ISC_STATUS error( ISC_STATUS* status, SSHORT count, ...)
|
||||||
{
|
{
|
||||||
/**************************************
|
/**************************************
|
||||||
|
@ -366,10 +366,15 @@ void ERRD_post(ISC_STATUS status, ...)
|
|||||||
|
|
||||||
|
|
||||||
**/
|
**/
|
||||||
void ERRD_punt(void)
|
void ERRD_punt(const ISC_STATUS* local)
|
||||||
{
|
{
|
||||||
tsql* tdsql = DSQL_get_thread_data();
|
tsql* tdsql = DSQL_get_thread_data();
|
||||||
|
|
||||||
|
// copy local status into user status
|
||||||
|
if (local) {
|
||||||
|
UTLD_copy_status(local, tdsql->tsql_status);
|
||||||
|
}
|
||||||
|
|
||||||
// Save any strings in a permanent location
|
// Save any strings in a permanent location
|
||||||
|
|
||||||
UTLD_save_status_strings(tdsql->tsql_status);
|
UTLD_save_status_strings(tdsql->tsql_status);
|
||||||
|
@ -32,7 +32,7 @@ void ERRD_bugcheck(const char*);
|
|||||||
void ERRD_error(int, const char*);
|
void ERRD_error(int, const char*);
|
||||||
void ERRD_post(ISC_STATUS, ...);
|
void ERRD_post(ISC_STATUS, ...);
|
||||||
bool ERRD_post_warning(ISC_STATUS, ...);
|
bool ERRD_post_warning(ISC_STATUS, ...);
|
||||||
void ERRD_punt(void);
|
void ERRD_punt(const ISC_STATUS* = 0);
|
||||||
|
|
||||||
#endif // DSQL_ERRD_PROTO_H
|
#endif // DSQL_ERRD_PROTO_H
|
||||||
|
|
||||||
|
@ -96,6 +96,28 @@ USHORT UTLD_char_length_to_byte_length(USHORT lengthInChars, USHORT maxBytesPerC
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
ISC_STATUS UTLD_copy_status(const ISC_STATUS* from, ISC_STATUS* to)
|
||||||
|
{
|
||||||
|
/**************************************
|
||||||
|
*
|
||||||
|
* c o p y _ s t a t u s
|
||||||
|
*
|
||||||
|
**************************************
|
||||||
|
*
|
||||||
|
* Functional description
|
||||||
|
* Copy a status vector.
|
||||||
|
*
|
||||||
|
**************************************/
|
||||||
|
const ISC_STATUS status = from[1];
|
||||||
|
|
||||||
|
const ISC_STATUS* const end = from + ISC_STATUS_LENGTH;
|
||||||
|
while (from < end)
|
||||||
|
*to++ = *from++;
|
||||||
|
|
||||||
|
return status;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
||||||
UTLD_parse_sql_info
|
UTLD_parse_sql_info
|
||||||
|
@ -30,6 +30,7 @@
|
|||||||
struct sqlda_sup;
|
struct sqlda_sup;
|
||||||
|
|
||||||
USHORT UTLD_char_length_to_byte_length(USHORT lengthInChars, USHORT maxBytesPerChar);
|
USHORT UTLD_char_length_to_byte_length(USHORT lengthInChars, USHORT maxBytesPerChar);
|
||||||
|
ISC_STATUS UTLD_copy_status(const ISC_STATUS*, ISC_STATUS*);
|
||||||
ISC_STATUS UTLD_parse_sql_info(ISC_STATUS*, USHORT, const SCHAR*, XSQLDA*, USHORT*);
|
ISC_STATUS UTLD_parse_sql_info(ISC_STATUS*, USHORT, const SCHAR*, XSQLDA*, USHORT*);
|
||||||
ISC_STATUS UTLD_parse_sqlda(ISC_STATUS*, sqlda_sup* const, USHORT*, USHORT*,
|
ISC_STATUS UTLD_parse_sqlda(ISC_STATUS*, sqlda_sup* const, USHORT*, USHORT*,
|
||||||
USHORT*, USHORT, XSQLDA*, const USHORT);
|
USHORT*, USHORT, XSQLDA*, const USHORT);
|
||||||
|
Loading…
Reference in New Issue
Block a user