8
0
mirror of https://github.com/FirebirdSQL/firebird.git synced 2025-01-23 23:23:04 +01:00
This commit is contained in:
asfernandes 2009-11-21 00:10:16 +00:00
parent 9f57e5112e
commit 13e1546a70
7 changed files with 65 additions and 75 deletions

View File

@ -669,7 +669,7 @@ inline void check_copy_incr(char*& to, const char ch, const char* const string)
%type <legacyNode> data_type data_type_or_domain datetime_value_expression %type <legacyNode> data_type data_type_or_domain datetime_value_expression
%type <legacyNode> db_alter_clause db_clause db_file db_file_list db_initial_desc db_initial_desc1 %type <legacyNode> db_alter_clause db_clause db_file db_file_list db_initial_desc db_initial_desc1
%type <legacyNode> db_initial_option db_name db_rem_desc db_rem_desc1 db_rem_option ddl_subname %type <legacyNode> db_initial_option db_rem_desc db_rem_desc1 db_rem_option ddl_subname
%type <legacyNode> decimal_keyword declare declare_clause %type <legacyNode> decimal_keyword declare declare_clause
%type <legacyNode> decode_pairs def_computed default_par_opt default_value delete delete_positioned %type <legacyNode> decode_pairs def_computed default_par_opt default_value delete delete_positioned
%type <legacyNode> delete_rule delete_searched delimiter_opt derived_column_list derived_table %type <legacyNode> delete_rule delete_searched delimiter_opt derived_column_list derived_table
@ -678,7 +678,7 @@ inline void check_copy_incr(char*& to, const char ch, const char* const string)
%type <legacyNode> domain_default domain_default_opt domain_or_non_array_type %type <legacyNode> domain_default domain_default_opt domain_or_non_array_type
%type <legacyNode> domain_or_non_array_type_name domain_type drop drop_behaviour %type <legacyNode> domain_or_non_array_type_name domain_type drop drop_behaviour
%type <legacyNode> drop_clause drop_user_clause %type <legacyNode> drop_clause drop_user_clause
%type <legacyStr> ddl_desc %type <legacyStr> db_name ddl_desc
%type <legacyNode> end_default err errors event_argument_opt exception_clause %type <legacyNode> end_default err errors event_argument_opt exception_clause
%type <legacyNode> excp_hndl_statement excp_hndl_statements excp_statement %type <legacyNode> excp_hndl_statement excp_hndl_statements excp_statement
@ -1464,10 +1464,10 @@ alter_charset_clause
// in preparse.cpp. They are interpreted only in the server, using this grammar. // in preparse.cpp. They are interpreted only in the server, using this grammar.
db_clause db_clause
: db_name db_initial_desc1 db_rem_desc1 : db_name db_initial_desc1 db_rem_desc1
{ {
$$ = make_node (nod_def_database, (int) e_cdb_count, $$ = make_node(nod_def_database, (int) e_cdb_count,
$1, make_list($2), make_list ($3)); $1, make_list($2), make_list($3));
} }
; ;
@ -1478,7 +1478,6 @@ equals
db_name db_name
: sql_string : sql_string
{ $$ = (dsql_nod*) $1; }
; ;
db_initial_desc1 db_initial_desc1
@ -1490,20 +1489,20 @@ db_initial_desc1
db_initial_desc db_initial_desc
: db_initial_option : db_initial_option
| db_initial_desc db_initial_option | db_initial_desc db_initial_option
{ $$ = make_node (nod_list, 2, $1, $2); } { $$ = make_node(nod_list, 2, $1, $2); }
; ;
db_initial_option db_initial_option
: KW_PAGE_SIZE equals pos_short_integer : KW_PAGE_SIZE equals pos_short_integer
{ $$ = make_node (nod_page_size, 1, $3); } { $$ = make_node(nod_page_size, 1, $3); }
| LENGTH equals long_integer page_noise | LENGTH equals long_integer page_noise
{ $$ = make_node (nod_file_length, 1, $3); } { $$ = make_node(nod_file_length, 1, $3); }
| USER sql_string | USER sql_string
{ $$ = make_node (nod_user_name, 1, $2); } { $$ = make_node(nod_user_name, 1, $2); }
| PASSWORD sql_string | PASSWORD sql_string
{ $$ = make_node (nod_password, 1, $2); } { $$ = make_node(nod_password, 1, $2); }
| SET NAMES sql_string | SET NAMES sql_string
{ $$ = make_node (nod_lc_ctype, 1, $3); } { $$ = make_node(nod_lc_ctype, 1, $3); }
; ;
db_rem_desc1 db_rem_desc1
@ -1515,35 +1514,34 @@ db_rem_desc1
db_rem_desc db_rem_desc
: db_rem_option : db_rem_option
| db_rem_desc db_rem_option | db_rem_desc db_rem_option
{ $$ = make_node (nod_list, 2, $1, $2); } { $$ = make_node(nod_list, 2, $1, $2); }
; ;
db_rem_option db_rem_option
: db_file : db_file
| DEFAULT CHARACTER SET symbol_character_set_name | DEFAULT CHARACTER SET symbol_character_set_name
{ $$ = make_node (nod_dfl_charset, 1, $4); } { $$ = make_node(nod_dfl_charset, 1, $4); }
| DEFAULT CHARACTER SET symbol_character_set_name COLLATION symbol_collation_name | DEFAULT CHARACTER SET symbol_character_set_name COLLATION symbol_collation_name
{ {
$$ = make_node (nod_list, 2, $$ = make_node(nod_list, 2,
make_node (nod_dfl_charset, 1, $4), make_node(nod_dfl_charset, 1, $4),
make_node (nod_dfl_collate, 1, $6)); make_node(nod_dfl_collate, 1, $6));
} }
| KW_DIFFERENCE KW_FILE sql_string | KW_DIFFERENCE KW_FILE sql_string
{ $$ = make_node (nod_difference_file, 1, $3); } { $$ = make_node(nod_difference_file, 1, $3); }
; ;
db_file db_file
: file1 sql_string file_desc1 : file1 sql_string file_desc1
{ {
lex.g_file->fil_name = $2; lex.g_file->fil_name = $2;
$$ = (dsql_nod*) make_node (nod_file_desc, (int) 1, $$ = make_node(nod_file_desc, (int) 1, (dsql_nod*) lex.g_file);
(dsql_nod*) lex.g_file);
} }
; ;
file1 file1
: KW_FILE : KW_FILE
{ lex.g_file = make_file();} { lex.g_file = make_file();}
; ;
file_desc1 file_desc1

