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

Misc/cleanup

This commit is contained in:
asfernandes 2010-06-22 00:53:35 +00:00
parent 56c738c09d
commit 75af3ccf65
13 changed files with 40 additions and 79 deletions

View File

@ -274,8 +274,6 @@ void AggNode::setParameterName(dsql_par* parameter) const
void AggNode::genBlr()
{
DsqlCompiledStatement* statement = dsqlScratch->getStatement();
if (aggInfo.blr) // Is this a standard aggregate function?
dsqlScratch->appendUChar((distinct ? aggInfo.distinctBlr : aggInfo.blr));
else // This is a new window function.

View File

@ -129,8 +129,6 @@ void DdlNode::putType(const TypeClause& type, bool useSubType)
}
#endif
DsqlCompiledStatement* statement = dsqlScratch->getStatement();
if (type.notNull)
dsqlScratch->appendUChar(blr_not_nullable);
@ -894,7 +892,6 @@ bool CreateAlterFunctionNode::executeAlter(thread_db* tdbb, jrd_tra* transaction
bool secondPass, bool runTriggers)
{
Attachment* attachment = transaction->getAttachment();
DsqlCompiledStatement* statement = dsqlScratch->getStatement();
bool modified = false;
@ -2462,8 +2459,6 @@ bool CreateAlterTriggerNode::executeAlter(thread_db* tdbb, jrd_tra* transaction,
}
else if (body)
{
DsqlCompiledStatement* statement = dsqlScratch->getStatement();
TRG.RDB$TRIGGER_BLR.NULL = FALSE;
attachment->storeBinaryBlob(tdbb, transaction, &TRG.RDB$TRIGGER_BLR,
dsqlScratch->getBlrData().begin(),

View File

@ -475,7 +475,6 @@ public:
dropNode.silent = true;
}
protected:
virtual CreateAlterTriggerNode* getCreateAlterNode()
{

View File

@ -898,8 +898,6 @@ void SysFuncCallNode::setParameterName(dsql_par* parameter) const
void SysFuncCallNode::genBlr()
{
DsqlCompiledStatement* statement = dsqlScratch->getStatement();
dsqlScratch->appendUChar(blr_sys_function);
dsqlScratch->appendMetaString(function->name.c_str());
dsqlScratch->appendUChar(dsqlArgs->nod_count);
@ -1124,8 +1122,6 @@ void UdfCallNode::setParameterName(dsql_par* parameter) const
void UdfCallNode::genBlr()
{
DsqlCompiledStatement* statement = dsqlScratch->getStatement();
if (dsqlFunction->udf_name.package.isEmpty())
dsqlScratch->appendUChar(blr_function);
else

View File

@ -67,8 +67,6 @@ void BlockNode::putDtype(DsqlCompilerScratch* dsqlScratch, const dsql_fld* field
}
#endif
DsqlCompiledStatement* statement = dsqlScratch->getStatement();
if (field->fld_not_nullable)
dsqlScratch->appendUChar(blr_not_nullable);
@ -213,7 +211,6 @@ void BlockNode::putLocalVariables(DsqlCompilerScratch* dsqlScratch, const dsql_n
void BlockNode::putLocalVariable(DsqlCompilerScratch* dsqlScratch, dsql_var* variable,
dsql_nod* hostParam, const dsql_str* collationName)
{
DsqlCompiledStatement* statement = dsqlScratch->getStatement();
dsql_fld* field = variable->var_field;
dsqlScratch->appendUChar(blr_dcl_variable);
@ -365,8 +362,6 @@ void SavepointEncloseNode::print(string& text, Array<dsql_nod*>& nodes) const
void SavepointEncloseNode::genBlr()
{
DsqlCompiledStatement* const statement = dsqlScratch->getStatement();
dsqlScratch->appendUChar(blr_begin);
dsqlScratch->appendUChar(blr_start_savepoint);
stmt->genBlr();
@ -1375,7 +1370,7 @@ void ForNode::genBlr()
if (dsqlAction)
{
dsqlScratch->appendUChar(blr_label);
dsqlScratch->appendUChar((int) (IPTR) dsqlLabel->nod_arg[Dsql::e_label_number]);
dsqlScratch->appendUChar((int)(IPTR) dsqlLabel->nod_arg[Dsql::e_label_number]);
}
// Generate FOR loop
@ -1900,8 +1895,6 @@ void ReturnNode::print(string& text, Array<dsql_nod*>& nodes) const
void ReturnNode::genBlr()
{
DsqlCompiledStatement* const statement = dsqlScratch->getStatement();
dsqlScratch->appendUChar(blr_assignment);
GEN_expr(dsqlScratch, value);
dsqlScratch->appendUChar(blr_variable);

View File

@ -2981,9 +2981,10 @@ static void define_view(DsqlCompilerScratch* dsqlScratch, NOD_TYPE op)
dsqlScratch->appendNullString(isc_dyn_def_local_fld, field_string);
dsqlScratch->appendString(isc_dyn_fld_base_fld, field->fld_name);
if (field->fld_dtype <= dtype_any_text) {
if (field->fld_dtype <= dtype_any_text)
dsqlScratch->appendNumber(isc_dyn_fld_collation, field->fld_collation_id);
}
dsqlScratch->appendNumber(isc_dyn_view_context, context->ctx_context);
}
else
@ -3299,7 +3300,6 @@ static void delete_exception (DsqlCompilerScratch* dsqlScratch, dsql_nod* node,
}
}
DsqlCompiledStatement* statement = dsqlScratch->getStatement();
dsqlScratch->appendNullString(isc_dyn_del_exception, string->str_data);
dsqlScratch->appendUChar(isc_dyn_end);
}
@ -3354,7 +3354,6 @@ static void delete_relation_view (DsqlCompilerScratch* dsqlScratch, dsql_nod* no
}
if (relation)
{
DsqlCompiledStatement* statement = dsqlScratch->getStatement();
dsqlScratch->appendNullString(isc_dyn_delete_rel, string->str_data);
dsqlScratch->appendUChar(isc_dyn_end);
}
@ -3867,8 +3866,6 @@ static void make_index( DsqlCompilerScratch* dsqlScratch,
if (string)
index_name = string->str_data;
DsqlCompiledStatement* statement = dsqlScratch->getStatement();
if (element->nod_type == nod_primary)
dsqlScratch->appendNullString(isc_dyn_def_primary_key, index_name);
else if (element->nod_type == nod_unique)
@ -4076,9 +4073,8 @@ static void modify_database( DsqlCompilerScratch* dsqlScratch)
drop_difference = true;
}
if (drop_difference) {
if (drop_difference)
dsqlScratch->appendUChar(isc_dyn_drop_difference);
}
SLONG start = 0;
@ -4104,7 +4100,7 @@ static void modify_database( DsqlCompilerScratch* dsqlScratch)
break;
case nod_difference_file:
dsqlScratch->appendNullString(isc_dyn_def_difference,
((dsql_str*) element->nod_arg[0])->str_data);
((dsql_str*) element->nod_arg[0])->str_data);
break;
case nod_begin_backup:
dsqlScratch->appendUChar(isc_dyn_begin_backup);
@ -4211,7 +4207,7 @@ static void modify_domain( DsqlCompilerScratch* dsqlScratch)
{
fb_assert(string->str_length <= MAX_USHORT);
dsqlScratch->appendString(isc_dyn_fld_validation_source,
string->str_data, string->str_length);
string->str_data, string->str_length);
}
break;
@ -4269,12 +4265,10 @@ static void modify_index( DsqlCompilerScratch* dsqlScratch)
dsqlScratch->appendNullString(isc_dyn_mod_idx, index_name->str_data);
if (index_node->nod_type == nod_idx_active) {
if (index_node->nod_type == nod_idx_active)
dsqlScratch->appendNumber(isc_dyn_idx_inactive, 0);
}
else if (index_node->nod_type == nod_idx_inactive) {
else if (index_node->nod_type == nod_idx_inactive)
dsqlScratch->appendNumber(isc_dyn_idx_inactive, 1);
}
dsqlScratch->appendUChar(isc_dyn_end);
}
@ -4292,7 +4286,6 @@ static void put_user_grant(DsqlCompilerScratch* dsqlScratch, const dsql_nod* use
* Stuff a user/role/obj option in grant/revoke
*
**************************************/
DsqlCompiledStatement* statement = dsqlScratch->getStatement();
const dsql_str* name = (dsql_str*) user->nod_arg[0];
switch (user->nod_type)
@ -4302,12 +4295,10 @@ static void put_user_grant(DsqlCompilerScratch* dsqlScratch, const dsql_nod* use
break;
case nod_user_name:
if (user->nod_count == 2) {
if (user->nod_count == 2)
dsqlScratch->appendNullString(isc_dyn_grant_user_explicit, name->str_data);
}
else {
else
dsqlScratch->appendNullString(isc_dyn_grant_user, name->str_data);
}
break;
case nod_package_obj:
@ -4363,8 +4354,6 @@ static void modify_privilege(DsqlCompilerScratch* dsqlScratch,
*
**************************************/
DsqlCompiledStatement* statement = dsqlScratch->getStatement();
if (type == nod_grant)
dsqlScratch->appendUChar(isc_dyn_grant);
else
@ -4374,6 +4363,7 @@ static void modify_privilege(DsqlCompilerScratch* dsqlScratch,
SSHORT priv_count = 0;
dsqlScratch->appendUShort(0);
for (; *privs; privs++)
{
priv_count++;
@ -4381,9 +4371,8 @@ static void modify_privilege(DsqlCompilerScratch* dsqlScratch,
}
UCHAR* dynsave = dsqlScratch->getBlrData().end();
for (SSHORT i = priv_count + 2; i; i--) {
for (SSHORT i = priv_count + 2; i; i--)
--dynsave;
}
*dynsave++ = (UCHAR) priv_count;
*dynsave = (UCHAR) (priv_count >> 8);
@ -4408,14 +4397,11 @@ static void modify_privilege(DsqlCompilerScratch* dsqlScratch,
put_user_grant(dsqlScratch, user);
if (field_name) {
if (field_name)
dsqlScratch->appendNullString(isc_dyn_fld_name, field_name->str_data);
}
if (option)
{
dsqlScratch->appendNumber(isc_dyn_grant_options, option);
}
put_grantor(dsqlScratch, grantor);
@ -4808,14 +4794,10 @@ static void process_role_nm_list(DsqlCompilerScratch* dsqlScratch,
* Build req_blr for grant & revoke role stmt
*
**************************************/
DsqlCompiledStatement* statement = dsqlScratch->getStatement();
if (type == nod_grant) {
if (type == nod_grant)
dsqlScratch->appendUChar(isc_dyn_grant);
}
else {
else
dsqlScratch->appendUChar(isc_dyn_revoke);
}
dsqlScratch->appendUShort(1);
dsqlScratch->appendUChar('M');
@ -4850,7 +4832,6 @@ static void put_grantor(DsqlCompilerScratch* dsqlScratch, const dsql_nod* granto
**************************************/
if (grantor)
{
DsqlCompiledStatement* statement = dsqlScratch->getStatement();
fb_assert(grantor->nod_type == nod_user_name);
const dsql_str* name = (const dsql_str*) grantor->nod_arg[0];
dsqlScratch->appendNullString(isc_dyn_grant_grantor, name->str_data);
@ -4872,8 +4853,6 @@ static void put_descriptor(DsqlCompilerScratch* dsqlScratch, const dsc* desc)
*
**************************************/
DsqlCompiledStatement* statement = dsqlScratch->getStatement();
dsqlScratch->appendNumber(isc_dyn_fld_type, blr_dtypes[desc->dsc_dtype]);
if (desc->dsc_dtype == dtype_varying) {
dsqlScratch->appendNumber(isc_dyn_fld_length, (SSHORT) (desc->dsc_length - sizeof(USHORT)));
@ -4918,8 +4897,6 @@ static void put_field( DsqlCompilerScratch* dsqlScratch, dsql_fld* field, bool u
*
**************************************/
DsqlCompiledStatement* statement = dsqlScratch->getStatement();
if (field->fld_not_nullable)
dsqlScratch->appendUChar(isc_dyn_fld_not_null);

View File

@ -369,7 +369,7 @@ enum intlsym_flags_vals {
// Compiled statement - shared by multiple requests.
class DsqlCompiledStatement : public Firebird::PermanentStorage
{
friend class DsqlCompilerScratch;
///friend class DsqlCompilerScratch;
public:
enum Type // statement type
@ -626,13 +626,13 @@ protected:
virtual bool isVersion4()
{
return statement->flags & DsqlCompiledStatement::FLAG_BLR_VERSION4;
return statement->getFlags() & DsqlCompiledStatement::FLAG_BLR_VERSION4;
}
virtual bool isDdlDyn()
{
return (statement->type == DsqlCompiledStatement::TYPE_DDL || statement->ddlNode) &&
!statement->blockNode;
return (statement->getType() == DsqlCompiledStatement::TYPE_DDL || statement->getDdlNode()) &&
!statement->getBlockNode();
}
public:

View File

@ -232,8 +232,8 @@ void GEN_expr(DsqlCompilerScratch* dsqlScratch, dsql_nod* node)
case nod_dom_value:
dsqlScratch->appendUChar(blr_fid);
dsqlScratch->appendUChar(0); // Context
dsqlScratch->appendUShort(0); // Field id
dsqlScratch->appendUChar(0); // Context
dsqlScratch->appendUShort(0); // Field id
return;
case nod_field:
@ -1111,14 +1111,14 @@ void GEN_statement( DsqlCompilerScratch* dsqlScratch, dsql_nod* node)
case nod_while:
dsqlScratch->appendUChar(blr_label);
dsqlScratch->appendUChar((int) (IPTR) node->nod_arg[e_while_label]->nod_arg[e_label_number]);
dsqlScratch->appendUChar((int)(IPTR) node->nod_arg[e_while_label]->nod_arg[e_label_number]);
dsqlScratch->appendUChar(blr_loop);
dsqlScratch->appendUChar(blr_begin);
dsqlScratch->appendUChar(blr_if);
GEN_expr(dsqlScratch, node->nod_arg[e_while_cond]);
GEN_statement(dsqlScratch, node->nod_arg[e_while_action]);
dsqlScratch->appendUChar(blr_leave);
dsqlScratch->appendUChar((int) (IPTR) node->nod_arg[e_while_label]->nod_arg[e_label_number]);
dsqlScratch->appendUChar((int)(IPTR) node->nod_arg[e_while_label]->nod_arg[e_label_number]);
dsqlScratch->appendUChar(blr_end);
return;
@ -1130,7 +1130,7 @@ void GEN_statement( DsqlCompilerScratch* dsqlScratch, dsql_nod* node)
case nod_cursor:
dsqlScratch->appendUChar(blr_dcl_cursor);
dsqlScratch->appendUShort((int) (IPTR) node->nod_arg[e_cur_number]);
dsqlScratch->appendUShort((int)(IPTR) node->nod_arg[e_cur_number]);
if (node->nod_arg[e_cur_scroll])
{
dsqlScratch->appendUChar(blr_scrollable);
@ -1394,7 +1394,7 @@ static void gen_constant( DsqlCompilerScratch* dsqlScratch, const dsc* desc, boo
{
case dtype_short:
GEN_descriptor(dsqlScratch, desc, true);
value = *(SSHORT *) p;
value = *(SSHORT*) p;
if (negate_value)
value = -value;
dsqlScratch->appendUShort(value);
@ -1402,7 +1402,7 @@ static void gen_constant( DsqlCompilerScratch* dsqlScratch, const dsc* desc, boo
case dtype_long:
GEN_descriptor(dsqlScratch, desc, true);
value = *(SLONG *) p;
value = *(SLONG*) p;
if (negate_value)
value = -value;
//printf("gen.cpp = %p %d\n", *((void**)p), value);
@ -1413,7 +1413,7 @@ static void gen_constant( DsqlCompilerScratch* dsqlScratch, const dsc* desc, boo
case dtype_sql_time:
case dtype_sql_date:
GEN_descriptor(dsqlScratch, desc, true);
value = *(SLONG *) p;
value = *(SLONG*) p;
dsqlScratch->appendUShort(value);
dsqlScratch->appendUShort(value >> 16);
break;
@ -1441,7 +1441,7 @@ static void gen_constant( DsqlCompilerScratch* dsqlScratch, const dsc* desc, boo
break;
case dtype_int64:
i64value = *(SINT64 *) p;
i64value = *(SINT64*) p;
if (negate_value)
i64value = -i64value;
@ -1488,10 +1488,10 @@ static void gen_constant( DsqlCompilerScratch* dsqlScratch, const dsc* desc, boo
case dtype_array:
case dtype_timestamp:
GEN_descriptor(dsqlScratch, desc, true);
value = *(SLONG *) p;
value = *(SLONG*) p;
dsqlScratch->appendUShort(value);
dsqlScratch->appendUShort(value >> 16);
value = *(SLONG *) (p + 4);
value = *(SLONG*) (p + 4);
dsqlScratch->appendUShort(value);
dsqlScratch->appendUShort(value >> 16);
break;
@ -1782,6 +1782,7 @@ static void gen_exec_stmt(DsqlCompilerScratch* dsqlScratch, const dsql_nod* node
GEN_expr(dsqlScratch, temp->nod_arg[i]);
}
}
dsqlScratch->appendUChar(blr_end);
}

View File

@ -6323,7 +6323,6 @@ static dsql_nod* pass1_merge(DsqlCompilerScratch* dsqlScratch, dsql_nod* input)
virtual void genBlr()
{
DsqlCompiledStatement* statement = dsqlScratch->getStatement();
dsql_msg* message = dsqlScratch->getStatement()->getReceiveMsg();
if (!dsqlScratch->isPsql() && message)

View File

@ -235,7 +235,7 @@ public:
#ifdef WIN_NT
struct mtx winMutex;
#endif
struct mtx *mutex;
struct mtx* mutex;
Header* base;
const SLONG process_id;

View File

@ -2405,7 +2405,7 @@ int ISC_map_mutex(sh_mem* shmem_data, mtx* mutex, mtx** mapped)
#ifdef HAVE_MAP_OBJECT
Arg::StatusVector temp;
mutex = reinterpret_cast<mtx*>(ISC_map_object(temp, shmem_data,
reinterpret_cast<UCHAR*>(mutex) - shmem_data->sh_mem_address, sizeof(mtx)));
reinterpret_cast<UCHAR*>(mutex) - shmem_data->sh_mem_address, sizeof(mtx)));
if (!mutex)
{
iscLogStatus("ISC_map_mutex()", temp.value());
@ -2429,7 +2429,7 @@ void ISC_unmap_mutex(mtx* mutex)
#endif // HAVE_MAP_OBJECT
}
#ifdef USE_POSIX_THREADS
@ -2452,6 +2452,7 @@ int ISC_mutex_init(sh_mem* shmem_data, struct mtx* mutex, struct mtx** mapped)
{
return -1; // no errno known here...
}
mutex = *mapped;
if (!getSem5(mutex))
@ -2608,6 +2609,7 @@ int ISC_mutex_init(sh_mem* shmem_data, struct mtx* mutex, struct mtx** mapped)
{
return -1; // no errno known here...
}
mutex = *mapped;
#ifdef BUGGY_LINUX_MUTEX

View File

@ -5046,7 +5046,7 @@ static void store_dependencies(thread_db* tdbb,
int dpdo_type = (int) (IPTR) node->nod_arg[e_dep_object_type];
jrd_rel* relation = NULL;
jrd_prc* procedure = NULL;
const MetaName* dpdo_name = 0;
const MetaName* dpdo_name = NULL;
MetaName packageName;
SubtypeInfo info;

View File

@ -2322,7 +2322,8 @@ void LockManager::initialize(sh_mem* shmem_data, bool initializeMemory)
}
#endif
if (!initializeMemory) {
if (!initializeMemory)
{
#ifndef WIN_NT
if (ISC_map_mutex(shmem_data, &m_header->lhb_mutex, &(MUTEX))) {
bug(NULL, "mutex map failed");