mirror of
https://github.com/FirebirdSQL/firebird.git
synced 2025-01-22 20:03:02 +01:00
Misc.
This commit is contained in:
parent
04462b52db
commit
bfcc37e7eb
@ -18,7 +18,7 @@ Deprecating UDF
|
||||
fixed in FB 1.5. But even after it incorrectly declared (using SQL statement
|
||||
DECLARE EXTERNAL FUNCTION) UDF can easily cause various security issues like
|
||||
server crash or execution of arbitrary code. Therefore UDFs are deprecated
|
||||
in v.4. That means that UDFs can't be used with default configuration
|
||||
in v4. That means that UDFs can't be used with default configuration
|
||||
(parameter "UdfAccess" set to "None") and all sample UDF libraries (ib_udf,
|
||||
fbudf) are not distributed any more. Most of functions in that libraries
|
||||
were replaced with builtin analogs in previous versions and therefore
|
||||
@ -29,4 +29,3 @@ Deprecating UDF
|
||||
path-list is just UDF and resulting line in firebird.conf should be:
|
||||
UdfAccess = Restrict UDF
|
||||
Recommended long-term solution is replacing of UDF with UDR.
|
||||
|
||||
|
@ -717,7 +717,8 @@ SINT64 ClumpletReader::fromVaxInteger(const UCHAR* ptr, FB_SIZE_T length)
|
||||
value += ((SINT64) *ptr++) << shift;
|
||||
shift += 8;
|
||||
}
|
||||
value += ((SINT64)(SCHAR)*ptr) << shift;
|
||||
|
||||
value += ((SINT64)(SCHAR) *ptr) << shift;
|
||||
|
||||
return value;
|
||||
}
|
||||
|
@ -220,10 +220,10 @@ public:
|
||||
};
|
||||
|
||||
|
||||
// Templates to allow to iterate thru array\vector of values and process items
|
||||
// Templates to allow to iterate thru array\vector of values and process items
|
||||
// in some way. Processed items are marked and skipped at next iteration circle.
|
||||
// Idea is to not remove processed items from array and avoid costly memory
|
||||
// moving. Also, iterator is able to move upper and lower bounds of array if
|
||||
// Idea is to not remove processed items from array and avoid costly memory
|
||||
// moving. Also, iterator is able to move upper and lower bounds of array if
|
||||
// last (or first) items are marked, making next iterations more efficient.
|
||||
|
||||
template <typename T>
|
||||
@ -243,12 +243,12 @@ public:
|
||||
static void mark(T* const item)
|
||||
{
|
||||
*item = MarkValue::getMarkValue();
|
||||
};
|
||||
}
|
||||
|
||||
static bool isMarked(const T* const item)
|
||||
{
|
||||
return *item == MarkValue::getMarkValue();
|
||||
};
|
||||
}
|
||||
};
|
||||
|
||||
template <typename T, typename Marker = DefaultMarker<T> >
|
||||
@ -315,8 +315,6 @@ public:
|
||||
|
||||
if (!Marker::isMarked(m_curr))
|
||||
m_last = m_curr;
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
// Show if current position is valid
|
||||
@ -328,7 +326,7 @@ public:
|
||||
// Show if not processed items still exists
|
||||
bool isEmpty() const
|
||||
{
|
||||
return (m_begin >= m_end);
|
||||
return m_begin >= m_end;
|
||||
}
|
||||
|
||||
private:
|
||||
|
@ -196,8 +196,8 @@ namespace fb_utils
|
||||
|
||||
bool inline isNetworkError(ISC_STATUS code)
|
||||
{
|
||||
return code == isc_network_error ||
|
||||
code == isc_net_write_err ||
|
||||
return code == isc_network_error ||
|
||||
code == isc_net_write_err ||
|
||||
code == isc_net_read_err ||
|
||||
code == isc_lost_db_connection;
|
||||
}
|
||||
|
@ -603,15 +603,16 @@ void DsqlCompilerScratch::clearCTEs()
|
||||
cteAliases.clear();
|
||||
}
|
||||
|
||||
// Look for unused CTEs and issue a warning about its presence. Also, make DSQL
|
||||
// pass of every found unused CTE to check all references and initialize input
|
||||
// parameters. Note, when passing some unused CTE which refers to another unused
|
||||
// (by the main query) CTE, "unused" flag of the second one is cleared. Therefore
|
||||
// Look for unused CTEs and issue a warning about its presence. Also, make DSQL
|
||||
// pass of every found unused CTE to check all references and initialize input
|
||||
// parameters. Note, when passing some unused CTE which refers to another unused
|
||||
// (by the main query) CTE, "unused" flag of the second one is cleared. Therefore
|
||||
// names is collected in separate step.
|
||||
void DsqlCompilerScratch::checkUnusedCTEs()
|
||||
{
|
||||
bool sqlWarn = false;
|
||||
FB_SIZE_T i;
|
||||
|
||||
for (i = 0; i < ctes.getCount(); ++i)
|
||||
{
|
||||
SelectExprNode* cte = ctes[i];
|
||||
@ -623,6 +624,7 @@ void DsqlCompilerScratch::checkUnusedCTEs()
|
||||
ERRD_post_warning(Arg::Warning(isc_sqlwarn) << Arg::Num(-104));
|
||||
sqlWarn = true;
|
||||
}
|
||||
|
||||
ERRD_post_warning(Arg::Warning(isc_dsql_cte_not_used) << cte->alias);
|
||||
}
|
||||
}
|
||||
|
@ -7722,6 +7722,7 @@ void DerivedFieldNode::setParameterName(dsql_par* parameter) const
|
||||
const RecordKeyNode* dbKeyNode = NULL;
|
||||
|
||||
const DerivedFieldNode* drvField = nodeAs<DerivedFieldNode>(value);
|
||||
|
||||
while (drvField)
|
||||
{
|
||||
if (fieldNode = nodeAs<FieldNode>(drvField->value))
|
||||
@ -7731,7 +7732,7 @@ void DerivedFieldNode::setParameterName(dsql_par* parameter) const
|
||||
break;
|
||||
|
||||
drvField = nodeAs<DerivedFieldNode>(drvField->value);
|
||||
};
|
||||
}
|
||||
|
||||
if (fieldNode || (fieldNode = nodeAs<FieldNode>(value)))
|
||||
{
|
||||
|
@ -3384,7 +3384,7 @@ void ExecStatementNode::genBlr(DsqlCompilerScratch* dsqlScratch)
|
||||
}
|
||||
|
||||
// If no new features of EXECUTE STATEMENT are used, lets generate old BLR.
|
||||
if (!dataSource && !userName && !password && !role && !useCallerPrivs && !inputs &&
|
||||
if (!dataSource && !userName && !password && !role && !useCallerPrivs && !inputs &&
|
||||
traScope == EDS::traNotSet)
|
||||
{
|
||||
if (outputs)
|
||||
|
@ -5489,7 +5489,7 @@ with_list
|
||||
$$ = newNode<WithClause>();
|
||||
$$->add($1);
|
||||
}
|
||||
| with_list ',' with_item
|
||||
| with_list ',' with_item
|
||||
{
|
||||
$$ = $1;
|
||||
$$->add($3);
|
||||
|
@ -340,6 +340,7 @@ FB_UDR_BEGIN_FUNCTION(UC_isLeapYear)
|
||||
out->resultNull = true;
|
||||
return;
|
||||
}
|
||||
|
||||
const int ly = in->val.date.getYear(master->getUtilInterface());
|
||||
out->result = ((ly % 4 == 0 && ly % 100 != 0) || ly % 400 == 0) ? FB_TRUE : FB_FALSE;
|
||||
out->resultNull = false;
|
||||
|
@ -417,12 +417,14 @@ void JrdStatement::verifyAccess(thread_db* tdbb)
|
||||
else if (item->exa_action == ExternalAccess::exa_function)
|
||||
{
|
||||
routine = Function::lookup(tdbb, item->exa_fun_id, false, false, 0);
|
||||
|
||||
if (!routine)
|
||||
{
|
||||
string name;
|
||||
name.printf("id %d", item->exa_fun_id);
|
||||
ERR_post(Arg::Gds(isc_funnotdef) << name);
|
||||
}
|
||||
|
||||
aclType = id_function;
|
||||
}
|
||||
else
|
||||
|
@ -704,7 +704,7 @@ void OptimizerRetrieval::analyzeNavigation()
|
||||
nodes.add(orgNode);
|
||||
|
||||
for (const OptimizerBlk::opt_conjunct* tail = optimizer->opt_conjuncts.begin();
|
||||
tail < optimizer->opt_conjuncts.end(); tail++)
|
||||
tail < optimizer->opt_conjuncts.end(); tail++)
|
||||
{
|
||||
BoolExprNode* const boolean = tail->opt_conjunct_node;
|
||||
fb_assert(boolean);
|
||||
|
@ -611,7 +611,7 @@ RelationSourceNode* RelationSourceNode::copy(thread_db* tdbb, NodeCopier& copier
|
||||
element->csb_view = newSource->view;
|
||||
element->csb_view_stream = copier.remap[0];
|
||||
|
||||
/*
|
||||
/*
|
||||
If there was a parent stream no., then copy the flags
|
||||
from that stream to its children streams. (Bug 10164/10166)
|
||||
For e.g. consider a view V1 with 2 streams:
|
||||
@ -648,7 +648,7 @@ RelationSourceNode* RelationSourceNode::copy(thread_db* tdbb, NodeCopier& copier
|
||||
Since we didn't do this properly before, V1's children got
|
||||
tagged with whatever flags X possesed leading to various
|
||||
errors.
|
||||
*/
|
||||
*/
|
||||
|
||||
copier.csb->inheritViewFlags(newSource->stream, csb_no_dbkey);
|
||||
|
||||
@ -2254,7 +2254,6 @@ WindowSourceNode* WindowSourceNode::copy(thread_db* tdbb, NodeCopier& copier) co
|
||||
|
||||
copyWindow.map = inputWindow->map->copy(tdbb, copier);
|
||||
copyWindow.exclusion = inputWindow->exclusion;
|
||||
|
||||
}
|
||||
|
||||
return newSource;
|
||||
|
@ -2538,7 +2538,7 @@ static void flushDirty(thread_db* tdbb, SLONG transaction_mask, const bool sys_o
|
||||
|
||||
|
||||
// Collect pages modified by garbage collector or all dirty pages or release page
|
||||
// locks - depending of flush_flag, and write it to disk.
|
||||
// locks - depending of flush_flag, and write it to disk.
|
||||
// See also comments in flushPages.
|
||||
static void flushAll(thread_db* tdbb, USHORT flush_flag)
|
||||
{
|
||||
@ -2589,8 +2589,8 @@ static void flushAll(thread_db* tdbb, USHORT flush_flag)
|
||||
extern "C" {
|
||||
static int cmpBdbs(const void* a, const void* b)
|
||||
{
|
||||
const BufferDesc* bdbA = *(BufferDesc**)a;
|
||||
const BufferDesc* bdbB = *(BufferDesc**)b;
|
||||
const BufferDesc* bdbA = *(BufferDesc**) a;
|
||||
const BufferDesc* bdbB = *(BufferDesc**) b;
|
||||
|
||||
if (bdbA->bdb_page > bdbB->bdb_page)
|
||||
return 1;
|
||||
@ -2603,7 +2603,7 @@ extern "C" {
|
||||
} // extern C
|
||||
|
||||
|
||||
// Write array of pages to disk in efficient order.
|
||||
// Write array of pages to disk in efficient order.
|
||||
// First, sort pages by their numbers to make writes physically ordered and
|
||||
// thus faster. At every iteration of while loop write pages which have no high
|
||||
// precedence pages to ensure order preserved. If after some iteration there are
|
||||
@ -2676,6 +2676,7 @@ static void flushPages(thread_db* tdbb, USHORT flush_flag, BufferDesc** begin, F
|
||||
|
||||
iter.rewind();
|
||||
}
|
||||
|
||||
fb_assert(count == written);
|
||||
}
|
||||
|
||||
|
@ -3559,12 +3559,13 @@ static bool create_relation(thread_db* tdbb, SSHORT phase, DeferredWork* work, j
|
||||
X.RDB$RELATION_NAME EQ work->dfw_name.c_str()
|
||||
{
|
||||
rel_id = X.RDB$RELATION_ID;
|
||||
|
||||
if ( (relation = MET_lookup_relation_id(tdbb, rel_id, false)) )
|
||||
{
|
||||
RelationPages* const relPages = relation->getBasePages();
|
||||
|
||||
if (relPages->rel_index_root)
|
||||
IDX_delete_indices(tdbb, relation, relPages);
|
||||
IDX_delete_indices(tdbb, relation, relPages);
|
||||
|
||||
if (relPages->rel_pages)
|
||||
DPM_delete_relation(tdbb, relation);
|
||||
|
@ -367,9 +367,10 @@ Transaction* Connection::createTransaction()
|
||||
|
||||
void Connection::deleteTransaction(thread_db* tdbb, Transaction* tran)
|
||||
{
|
||||
// Close all active statements in tran context avoiding commit of already
|
||||
// Close all active statements in tran context avoiding commit of already
|
||||
// deleted transaction
|
||||
Statement** stmt_ptr = m_statements.begin();
|
||||
|
||||
while (stmt_ptr < m_statements.end())
|
||||
{
|
||||
Statement* stmt = *stmt_ptr;
|
||||
@ -378,6 +379,7 @@ void Connection::deleteTransaction(thread_db* tdbb, Transaction* tran)
|
||||
if (stmt->isActive())
|
||||
stmt->close(tdbb, true);
|
||||
}
|
||||
|
||||
// close() above could destroy statement and remove it from m_statements
|
||||
if (stmt_ptr < m_statements.end() && *stmt_ptr == stmt)
|
||||
stmt_ptr++;
|
||||
|
@ -47,7 +47,7 @@ class Statement;
|
||||
class Blob;
|
||||
|
||||
enum TraModes {traReadCommited, traReadCommitedRecVersions, traConcurrency, traConsistency};
|
||||
enum TraScope {traNotSet = 0, traAutonomous = 1, traCommon, traTwoPhase};
|
||||
enum TraScope {traNotSet = 0, traAutonomous, traCommon, traTwoPhase};
|
||||
|
||||
// Known built-in provider's names
|
||||
extern const char* FIREBIRD_PROVIDER_NAME;
|
||||
|
@ -226,11 +226,11 @@ bool IscConnection::cancelExecution(bool forced)
|
||||
|
||||
if (m_handle)
|
||||
{
|
||||
m_iscProvider.fb_cancel_operation(&status, &m_handle,
|
||||
m_iscProvider.fb_cancel_operation(&status, &m_handle,
|
||||
forced ? fb_cancel_abort : fb_cancel_raise);
|
||||
|
||||
if (!forced && m_handle &&
|
||||
(status->getState() & IStatus::STATE_ERRORS) &&
|
||||
if (!forced && m_handle &&
|
||||
(status->getState() & IStatus::STATE_ERRORS) &&
|
||||
(status->getErrors()[1] != isc_bad_db_handle))
|
||||
{
|
||||
status->init();
|
||||
|
@ -1866,7 +1866,7 @@ void Attachment::freeClientData(CheckStatusWrapper* status, bool force)
|
||||
// telling the user that an unrecoverable network error occurred and that
|
||||
// if there was any uncommitted work, its gone...... Oh well....
|
||||
ex.stuffException(status);
|
||||
|
||||
|
||||
if (!fb_utils::isNetworkError(status->getErrors()[1]) && (!force))
|
||||
{
|
||||
return;
|
||||
|
@ -647,6 +647,7 @@ SINT64 API_ROUTINE isc_portable_integer(const UCHAR* ptr, SSHORT length)
|
||||
value += ((SINT64) *ptr++) << shift;
|
||||
shift += 8;
|
||||
}
|
||||
|
||||
value += ((SINT64)(SCHAR) *ptr) << shift;
|
||||
|
||||
return value;
|
||||
@ -2556,6 +2557,7 @@ SLONG API_ROUTINE gds__vax_integer(const UCHAR* ptr, SSHORT length)
|
||||
value += ((SLONG) *ptr++) << shift;
|
||||
shift += 8;
|
||||
}
|
||||
|
||||
value += ((SLONG)(SCHAR) *ptr) << shift;
|
||||
|
||||
return value;
|
||||
|
Loading…
Reference in New Issue
Block a user