View File

@ -68,4 +68,3 @@ void CMP_shutdown_database(Jrd::thread_db*);
void CMP_verify_access(Jrd::thread_db* tdbb, Jrd::jrd_req* request); void CMP_verify_access(Jrd::thread_db* tdbb, Jrd::jrd_req* request);
#endif // JRD_CMP_PROTO_H #endif // JRD_CMP_PROTO_H

View File

@ -4728,9 +4728,7 @@ static Format* make_format(thread_db* tdbb, jrd_rel* relation, USHORT* version,
defRef.vlu_desc.dsc_address = defRef.vlu_string->str_data; defRef.vlu_desc.dsc_address = defRef.vlu_string->str_data;
} }
else else
{
defRef.vlu_desc.dsc_address = (UCHAR*) &defRef.vlu_misc; defRef.vlu_desc.dsc_address = (UCHAR*) &defRef.vlu_misc;
}
} }
/* Compute the offsets of the various fields */ /* Compute the offsets of the various fields */
@ -5089,44 +5087,43 @@ static bool make_version(thread_db* tdbb, SSHORT phase, DeferredWork* work, jrd_
jrd_nod* defaultNode = MET_parse_blob(tdbb, relation, defaultValue, jrd_nod* defaultNode = MET_parse_blob(tdbb, relation, defaultValue,
NULL, &defaultRequest, false); NULL, &defaultRequest, false);
{ // scope // Attention: this is scoped to the end of this "try".
AutoSetRestore2<jrd_req*, thread_db> autoRequest(tdbb, AutoSetRestore2<jrd_req*, thread_db> autoRequest(tdbb,
&thread_db::getRequest, &thread_db::setRequest, defaultRequest); &thread_db::getRequest, &thread_db::setRequest, defaultRequest);
defaultRequest->req_timestamp.validate(); defaultRequest->req_timestamp.validate();
TRA_attach_request(transaction, defaultRequest); TRA_attach_request(transaction, defaultRequest);
dsc* result = EVL_expr(tdbb, defaultNode); dsc* result = EVL_expr(tdbb, defaultNode);
TRA_detach_request(defaultRequest); TRA_detach_request(defaultRequest);
if (result) if (result)
{
tfb->tfb_default.vlu_desc = *result;
if (result->isText() || result->isBlob())
{ {
tfb->tfb_default.vlu_desc = *result; UCHAR* ptr = NULL;
MoveBuffer buffer;
int len = MOV_make_string2(tdbb, result, CS_NONE, &ptr, buffer, true);
fb_assert(ULONG(len) < ULONG(MAX_USHORT));
if (result->isText() || result->isBlob()) VaryingString* newString = FB_NEW_RPT(*dbb->dbb_permanent,
{ len) VaryingString();
UCHAR* ptr = NULL; newString->str_length = USHORT(len);
MoveBuffer buffer; memcpy(newString->str_data, ptr, len);
int len = MOV_make_string2(tdbb, result, CS_NONE, &ptr, buffer, true);
fb_assert(ULONG(len) < ULONG(MAX_USHORT));
VaryingString* newString = FB_NEW_RPT(*dbb->dbb_permanent, tfb->tfb_default.vlu_string = newString;
len) VaryingString(); tfb->tfb_default.vlu_desc.dsc_dtype = dtype_text;
newString->str_length = USHORT(len); tfb->tfb_default.vlu_desc.dsc_length = USHORT(len);
memcpy(newString->str_data, ptr, len); tfb->tfb_default.vlu_desc.dsc_address = newString->str_data;
}
tfb->tfb_default.vlu_string = newString; else
tfb->tfb_default.vlu_desc.dsc_dtype = dtype_text; {
tfb->tfb_default.vlu_desc.dsc_length = USHORT(len); memcpy(&tfb->tfb_default.vlu_misc, result->dsc_address,
tfb->tfb_default.vlu_desc.dsc_address = newString->str_data; result->dsc_length);
} tfb->tfb_default.vlu_desc.dsc_address =
else (UCHAR*) &tfb->tfb_default.vlu_misc;
{
memcpy(&tfb->tfb_default.vlu_misc, result->dsc_address,
result->dsc_length);
tfb->tfb_default.vlu_desc.dsc_address =
(UCHAR*) &tfb->tfb_default.vlu_misc;
}
} }
} }
} }

