8
0
mirror of https://github.com/FirebirdSQL/firebird.git synced 2025-01-23 16:03:02 +01:00
This commit is contained in:
asfernandes 2009-11-22 00:09:30 +00:00
parent b0d1ff8403
commit 7c11f5b6b0
6 changed files with 40 additions and 42 deletions

View File

@ -2317,10 +2317,8 @@ void GEN_return(CompiledStatement* statement, const Array<dsql_nod*>& variables,
stuff(statement, 1);
stuff(statement, blr_begin);
USHORT outputs = 0;
for (Array<dsql_nod*>::const_iterator i = variables.begin(); i != variables.end(); ++i)
{
outputs++;
const dsql_nod* parameter = *i;
const dsql_var* variable = (dsql_var*) parameter->nod_arg[e_var_variable];
stuff(statement, blr_assignment);
@ -2342,7 +2340,7 @@ void GEN_return(CompiledStatement* statement, const Array<dsql_nod*>& variables,
stuff_word(statement, 1);
stuff(statement, blr_parameter);
stuff(statement, 1);
stuff_word(statement, 2 * outputs);
stuff_word(statement, USHORT(2 * variables.getCount()));
stuff(statement, blr_end);
if (!eos_flag)
{

View File

@ -3519,12 +3519,12 @@ blob_subtype
;
charset_clause
: CHARACTER SET symbol_character_set_name
:
{ $$ = NULL; }
| CHARACTER SET symbol_character_set_name
{
lex.g_field->fld_character_set = $3;
}
|
{ $$ = NULL; }
;
@ -3615,7 +3615,7 @@ prec_scale :
| '(' signed_long_integer ')'
{
if ($2 < 1 || $2 > 18)
yyabandon (-842, isc_precision_err); // Precision most be between 1 and 18.
yyabandon(-842, isc_precision_err); // Precision must be between 1 and 18.
if ($2 > 9)
{
if ( ( (client_dialect <= SQL_DIALECT_V5) &&
@ -3748,10 +3748,10 @@ float_type
;
precision_opt
: '(' nonneg_short_integer ')'
{ $$ = $2; }
|
:
{ $$ = 0; }
| '(' nonneg_short_integer ')'
{ $$ = $2; }
;
@ -5199,7 +5199,7 @@ nonneg_short_integer
{
if ($1 > SHRT_POS_MAX)
yyabandon(-842, isc_expec_short); // Short integer expected
$$ = $1;
}
;
@ -5219,7 +5219,7 @@ pos_short_integer
{
if ($1 == 0)
yyabandon(-842, isc_expec_positive); // Positive number expected
$$ = $1;
}
;

View File

@ -9789,6 +9789,8 @@ dsql_nod* PASS1_resolve_variable_name(const Array<dsql_nod*>& variables, const d
for (Array<dsql_nod*>::const_iterator i = variables.begin(); i != variables.end(); ++i)
{
dsql_nod* var_node = *i;
fb_assert(var_node->nod_type == nod_variable);
if (var_node->nod_type == nod_variable)
{
const dsql_var* variable = (dsql_var*) var_node->nod_arg[e_var_variable];

View File

@ -34,4 +34,3 @@ Jrd::dsql_nod* PASS1_rse(Jrd::CompiledStatement*, Jrd::dsql_nod*, Jrd::dsql_nod*
Jrd::dsql_nod* PASS1_statement(Jrd::CompiledStatement*, Jrd::dsql_nod*);
#endif // DSQL_PASS1_PROTO_H

View File

@ -2135,31 +2135,24 @@ void DYN_define_index(Global* gbl,
// to an index type in order to compute the length
if (!F.RDB$COLLATION_ID.NULL)
{
length =
INTL_key_length(tdbb,
INTL_TEXT_TO_INDEX(
INTL_CS_COLL_TO_TTYPE(GF.RDB$CHARACTER_SET_ID,
F.RDB$COLLATION_ID)),
GF.RDB$FIELD_LENGTH);
length = INTL_key_length(tdbb,
INTL_TEXT_TO_INDEX(INTL_CS_COLL_TO_TTYPE(
GF.RDB$CHARACTER_SET_ID, F.RDB$COLLATION_ID)),
GF.RDB$FIELD_LENGTH);
}
else if (!GF.RDB$COLLATION_ID.NULL)
{
length =
INTL_key_length(tdbb,
INTL_TEXT_TO_INDEX(
INTL_CS_COLL_TO_TTYPE(GF.RDB$CHARACTER_SET_ID,
GF.RDB$COLLATION_ID)),
GF.RDB$FIELD_LENGTH);
length = INTL_key_length(tdbb,
INTL_TEXT_TO_INDEX(INTL_CS_COLL_TO_TTYPE(
GF.RDB$CHARACTER_SET_ID, GF.RDB$COLLATION_ID)),
GF.RDB$FIELD_LENGTH);
}
else
{
length = GF.RDB$FIELD_LENGTH;
}
}
else
{
length = sizeof(double);
}
if (key_length)
{
key_length += ((length + STUFF_COUNT - 1) / (unsigned) STUFF_COUNT) *
@ -2175,7 +2168,7 @@ void DYN_define_index(Global* gbl,
break;
}
// for expression indices, store the BLR and the source string
// for expression indices, store the BLR and the source string
case isc_dyn_fld_computed_blr:
DYN_put_blr_blob(gbl, ptr, &IDX.RDB$EXPRESSION_BLR);
@ -2187,7 +2180,7 @@ void DYN_define_index(Global* gbl,
IDX.RDB$EXPRESSION_SOURCE.NULL = FALSE;
break;
// for foreign keys, point to the corresponding relation
// for foreign keys, point to the corresponding relation
case isc_dyn_idx_foreign_key:
GET_STRING(ptr, referenced_relation);
@ -3579,9 +3572,9 @@ void DYN_define_sql_field(Global* gbl,
case isc_dyn_fld_collation:
// Note: the global field's collation is not set, just
// the local field. There is no full "domain"
// created for the local field.
// This is the same decision for items like NULL_FLAG
// the local field. There is no full "domain"
// created for the local field.
// This is the same decision for items like NULL_FLAG
RFR.RDB$COLLATION_ID = DYN_get_number(ptr);
RFR.RDB$COLLATION_ID.NULL = FALSE;
break;

View File

@ -801,8 +801,8 @@ void DYN_modify_global_field(Global* gbl,
break;
// CVC: The syntax for DDL alter domain was accepting multiple
// changes in one command even to the same features, IE two length alterations.
// This repetitive type change will cause havoc so it should be stopped in the future.
// changes in one command even to the same features, IE two length alterations.
// This repetitive type change will cause havoc so it should be stopped in the future.
case isc_dyn_fld_length:
fldlen = true;
@ -2099,8 +2099,10 @@ static void modify_lfield_position(thread_db* tdbb,
// increase the value of RDB$FIELD_POSITION
if (field_name == FLD.RDB$FIELD_NAME) {
if (new_position > max_position)
{
// This prevents gaps in the position sequence of the fields
FLD.RDB$FIELD_POSITION = max_position;
}
else
FLD.RDB$FIELD_POSITION = new_position;
}
@ -2183,9 +2185,11 @@ static bool check_view_dependency(thread_db* tdbb,
CMP_release(tdbb, request);
if (retval)
{
DYN_error_punt(false, 206, SafeArg() << field_name.c_str() <<
relation_name.c_str() << view_name.c_str());
// msg 206: Column %s from table %s is referenced in %s.
}
return retval;
}
@ -2222,9 +2226,11 @@ static bool check_sptrig_dependency(thread_db* tdbb,
CMP_release(tdbb, request);
if (retval)
{
DYN_error_punt(false, 206, SafeArg() << field_name.c_str() <<
relation_name.c_str() << dep_name.c_str());
// msg 206: Column %s from table %s is referenced in %s.
}
return retval;
}
@ -3310,8 +3316,8 @@ static ULONG check_update_fld_type(const dyn_fld& orig_fld,
// Cannot change datatype for column %s. Conversion from base type %s to base type %s is not supported.
break;
// If the original field is a date field and the new field is a character field,
// is there enough space in the new field?
// If the original field is a date field and the new field is a character field,
// is there enough space in the new field?
case blr_text:
case blr_text2:
case blr_varying:
@ -3357,8 +3363,8 @@ static ULONG check_update_fld_type(const dyn_fld& orig_fld,
return isc_dyn_invalid_dtype_conversion;
// Cannot change datatype for column %s. Conversion from base type %s to base type %s is not supported.
// If the original field is a numeric field and the new field is a numeric field,
// is there enough space in the new field (do not allow the base type to decrease)
// If the original field is a numeric field and the new field is a numeric field,
// is there enough space in the new field (do not allow the base type to decrease)
case blr_short:
switch (orig_fld.dyn_dtype)
@ -3429,8 +3435,8 @@ static ULONG check_update_fld_type(const dyn_fld& orig_fld,
}
break;
// If the original field is a numeric field and the new field is a character field,
// is there enough space in the new field?
// If the original field is a numeric field and the new field is a character field,
// is there enough space in the new field?
case blr_text:
case blr_varying:
case blr_cstring: