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

fixing CORE-1964: Use of 0 instead of isc_arg_end to terminate list of ERR_post's (and cousines) arguments is invalid

finished cleanup of vararg in error diagnostics in DSQL
This commit is contained in:
alexpeshkoff 2008-08-15 11:21:47 +00:00
parent 805343f5c2
commit 1785fb6ee3
13 changed files with 860 additions and 1235 deletions

View File

@ -143,6 +143,20 @@ void StatusVector::raise() const
Str("Attempt to raise empty exception"));
}
ISC_STATUS StatusVector::copyTo(ISC_STATUS* dest) const throw()
{
if (hasData())
{
memcpy(dest, value(), (length() + 1) * sizeof(ISC_STATUS));
}
else {
dest[0] = isc_arg_gds;
dest[1] = FB_SUCCESS;
dest[2] = isc_arg_end;
}
return dest[1];
}
Gds::Gds(ISC_STATUS s) throw() :
StatusVector(isc_arg_gds, s) { }

View File

@ -73,6 +73,7 @@ public:
void clear() throw();
void append(const StatusVector& v) throw();
void raise() const;
ISC_STATUS copyTo(ISC_STATUS* dest) const throw();
// generic argument insert
StatusVector& operator<<(const Base& arg) throw();

View File

@ -40,6 +40,9 @@
#include "../dsql/array_proto.h"
#include "../dsql/utld_proto.h"
#include "../jrd/gds_proto.h"
#include "../common/StatusArg.h"
using namespace Firebird;
DATABASE DB = STATIC FILENAME "yachts.lnk";
@ -57,7 +60,7 @@ typedef gen_t *GEN_T;
static void adjust_length(ISC_ARRAY_DESC*);
static void copy_exact_name (const char*, char*, SSHORT);
static ISC_STATUS error(ISC_STATUS*, SSHORT, ...);
static ISC_STATUS error(ISC_STATUS* status, const Arg::StatusVector& v);
static ISC_STATUS gen_sdl(ISC_STATUS*, const ISC_ARRAY_DESC*, SSHORT*, UCHAR**,
SSHORT*, bool);
static ISC_STATUS lookup_desc(ISC_STATUS*, FB_API_HANDLE*, FB_API_HANDLE*, const SCHAR*,
@ -317,14 +320,11 @@ ISC_STATUS API_ROUTINE isc_array_set_desc(ISC_STATUS* status,
desc->array_desc_dtype = blr_quad;
break;
default:
return error(status, 7, (ISC_STATUS) isc_sqlerr,
(ISC_STATUS) isc_arg_number, (ISC_STATUS) - 804,
(ISC_STATUS) isc_arg_gds, (ISC_STATUS) isc_random,
(ISC_STATUS) isc_arg_string,
(ISC_STATUS) "data type not understood");
return error(status, Arg::Gds(isc_sqlerr) << Arg::Num(-804) <<
Arg::Gds(isc_random) << Arg::Str("data type not understood"));
}
return error(status, 1, (ISC_STATUS) FB_SUCCESS);
return error(status, Arg::Gds(FB_SUCCESS));
}
@ -370,7 +370,7 @@ static void copy_exact_name (
}
static ISC_STATUS error( ISC_STATUS* status, SSHORT count, ...)
static ISC_STATUS error(ISC_STATUS* status, const Arg::StatusVector& v)
{
/**************************************
*
@ -382,20 +382,7 @@ static ISC_STATUS error( ISC_STATUS* status, SSHORT count, ...)
* Stuff a status vector.
*
**************************************/
ISC_STATUS* stat;
va_list ptr;
va_start(ptr, count);
stat = status;
*stat++ = isc_arg_gds;
for (; count; --count)
*stat++ = (ISC_STATUS) va_arg(ptr, ISC_STATUS);
va_end(ptr);
*stat = isc_arg_end;
return status[1];
return v.copyTo(status);
}
@ -418,9 +405,7 @@ static ISC_STATUS gen_sdl(ISC_STATUS* status,
const SSHORT dimensions = desc->array_desc_dimensions;
if (dimensions > 16)
return error(status, 5, (ISC_STATUS) isc_invalid_dimension,
(ISC_STATUS) isc_arg_number, (ISC_STATUS) dimensions,
(ISC_STATUS) isc_arg_number, (ISC_STATUS) 16);
return error(status, Arg::Gds(isc_invalid_dimension) << Arg::Num(dimensions) << Arg::Num(16));
gen_t gen_block;
gen_t* gen = &gen_block;
@ -501,7 +486,7 @@ static ISC_STATUS gen_sdl(ISC_STATUS* status,
return status[1];
*sdl_length = gen->gen_sdl - *gen->gen_sdl_ptr;
return error(status, 1, (ISC_STATUS) FB_SUCCESS);
return error(status, Arg::Gds(FB_SUCCESS));
}
@ -561,13 +546,10 @@ static ISC_STATUS lookup_desc(ISC_STATUS* status,
isc_release_request(isc_status, &handle);
if (!flag)
return error(status, 5, (ISC_STATUS) isc_fldnotdef,
(ISC_STATUS) isc_arg_string,
(ISC_STATUS) desc->array_desc_field_name,
(ISC_STATUS) isc_arg_string,
(ISC_STATUS) desc->array_desc_relation_name);
return error(status, Arg::Gds(isc_fldnotdef) << Arg::Str(desc->array_desc_field_name) <<
Arg::Str(desc->array_desc_relation_name));
return error(status, 1, (ISC_STATUS) FB_SUCCESS);
return error(status, Arg::Gds(FB_SUCCESS));
}
@ -588,9 +570,7 @@ static ISC_STATUS stuff_args(gen_t* gen, SSHORT count, ...)
if (gen->gen_sdl + count >= gen->gen_end) {
if (gen->gen_internal < 0) {
return error(gen->gen_status, 3, (ISC_STATUS) isc_misc_interpreted,
(ISC_STATUS) isc_arg_string,
(ISC_STATUS) "SDL buffer overflow");
return error(gen->gen_status, Arg::Gds(isc_misc_interpreted) << Arg::Str("SDL buffer overflow"));
}
// The sdl buffer is too small. Allocate a larger one.
@ -598,10 +578,8 @@ static ISC_STATUS stuff_args(gen_t* gen, SSHORT count, ...)
const SSHORT new_len = gen->gen_end - *gen->gen_sdl_ptr + 512 + count;
UCHAR* const new_sdl = (UCHAR*) gds__alloc(new_len);
if (!new_sdl) {
return error(gen->gen_status, 5, (ISC_STATUS) isc_misc_interpreted,
(ISC_STATUS) isc_arg_string,
(ISC_STATUS) "SDL buffer overflow", (ISC_STATUS) isc_arg_gds,
(ISC_STATUS) isc_virmemexh);
return error(gen->gen_status, Arg::Gds(isc_misc_interpreted) << Arg::Str("SDL buffer overflow") <<
Arg::Gds(isc_virmemexh));
}
const SSHORT current_len = gen->gen_sdl - *gen->gen_sdl_ptr;

View File

@ -36,11 +36,14 @@
#include "../jrd/intl.h"
#include "../dsql/blob_proto.h"
#include "../dsql/utld_proto.h"
#include "../common/StatusArg.h"
using namespace Firebird;
DATABASE DB = STATIC "yachts.lnk";
static void copy_exact_name (const UCHAR*, UCHAR*, SSHORT);
static ISC_STATUS error(ISC_STATUS*, SSHORT, ...);
static ISC_STATUS error(ISC_STATUS* status, const Arg::StatusVector& v);
void API_ROUTINE isc_blob_default_desc(
@ -95,9 +98,7 @@ ISC_STATUS API_ROUTINE isc_blob_gen_bpb(
*
**************************************/
if (bpb_buffer_length < 17)
return error(status, 3, (ISC_STATUS) isc_random,
(ISC_STATUS) isc_arg_string,
(ISC_STATUS) "BPB buffer too small");
return error(status, Arg::Gds(isc_random) << Arg::Str("BPB buffer too small"));
UCHAR* p = bpb_buffer;
*p++ = isc_bpb_version1;
@ -120,7 +121,7 @@ ISC_STATUS API_ROUTINE isc_blob_gen_bpb(
*bpb_length = p - bpb_buffer;
return error(status, 1, (ISC_STATUS) FB_SUCCESS);
return error(status, Arg::Gds(FB_SUCCESS));
}
@ -211,13 +212,10 @@ ISC_STATUS API_ROUTINE isc_blob_lookup_desc(ISC_STATUS* status,
}
if (!flag)
return error(status, 5, (ISC_STATUS) isc_fldnotdef,
(ISC_STATUS) isc_arg_string,
(ISC_STATUS) desc->blob_desc_field_name,
(ISC_STATUS) isc_arg_string,
(ISC_STATUS) desc->blob_desc_relation_name);
return error(status, Arg::Gds(isc_fldnotdef) << Arg::Str((const char *)(desc->blob_desc_field_name)) <<
Arg::Str((const char *)(desc->blob_desc_relation_name)));
return error(status, 1, (ISC_STATUS) FB_SUCCESS);
return error(status, Arg::Gds(FB_SUCCESS));
}
@ -253,7 +251,7 @@ ISC_STATUS API_ROUTINE isc_blob_set_desc(ISC_STATUS* status,
desc->blob_desc_charset = charset;
desc->blob_desc_segment_size = segment_size;
return error(status, 1, (ISC_STATUS) FB_SUCCESS);
return error(status, Arg::Gds(FB_SUCCESS));
}
@ -287,7 +285,7 @@ static void copy_exact_name (
}
static ISC_STATUS error( ISC_STATUS* status, SSHORT count, ...)
static ISC_STATUS error(ISC_STATUS* status, const Arg::StatusVector& v)
{
/**************************************
*
@ -299,19 +297,6 @@ static ISC_STATUS error( ISC_STATUS* status, SSHORT count, ...)
* Stuff a status vector.
*
**************************************/
ISC_STATUS *stat;
va_list ptr;
va_start(ptr, count);
stat = status;
*stat++ = isc_arg_gds;
for (; count; --count)
*stat++ = (ISC_STATUS) va_arg(ptr, ISC_STATUS);
va_end(ptr);
*stat = isc_arg_end;
return status[1];
return v.copyTo(status);
}

View File

@ -96,6 +96,7 @@
#include "../jrd/why_proto.h"
#include "../common/utils_proto.h"
#include "../dsql/DdlNodes.h"
#include "../common/StatusArg.h"
#ifdef DSQL_DEBUG
#include "../gpre/prett_proto.h"
@ -103,6 +104,7 @@
using namespace Jrd;
using namespace Dsql;
using namespace Firebird;
const int BLOB_BUFFER_SIZE = 4096; // to read in blr blob for default values
@ -273,7 +275,7 @@ void CompiledStatement::append_raw_string(const UCHAR* string, USHORT len)
//
// Write out a string valued attribute. (Overload 2.)
//
inline void CompiledStatement::append_string(UCHAR verb, const Firebird::MetaName& name)
inline void CompiledStatement::append_string(UCHAR verb, const MetaName& name)
{
append_string(verb, name.c_str(), name.length());
}
@ -282,7 +284,7 @@ inline void CompiledStatement::append_string(UCHAR verb, const Firebird::MetaNam
//
// Write out a string valued attribute. (Overload 3.)
//
inline void CompiledStatement::append_string(UCHAR verb, const Firebird::string& name)
inline void CompiledStatement::append_string(UCHAR verb, const string& name)
{
append_string(verb, name.c_str(), name.length());
}
@ -416,7 +418,7 @@ void DDL_generate(CompiledStatement* statement, dsql_nod* node)
**************************************/
if (statement->req_dbb->dbb_read_only) {
ERRD_post(isc_read_only_database, isc_arg_end);
ERRD_post(Arg::Gds(isc_read_only_database));
return;
}
@ -522,12 +524,9 @@ void DDL_resolve_intl_type2(CompiledStatement* statement,
{
if (ENCODE_ODS(statement->req_dbb->dbb_ods_version, statement->req_dbb->dbb_minor_version) < ODS_11_1)
{
ERRD_post(isc_sqlerr, isc_arg_number, (SLONG) -804,
isc_arg_gds, isc_dsql_feature_not_supported_ods,
isc_arg_number, 11,
isc_arg_number, 1,
ERRD_post(Arg::Gds(isc_sqlerr) << Arg::Num(-804) <<
// Feature not supported on ODS version older than %d.%d
isc_arg_end);
Arg::Gds(isc_dsql_feature_not_supported_ods) << Arg::Num(11) << Arg::Num(1));
}
if (field->fld_type_of_table)
@ -537,7 +536,7 @@ void DDL_resolve_intl_type2(CompiledStatement* statement,
if (relation)
{
const Firebird::MetaName fieldName(field->fld_type_of_name);
const MetaName fieldName(field->fld_type_of_name);
for (fld = relation->rel_fields; fld; fld = fld->fld_next)
{
if (fieldName == fld->fld_name)
@ -560,25 +559,19 @@ void DDL_resolve_intl_type2(CompiledStatement* statement,
if (!fld)
{
ERRD_post(isc_sqlerr, isc_arg_number, (SLONG) -607,
isc_arg_gds, isc_dsql_command_err,
isc_arg_gds, isc_dyn_column_does_not_exist,
isc_arg_string, field->fld_type_of_name.c_str(),
isc_arg_string, field->fld_type_of_table->str_data,
ERRD_post(Arg::Gds(isc_sqlerr) << Arg::Num(-607) << Arg::Gds(isc_dsql_command_err) <<
// column @1 does not exist in table/view @2
isc_arg_end);
Arg::Gds(isc_dyn_column_does_not_exist) <<
Arg::Str(field->fld_type_of_name) << Arg::Str(field->fld_type_of_table->str_data));
}
}
else
{
if (!METD_get_domain(statement, field, field->fld_type_of_name.c_str()))
{
ERRD_post(isc_sqlerr, isc_arg_number, (SLONG) -607,
isc_arg_gds, isc_dsql_command_err,
isc_arg_gds, isc_dsql_domain_not_found,
isc_arg_string, field->fld_type_of_name.c_str(),
ERRD_post(Arg::Gds(isc_sqlerr) << Arg::Num(-607) << Arg::Gds(isc_dsql_command_err) <<
// Specified domain or source field does not exist
isc_arg_end);
Arg::Gds(isc_dsql_domain_not_found) << Arg::Str(field->fld_type_of_name));
}
}
}
@ -588,9 +581,8 @@ void DDL_resolve_intl_type2(CompiledStatement* statement,
if (field->fld_character_set || collation_name ||
field->fld_flags & FLD_national)
{
ERRD_post(isc_sqlerr, isc_arg_number, (SLONG) -204,
isc_arg_gds, isc_dsql_datatype_err,
isc_arg_gds, isc_collation_requires_text, isc_arg_end);
ERRD_post(Arg::Gds(isc_sqlerr) << Arg::Num(-204) <<
Arg::Gds(isc_dsql_datatype_err) << Arg::Gds(isc_collation_requires_text));
}
return;
}
@ -605,18 +597,16 @@ void DDL_resolve_intl_type2(CompiledStatement* statement,
"RDB$FIELD_SUB_TYPE",
&blob_sub_type))
{
ERRD_post(isc_sqlerr, isc_arg_number, (SLONG) -204, isc_arg_gds,
isc_dsql_datatype_err, isc_arg_gds,
isc_dsql_blob_type_unknown, isc_arg_string,
((dsql_str*) field->fld_sub_type_name)->str_data, isc_arg_end);
ERRD_post(Arg::Gds(isc_sqlerr) << Arg::Num(-204) <<
Arg::Gds(isc_dsql_datatype_err) <<
Arg::Gds(isc_dsql_blob_type_unknown) << Arg::Str(((dsql_str*)field->fld_sub_type_name)->str_data));
}
field->fld_sub_type = blob_sub_type;
}
if (field->fld_sub_type > isc_blob_text)
{
ERRD_post(isc_sqlerr, isc_arg_number, (SLONG) -204, isc_arg_gds,
isc_dsql_datatype_err, isc_arg_gds,
isc_subtype_for_internal_use, isc_arg_end);
ERRD_post(Arg::Gds(isc_sqlerr) << Arg::Num(-204) << Arg::Gds(isc_dsql_datatype_err) <<
Arg::Gds(isc_subtype_for_internal_use));
}
if (field->fld_character_set && (field->fld_sub_type == isc_blob_untyped))
{
@ -624,15 +614,13 @@ void DDL_resolve_intl_type2(CompiledStatement* statement,
}
if (field->fld_character_set && (field->fld_sub_type != isc_blob_text))
{
ERRD_post(isc_sqlerr, isc_arg_number, (SLONG) -204, isc_arg_gds,
isc_dsql_datatype_err, isc_arg_gds,
isc_collation_requires_text, isc_arg_end);
ERRD_post(Arg::Gds(isc_sqlerr) << Arg::Num(-204) << Arg::Gds(isc_dsql_datatype_err) <<
Arg::Gds(isc_collation_requires_text));
}
if (collation_name && (field->fld_sub_type != isc_blob_text))
{
ERRD_post(isc_sqlerr, isc_arg_number, (SLONG) -204, isc_arg_gds,
isc_dsql_datatype_err, isc_arg_gds,
isc_collation_requires_text, isc_arg_end);
ERRD_post(Arg::Gds(isc_sqlerr) << Arg::Num(-204) << Arg::Gds(isc_dsql_datatype_err) <<
Arg::Gds(isc_collation_requires_text));
}
if (field->fld_sub_type != isc_blob_text) {
return;
@ -728,10 +716,8 @@ void DDL_resolve_intl_type2(CompiledStatement* statement,
if (!resolved_charset)
{
// specified character set not found
ERRD_post(isc_sqlerr, isc_arg_number, (SLONG) -204,
isc_arg_gds, isc_dsql_datatype_err,
isc_arg_gds, isc_charset_not_found, isc_arg_string,
charset_name, isc_arg_end);
ERRD_post(Arg::Gds(isc_sqlerr) << Arg::Num(-204) << Arg::Gds(isc_dsql_datatype_err) <<
Arg::Gds(isc_charset_not_found) << Arg::Str(charset_name));
}
field->fld_character_set_id = resolved_charset->intlsym_charset_id;
resolved_type = resolved_charset;
@ -744,7 +730,7 @@ void DDL_resolve_intl_type2(CompiledStatement* statement,
if (!resolved_collation)
{
Firebird::MetaName charSetName;
MetaName charSetName;
if (charset_name)
charSetName = charset_name;
@ -752,11 +738,8 @@ void DDL_resolve_intl_type2(CompiledStatement* statement,
charSetName = METD_get_charset_name(statement, field->fld_character_set_id);
// Specified collation not found
ERRD_post(isc_sqlerr, isc_arg_number, (SLONG) -204,
isc_arg_gds, isc_dsql_datatype_err,
isc_arg_gds, isc_collation_not_found,
isc_arg_string, collation_name->str_data,
isc_arg_string, charSetName.c_str(), isc_arg_end);
ERRD_post(Arg::Gds(isc_sqlerr) << Arg::Num(-204) << Arg::Gds(isc_dsql_datatype_err) <<
Arg::Gds(isc_collation_not_found) << Arg::Str(collation_name->str_data) << Arg::Str(charSetName));
}
// If both specified, must be for same character set
@ -766,10 +749,8 @@ void DDL_resolve_intl_type2(CompiledStatement* statement,
if ((field->fld_character_set_id != resolved_type->intlsym_charset_id)
&& (field->fld_character_set_id != ttype_dynamic))
{
ERRD_post(isc_sqlerr, isc_arg_number, (SLONG) -204, isc_arg_gds,
isc_dsql_datatype_err, isc_arg_gds,
isc_collation_not_for_charset, isc_arg_string,
collation_name->str_data, isc_arg_end);
ERRD_post(Arg::Gds(isc_sqlerr) << Arg::Num(-204) << Arg::Gds(isc_dsql_datatype_err) <<
Arg::Gds(isc_collation_not_for_charset) << Arg::Str(collation_name->str_data));
}
field->fld_explicit_collation = true;
@ -814,11 +795,9 @@ static void assign_field_length (
}
if (field_length > MAX_COLUMN_SIZE)
{
ERRD_post(isc_sqlerr, isc_arg_number, (SLONG) -204,
isc_arg_gds, isc_dsql_datatype_err,
isc_arg_gds, isc_imp_exc,
isc_arg_gds, isc_field_name, isc_arg_string,
field->fld_name.c_str(), isc_arg_end);
ERRD_post(Arg::Gds(isc_sqlerr) << Arg::Num(-204) << Arg::Gds(isc_dsql_datatype_err) <<
Arg::Gds(isc_imp_exc) <<
Arg::Gds(isc_field_name) << Arg::Str(field->fld_name));
}
field->fld_length = (USHORT) field_length;
}
@ -918,7 +897,7 @@ static bool is_array_or_blob(CompiledStatement* statement, const dsql_nod* node)
{
const dsql_str* name = (dsql_str*) node->nod_arg[e_sysfunc_name];
dsql_nod* nodeArgs = node->nod_arg[e_sysfunc_args];
Firebird::Array<const dsc*> args;
Array<const dsc*> args;
if (nodeArgs)
{
@ -1047,10 +1026,8 @@ static void check_one_call (USHORT* repetition_count,
**************************************/
if (++repetition_count[pos] > 1)
{
ERRD_post (isc_sqlerr, isc_arg_number, (SLONG) -637,
isc_arg_gds, isc_dsql_duplicate_spec,
isc_arg_string, error_msg,
isc_arg_end);
ERRD_post (Arg::Gds(isc_sqlerr) << Arg::Num(-637) <<
Arg::Gds(isc_dsql_duplicate_spec) << Arg::Str(error_msg));
}
}
@ -1164,8 +1141,7 @@ static void define_computed(CompiledStatement* statement,
if (is_array_or_blob(statement, input))
{
ERRD_post(isc_sqlerr, isc_arg_number, (SLONG) -607,
isc_arg_gds, isc_dsql_no_array_computed, isc_arg_end);
ERRD_post(Arg::Gds(isc_sqlerr) << Arg::Num(-607) << Arg::Gds(isc_dsql_no_array_computed));
}
// try to calculate size of the computed field. The calculated size
@ -1726,8 +1702,7 @@ static void define_dimensions( CompiledStatement* statement, const dsql_fld* fie
if (dims > MAX_ARRAY_DIMENSIONS)
{
ERRD_post(isc_sqlerr, isc_arg_number, (SLONG) -604,
isc_arg_gds, isc_dsql_max_arr_dim_exceeded, isc_arg_end);
ERRD_post(Arg::Gds(isc_sqlerr) << Arg::Num(-604) << Arg::Gds(isc_dsql_max_arr_dim_exceeded));
}
statement->append_number(isc_dyn_fld_dimensions, (SSHORT) dims);
@ -1749,8 +1724,7 @@ static void define_dimensions( CompiledStatement* statement, const dsql_fld* fie
statement->append_uchar(isc_dyn_end);
if (lrange >= hrange)
{
ERRD_post(isc_sqlerr, isc_arg_number, (SLONG) -604,
isc_arg_gds, isc_dsql_arr_range_error, isc_arg_end);
ERRD_post(Arg::Gds(isc_sqlerr) << Arg::Num(-604) << Arg::Gds(isc_dsql_arr_range_error));
}
}
}
@ -1774,9 +1748,8 @@ static void define_domain(CompiledStatement* statement)
if (fb_utils::implicit_domain(field->fld_name.c_str()))
{
ERRD_post(isc_sqlerr, isc_arg_number, (SLONG) -637,
isc_arg_gds, isc_dsql_implicit_domain_name,
isc_arg_string, field->fld_name.c_str(), isc_arg_end);
ERRD_post(Arg::Gds(isc_sqlerr) << Arg::Num(-637) <<
Arg::Gds(isc_dsql_implicit_domain_name) << Arg::Str(field->fld_name));
}
statement->append_string(isc_dyn_def_global_fld, field->fld_name);
@ -1821,19 +1794,16 @@ static void define_domain(CompiledStatement* statement)
}
else
{
ERRD_post(isc_sqlerr, isc_arg_number, (SLONG) -637,
isc_arg_gds, isc_dsql_duplicate_spec,
isc_arg_string, "NOT NULL", isc_arg_end);
ERRD_post(Arg::Gds(isc_sqlerr) << Arg::Num(-637) <<
Arg::Gds(isc_dsql_duplicate_spec) << Arg::Str("NOT NULL"));
}
}
else if (node1->nod_type == nod_def_constraint)
{
if (check_flag)
{
ERRD_post(isc_sqlerr, isc_arg_number, (SLONG) -637,
isc_arg_gds, isc_dsql_duplicate_spec,
isc_arg_string, "DOMAIN CHECK CONSTRAINT",
isc_arg_end);
ERRD_post(Arg::Gds(isc_sqlerr) << Arg::Num(-637) <<
Arg::Gds(isc_dsql_duplicate_spec) << Arg::Str("DOMAIN CHECK CONSTRAINT"));
}
check_flag = true;
@ -1971,12 +1941,10 @@ static void define_field(CompiledStatement* statement,
if (!METD_get_domain(statement, field, domain_name->str_data))
{
ERRD_post(isc_sqlerr, isc_arg_number, (SLONG) -607,
isc_arg_gds, isc_dsql_command_err,
isc_arg_gds, isc_dsql_domain_not_found,
isc_arg_string, domain_name->str_data,
ERRD_post(Arg::Gds(isc_sqlerr) << Arg::Num(-607) <<
Arg::Gds(isc_dsql_command_err) <<
// Specified domain or source field does not exist
isc_arg_end);
Arg::Gds(isc_dsql_domain_not_found) << Arg::Str(domain_name->str_data));
}
DDL_resolve_intl_type( statement,
@ -2014,12 +1982,9 @@ static void define_field(CompiledStatement* statement,
{
const char* typeName = (field->fld_dtype == dtype_blob ? "BLOB" : "ARRAY");
ERRD_post(isc_sqlerr, isc_arg_number, (SLONG) -607,
isc_arg_gds, isc_dsql_type_not_supp_ext_tab,
isc_arg_string, typeName,
isc_arg_string, relation->rel_name.c_str(),
isc_arg_string, field->fld_name.c_str(),
isc_arg_end);
ERRD_post(Arg::Gds(isc_sqlerr) << Arg::Num(-607) <<
Arg::Gds(isc_dsql_type_not_supp_ext_tab) << Arg::Str(typeName) <<
Arg::Str(relation->rel_name) << Arg::Str(field->fld_name));
}
if (position != -1)
@ -2066,10 +2031,9 @@ static void define_field(CompiledStatement* statement,
case nod_primary:
if (default_null_flag)
{
ERRD_post(isc_sqlerr, isc_arg_number, (SLONG) -204,
isc_arg_gds, isc_bad_default_value,
isc_arg_gds, isc_invalid_clause,
isc_arg_string, "default null not null", isc_arg_end);
ERRD_post(Arg::Gds(isc_sqlerr) << Arg::Num(-204) <<
Arg::Gds(isc_bad_default_value) <<
Arg::Gds(isc_invalid_clause) << Arg::Str("default null not null"));
}
if (!not_null_flag)
{
@ -2154,7 +2118,7 @@ static void define_field(CompiledStatement* statement,
}
} // try
catch (const Firebird::Exception&)
catch (const Exception&)
{
clearPermanentField(relation, permanent);
throw;
@ -2195,10 +2159,9 @@ static SSHORT getBlobFilterSubType(CompiledStatement* statement, const dsql_nod*
"RDB$FIELD_SUB_TYPE",
&blob_sub_type))
{
ERRD_post(isc_sqlerr, isc_arg_number, (SLONG) -204, isc_arg_gds,
isc_dsql_datatype_err, isc_arg_gds,
isc_dsql_blob_type_unknown, isc_arg_string,
((const dsql_str*)(node->nod_arg[0]))->str_data, isc_arg_end);
ERRD_post(Arg::Gds(isc_sqlerr) << Arg::Num(-204) <<
Arg::Gds(isc_dsql_datatype_err) <<
Arg::Gds(isc_dsql_blob_type_unknown) << Arg::Str(((const dsql_str*)(node->nod_arg[0]))->str_data));
}
return blob_sub_type;
}
@ -2260,9 +2223,8 @@ static void define_collation(CompiledStatement* statement)
if (!resolved_charset)
{
// specified character set not found
ERRD_post(isc_sqlerr, isc_arg_number, (SLONG) -504,
isc_arg_gds, isc_charset_not_found, isc_arg_string,
coll_for->str_data, isc_arg_end);
ERRD_post(Arg::Gds(isc_sqlerr) << Arg::Num(-504) <<
Arg::Gds(isc_charset_not_found) << Arg::Str(coll_for->str_data));
}
if (coll_specific_attributes)
@ -2282,11 +2244,9 @@ static void define_collation(CompiledStatement* statement)
if (!resolved_collation)
{
// Specified collation not found
ERRD_post(isc_sqlerr, isc_arg_number, (SLONG) -204,
isc_arg_gds, isc_collation_not_found,
isc_arg_string, ((dsql_str*)coll_from->nod_arg[0])->str_data,
isc_arg_string, resolved_charset->intlsym_name,
isc_arg_end);
ERRD_post(Arg::Gds(isc_sqlerr) << Arg::Num(-204) <<
Arg::Gds(isc_collation_not_found) << Arg::Str(((dsql_str*)coll_from->nod_arg[0])->str_data) <<
Arg::Str(resolved_charset->intlsym_name));
}
statement->append_number(isc_dyn_coll_from,
@ -2524,10 +2484,9 @@ static void define_procedure(CompiledStatement* statement, NOD_TYPE op)
}
else if (defaults) {
// parameter without default value after parameters with default
ERRD_post(isc_sqlerr, isc_arg_number, (SLONG) -204,
isc_arg_gds, isc_bad_default_value,
isc_arg_gds, isc_invalid_clause,
isc_arg_string, "defaults must be last", isc_arg_end);
ERRD_post(Arg::Gds(isc_sqlerr) << Arg::Num(-204) <<
Arg::Gds(isc_bad_default_value) <<
Arg::Gds(isc_invalid_clause) << Arg::Str("defaults must be last"));
}
*ptr = MAKE_variable(field, field->fld_name.c_str(),
@ -3051,9 +3010,9 @@ static void define_shadow(CompiledStatement* statement)
if (!ptr[e_shadow_number])
{
ERRD_post(isc_sqlerr, isc_arg_number, (SLONG) -607,
isc_arg_gds, isc_dsql_command_err,
isc_arg_gds, isc_dsql_shadow_number_err, isc_arg_end);
ERRD_post(Arg::Gds(isc_sqlerr) << Arg::Num(-607) <<
Arg::Gds(isc_dsql_command_err) <<
Arg::Gds(isc_dsql_shadow_number_err));
}
statement->append_number(isc_dyn_def_shadow, (SSHORT)(IPTR) (ptr[e_shadow_number]));
@ -3082,12 +3041,10 @@ static void define_shadow(CompiledStatement* statement)
if (!length && !file->fil_start)
{
ERRD_post(isc_sqlerr, isc_arg_number, (SLONG) -607,
isc_arg_gds, isc_dsql_command_err,
isc_arg_gds, isc_dsql_file_length_err,
isc_arg_number, (ISC_STATUS) file->fil_name->str_data,
ERRD_post(Arg::Gds(isc_sqlerr) << Arg::Num(-607) <<
Arg::Gds(isc_dsql_command_err) <<
// Preceding file did not specify length, so %s must include starting page number
isc_arg_end);
Arg::Gds(isc_dsql_file_length_err) << Arg::Str(file->fil_name->str_data));
}
const SLONG start = file->fil_start;
@ -3136,9 +3093,8 @@ static void define_trigger(CompiledStatement* statement, NOD_TYPE op)
{
if (type_node && (type_node->getSlong() & TRIGGER_TYPE_MASK) != TRIGGER_TYPE_DML)
{
ERRD_post(isc_dsql_command_err,
isc_arg_gds, isc_dsql_incompatible_trigger_type,
isc_arg_end);
ERRD_post(Arg::Gds(isc_dsql_command_err) <<
Arg::Gds(isc_dsql_incompatible_trigger_type));
}
const dsql_str* relation_name =
@ -3152,9 +3108,8 @@ static void define_trigger(CompiledStatement* statement, NOD_TYPE op)
{
if (type_node && (type_node->getSlong() & TRIGGER_TYPE_MASK) != TRIGGER_TYPE_DB)
{
ERRD_post(isc_dsql_command_err,
isc_arg_gds, isc_dsql_incompatible_trigger_type,
isc_arg_end);
ERRD_post(Arg::Gds(isc_dsql_command_err) <<
Arg::Gds(isc_dsql_incompatible_trigger_type));
}
}
@ -3179,9 +3134,8 @@ static void define_trigger(CompiledStatement* statement, NOD_TYPE op)
{
if (type_node && (type_node->getSlong() & TRIGGER_TYPE_MASK) != TRIGGER_TYPE_DML)
{
ERRD_post(isc_dsql_command_err,
isc_arg_gds, isc_dsql_incompatible_trigger_type,
isc_arg_end);
ERRD_post(Arg::Gds(isc_dsql_command_err) <<
Arg::Gds(isc_dsql_incompatible_trigger_type));
}
relation_node = FB_NEW_RPT(*tdbb->getDefaultPool(), e_rln_count) dsql_nod;
@ -3193,9 +3147,8 @@ static void define_trigger(CompiledStatement* statement, NOD_TYPE op)
}
else if (found && type_node && (USHORT) type_node->getSlong() != trig_type)
{
ERRD_post(isc_dsql_command_err,
isc_arg_gds, isc_dsql_db_trigger_type_cant_change,
isc_arg_end);
ERRD_post(Arg::Gds(isc_dsql_command_err) <<
Arg::Gds(isc_dsql_db_trigger_type_cant_change));
}
}
}
@ -3352,11 +3305,10 @@ static void define_udf(CompiledStatement* statement)
field->fld_dtype == dtype_blob ||
field->fld_dtype == dtype_timestamp))
{
ERRD_post(isc_sqlerr, isc_arg_number, (SLONG) -607,
isc_arg_gds, isc_dsql_command_err,
isc_arg_gds, isc_return_mode_err,
ERRD_post(Arg::Gds(isc_sqlerr) << Arg::Num(-60) <<
Arg::Gds(isc_dsql_command_err) <<
// Return mode by value not allowed for this data type
isc_arg_end);
Arg::Gds(isc_return_mode_err));
}
/* For functions returning a blob, coerce return argument position to
@ -3367,12 +3319,11 @@ static void define_udf(CompiledStatement* statement)
blob_position = (arguments) ? arguments->nod_count + 1 : 1;
if (blob_position > MAX_UDF_ARGUMENTS)
{
ERRD_post(isc_sqlerr, isc_arg_number, (SLONG) -607,
isc_arg_gds, isc_dsql_command_err,
isc_arg_gds, isc_extern_func_err,
ERRD_post(Arg::Gds(isc_sqlerr) << Arg::Num(-607) <<
Arg::Gds(isc_dsql_command_err) <<
// External functions can not have more than 10 parameters
// Or 9 if the function returns a BLOB
isc_arg_end);
Arg::Gds(isc_extern_func_err));
}
statement->append_number(isc_dyn_func_return_argument, blob_position);
@ -3393,15 +3344,14 @@ static void define_udf(CompiledStatement* statement)
if (!arguments || position > arguments->nod_count || position < 1)
{
ERRD_post(isc_sqlerr, isc_arg_number, (SLONG) -607,
isc_arg_gds, isc_dsql_udf_return_pos_err, //gds__extern_func_err,
isc_arg_number, (SLONG) (arguments ? arguments->nod_count : 0),
ERRD_post(Arg::Gds(isc_sqlerr) << Arg::Num(-607) <<
Arg::Gds(isc_dsql_udf_return_pos_err) << //gds__extern_func_err,
Arg::Num(arguments ? arguments->nod_count : 0));
// CVC: We should devise new msg "position should be between 1 and #params";
// here it is: dsql_udf_return_pos_err
// External functions can not have more than 10 parameters
// Not strictly correct -- return position error
isc_arg_end);
}
// We'll verify that SCALAR_ARRAY can't be used as a return type.
@ -3412,10 +3362,8 @@ static void define_udf(CompiledStatement* statement)
{
const SSHORT arg_mechanism = (SSHORT) param_node[e_udf_param_type]->getSlong();
if (arg_mechanism == FUN_scalar_array)
ERRD_post(isc_sqlerr, isc_arg_number, (SLONG) -607,
isc_arg_gds, isc_random,
isc_arg_string, "BY SCALAR_ARRAY can't be used as a return parameter",
isc_arg_end);
ERRD_post(Arg::Gds(isc_sqlerr) << Arg::Num(-607) <<
Arg::Gds(isc_random) << Arg::Str("BY SCALAR_ARRAY can't be used as a return parameter"));
}
statement->append_number(isc_dyn_func_return_argument, position);
@ -3463,11 +3411,10 @@ static void define_udf(CompiledStatement* statement)
{
if (position > MAX_UDF_ARGUMENTS)
{
ERRD_post(isc_sqlerr, isc_arg_number, (SLONG) -607,
isc_arg_gds, isc_dsql_command_err,
isc_arg_gds, isc_extern_func_err,
ERRD_post(Arg::Gds(isc_sqlerr) << Arg::Num(-607) <<
Arg::Gds(isc_dsql_command_err) <<
// External functions can not have more than 10 parameters
isc_arg_end);
Arg::Gds(isc_extern_func_err));
}
/*field = (dsql_fld*) *ptr; */
@ -3750,11 +3697,9 @@ static void define_view(CompiledStatement* statement, NOD_TYPE op)
view_relation = METD_get_relation(statement, view_name);
if (!view_relation)
{
ERRD_post(isc_sqlerr, isc_arg_number, (SLONG) -607,
isc_arg_gds, isc_dsql_command_err,
isc_arg_gds, isc_dsql_view_not_found,
isc_arg_string, view_name->str_data,
isc_arg_end);
ERRD_post(Arg::Gds(isc_sqlerr) << Arg::Num(-607) <<
Arg::Gds(isc_dsql_command_err) <<
Arg::Gds(isc_dsql_view_not_found) << Arg::Str(view_name->str_data));
}
}
@ -3810,11 +3755,11 @@ static void define_view(CompiledStatement* statement, NOD_TYPE op)
if (procedure)
{
// Disallow procedure-based views
ERRD_post(isc_wish_list, isc_arg_end);
ERRD_post(Arg::Gds(isc_wish_list));
}
*/
const Firebird::MetaName& name = relation ? relation->rel_name : procedure->prc_name;
const MetaName& name = relation ? relation->rel_name : procedure->prc_name;
statement->append_string(isc_dyn_view_relation, name);
statement->append_number(isc_dyn_view_context, context->ctx_context);
@ -3846,7 +3791,7 @@ static void define_view(CompiledStatement* statement, NOD_TYPE op)
dsql_nod* items = rse->nod_arg[e_rse_items];
dsql_nod** i_ptr = items->nod_arg;
Firebird::SortedArray<dsql_fld*> modified_fields;
SortedArray<dsql_fld*> modified_fields;
for (const dsql_nod* const* const i_end = i_ptr + items->nod_count;
i_ptr < i_end; i_ptr++, position++)
@ -3886,11 +3831,10 @@ static void define_view(CompiledStatement* statement, NOD_TYPE op)
if (!ptr && !field_string)
{
ERRD_post(isc_sqlerr, isc_arg_number, (SLONG) -607,
isc_arg_gds, isc_dsql_command_err,
isc_arg_gds, isc_specify_field_err,
ERRD_post(Arg::Gds(isc_sqlerr) << Arg::Num(-607) <<
Arg::Gds(isc_dsql_command_err) <<
// must specify field name for view select expression
isc_arg_end);
Arg::Gds(isc_specify_field_err));
}
// CVC: Small modification here to catch any mismatch between number of
@ -3919,12 +3863,10 @@ static void define_view(CompiledStatement* statement, NOD_TYPE op)
{
if (modified_fields.exist(rel_field))
{
ERRD_post(isc_sqlerr, isc_arg_number, (SLONG) -104,
isc_arg_gds, isc_dsql_command_err,
isc_arg_gds, isc_dsql_col_more_than_once_view,
isc_arg_string, field_string,
ERRD_post(Arg::Gds(isc_sqlerr) << Arg::Num(-104) <<
Arg::Gds(isc_dsql_command_err) <<
// column @1 appears more than once in ALTER VIEW
isc_arg_end);
Arg::Gds(isc_dsql_col_more_than_once_view) << Arg::Str(field_string));
}
modified_fields.add(rel_field);
@ -3981,11 +3923,10 @@ static void define_view(CompiledStatement* statement, NOD_TYPE op)
if (ptr != end)
{
ERRD_post(isc_sqlerr, isc_arg_number, (SLONG) -607,
isc_arg_gds, isc_dsql_command_err,
isc_arg_gds, isc_num_field_err,
ERRD_post(Arg::Gds(isc_sqlerr) << Arg::Num(-607) <<
Arg::Gds(isc_dsql_command_err) <<
// number of fields does not match select list
isc_arg_end);
Arg::Gds(isc_num_field_err));
}
if (view_relation) // modifying a view
@ -4009,51 +3950,46 @@ static void define_view(CompiledStatement* statement, NOD_TYPE op)
{
if (!updatable)
{
ERRD_post(isc_sqlerr, isc_arg_number, (SLONG) -607,
isc_arg_gds, isc_dsql_command_err,
isc_arg_gds, isc_col_name_err,
ERRD_post(Arg::Gds(isc_sqlerr) << Arg::Num(-607) <<
Arg::Gds(isc_dsql_command_err) <<
// Only simple column names permitted for VIEW WITH CHECK OPTION
isc_arg_end);
Arg::Gds(isc_col_name_err));
}
select_expr = select_expr->nod_arg[e_sel_query_spec];
if (select_expr->nod_type == nod_list)
{
ERRD_post(isc_sqlerr, isc_arg_number, (SLONG) -607,
isc_arg_gds, isc_dsql_command_err,
isc_arg_gds, isc_table_view_err,
ERRD_post(Arg::Gds(isc_sqlerr) << Arg::Num(-607) <<
Arg::Gds(isc_dsql_command_err) <<
// Only one table allowed for VIEW WITH CHECK OPTION
isc_arg_end);
Arg::Gds(isc_table_view_err));
}
if (select_expr->nod_arg[e_qry_from]->nod_count != 1)
{
ERRD_post(isc_sqlerr, isc_arg_number, (SLONG) -607,
isc_arg_gds, isc_dsql_command_err,
isc_arg_gds, isc_table_view_err,
ERRD_post(Arg::Gds(isc_sqlerr) << Arg::Num(-607) <<
Arg::Gds(isc_dsql_command_err) <<
// Only one table allowed for VIEW WITH CHECK OPTION
isc_arg_end);
Arg::Gds(isc_table_view_err));
}
if (!select_expr->nod_arg[e_qry_where])
{
ERRD_post(isc_sqlerr, isc_arg_number, (SLONG) -607,
isc_arg_gds, isc_dsql_command_err,
isc_arg_gds, isc_where_err,
ERRD_post(Arg::Gds(isc_sqlerr) << Arg::Num(-607) <<
Arg::Gds(isc_dsql_command_err) <<
// No where clause for VIEW WITH CHECK OPTION
isc_arg_end);
Arg::Gds(isc_where_err));
}
if (select_expr->nod_arg[e_qry_distinct] ||
select_expr->nod_arg[e_qry_group] ||
select_expr->nod_arg[e_qry_having])
{
ERRD_post(isc_sqlerr, isc_arg_number, (SLONG) -607,
isc_arg_gds, isc_dsql_command_err,
isc_arg_gds, isc_distinct_err,
ERRD_post(Arg::Gds(isc_sqlerr) << Arg::Num(-607) <<
Arg::Gds(isc_dsql_command_err) <<
// DISTINCT, GROUP or HAVING not permitted for VIEW WITH CHECK OPTION
isc_arg_end);
Arg::Gds(isc_distinct_err));
}
dsql_nod* relation_node = MAKE_node(nod_relation_name, e_rln_count);
@ -4352,22 +4288,18 @@ static void delete_relation_view (CompiledStatement* statement,
if (!relation && !silent_deletion ||
relation && (relation->rel_flags & REL_view))
{
ERRD_post (isc_sqlerr, isc_arg_number, (SLONG) -607,
isc_arg_gds, isc_dsql_command_err,
isc_arg_gds, isc_dsql_table_not_found,
isc_arg_string, string->str_data,
isc_arg_end);
ERRD_post (Arg::Gds(isc_sqlerr) << Arg::Num(-607) <<
Arg::Gds(isc_dsql_command_err) <<
Arg::Gds(isc_dsql_table_not_found) << Arg::Str(string->str_data));
}
}
else { /* node->nod_type == nod_del_view, nod_redef_view */
if (!relation && !silent_deletion ||
relation && !(relation->rel_flags & REL_view))
{
ERRD_post (isc_sqlerr, isc_arg_number, (SLONG) -607,
isc_arg_gds, isc_dsql_command_err,
isc_arg_gds, isc_dsql_view_not_found,
isc_arg_string, string->str_data,
isc_arg_end);
ERRD_post (Arg::Gds(isc_sqlerr) << Arg::Num(-607) <<
Arg::Gds(isc_dsql_command_err) <<
Arg::Gds(isc_dsql_view_not_found) << Arg::Str(string->str_data));
}
}
if (relation) {
@ -4527,22 +4459,20 @@ static void foreign_key(CompiledStatement* statement, dsql_nod* element, const c
referenced field, fail. */
if (!columns2)
{
ERRD_post(isc_sqlerr, isc_arg_number, (SLONG) -607,
isc_arg_gds, isc_dsql_command_err,
isc_arg_gds, isc_reftable_requires_pk,
ERRD_post (Arg::Gds(isc_sqlerr) << Arg::Num(-607) <<
Arg::Gds(isc_dsql_command_err) <<
/* "REFERENCES table" without "(column)" requires PRIMARY
KEY on referenced table */
isc_arg_end);
Arg::Gds(isc_reftable_requires_pk));
}
}
if (columns2 && (columns1->nod_count != columns2->nod_count))
{
ERRD_post(isc_sqlerr, isc_arg_number, (SLONG) -607,
isc_arg_gds, isc_dsql_command_err,
isc_arg_gds, isc_key_field_count_err,
ERRD_post (Arg::Gds(isc_sqlerr) << Arg::Num(-607) <<
Arg::Gds(isc_dsql_command_err) <<
// foreign key field count does not match primary key
isc_arg_end);
Arg::Gds(isc_key_field_count_err));
}
/* define the foreign key index and the triggers that may be needed
@ -5338,12 +5268,10 @@ static void modify_domain( CompiledStatement* statement)
correct type, length, scale, etc. */
if (!METD_get_domain(statement, &local_field, domain_name->str_data))
{
ERRD_post(isc_sqlerr, isc_arg_number, (SLONG) -607,
isc_arg_gds, isc_dsql_command_err,
isc_arg_gds, isc_dsql_domain_not_found,
isc_arg_string, domain_name->str_data,
ERRD_post(Arg::Gds(isc_sqlerr) << Arg::Num(-607) <<
Arg::Gds(isc_dsql_command_err) <<
// Specified domain or source field does not exist
isc_arg_end);
Arg::Gds(isc_dsql_domain_not_found) << Arg::Str(domain_name->str_data));
}
if (element->nod_arg[e_cnstr_condition])
{
@ -5663,10 +5591,10 @@ static void modify_relation(CompiledStatement* statement)
TEXT linecol[64];
sprintf (linecol, "At line %d, column %d.",
(int) relation_node->nod_line, (int) relation_node->nod_column);
ERRD_post(isc_sqlerr, isc_arg_number, (SLONG) - 204, isc_arg_gds,
isc_dsql_relation_err, isc_arg_gds, isc_random,
isc_arg_string, relation_name->str_data, isc_arg_gds,
isc_random, isc_arg_string, linecol, isc_arg_end);
ERRD_post(Arg::Gds(isc_sqlerr) << Arg::Num(-204) <<
Arg::Gds(isc_dsql_relation_err) <<
Arg::Gds(isc_random) << Arg::Str(relation_name->str_data) <<
Arg::Gds(isc_random) << Arg::Str(linecol));
}
/* need to handle error that occur in generating dyn string.
@ -5746,9 +5674,9 @@ static void modify_relation(CompiledStatement* statement)
if ((element->nod_arg[1])->nod_type == nod_cascade)
{
// Unsupported DSQL construct
ERRD_post(isc_sqlerr, isc_arg_number, (SLONG) -901,
isc_arg_gds, isc_dsql_command_err,
isc_arg_gds, isc_dsql_construct_err, isc_arg_end);
ERRD_post(Arg::Gds(isc_sqlerr) << Arg::Num(-901) <<
Arg::Gds(isc_dsql_command_err) <<
Arg::Gds(isc_dsql_construct_err));
}
fb_assert((element->nod_arg[1])->nod_type == nod_restrict);
@ -5773,7 +5701,7 @@ static void modify_relation(CompiledStatement* statement)
statement->append_uchar(isc_dyn_end);
} // try
catch (const Firebird::Exception&)
catch (const Exception&)
{
METD_drop_relation(statement, relation_name);
statement->req_relation = 0;
@ -5794,12 +5722,11 @@ static void modify_udf(CompiledStatement* statement)
const dsql_str* obj_name = (dsql_str*) node->nod_arg[e_mod_udf_name];
if (!node->nod_arg[e_mod_udf_entry_pt] && !node->nod_arg[e_mod_udf_module])
ERRD_post(isc_sqlerr, isc_arg_number, (SLONG) -104,
isc_arg_gds, isc_command_end_err2, // Unexpected end of command
isc_arg_number, (SLONG) node->nod_line,
isc_arg_number,
(SLONG) node->nod_column + obj_name->str_length, // + strlen("FUNCTION"),
isc_arg_end);
ERRD_post(Arg::Gds(isc_sqlerr) << Arg::Num(-104) <<
// Unexpected end of command
Arg::Gds(isc_command_end_err2) << Arg::Num(node->nod_line) <<
Arg::Num(node->nod_column + obj_name->str_length));
// + strlen("FUNCTION")
statement->append_cstring(isc_dyn_mod_function, obj_name->str_data);
const dsql_str* entry_point_name = (dsql_str*) node->nod_arg[e_mod_udf_entry_pt];
@ -5855,11 +5782,10 @@ static void define_user(CompiledStatement* statement, UCHAR op)
{
if (i == e_user_name || (i == e_user_passwd && op == isc_dyn_user_add))
{
ERRD_post(isc_sqlerr, isc_arg_number, (SLONG) -104,
isc_arg_gds, isc_command_end_err2, // Unexpected end of command
isc_arg_number, (SLONG) node->nod_line,
isc_arg_number, (SLONG) node->nod_column,
isc_arg_end);
ERRD_post(Arg::Gds(isc_sqlerr) << Arg::Num(-104) <<
// Unexpected end of command
Arg::Gds(isc_command_end_err2) << Arg::Num(node->nod_line) <<
Arg::Num(node->nod_column));
}
continue;
@ -5889,11 +5815,10 @@ static void define_user(CompiledStatement* statement, UCHAR op)
if (argCount < 2 && op != isc_dyn_user_del)
{
ERRD_post(isc_sqlerr, isc_arg_number, (SLONG) -104,
isc_arg_gds, isc_command_end_err2, // Unexpected end of command
isc_arg_number, (SLONG) node->nod_line,
isc_arg_number, (SLONG) node->nod_column,
isc_arg_end);
ERRD_post(Arg::Gds(isc_sqlerr) << Arg::Num(-104) <<
// Unexpected end of command
Arg::Gds(isc_command_end_err2) << Arg::Num(node->nod_line) <<
Arg::Num(node->nod_column));
}
statement->append_uchar(isc_user_end);
@ -6322,9 +6247,8 @@ static void put_local_variables(CompiledStatement* statement, dsql_nod* paramete
const dsql_fld* rest_field = (dsql_fld*) (*rest)->nod_arg[e_dfl_field];
if (field->fld_name == rest_field->fld_name)
{
ERRD_post(isc_sqlerr, isc_arg_number, (SLONG) -637,
isc_arg_gds, isc_dsql_duplicate_spec,
isc_arg_string, field->fld_name.c_str(), isc_arg_end);
ERRD_post(Arg::Gds(isc_sqlerr) << Arg::Num(-637) <<
Arg::Gds(isc_dsql_duplicate_spec) << Arg::Str(field->fld_name));
}
}
}
@ -6407,11 +6331,10 @@ static dsql_nod* replace_field_names(dsql_nod* input,
if ((*ptr)->nod_type == nod_select_expr)
{
ERRD_post(isc_sqlerr, isc_arg_number, (SLONG) -607,
isc_arg_gds, isc_dsql_command_err,
isc_arg_gds, isc_subquery_err,
ERRD_post(Arg::Gds(isc_sqlerr) << Arg::Num(-607) <<
Arg::Gds(isc_dsql_command_err) <<
// No subqueries permitted for VIEW WITH CHECK OPTION
isc_arg_end);
Arg::Gds(isc_subquery_err));
}
if ((*ptr)->nod_type == nod_field_name)
@ -6770,9 +6693,8 @@ static void modify_field(CompiledStatement* statement,
if (is_array_or_blob(statement, computedNod))
{
ERRD_post(isc_sqlerr, isc_arg_number, (SLONG) -607,
isc_arg_gds, isc_dsql_no_array_computed,
isc_arg_end);
ERRD_post(Arg::Gds(isc_sqlerr) << Arg::Num(-607) <<
Arg::Gds(isc_dsql_no_array_computed));
}
statement->begin_blr(isc_dyn_fld_computed_blr);
@ -6811,12 +6733,10 @@ static void modify_field(CompiledStatement* statement,
// Get the domain information
if (!METD_get_domain(statement, field, domain_name->str_data))
{
ERRD_post(isc_sqlerr, isc_arg_number, (SLONG) -607,
isc_arg_gds, isc_dsql_command_err,
isc_arg_gds, isc_dsql_domain_not_found,
ERRD_post(Arg::Gds(isc_sqlerr) << Arg::Num(-607) <<
Arg::Gds(isc_dsql_command_err) <<
// Specified domain or source field does not exist
isc_arg_string, domain_name->str_data,
isc_arg_end);
Arg::Gds(isc_dsql_domain_not_found) << Arg::Str(domain_name->str_data));
}
DDL_resolve_intl_type(statement, field, NULL);
}
@ -6853,7 +6773,7 @@ static void modify_field(CompiledStatement* statement,
statement->append_uchar(isc_dyn_end);
} // try
catch (const Firebird::Exception&)
catch (const Exception&)
{
clearPermanentField(relation, permanent);
throw;
@ -6940,8 +6860,7 @@ void CompiledStatement::end_blr()
const ULONG length = (req_blr_data.getCount() - req_base_offset) - 2;
if (length > 0xFFFF) {
ERRD_post(isc_too_big_blr, isc_arg_number, (SLONG) length,
isc_arg_number, (SLONG) 0xFFFF, isc_arg_end);
ERRD_post(Arg::Gds(isc_too_big_blr) << Arg::Num(length) << Arg::Num(0xFFFF));
}
*blr_base++ = (UCHAR) length;
@ -6988,7 +6907,7 @@ void CompiledStatement::append_meta_string(const char* string)
thread_db* tdbb = JRD_get_thread_data();
ISC_STATUS_ARRAY status_vector = {0};
Firebird::UCharBuffer nameBuffer;
UCharBuffer nameBuffer;
CsConvert cv(INTL_charset_lookup(tdbb, CS_dynamic)->getStruct(),
INTL_charset_lookup(tdbb, CS_METADATA)->getStruct());

View File

@ -64,6 +64,7 @@
#ifdef SCROLLABLE_CURSORS
#include "../jrd/scroll_cursors.h"
#endif
#include "../common/StatusArg.h"
#ifdef HAVE_CTYPE_H
#include <ctype.h>
@ -71,6 +72,7 @@
using namespace Jrd;
using namespace Dsql;
using namespace Firebird;
static void close_cursor(thread_db*, dsql_req*);
@ -205,9 +207,8 @@ void DSQL_execute(thread_db* tdbb,
if (request->req_flags & REQ_orphan)
{
ERRD_post (isc_sqlerr, isc_arg_number, (SLONG) -901,
isc_arg_gds, isc_bad_req_handle,
isc_arg_end);
ERRD_post(Arg::Gds(isc_sqlerr) << Arg::Num(-901) <<
Arg::Gds(isc_bad_req_handle));
}
if ((SSHORT) in_msg_type == -1) {
@ -218,8 +219,8 @@ void DSQL_execute(thread_db* tdbb,
if (!*tra_handle && request->req_type != REQ_START_TRANS)
{
ERRD_post(isc_sqlerr, isc_arg_number, (SLONG) - 901,
isc_arg_gds, isc_bad_trans_handle, isc_arg_end);
ERRD_post(Arg::Gds(isc_sqlerr) << Arg::Num(-901) <<
Arg::Gds(isc_bad_trans_handle));
}
/* If the request is a SELECT or blob statement then this is an open.
@ -235,8 +236,8 @@ void DSQL_execute(thread_db* tdbb,
{
if (request->req_flags & REQ_cursor_open)
{
ERRD_post(isc_sqlerr, isc_arg_number, (SLONG) - 502,
isc_arg_gds, isc_dsql_cursor_open_err, isc_arg_end);
ERRD_post(Arg::Gds(isc_sqlerr) << Arg::Num(-502) <<
Arg::Gds(isc_dsql_cursor_open_err));
}
}
@ -368,9 +369,9 @@ ISC_STATUS DSQL_fetch(thread_db* tdbb,
request->req_type == REQ_GET_SEGMENT)
{
if (!(request->req_flags & REQ_cursor_open))
ERRD_post(isc_sqlerr, isc_arg_number, (SLONG) - 504,
isc_arg_gds, isc_dsql_cursor_err,
isc_arg_gds, isc_dsql_cursor_not_open, isc_arg_end);
ERRD_post(Arg::Gds(isc_sqlerr) << Arg::Num(-504) <<
Arg::Gds(isc_dsql_cursor_err) <<
Arg::Gds(isc_dsql_cursor_not_open));
}
#ifdef SCROLLABLE_CURSORS
@ -435,8 +436,8 @@ ISC_STATUS DSQL_fetch(thread_db* tdbb,
break;
default:
ERRD_post(isc_sqlerr, isc_arg_number, (SLONG) - 804,
isc_arg_gds, isc_dsql_sqlda_err, isc_arg_end);
ERRD_post(Arg::Gds(isc_sqlerr) << Arg::Num(-804) <<
Arg::Gds(isc_dsql_sqlda_err));
}
if (offset)
@ -555,8 +556,8 @@ void DSQL_free_statement(thread_db* tdbb,
// Just close the cursor associated with the request
if (!(request->req_flags & REQ_cursor_open))
{
ERRD_post(isc_sqlerr, isc_arg_number, (SLONG) - 501,
isc_arg_gds, isc_dsql_cursor_close_err, isc_arg_end);
ERRD_post(Arg::Gds(isc_sqlerr) << Arg::Num(- 501) <<
Arg::Gds(isc_dsql_cursor_close_err));
}
close_cursor(tdbb, request);
}
@ -590,9 +591,8 @@ void DSQL_insert(thread_db* tdbb,
if (request->req_flags & REQ_orphan)
{
ERRD_post (isc_sqlerr, isc_arg_number, (SLONG) -901,
isc_arg_gds, isc_bad_req_handle,
isc_arg_end);
ERRD_post(Arg::Gds(isc_sqlerr) << Arg::Num(-901) <<
Arg::Gds(isc_bad_req_handle));
}
// if the cursor isn't open, we've got a problem
@ -601,9 +601,9 @@ void DSQL_insert(thread_db* tdbb,
{
if (!(request->req_flags & REQ_cursor_open))
{
ERRD_post(isc_sqlerr, isc_arg_number, (SLONG) - 504,
isc_arg_gds, isc_dsql_cursor_err,
isc_arg_gds, isc_dsql_cursor_not_open, isc_arg_end);
ERRD_post(Arg::Gds(isc_sqlerr) << Arg::Num(-504) <<
Arg::Gds(isc_dsql_cursor_err) <<
Arg::Gds(isc_dsql_cursor_not_open));
}
}
@ -658,23 +658,21 @@ void DSQL_prepare(thread_db* tdbb,
dsql_req* const old_request = *req_handle;
if (!old_request) {
ERRD_post (isc_sqlerr, isc_arg_number, (SLONG) -901,
isc_arg_gds, isc_bad_req_handle,
isc_arg_end);
ERRD_post(Arg::Gds(isc_sqlerr) << Arg::Num(-901) <<
Arg::Gds(isc_bad_req_handle));
}
dsql_dbb* database = old_request->req_dbb;
if (!database) {
ERRD_post (isc_sqlerr, isc_arg_number, (SLONG) -901,
isc_arg_gds, isc_bad_req_handle,
isc_arg_end);
ERRD_post(Arg::Gds(isc_sqlerr) << Arg::Num(-901) <<
Arg::Gds(isc_bad_req_handle));
}
// check to see if old request has an open cursor
if (old_request && (old_request->req_flags & REQ_cursor_open)) {
ERRD_post(isc_sqlerr, isc_arg_number, (SLONG) - 519,
isc_arg_gds, isc_dsql_open_cursor_request, isc_arg_end);
ERRD_post(Arg::Gds(isc_sqlerr) << Arg::Num(-519) <<
Arg::Gds(isc_dsql_open_cursor_request));
}
dsql_req* request = NULL;
@ -682,11 +680,10 @@ void DSQL_prepare(thread_db* tdbb,
try {
if (!string) {
ERRD_post(isc_sqlerr, isc_arg_number, (SLONG) - 104,
isc_arg_gds, isc_command_end_err2,
ERRD_post(Arg::Gds(isc_sqlerr) << Arg::Num(-104) <<
// Unexpected end of command
// CVC: Nothing will be line 1, column 1 for the user.
isc_arg_number, (SLONG) 1, isc_arg_number, (SLONG) 1,
isc_arg_end); // Unexpected end of command
Arg::Gds(isc_command_end_err2) << Arg::Num(1) << Arg::Num(1));
}
if (!length) {
@ -739,8 +736,8 @@ void DSQL_prepare(thread_db* tdbb,
if (request->req_type == REQ_CREATE_DB)
{
ERRD_post(isc_sqlerr, isc_arg_number, (SLONG) - 530,
isc_arg_gds, isc_dsql_crdb_prepare_err, isc_arg_end);
ERRD_post(Arg::Gds(isc_sqlerr) << Arg::Num(-530) <<
Arg::Gds(isc_dsql_crdb_prepare_err));
}
request->req_flags |= REQ_prepared;
@ -820,9 +817,9 @@ void DSQL_set_cursor(thread_db* tdbb,
USHORT length = (USHORT) fb_utils::name_length(cursor.c_str());
if (length == 0) {
ERRD_post(isc_sqlerr, isc_arg_number, (SLONG) - 502,
isc_arg_gds, isc_dsql_decl_err,
isc_arg_gds, isc_dsql_cursor_invalid, isc_arg_end);
ERRD_post(Arg::Gds(isc_sqlerr) << Arg::Num(-502) <<
Arg::Gds(isc_dsql_decl_err) <<
Arg::Gds(isc_dsql_cursor_invalid));
}
if (length > MAX_CURSOR_LENGTH) {
length = MAX_CURSOR_LENGTH;
@ -838,10 +835,9 @@ void DSQL_set_cursor(thread_db* tdbb,
if (request->req_cursor == symbol)
return;
ERRD_post(isc_sqlerr, isc_arg_number, (SLONG) - 502,
isc_arg_gds, isc_dsql_decl_err,
isc_arg_gds, isc_dsql_cursor_redefined,
isc_arg_string, symbol->sym_string, isc_arg_end);
ERRD_post(Arg::Gds(isc_sqlerr) << Arg::Num(-502) <<
Arg::Gds(isc_dsql_decl_err) <<
Arg::Gds(isc_dsql_cursor_redefined) << Arg::Str(symbol->sym_string));
}
// If there already is a cursor and its name isn't the same, ditto.
@ -853,10 +849,9 @@ void DSQL_set_cursor(thread_db* tdbb,
}
else {
fb_assert(request->req_cursor != symbol);
ERRD_post(isc_sqlerr, isc_arg_number, (SLONG) - 502,
isc_arg_gds, isc_dsql_decl_err,
isc_arg_gds, isc_dsql_cursor_redefined,
isc_arg_string, request->req_cursor->sym_string, isc_arg_end);
ERRD_post(Arg::Gds(isc_sqlerr) << Arg::Num(-502) <<
Arg::Gds(isc_dsql_decl_err) <<
Arg::Gds(isc_dsql_cursor_redefined) << Arg::Str(request->req_cursor->sym_string));
}
}
@ -1375,9 +1370,9 @@ static void execute_request(thread_db* tdbb,
if (!request->req_updates)
{
ERRD_post(isc_sqlerr, isc_arg_number, (SLONG) - 913,
isc_arg_gds, isc_deadlock, isc_arg_gds,
isc_update_conflict, isc_arg_end);
ERRD_post(Arg::Gds(isc_sqlerr) << Arg::Num(-913) <<
Arg::Gds(isc_deadlock) <<
Arg::Gds(isc_update_conflict));
}
}
else if (request->req_type == REQ_DELETE_CURSOR)
@ -1390,9 +1385,9 @@ static void execute_request(thread_db* tdbb,
if (!request->req_deletes)
{
ERRD_post(isc_sqlerr, isc_arg_number, (SLONG) - 913,
isc_arg_gds, isc_deadlock, isc_arg_gds,
isc_update_conflict, isc_arg_end);
ERRD_post(Arg::Gds(isc_sqlerr) << Arg::Num(-913) <<
Arg::Gds(isc_deadlock) <<
Arg::Gds(isc_update_conflict));
}
}
}
@ -2100,9 +2095,8 @@ static dsql_dbb* init(Attachment* attachment)
database->dbb_ods_version = gds__vax_integer(data, l);
if (database->dbb_ods_version <= 7)
{
ERRD_post(isc_sqlerr, isc_arg_number, (SLONG) - 804,
isc_arg_gds, isc_dsql_too_old_ods,
isc_arg_number, (SLONG) 8, isc_arg_end);
ERRD_post(Arg::Gds(isc_sqlerr) << Arg::Num(-804) <<
Arg::Gds(isc_dsql_too_old_ods) << Arg::Num(8));
}
break;
@ -2234,8 +2228,8 @@ static void map_in_out( dsql_req* request,
if (parameter || count)
{
ERRD_post(isc_sqlerr, isc_arg_number, (SLONG) - 804,
isc_arg_gds, isc_dsql_sqlda_err, isc_arg_end);
ERRD_post(Arg::Gds(isc_sqlerr) << Arg::Num(-804) <<
Arg::Gds(isc_dsql_sqlda_err));
}
dsql_par* dbkey;
@ -2303,14 +2297,14 @@ static USHORT parse_blr(
if (*blr != blr_version4 && *blr != blr_version5)
{
ERRD_post(isc_sqlerr, isc_arg_number, (SLONG) - 804,
isc_arg_gds, isc_dsql_sqlda_err, isc_arg_end);
ERRD_post(Arg::Gds(isc_sqlerr) << Arg::Num(-804) <<
Arg::Gds(isc_dsql_sqlda_err));
}
blr++; // skip the blr_version
if (*blr++ != blr_begin || *blr++ != blr_message)
{
ERRD_post(isc_sqlerr, isc_arg_number, (SLONG) - 804,
isc_arg_gds, isc_dsql_sqlda_err, isc_arg_end);
ERRD_post(Arg::Gds(isc_sqlerr) << Arg::Num(-804) <<
Arg::Gds(isc_dsql_sqlda_err));
}
++blr; // skip the message number
@ -2422,8 +2416,8 @@ static USHORT parse_blr(
break;
default:
ERRD_post(isc_sqlerr, isc_arg_number, (SLONG) - 804,
isc_arg_gds, isc_dsql_sqlda_err, isc_arg_end);
ERRD_post(Arg::Gds(isc_sqlerr) << Arg::Num(-804) <<
Arg::Gds(isc_dsql_sqlda_err));
}
USHORT align = type_alignments[desc.dsc_dtype];
@ -2433,8 +2427,10 @@ static USHORT parse_blr(
offset += desc.dsc_length;
if (*blr++ != blr_short || *blr++ != 0)
ERRD_post(isc_sqlerr, isc_arg_number, (SLONG) - 804,
isc_arg_gds, isc_dsql_sqlda_err, isc_arg_end);
{
ERRD_post(Arg::Gds(isc_sqlerr) << Arg::Num(-804) <<
Arg::Gds(isc_dsql_sqlda_err));
}
align = type_alignments[dtype_short];
if (align)
@ -2459,8 +2455,8 @@ static USHORT parse_blr(
if (*blr++ != (UCHAR) blr_end || offset != msg_length)
{
ERRD_post(isc_sqlerr, isc_arg_number, (SLONG) - 804,
isc_arg_gds, isc_dsql_sqlda_err, isc_arg_end);
ERRD_post(Arg::Gds(isc_sqlerr) << Arg::Num(-804) <<
Arg::Gds(isc_dsql_sqlda_err));
}
return count;
@ -2492,8 +2488,8 @@ static dsql_req* prepare(thread_db* tdbb, dsql_dbb* database, jrd_tra* transacti
if (client_dialect > SQL_DIALECT_CURRENT)
{
ERRD_post(isc_sqlerr, isc_arg_number, (SLONG) - 901,
isc_arg_gds, isc_wish_list, isc_arg_end);
ERRD_post(Arg::Gds(isc_sqlerr) << Arg::Num(-901) <<
Arg::Gds(isc_wish_list));
}
if (!string_length)
@ -2534,9 +2530,9 @@ static dsql_req* prepare(thread_db* tdbb, dsql_dbb* database, jrd_tra* transacti
// CVC: Apparently, dsql_ypparse won't return if the command is incomplete,
// because yyerror() will call ERRD_post().
// This may be a special case, but we don't know about positions here.
ERRD_post(isc_sqlerr, isc_arg_number, (SLONG) - 104,
isc_arg_gds, isc_command_end_err, // Unexpected end of command
isc_arg_end);
ERRD_post(Arg::Gds(isc_sqlerr) << Arg::Num(-104) <<
// Unexpected end of command
Arg::Gds(isc_command_end_err));
}
// allocate the send and receive messages
@ -2575,10 +2571,8 @@ static dsql_req* prepare(thread_db* tdbb, dsql_dbb* database, jrd_tra* transacti
if (statement->req_type == REQ_DDL && parser.isStmtAmbiguous() &&
statement->req_dbb->dbb_db_SQL_dialect != client_dialect)
{
ERRD_post(isc_sqlerr, isc_arg_number, (SLONG) - 817,
isc_arg_gds, isc_ddl_not_allowed_by_db_sql_dial,
isc_arg_number,
(SLONG) statement->req_dbb->dbb_db_SQL_dialect, isc_arg_end);
ERRD_post(Arg::Gds(isc_sqlerr) << Arg::Num(-817) <<
Arg::Gds(isc_ddl_not_allowed_by_db_sql_dial) << Arg::Num(statement->req_dbb->dbb_db_SQL_dialect));
}
if (statement->req_type == REQ_COMMIT ||
@ -3173,8 +3167,8 @@ static UCHAR* var_info(
break;
default:
ERRD_post(isc_sqlerr, isc_arg_number, (SLONG) - 804,
isc_arg_gds, isc_dsql_datatype_err, isc_arg_end);
ERRD_post(Arg::Gds(isc_sqlerr) << Arg::Num(-804) <<
Arg::Gds(isc_dsql_datatype_err));
}
if (sql_type && (param->par_desc.dsc_flags & DSC_nullable))

View File

@ -148,12 +148,8 @@ void ERRD_error(const char* text)
@param
**/
bool ERRD_post_warning(ISC_STATUS status, ...)
bool ERRD_post_warning(const Firebird::Arg::StatusVector& v)
{
va_list args;
va_start(args, status);
ISC_STATUS* status_vector = JRD_get_thread_data()->tdbb_status_vector;
int indx = 0;
@ -177,88 +173,14 @@ bool ERRD_post_warning(ISC_STATUS status, ...)
}
}
// stuff the warning
if (indx + 3 >= ISC_STATUS_LENGTH)
if (indx + v.length() < ISC_STATUS_LENGTH)
{
// not enough free space
// Hey, before returning, clean the varargs thing!
va_end(args);
return false;
}
status_vector[indx++] = isc_arg_warning;
status_vector[indx++] = status;
int type, len;
while ((type = va_arg(args, int)) && (indx + 3 < ISC_STATUS_LENGTH))
{
const char* pszTmp = NULL;
switch (status_vector[indx++] = type)
{
case isc_arg_warning:
status_vector[indx++] = (ISC_STATUS) va_arg(args, ISC_STATUS);
break;
case isc_arg_string:
pszTmp = va_arg(args, char*);
if (strlen(pszTmp) >= (size_t) MAX_ERRSTR_LEN) {
status_vector[(indx - 1)] = isc_arg_cstring;
status_vector[indx++] = MAX_ERRSTR_LEN;
}
status_vector[indx++] = reinterpret_cast<ISC_STATUS>(ERR_cstring(pszTmp));
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;
case isc_arg_cstring:
len = va_arg(args, int);
status_vector[indx++] =
(ISC_STATUS) (len >= MAX_ERRSTR_LEN) ? MAX_ERRSTR_LEN : len;
pszTmp = va_arg(args, char*);
status_vector[indx++] = reinterpret_cast<ISC_STATUS>(ERR_cstring(pszTmp));
break;
case isc_arg_number:
status_vector[indx++] = (ISC_STATUS) va_arg(args, SLONG);
break;
case isc_arg_vms:
case isc_arg_unix:
case isc_arg_win32:
default:
status_vector[indx++] = (ISC_STATUS) va_arg(args, int);
break;
}
}
va_end(args);
status_vector[indx] = isc_arg_end;
memcpy(&status_vector[indx], v.value(), sizeof(ISC_STATUS) * (v.length() + 1));
return true;
}
}
/**
ERRD_post
@brief Post an error, copying any potentially
transient data before we punt.
@param status
@param
**/
void ERRD_post(ISC_STATUS status, ...)
{
// stuff the status into temp buffer
ISC_STATUS_ARRAY tmp_status;
MOVE_CLEAR(tmp_status, sizeof(tmp_status));
STUFF_STATUS(tmp_status, status);
internal_post(tmp_status);
// not enough free space
return false;
}

View File

@ -30,9 +30,8 @@ void ERRD_assert_msg(const char*, const char*, ULONG);
void ERRD_bugcheck(const char*);
void ERRD_error(const char*);
void ERRD_post(ISC_STATUS, ...);
void ERRD_post(const Firebird::Arg::StatusVector&);
bool ERRD_post_warning(ISC_STATUS, ...);
void ERRD_post(const Firebird::Arg::StatusVector& v);
bool ERRD_post_warning(const Firebird::Arg::StatusVector& v);
void ERRD_punt(const ISC_STATUS* = 0);
#endif // DSQL_ERRD_PROTO_H

View File

@ -56,9 +56,11 @@
#include "../jrd/dsc_proto.h"
#include "../jrd/why_proto.h"
#include "gen/iberror.h"
#include "../common/StatusArg.h"
using namespace Jrd;
using namespace Dsql;
using namespace Firebird;
static void gen_aggregate(CompiledStatement*, const dsql_nod*);
static void gen_cast(CompiledStatement*, const dsql_nod*);
@ -531,11 +533,10 @@ void GEN_expr(CompiledStatement* statement, dsql_nod* node)
return;
default:
ERRD_post(isc_sqlerr, isc_arg_number, (SLONG) - 901,
isc_arg_gds, isc_dsql_internal_err,
isc_arg_gds, isc_expression_eval_err,
ERRD_post(Arg::Gds(isc_sqlerr) << Arg::Num(-901) <<
Arg::Gds(isc_dsql_internal_err) <<
// expression evaluation not supported
isc_arg_end);
Arg::Gds(isc_expression_eval_err));
}
stuff(statement, blr_operator);
@ -592,8 +593,7 @@ void GEN_expr(CompiledStatement* statement, dsql_nod* node)
sprintf(message_buf, "blr %d", (int) blr_operator);
s = message_buf;
}
ERRD_post_warning(isc_dsql_dialect_warning_expr,
isc_arg_string, s, isc_arg_end);
ERRD_post_warning(Arg::Warning(isc_dsql_dialect_warning_expr) << Arg::Str(s));
}
}
@ -679,13 +679,10 @@ void GEN_port(CompiledStatement* statement, dsql_msg* message)
case dtype_sql_date:
case dtype_sql_time:
case dtype_int64:
ERRD_post(isc_sqlerr, isc_arg_number, (SLONG) - 804,
isc_arg_gds, isc_dsql_datatype_err,
isc_arg_gds, isc_sql_dialect_datatype_unsupport,
isc_arg_number, (SLONG) statement->req_client_dialect,
isc_arg_string,
DSC_dtype_tostring(parameter->par_desc.dsc_dtype),
isc_arg_end);
ERRD_post(Arg::Gds(isc_sqlerr) << Arg::Num(-804) <<
Arg::Gds(isc_dsql_datatype_err) <<
Arg::Gds(isc_sql_dialect_datatype_unsupport) << Arg::Num(statement->req_client_dialect) <<
Arg::Str(DSC_dtype_tostring(parameter->par_desc.dsc_dtype)));
break;
default:
// No special action for other data types
@ -701,10 +698,9 @@ void GEN_port(CompiledStatement* statement, dsql_msg* message)
}
if (offset > MAX_FORMAT_SIZE) {
ERRD_post(isc_sqlerr, isc_arg_number, (SLONG) -204,
isc_arg_gds, isc_imp_exc,
isc_arg_gds, isc_blktoobig,
isc_arg_end);
ERRD_post(Arg::Gds(isc_sqlerr) << Arg::Num(-204) <<
Arg::Gds(isc_imp_exc) <<
Arg::Gds(isc_blktoobig));
}
message->msg_length = (USHORT) offset;
@ -860,8 +856,8 @@ void GEN_start_transaction( CompiledStatement* statement, const dsql_nod* tran_n
switch (ptr->nod_type) {
case nod_access:
if (sw_access)
ERRD_post(isc_sqlerr, isc_arg_number, (SLONG) - 104,
isc_arg_gds, isc_dsql_dup_option, isc_arg_end);
ERRD_post(Arg::Gds(isc_sqlerr) << Arg::Num(-104) <<
Arg::Gds(isc_dsql_dup_option));
sw_access = true;
if (ptr->nod_flags & NOD_READ_ONLY)
@ -872,8 +868,8 @@ void GEN_start_transaction( CompiledStatement* statement, const dsql_nod* tran_n
case nod_wait:
if (sw_wait)
ERRD_post(isc_sqlerr, isc_arg_number, (SLONG) - 104,
isc_arg_gds, isc_dsql_dup_option, isc_arg_end);
ERRD_post(Arg::Gds(isc_sqlerr) << Arg::Num(-104) <<
Arg::Gds(isc_dsql_dup_option));
sw_wait = true;
if (ptr->nod_flags & NOD_NO_WAIT)
@ -884,8 +880,8 @@ void GEN_start_transaction( CompiledStatement* statement, const dsql_nod* tran_n
case nod_isolation:
if (sw_isolation)
ERRD_post(isc_sqlerr, isc_arg_number, (SLONG) - 104,
isc_arg_gds, isc_dsql_dup_option, isc_arg_end);
ERRD_post(Arg::Gds(isc_sqlerr) << Arg::Num(-104) <<
Arg::Gds(isc_dsql_dup_option));
sw_isolation = true;
@ -913,8 +909,8 @@ void GEN_start_transaction( CompiledStatement* statement, const dsql_nod* tran_n
case nod_reserve:
{
if (sw_reserve)
ERRD_post(isc_sqlerr, isc_arg_number, (SLONG) - 104,
isc_arg_gds, isc_dsql_dup_option, isc_arg_end);
ERRD_post(Arg::Gds(isc_sqlerr) << Arg::Num(-104) <<
Arg::Gds(isc_dsql_dup_option));
sw_reserve = true;
const dsql_nod* reserve = ptr->nod_arg[0];
@ -932,8 +928,8 @@ void GEN_start_transaction( CompiledStatement* statement, const dsql_nod* tran_n
case nod_tra_misc:
if (misc_flags & ptr->nod_flags)
ERRD_post(isc_sqlerr, isc_arg_number, (SLONG) - 104,
isc_arg_gds, isc_dsql_dup_option, isc_arg_end);
ERRD_post(Arg::Gds(isc_sqlerr) << Arg::Num(-104) <<
Arg::Gds(isc_dsql_dup_option));
misc_flags |= ptr->nod_flags;
if (ptr->nod_flags & NOD_NO_AUTO_UNDO)
@ -946,8 +942,8 @@ void GEN_start_transaction( CompiledStatement* statement, const dsql_nod* tran_n
case nod_lock_timeout:
if (sw_lock_timeout)
ERRD_post(isc_sqlerr, isc_arg_number, (SLONG) - 104,
isc_arg_gds, isc_dsql_dup_option, isc_arg_end);
ERRD_post(Arg::Gds(isc_sqlerr) << Arg::Num(-104) <<
Arg::Gds(isc_dsql_dup_option));
sw_lock_timeout = true;
if (ptr->nod_count == 1 && ptr->nod_arg[0]->nod_type == nod_constant)
@ -960,8 +956,8 @@ void GEN_start_transaction( CompiledStatement* statement, const dsql_nod* tran_n
break;
default:
ERRD_post(isc_sqlerr, isc_arg_number, (SLONG) - 104,
isc_arg_gds, isc_dsql_tran_err, isc_arg_end);
ERRD_post(Arg::Gds(isc_sqlerr) << Arg::Num(-104) <<
Arg::Gds(isc_dsql_tran_err));
}
}
}
@ -1268,8 +1264,8 @@ void GEN_statement( CompiledStatement* statement, dsql_nod* node)
dsql_nod* list = cursor->nod_arg[e_cur_rse]->nod_arg[e_rse_items];
if (list->nod_count != list_into->nod_count)
{
ERRD_post(isc_sqlerr, isc_arg_number, (SLONG) - 313,
isc_arg_gds, isc_dsql_count_mismatch, isc_arg_end);
ERRD_post(Arg::Gds(isc_sqlerr) << Arg::Num(-313) <<
Arg::Gds(isc_dsql_count_mismatch));
}
stuff(statement, blr_begin);
ptr = list->nod_arg;
@ -1291,10 +1287,10 @@ void GEN_statement( CompiledStatement* statement, dsql_nod* node)
return;
default:
ERRD_post(isc_sqlerr, isc_arg_number, (SLONG) - 901,
isc_arg_gds, isc_dsql_internal_err,
isc_arg_gds, isc_node_err, // gen.c: node not supported
isc_arg_end);
ERRD_post(Arg::Gds(isc_sqlerr) << Arg::Num(-901) <<
Arg::Gds(isc_dsql_internal_err) <<
// gen.c: node not supported
Arg::Gds(isc_node_err));
}
}
@ -1491,11 +1487,9 @@ static void gen_constant( CompiledStatement* statement, const dsc* desc, bool ne
* didn't contain an exponent so it's not a valid DOUBLE
* PRECISION literal either, so we have to bounce it.
*/
ERRD_post(isc_sqlerr,
isc_arg_number, (SLONG) - 104,
isc_arg_gds, isc_arith_except,
isc_arg_gds, isc_numeric_out_of_range,
isc_arg_end);
ERRD_post(Arg::Gds(isc_sqlerr) << Arg::Num(- 104) <<
Arg::Gds(isc_arith_except) <<
Arg::Gds(isc_numeric_out_of_range));
}
/* We and the lexer both agree that this is an SINT64 constant,
@ -1548,8 +1542,8 @@ static void gen_constant( CompiledStatement* statement, const dsc* desc, bool ne
default:
// gen_constant: datatype not understood
ERRD_post(isc_sqlerr, isc_arg_number, (SLONG) - 103,
isc_arg_gds, isc_dsql_constant_err, isc_arg_end);
ERRD_post(Arg::Gds(isc_sqlerr) << Arg::Num(-103) <<
Arg::Gds(isc_dsql_constant_err));
}
}
@ -1668,8 +1662,8 @@ static void gen_descriptor( CompiledStatement* statement, const dsc* desc, bool
default:
// don't understand dtype
ERRD_post(isc_sqlerr, isc_arg_number, (SLONG) - 804,
isc_arg_gds, isc_dsql_datatype_err, isc_arg_end);
ERRD_post(Arg::Gds(isc_sqlerr) << Arg::Num(-804) <<
Arg::Gds(isc_dsql_datatype_err));
}
}
@ -1843,13 +1837,10 @@ static void gen_field( CompiledStatement* statement, const dsql_ctx* context,
case dtype_sql_date:
case dtype_sql_time:
case dtype_int64:
ERRD_post(isc_sqlerr, isc_arg_number, (SLONG) - 804,
isc_arg_gds, isc_dsql_datatype_err,
isc_arg_gds, isc_sql_dialect_datatype_unsupport,
isc_arg_number, (SLONG) statement->req_client_dialect,
isc_arg_string,
DSC_dtype_tostring(static_cast<UCHAR>(field->fld_dtype)),
isc_arg_end);
ERRD_post(Arg::Gds(isc_sqlerr) << Arg::Num(-804) <<
Arg::Gds(isc_dsql_datatype_err) <<
Arg::Gds(isc_sql_dialect_datatype_unsupport) << Arg::Num(statement->req_client_dialect) <<
Arg::Str(DSC_dtype_tostring(static_cast<UCHAR>(field->fld_dtype))));
break;
default:
// No special action for other data types
@ -1936,8 +1927,8 @@ static void gen_for_select( CompiledStatement* statement, const dsql_nod* for_se
if (list_to)
{
if (list->nod_count != list_to->nod_count)
ERRD_post(isc_sqlerr, isc_arg_number, (SLONG) - 313,
isc_arg_gds, isc_dsql_count_mismatch, isc_arg_end);
ERRD_post(Arg::Gds(isc_sqlerr) << Arg::Num(-313) <<
Arg::Gds(isc_dsql_count_mismatch));
dsql_nod** ptr = list->nod_arg;
dsql_nod** ptr_to = list_to->nod_arg;
for (const dsql_nod* const* const end = ptr + list->nod_count; ptr < end;
@ -3069,14 +3060,14 @@ static void gen_union( CompiledStatement* statement, const dsql_nod* union_node)
static void stuff_context(CompiledStatement* statement, const dsql_ctx* context)
{
if (context->ctx_context > MAX_UCHAR) {
ERRD_post(isc_too_many_contexts, isc_arg_end);
ERRD_post(Arg::Gds(isc_too_many_contexts));
}
stuff(statement, context->ctx_context);
if (context->ctx_flags & CTX_recursive)
{
if (context->ctx_recursive > MAX_UCHAR) {
ERRD_post(isc_too_many_contexts, isc_arg_end);
ERRD_post(Arg::Gds(isc_too_many_contexts));
}
stuff(statement, context->ctx_recursive);
}

View File

@ -62,9 +62,11 @@
#include "../jrd/thread_proto.h"
#include "../jrd/why_proto.h"
#include "../common/config/config.h"
#include "../common/StatusArg.h"
using namespace Jrd;
using namespace Dsql;
using namespace Firebird;
/* Firebird provides transparent conversion from string to date in
* contexts where it makes sense. This macro checks a descriptor to
@ -451,7 +453,7 @@ void MAKE_desc(CompiledStatement* statement, dsc* desc, dsql_nod* node, dsql_nod
if (!DTYPE_IS_NUMERIC(desc->dsc_dtype) &&
!DTYPE_IS_TEXT(desc->dsc_dtype))
{
ERRD_post(isc_expression_eval_err, isc_arg_end);
ERRD_post(Arg::Gds(isc_expression_eval_err));
}
else if (DTYPE_IS_TEXT(desc->dsc_dtype)) {
desc->dsc_dtype = dtype_double;
@ -464,7 +466,7 @@ void MAKE_desc(CompiledStatement* statement, dsc* desc, dsql_nod* node, dsql_nod
desc->dsc_flags = DSC_nullable;
dtype = desc->dsc_dtype;
if (!DTYPE_IS_NUMERIC(dtype)) {
ERRD_post(isc_expression_eval_err, isc_arg_end);
ERRD_post(Arg::Gds(isc_expression_eval_err));
}
else if (DTYPE_IS_EXACT(dtype)) {
desc->dsc_dtype = dtype_int64;
@ -482,7 +484,7 @@ void MAKE_desc(CompiledStatement* statement, dsc* desc, dsql_nod* node, dsql_nod
if (!DTYPE_IS_NUMERIC(desc->dsc_dtype) &&
!DTYPE_IS_TEXT(desc->dsc_dtype))
{
ERRD_post(isc_expression_eval_err, isc_arg_end);
ERRD_post(Arg::Gds(isc_expression_eval_err));
}
else if (desc->dsc_dtype == dtype_short) {
desc->dsc_dtype = dtype_long;
@ -503,7 +505,7 @@ void MAKE_desc(CompiledStatement* statement, dsc* desc, dsql_nod* node, dsql_nod
MAKE_desc(statement, desc, node->nod_arg[0], null_replacement);
dtype = desc->dsc_dtype;
if (!DTYPE_IS_NUMERIC(dtype)) {
ERRD_post(isc_expression_eval_err, isc_arg_end);
ERRD_post(Arg::Gds(isc_expression_eval_err));
}
else if (DTYPE_IS_EXACT(dtype)) {
desc->dsc_dtype = dtype_int64;
@ -641,8 +643,8 @@ void MAKE_desc(CompiledStatement* statement, dsc* desc, dsql_nod* node, dsql_nod
dtype = MAX(dtype1, dtype2);
if (DTYPE_IS_BLOB(dtype)) {
ERRD_post(isc_sqlerr, isc_arg_number, (SLONG) - 607,
isc_arg_gds, isc_dsql_no_blob_array, isc_arg_end);
ERRD_post(Arg::Gds(isc_sqlerr) << Arg::Num(-607) <<
Arg::Gds(isc_dsql_no_blob_array));
}
desc->dsc_flags = (desc1.dsc_flags | desc2.dsc_flags) & DSC_nullable;
@ -654,7 +656,7 @@ void MAKE_desc(CompiledStatement* statement, dsc* desc, dsql_nod* node, dsql_nod
if (DTYPE_IS_TEXT(desc1.dsc_dtype) ||
DTYPE_IS_TEXT(desc2.dsc_dtype))
{
ERRD_post(isc_expression_eval_err, isc_arg_end);
ERRD_post(Arg::Gds(isc_expression_eval_err));
}
case dtype_timestamp:
@ -691,7 +693,7 @@ void MAKE_desc(CompiledStatement* statement, dsc* desc, dsql_nod* node, dsql_nod
dtype = dtype_timestamp;
}
else {
ERRD_post(isc_expression_eval_err, isc_arg_end);
ERRD_post(Arg::Gds(isc_expression_eval_err));
}
if (dtype == dtype_sql_date) {
@ -721,7 +723,7 @@ void MAKE_desc(CompiledStatement* statement, dsc* desc, dsql_nod* node, dsql_nod
}
else {
/* <date> + <date> */
ERRD_post(isc_expression_eval_err, isc_arg_end);
ERRD_post(Arg::Gds(isc_expression_eval_err));
}
}
else if (DTYPE_IS_DATE(desc1.dsc_dtype) || (node->nod_type == nod_add))
@ -738,7 +740,7 @@ void MAKE_desc(CompiledStatement* statement, dsc* desc, dsql_nod* node, dsql_nod
else {
/* <non-date> - <date> */
fb_assert(node->nod_type == nod_subtract);
ERRD_post(isc_expression_eval_err, isc_arg_end);
ERRD_post(Arg::Gds(isc_expression_eval_err));
}
return;
@ -780,15 +782,15 @@ void MAKE_desc(CompiledStatement* statement, dsc* desc, dsql_nod* node, dsql_nod
// Arrays and blobs can never partipate in addition/subtraction
if (DTYPE_IS_BLOB(dtype1) || DTYPE_IS_BLOB(dtype2)) {
ERRD_post(isc_sqlerr, isc_arg_number, (SLONG) - 607,
isc_arg_gds, isc_dsql_no_blob_array, isc_arg_end);
ERRD_post(Arg::Gds(isc_sqlerr) << Arg::Num(-607) <<
Arg::Gds(isc_dsql_no_blob_array));
}
// In Dialect 2 or 3, strings can never partipate in addition / sub
// (use a specific cast instead)
if (DTYPE_IS_TEXT(dtype1) || DTYPE_IS_TEXT(dtype2))
{
ERRD_post(isc_expression_eval_err, isc_arg_end);
ERRD_post(Arg::Gds(isc_expression_eval_err));
}
/* Determine the TYPE of arithmetic to perform, store it
@ -852,7 +854,7 @@ void MAKE_desc(CompiledStatement* statement, dsc* desc, dsql_nod* node, dsql_nod
dtype = dtype_timestamp;
}
else {
ERRD_post(isc_expression_eval_err, isc_arg_end);
ERRD_post(Arg::Gds(isc_expression_eval_err));
}
if (dtype == dtype_sql_date) {
@ -883,7 +885,7 @@ void MAKE_desc(CompiledStatement* statement, dsc* desc, dsql_nod* node, dsql_nod
}
else {
/* <date> + <date> */
ERRD_post(isc_expression_eval_err, isc_arg_end);
ERRD_post(Arg::Gds(isc_expression_eval_err));
}
}
else if (DTYPE_IS_DATE(desc1.dsc_dtype) || (node->nod_type == nod_add2))
@ -900,7 +902,7 @@ void MAKE_desc(CompiledStatement* statement, dsc* desc, dsql_nod* node, dsql_nod
else {
/* <non-date> - <date> */
fb_assert(node->nod_type == nod_subtract2);
ERRD_post(isc_expression_eval_err, isc_arg_end);
ERRD_post(Arg::Gds(isc_expression_eval_err));
}
return;
@ -934,7 +936,7 @@ void MAKE_desc(CompiledStatement* statement, dsc* desc, dsql_nod* node, dsql_nod
default:
// a type which cannot participate in an add or subtract
ERRD_post(isc_expression_eval_err, isc_arg_end);
ERRD_post(Arg::Gds(isc_expression_eval_err));
}
return;
@ -952,8 +954,8 @@ void MAKE_desc(CompiledStatement* statement, dsc* desc, dsql_nod* node, dsql_nod
// Arrays and blobs can never partipate in multiplication
if (DTYPE_IS_BLOB(desc1.dsc_dtype) || DTYPE_IS_BLOB(desc2.dsc_dtype)) {
ERRD_post(isc_sqlerr, isc_arg_number, (SLONG) - 607,
isc_arg_gds, isc_dsql_no_blob_array, isc_arg_end);
ERRD_post(Arg::Gds(isc_sqlerr) << Arg::Num(-607) <<
Arg::Gds(isc_dsql_no_blob_array));
}
dtype = DSC_multiply_blr4_result[desc1.dsc_dtype][desc2.dsc_dtype];
@ -975,7 +977,7 @@ void MAKE_desc(CompiledStatement* statement, dsc* desc, dsql_nod* node, dsql_nod
break;
default:
ERRD_post(isc_expression_eval_err, isc_arg_end);
ERRD_post(Arg::Gds(isc_expression_eval_err));
}
return;
@ -995,13 +997,13 @@ void MAKE_desc(CompiledStatement* statement, dsc* desc, dsql_nod* node, dsql_nod
// (use a specific cast instead)
if (DTYPE_IS_TEXT(desc1.dsc_dtype) || DTYPE_IS_TEXT(desc2.dsc_dtype))
{
ERRD_post(isc_expression_eval_err, isc_arg_end);
ERRD_post(Arg::Gds(isc_expression_eval_err));
}
// Arrays and blobs can never partipate in multiplication
if (DTYPE_IS_BLOB(desc1.dsc_dtype) || DTYPE_IS_BLOB(desc2.dsc_dtype)) {
ERRD_post(isc_sqlerr, isc_arg_number, (SLONG) - 607,
isc_arg_gds, isc_dsql_no_blob_array, isc_arg_end);
ERRD_post(Arg::Gds(isc_sqlerr) << Arg::Num(-607) <<
Arg::Gds(isc_dsql_no_blob_array));
}
dtype = DSC_multiply_result[desc1.dsc_dtype][desc2.dsc_dtype];
@ -1024,7 +1026,7 @@ void MAKE_desc(CompiledStatement* statement, dsc* desc, dsql_nod* node, dsql_nod
break;
default:
ERRD_post(isc_expression_eval_err, isc_arg_end);
ERRD_post(Arg::Gds(isc_expression_eval_err));
}
return;
@ -1052,8 +1054,8 @@ void MAKE_desc(CompiledStatement* statement, dsc* desc, dsql_nod* node, dsql_nod
// Arrays and blobs can never partipate in division
if (DTYPE_IS_BLOB(desc1.dsc_dtype) || DTYPE_IS_BLOB(desc2.dsc_dtype)) {
ERRD_post(isc_sqlerr, isc_arg_number, (SLONG) - 607,
isc_arg_gds, isc_dsql_no_blob_array, isc_arg_end);
ERRD_post(Arg::Gds(isc_sqlerr) << Arg::Num(-607) <<
Arg::Gds(isc_dsql_no_blob_array));
}
dtype1 = desc1.dsc_dtype;
@ -1067,7 +1069,7 @@ void MAKE_desc(CompiledStatement* statement, dsc* desc, dsql_nod* node, dsql_nod
dtype = MAX(dtype1, dtype2);
if (!DTYPE_IS_NUMERIC(dtype)) {
ERRD_post(isc_expression_eval_err, isc_arg_end);
ERRD_post(Arg::Gds(isc_expression_eval_err));
}
desc->dsc_dtype = dtype_double;
@ -1092,13 +1094,13 @@ void MAKE_desc(CompiledStatement* statement, dsc* desc, dsql_nod* node, dsql_nod
// (use a specific cast instead)
if (DTYPE_IS_TEXT(desc1.dsc_dtype) || DTYPE_IS_TEXT(desc2.dsc_dtype))
{
ERRD_post(isc_expression_eval_err, isc_arg_end);
ERRD_post(Arg::Gds(isc_expression_eval_err));
}
// Arrays and blobs can never partipate in division
if (DTYPE_IS_BLOB(desc1.dsc_dtype) || DTYPE_IS_BLOB(desc2.dsc_dtype)) {
ERRD_post(isc_sqlerr, isc_arg_number, (SLONG) - 607,
isc_arg_gds, isc_dsql_no_blob_array, isc_arg_end);
ERRD_post(Arg::Gds(isc_sqlerr) << Arg::Num(-607) <<
Arg::Gds(isc_dsql_no_blob_array));
}
dtype = DSC_multiply_result[desc1.dsc_dtype][desc2.dsc_dtype];
@ -1118,7 +1120,7 @@ void MAKE_desc(CompiledStatement* statement, dsc* desc, dsql_nod* node, dsql_nod
break;
default:
ERRD_post(isc_expression_eval_err, isc_arg_end);
ERRD_post(Arg::Gds(isc_expression_eval_err));
}
return;
@ -1137,7 +1139,7 @@ void MAKE_desc(CompiledStatement* statement, dsc* desc, dsql_nod* node, dsql_nod
// (use a specific cast instead)
if (DTYPE_IS_TEXT(desc->dsc_dtype)) {
if (statement->req_client_dialect >= SQL_DIALECT_V6_TRANSITION) {
ERRD_post(isc_expression_eval_err, isc_arg_end);
ERRD_post(Arg::Gds(isc_expression_eval_err));
}
desc->dsc_dtype = dtype_double;
desc->dsc_length = sizeof(double);
@ -1145,12 +1147,12 @@ void MAKE_desc(CompiledStatement* statement, dsc* desc, dsql_nod* node, dsql_nod
// Forbid blobs and arrays
else if (DTYPE_IS_BLOB(desc->dsc_dtype))
{
ERRD_post(isc_sqlerr, isc_arg_number, (SLONG) - 607,
isc_arg_gds, isc_dsql_no_blob_array, isc_arg_end);
ERRD_post(Arg::Gds(isc_sqlerr) << Arg::Num(-607) <<
Arg::Gds(isc_dsql_no_blob_array));
}
// Forbid other not numeric datatypes
else if (!DTYPE_IS_NUMERIC(desc->dsc_dtype)) {
ERRD_post(isc_expression_eval_err, isc_arg_end);
ERRD_post(Arg::Gds(isc_expression_eval_err));
}
return;
@ -1172,8 +1174,8 @@ void MAKE_desc(CompiledStatement* statement, dsc* desc, dsql_nod* node, dsql_nod
desc->dsc_ttype() = ttype_binary;
}
else {
ERRD_post(isc_sqlerr, isc_arg_number, (SLONG) - 607,
isc_arg_gds, isc_dsql_dbkey_from_non_table, isc_arg_end);
ERRD_post(Arg::Gds(isc_sqlerr) << Arg::Num(-607) <<
Arg::Gds(isc_dsql_dbkey_from_non_table));
}
return;
@ -1261,8 +1263,8 @@ void MAKE_desc(CompiledStatement* statement, dsc* desc, dsql_nod* node, dsql_nod
}
else
{
ERRD_post(isc_sqlerr, isc_arg_number, (SLONG) - 203,
isc_arg_gds, isc_dsql_field_ref, isc_arg_end);
ERRD_post(Arg::Gds(isc_sqlerr) << Arg::Num(-203) <<
Arg::Gds(isc_dsql_field_ref));
}
return;
@ -1522,9 +1524,8 @@ dsql_nod* MAKE_field(dsql_ctx* context, dsql_fld* field, dsql_nod* indices)
else {
if (indices)
{
ERRD_post(isc_sqlerr, isc_arg_number, (SLONG) - 607,
isc_arg_gds, isc_dsql_only_can_subscript_array,
isc_arg_string, field->fld_name.c_str(), isc_arg_end);
ERRD_post(Arg::Gds(isc_sqlerr) << Arg::Num(-607) <<
Arg::Gds(isc_dsql_only_can_subscript_array) << Arg::Str(field->fld_name));
}
MAKE_desc_from_field(&node->nod_desc, field);
@ -1641,8 +1642,8 @@ dsql_par* MAKE_parameter(dsql_msg* message, bool sqlda_flag, bool null_flag,
USHORT sqlda_index, const dsql_nod* node)
{
if (!message) {
ERRD_post(isc_sqlerr, isc_arg_number, (SLONG) - 901,
isc_arg_gds, isc_badmsgnum, isc_arg_end);
ERRD_post(Arg::Gds(isc_sqlerr) << Arg::Num(-901) <<
Arg::Gds(isc_badmsgnum));
}
DEV_BLKCHK(message, dsql_type_msg);

View File

@ -95,6 +95,7 @@
#include "../jrd/gds_proto.h"
#include "../jrd/err_proto.h"
#include "../jrd/intlobj_new.h"
#include "../common/StatusArg.h"
/* since UNIX isn't standard, we have to define
stuff which is in <limits.h> (which isn't available
@ -143,6 +144,7 @@ const int MAX_TOKEN_LEN = 256;
using namespace Jrd;
using namespace Dsql;
using namespace Firebird;
#ifdef NOT_USED_OR_REPLACED
static bool long_int(dsql_nod*, SLONG*);
@ -2713,17 +2715,13 @@ non_charset_simple_type : national_character_type
| BIGINT
{
if (client_dialect < SQL_DIALECT_V6_TRANSITION)
ERRD_post (isc_sqlerr, isc_arg_number, (SLONG) -104,
isc_arg_gds, isc_sql_dialect_datatype_unsupport,
isc_arg_number, (SLONG) client_dialect,
isc_arg_string, "BIGINT",
isc_arg_end);
ERRD_post (Arg::Gds(isc_sqlerr) << Arg::Num(-104) <<
Arg::Gds(isc_sql_dialect_datatype_unsupport) << Arg::Num(client_dialect) <<
Arg::Str("BIGINT"));
if (db_dialect < SQL_DIALECT_V6_TRANSITION)
ERRD_post (isc_sqlerr, isc_arg_number, (SLONG) -104,
isc_arg_gds, isc_sql_db_dialect_dtype_unsupport,
isc_arg_number, (SLONG) db_dialect,
isc_arg_string, "BIGINT",
isc_arg_end);
ERRD_post (Arg::Gds(isc_sqlerr) << Arg::Num(-104) <<
Arg::Gds(isc_sql_db_dialect_dtype_unsupport) << Arg::Num(db_dialect) <<
Arg::Str("BIGINT"));
lex.g_field->fld_dtype = dtype_int64;
lex.g_field->fld_length = sizeof (SINT64);
}
@ -2743,8 +2741,8 @@ non_charset_simple_type : national_character_type
if (client_dialect <= SQL_DIALECT_V5)
{
/* Post warning saying that DATE is equivalent to TIMESTAMP */
ERRD_post_warning (isc_sqlwarn, isc_arg_number, (SLONG) 301,
isc_arg_warning, isc_dtype_renamed, isc_arg_end);
ERRD_post_warning(Arg::Warning(isc_sqlwarn) << Arg::Num(301) <<
Arg::Warning(isc_dtype_renamed));
lex.g_field->fld_dtype = dtype_timestamp;
lex.g_field->fld_length = sizeof (GDS_TIMESTAMP);
}
@ -2759,17 +2757,13 @@ non_charset_simple_type : national_character_type
| TIME
{
if (client_dialect < SQL_DIALECT_V6_TRANSITION)
ERRD_post (isc_sqlerr, isc_arg_number, (SLONG) -104,
isc_arg_gds, isc_sql_dialect_datatype_unsupport,
isc_arg_number, (SLONG) client_dialect,
isc_arg_string, "TIME",
isc_arg_end);
ERRD_post(Arg::Gds(isc_sqlerr) << Arg::Num(-104) <<
Arg::Gds(isc_sql_dialect_datatype_unsupport) << Arg::Num(client_dialect) <<
Arg::Str("TIME"));
if (db_dialect < SQL_DIALECT_V6_TRANSITION)
ERRD_post (isc_sqlerr, isc_arg_number, (SLONG) -104,
isc_arg_gds, isc_sql_db_dialect_dtype_unsupport,
isc_arg_number, (SLONG) db_dialect,
isc_arg_string, "TIME",
isc_arg_end);
ERRD_post(Arg::Gds(isc_sqlerr) << Arg::Num(-104) <<
Arg::Gds(isc_sql_dialect_datatype_unsupport) << Arg::Num(db_dialect) <<
Arg::Str("TIME"));
lex.g_field->fld_dtype = dtype_sql_time;
lex.g_field->fld_length = sizeof (SLONG);
}
@ -2938,12 +2932,8 @@ prec_scale :
(db_dialect > SQL_DIALECT_V5) ) ||
( (client_dialect > SQL_DIALECT_V5) &&
(db_dialect <= SQL_DIALECT_V5) ) )
ERRD_post (isc_sqlerr,
isc_arg_number, (SLONG) -817,
isc_arg_gds,
isc_ddl_not_allowed_by_db_sql_dial,
isc_arg_number, (SLONG) db_dialect,
isc_arg_end);
ERRD_post(Arg::Gds(isc_sqlerr) << Arg::Num(-817) <<
Arg::Gds(isc_ddl_not_allowed_by_db_sql_dial) << Arg::Num(db_dialect));
if (client_dialect <= SQL_DIALECT_V5)
{
lex.g_field->fld_dtype = dtype_double;
@ -2953,16 +2943,9 @@ prec_scale :
{
if (client_dialect == SQL_DIALECT_V6_TRANSITION)
{
ERRD_post_warning (
isc_dsql_warn_precision_ambiguous,
isc_arg_end );
ERRD_post_warning (
isc_dsql_warn_precision_ambiguous1,
isc_arg_end );
ERRD_post_warning (
isc_dsql_warn_precision_ambiguous2,
isc_arg_end );
ERRD_post_warning(Arg::Warning(isc_dsql_warn_precision_ambiguous));
ERRD_post_warning(Arg::Warning(isc_dsql_warn_precision_ambiguous1));
ERRD_post_warning(Arg::Warning(isc_dsql_warn_precision_ambiguous2));
}
lex.g_field->fld_dtype = dtype_int64;
lex.g_field->fld_length = sizeof (SINT64);
@ -2995,12 +2978,8 @@ prec_scale :
(db_dialect > SQL_DIALECT_V5) ) ||
( (client_dialect > SQL_DIALECT_V5) &&
(db_dialect <= SQL_DIALECT_V5) ) )
ERRD_post (isc_sqlerr,
isc_arg_number, (SLONG) -817,
isc_arg_gds,
isc_ddl_not_allowed_by_db_sql_dial,
isc_arg_number, (SLONG) db_dialect,
isc_arg_end);
ERRD_post(Arg::Gds(isc_sqlerr) << Arg::Num(-817) <<
Arg::Gds(isc_ddl_not_allowed_by_db_sql_dial) << Arg::Num(db_dialect));
if (client_dialect <= SQL_DIALECT_V5)
{
lex.g_field->fld_dtype = dtype_double;
@ -3010,15 +2989,9 @@ prec_scale :
{
if (client_dialect == SQL_DIALECT_V6_TRANSITION)
{
ERRD_post_warning (
isc_dsql_warn_precision_ambiguous,
isc_arg_end );
ERRD_post_warning (
isc_dsql_warn_precision_ambiguous1,
isc_arg_end );
ERRD_post_warning (
isc_dsql_warn_precision_ambiguous2,
isc_arg_end );
ERRD_post_warning(Arg::Warning(isc_dsql_warn_precision_ambiguous));
ERRD_post_warning(Arg::Warning(isc_dsql_warn_precision_ambiguous1));
ERRD_post_warning(Arg::Warning(isc_dsql_warn_precision_ambiguous2));
}
/* client_dialect >= SQL_DIALECT_V6 */
lex.g_field->fld_dtype = dtype_int64;
@ -4278,33 +4251,25 @@ value : column_name
datetime_value_expression : CURRENT_DATE
{
if (client_dialect < SQL_DIALECT_V6_TRANSITION)
ERRD_post (isc_sqlerr, isc_arg_number, (SLONG) -104,
isc_arg_gds, isc_sql_dialect_datatype_unsupport,
isc_arg_number, (SLONG) client_dialect,
isc_arg_string, "DATE",
isc_arg_end);
ERRD_post(Arg::Gds(isc_sqlerr) << Arg::Num(-104) <<
Arg::Gds(isc_sql_dialect_datatype_unsupport) << Arg::Num(client_dialect) <<
Arg::Str("DATE"));
if (db_dialect < SQL_DIALECT_V6_TRANSITION)
ERRD_post (isc_sqlerr, isc_arg_number, (SLONG) -104,
isc_arg_gds, isc_sql_db_dialect_dtype_unsupport,
isc_arg_number, (SLONG) db_dialect,
isc_arg_string, "DATE",
isc_arg_end);
ERRD_post(Arg::Gds(isc_sqlerr) << Arg::Num(-104) <<
Arg::Gds(isc_sql_dialect_datatype_unsupport) << Arg::Num(db_dialect) <<
Arg::Str("DATE"));
$$ = make_node (nod_current_date, 0, NULL);
}
| CURRENT_TIME sec_precision_opt
{
if (client_dialect < SQL_DIALECT_V6_TRANSITION)
ERRD_post (isc_sqlerr, isc_arg_number, (SLONG) -104,
isc_arg_gds, isc_sql_dialect_datatype_unsupport,
isc_arg_number, (SLONG) client_dialect,
isc_arg_string, "TIME",
isc_arg_end);
ERRD_post(Arg::Gds(isc_sqlerr) << Arg::Num(-104) <<
Arg::Gds(isc_sql_dialect_datatype_unsupport) << Arg::Num(client_dialect) <<
Arg::Str("TIME"));
if (db_dialect < SQL_DIALECT_V6_TRANSITION)
ERRD_post (isc_sqlerr, isc_arg_number, (SLONG) -104,
isc_arg_gds, isc_sql_db_dialect_dtype_unsupport,
isc_arg_number, (SLONG) db_dialect,
isc_arg_string, "TIME",
isc_arg_end);
ERRD_post(Arg::Gds(isc_sqlerr) << Arg::Num(-104) <<
Arg::Gds(isc_sql_dialect_datatype_unsupport) << Arg::Num(db_dialect) <<
Arg::Str("TIME"));
$$ = make_node (nod_current_time, 1, $2);
}
| CURRENT_TIMESTAMP sec_precision_opt
@ -4355,33 +4320,25 @@ u_constant : u_numeric_constant
| DATE STRING
{
if (client_dialect < SQL_DIALECT_V6_TRANSITION)
ERRD_post (isc_sqlerr, isc_arg_number, (SLONG) -104,
isc_arg_gds, isc_sql_dialect_datatype_unsupport,
isc_arg_number, (SLONG) client_dialect,
isc_arg_string, "DATE",
isc_arg_end);
ERRD_post(Arg::Gds(isc_sqlerr) << Arg::Num(-104) <<
Arg::Gds(isc_sql_dialect_datatype_unsupport) << Arg::Num(client_dialect) <<
Arg::Str("DATE"));
if (db_dialect < SQL_DIALECT_V6_TRANSITION)
ERRD_post (isc_sqlerr, isc_arg_number, (SLONG) -104,
isc_arg_gds, isc_sql_db_dialect_dtype_unsupport,
isc_arg_number, (SLONG) db_dialect,
isc_arg_string, "DATE",
isc_arg_end);
ERRD_post(Arg::Gds(isc_sqlerr) << Arg::Num(-104) <<
Arg::Gds(isc_sql_dialect_datatype_unsupport) << Arg::Num(db_dialect) <<
Arg::Str("DATE"));
$$ = MAKE_constant ((dsql_str*) $2, CONSTANT_DATE);
}
| TIME STRING
{
if (client_dialect < SQL_DIALECT_V6_TRANSITION)
ERRD_post (isc_sqlerr, isc_arg_number, (SLONG) -104,
isc_arg_gds, isc_sql_dialect_datatype_unsupport,
isc_arg_number, (SLONG) client_dialect,
isc_arg_string, "TIME",
isc_arg_end);
ERRD_post(Arg::Gds(isc_sqlerr) << Arg::Num(-104) <<
Arg::Gds(isc_sql_dialect_datatype_unsupport) << Arg::Num(client_dialect) <<
Arg::Str("TIME"));
if (db_dialect < SQL_DIALECT_V6_TRANSITION)
ERRD_post (isc_sqlerr, isc_arg_number, (SLONG) -104,
isc_arg_gds, isc_sql_db_dialect_dtype_unsupport,
isc_arg_number, (SLONG) db_dialect,
isc_arg_string, "TIME",
isc_arg_end);
ERRD_post(Arg::Gds(isc_sqlerr) << Arg::Num(-104) <<
Arg::Gds(isc_sql_dialect_datatype_unsupport) << Arg::Num(db_dialect) <<
Arg::Str("TIME"));
$$ = MAKE_constant ((dsql_str*) $2, CONSTANT_TIME);
}
| TIMESTAMP STRING
@ -6064,12 +6021,9 @@ int Parser::yylexAux()
* the message text exceeds the 119-character limit
* of our message database.
*/
ERRD_post_warning( isc_dsql_warning_number_ambiguous,
isc_arg_string,
ERR_string( lex.last_token, lex.ptr - lex.last_token ),
isc_arg_end );
ERRD_post_warning( isc_dsql_warning_number_ambiguous1,
isc_arg_end );
ERRD_post_warning(Arg::Warning(isc_dsql_warning_number_ambiguous) <<
Arg::Str(Firebird::string(lex.last_token, lex.ptr - lex.last_token)));
ERRD_post_warning(Arg::Warning(isc_dsql_warning_number_ambiguous1));
}
yylval = (dsql_nod*) MAKE_string(lex.last_token, lex.ptr - lex.last_token);
@ -6172,22 +6126,18 @@ void Parser::yyerror_detailed(const TEXT* error_string, int yychar, YYSTYPE&, YY
}
if (yychar < 1)
ERRD_post (isc_sqlerr, isc_arg_number, (SLONG) -104,
isc_arg_gds, isc_command_end_err2, /* Unexpected end of command */
isc_arg_number, lines,
isc_arg_number, (SLONG) (lex.last_token - line_start + 1),
isc_arg_end);
ERRD_post(Arg::Gds(isc_sqlerr) << Arg::Num(-104) <<
/* Unexpected end of command */
Arg::Gds(isc_command_end_err2) << Arg::Num(lines) <<
Arg::Num(lex.last_token - line_start + 1));
else
{
ERRD_post (isc_sqlerr, isc_arg_number, (SLONG) -104,
ERRD_post (Arg::Gds(isc_sqlerr) << Arg::Num(-104) <<
/* Token unknown - line %d, column %d */
isc_arg_gds, isc_dsql_token_unk_err,
isc_arg_number, (SLONG) lines,
isc_arg_number, (SLONG) (lex.last_token - line_start + 1), /*CVC: +1*/
Arg::Gds(isc_dsql_token_unk_err) << Arg::Num(lines) <<
Arg::Num(lex.last_token - line_start + 1) << /*CVC: +1*/
/* Show the token */
isc_arg_gds, isc_random,
isc_arg_cstring, (int) (lex.ptr - lex.last_token), lex.last_token,
isc_arg_end);
Arg::Gds(isc_random) << Arg::Str(string(lex.last_token, lex.ptr - lex.last_token)));
}
}
@ -6216,6 +6166,6 @@ static void yyabandon (SLONG sql_code,
*
**************************************/
ERRD_post (isc_sqlerr, isc_arg_number, sql_code,
isc_arg_gds, error_symbol, isc_arg_end);
ERRD_post(Arg::Gds(isc_sqlerr) << Arg::Num(sql_code) <<
Arg::Gds(error_symbol));
}

File diff suppressed because it is too large Load Diff

View File

@ -45,11 +45,13 @@
#include "gen/iberror.h"
#include "../common/classes/init.h"
#include "../common/classes/rwlock.h"
#include "../common/StatusArg.h"
#include <stdio.h>
#include <stdlib.h>
#include <stdarg.h>
using namespace Firebird;
enum name_type {
NAME_statement = 1,
@ -99,7 +101,7 @@ static void cleanup(void*);
static void cleanup_database(FB_API_HANDLE*, void*);
static ISC_STATUS error(const Firebird::Exception& ex);
static ISC_STATUS error();
static void error_post(ISC_STATUS, ...);
static void error_post(const Arg::StatusVector& v);
static dsql_name* lookup_name(const SCHAR*, dsql_name*);
static dsql_stmt* lookup_stmt(const SCHAR*, dsql_name*, name_type);
static void init(FB_API_HANDLE*);
@ -712,7 +714,7 @@ ISC_STATUS API_ROUTINE isc_embed_dsql_prepare(ISC_STATUS* user_status,
statement = (dsql_stmt*) gds__alloc((SLONG) sizeof(dsql_stmt));
// FREE: by user calling isc_embed_dsql_release()
if (!statement) // NOMEM:
error_post(isc_virmemexh, isc_arg_end);
error_post(Arg::Gds(isc_virmemexh));
#ifdef DEBUG_GDS_ALLOC
gds_alloc_flag_unfreed((void *) statement);
@ -1267,60 +1269,12 @@ static ISC_STATUS error()
// exception that it uses a different error block - one which
// is local to the V3 DSQL routines...
//
static void error_post(ISC_STATUS status, ...)
static void error_post(const Arg::StatusVector& v)
{
va_list args;
ISC_STATUS* p;
int type;
/* Get the addresses of the argument vector and the status vector, and do
word-wise copy. */
va_start(args, status);
p = UDSQL_error->dsql_status;
// Copy first argument
*p++ = isc_arg_gds;
*p++ = status;
// Pick up remaining args
while (type = va_arg(args, int))
{
switch (*p++ = type) {
case isc_arg_gds:
*p++ = (ISC_STATUS) va_arg(args, ISC_STATUS);
break;
case isc_arg_number:
*p++ = (ISC_STATUS) va_arg(args, SLONG);
break;
case isc_arg_vms:
case isc_arg_unix:
case isc_arg_win32:
*p++ = va_arg(args, int);
break;
case isc_arg_string:
case isc_arg_interpreted:
case isc_arg_sql_state:
*p++ = (ISC_STATUS)(IPTR) va_arg(args, TEXT *);
break;
case isc_arg_cstring:
*p++ = (ISC_STATUS) va_arg(args, int);
*p++ = (ISC_STATUS)(IPTR) va_arg(args, TEXT *);
break;
}
}
va_end(args);
*p = isc_arg_end;
// Save status vector in appropriate place
v.copyTo(UDSQL_error->dsql_status);
// Give up whatever we were doing and return to the user.
Firebird::status_exception::raise(UDSQL_error->dsql_status);
}
@ -1393,7 +1347,7 @@ static dsql_name* insert_name(const TEXT* symbol_name, dsql_name** list_ptr, dsq
dsql_name* name = (dsql_name*) gds__alloc((SLONG) sizeof(dsql_name) + l);
// FREE: by exit handler cleanup() or database_cleanup()
if (!name) // NOMEM:
error_post(isc_virmemexh, isc_arg_end);
error_post(Arg::Gds(isc_virmemexh));
name->name_stmt = stmt;
name->name_length = l;
memcpy(name->name_symbol, symbol_name, l);
@ -1451,16 +1405,15 @@ static dsql_stmt* lookup_stmt(const TEXT* name, dsql_name* list, name_type type)
return found->name_stmt;
if (type == NAME_statement) {
error_post(isc_dsql_error,
isc_arg_gds, isc_sqlerr, isc_arg_number, (SLONG) - 518,
isc_arg_gds, isc_dsql_request_err, isc_arg_end);
error_post(Arg::Gds(isc_dsql_error) <<
Arg::Gds(isc_sqlerr) << Arg::Num(-518) <<
Arg::Gds(isc_dsql_request_err));
}
else {
error_post(isc_dsql_error,
isc_arg_gds, isc_sqlerr, isc_arg_number, (SLONG) - 504,
isc_arg_gds, isc_dsql_cursor_err,
isc_arg_gds, isc_dsql_cursor_not_found,
isc_arg_string, name, isc_arg_end);
error_post(Arg::Gds(isc_dsql_error) <<
Arg::Gds(isc_sqlerr) << Arg::Num(-504) <<
Arg::Gds(isc_dsql_cursor_err) <<
Arg::Gds(isc_dsql_cursor_not_found) << Arg::Str(name));
}
return NULL;
}