View File

@ -1227,17 +1227,15 @@ SINT64 DPM_gen_id(thread_db* tdbb, SLONG generator, bool initialize, SINT64 val)
* decided that the V6 engine would only access an ODS-10 database. * decided that the V6 engine would only access an ODS-10 database.
* (and uncommented 2000-05-05, also by ChrisJ, when minds changed.) * (and uncommented 2000-05-05, also by ChrisJ, when minds changed.)
*/ */
SINT64* ptr = 0; SINT64* ptr = NULL;
SLONG* lptr = 0; SLONG* lptr = NULL;
if (dbb->dbb_ods_version >= ODS_VERSION12) {
ptr = ((SINT64 *) (page->gpg_values)) + offset; if (dbb->dbb_ods_version >= ODS_VERSION12)
} ptr = ((SINT64*) (page->gpg_values)) + offset;
else if (dbb->dbb_ods_version >= ODS_VERSION10) { else if (dbb->dbb_ods_version >= ODS_VERSION10)
ptr = ((SINT64 *) (((old_gen_page*) page)->gpg_values)) + offset; ptr = ((SINT64*) (((old_gen_page*) page)->gpg_values)) + offset;
} else
else {
lptr = ((SLONG *) (((pointer_page*) page)->ppg_page)) + offset; lptr = ((SLONG *) (((pointer_page*) page)->ppg_page)) + offset;
}
if (val || initialize) if (val || initialize)
{ {

View File

@ -174,12 +174,12 @@ public:
// Parameter passing mechanism. Also used for returning values, except for scalar_array. // Parameter passing mechanism. Also used for returning values, except for scalar_array.
enum FUN_T { enum FUN_T {
FUN_value, FUN_value,
FUN_reference, FUN_reference,
FUN_descriptor, FUN_descriptor,
FUN_blob_struct, FUN_blob_struct,
FUN_scalar_array, FUN_scalar_array,
FUN_ref_with_null FUN_ref_with_null
}; };
@ -263,4 +263,3 @@ public:
} //namespace Jrd } //namespace Jrd
#endif /* JRD_VAL_H */ #endif /* JRD_VAL_H */

View File

@ -2720,7 +2720,7 @@ void VIO_store(thread_db* tdbb, record_param* rpb, jrd_tra* transaction)
bool check_blr = true; bool check_blr = true;
if (ENCODE_ODS(tdbb->getDatabase()->dbb_ods_version, if (ENCODE_ODS(tdbb->getDatabase()->dbb_ods_version,
tdbb->getDatabase()->dbb_minor_version) >= ODS_11_1) tdbb->getDatabase()->dbb_minor_version) >= ODS_11_1)
{ {
if (EVL_field(0, rpb->rpb_record, f_prc_valid_blr, &desc2)) if (EVL_field(0, rpb->rpb_record, f_prc_valid_blr, &desc2))
check_blr = MOV_get_long(&desc2, 0) != 0; check_blr = MOV_get_long(&desc2, 0) != 0;

View File

@ -561,4 +561,3 @@ static void sanitize( TEXT* locale)
locale++; locale++;
} }
} }