mirror of
https://github.com/FirebirdSQL/firebird.git
synced 2025-01-23 18:03:04 +01:00
Misc.
This commit is contained in:
parent
5ca6a8dcd0
commit
580172419b
@ -1750,48 +1750,53 @@ void ISC_systemToUtf8(Firebird::AbstractString& str)
|
||||
|
||||
#if defined(WIN_NT)
|
||||
HalfStaticArray<WCHAR, MAX_PATH> utf16;
|
||||
WCHAR *utf16Buffer = utf16.getBuffer(MAX_PATH);
|
||||
WCHAR* utf16Buffer = utf16.getBuffer(MAX_PATH);
|
||||
int len16 = MultiByteToWideChar(CP_ACP, 0, str.c_str(), str.length(), utf16Buffer, MAX_PATH);
|
||||
|
||||
if (len16 == 0)
|
||||
{
|
||||
DWORD err = GetLastError();
|
||||
if (err != ERROR_INSUFFICIENT_BUFFER)
|
||||
if (err != ERROR_INSUFFICIENT_BUFFER)
|
||||
{
|
||||
status_exception::raise(Arg::Gds(isc_bad_conn_str) << Arg::Gds(isc_transliteration_failed)
|
||||
<< Arg::Windows(err));
|
||||
status_exception::raise(
|
||||
Arg::Gds(isc_bad_conn_str) << Arg::Gds(isc_transliteration_failed) <<
|
||||
Arg::Windows(err));
|
||||
}
|
||||
|
||||
len16 = MultiByteToWideChar(CP_ACP, 0, str.c_str(), str.length(), NULL, 0);
|
||||
if (len16 == 0)
|
||||
{
|
||||
err = GetLastError();
|
||||
status_exception::raise(Arg::Gds(isc_bad_conn_str) << Arg::Gds(isc_transliteration_failed)
|
||||
<< Arg::Windows(err));
|
||||
status_exception::raise(
|
||||
Arg::Gds(isc_bad_conn_str) << Arg::Gds(isc_transliteration_failed) <<
|
||||
Arg::Windows(err));
|
||||
}
|
||||
|
||||
utf16Buffer = utf16.getBuffer(len16);
|
||||
len16 = MultiByteToWideChar(CP_ACP, 0, str.c_str(), str.length(), utf16Buffer, len16);
|
||||
}
|
||||
|
||||
char *utf8Buffer = str.getBuffer(str.capacity());
|
||||
int len8 = WideCharToMultiByte(CP_UTF8, 0, utf16Buffer, len16, utf8Buffer, str.capacity(), NULL, NULL);
|
||||
char* utf8Buffer = str.getBuffer(str.capacity());
|
||||
int len8 = WideCharToMultiByte(CP_UTF8, 0, utf16Buffer, len16,
|
||||
utf8Buffer, str.capacity(), NULL, NULL);
|
||||
|
||||
if (len8 == 0)
|
||||
{
|
||||
DWORD err = GetLastError();
|
||||
if (err != ERROR_INSUFFICIENT_BUFFER)
|
||||
if (err != ERROR_INSUFFICIENT_BUFFER)
|
||||
{
|
||||
status_exception::raise(Arg::Gds(isc_bad_conn_str) << Arg::Gds(isc_transliteration_failed)
|
||||
<< Arg::Windows(err));
|
||||
status_exception::raise(
|
||||
Arg::Gds(isc_bad_conn_str) << Arg::Gds(isc_transliteration_failed) <<
|
||||
Arg::Windows(err));
|
||||
}
|
||||
|
||||
len8 = WideCharToMultiByte(CP_UTF8, 0, utf16Buffer, len16, NULL, 0, NULL, NULL);
|
||||
if (len8 == 0)
|
||||
{
|
||||
err = GetLastError();
|
||||
status_exception::raise(Arg::Gds(isc_bad_conn_str) << Arg::Gds(isc_transliteration_failed)
|
||||
<< Arg::Windows(err));
|
||||
status_exception::raise(
|
||||
Arg::Gds(isc_bad_conn_str) << Arg::Gds(isc_transliteration_failed) <<
|
||||
Arg::Windows(err));
|
||||
}
|
||||
|
||||
utf8Buffer = str.getBuffer(len8);
|
||||
@ -1813,7 +1818,7 @@ void ISC_utf8ToSystem(Firebird::AbstractString& str)
|
||||
|
||||
#if defined(WIN_NT)
|
||||
HalfStaticArray<WCHAR, MAX_PATH> utf16;
|
||||
WCHAR *utf16Buffer = utf16.getBuffer(MAX_PATH);
|
||||
WCHAR* utf16Buffer = utf16.getBuffer(MAX_PATH);
|
||||
int len16 = MultiByteToWideChar(CP_UTF8, 0, str.c_str(), str.length(), utf16Buffer, MAX_PATH);
|
||||
|
||||
if (len16 == 0)
|
||||
@ -1821,16 +1826,18 @@ void ISC_utf8ToSystem(Firebird::AbstractString& str)
|
||||
DWORD err = GetLastError();
|
||||
if (err != ERROR_INSUFFICIENT_BUFFER)
|
||||
{
|
||||
status_exception::raise(Arg::Gds(isc_bad_conn_str) << Arg::Gds(isc_transliteration_failed)
|
||||
<< Arg::Windows(err));
|
||||
status_exception::raise(
|
||||
Arg::Gds(isc_bad_conn_str) << Arg::Gds(isc_transliteration_failed) <<
|
||||
Arg::Windows(err));
|
||||
}
|
||||
|
||||
len16 = MultiByteToWideChar(CP_UTF8, 0, str.c_str(), str.length(), NULL, 0);
|
||||
if (len16 == 0)
|
||||
{
|
||||
err = GetLastError();
|
||||
status_exception::raise(Arg::Gds(isc_bad_conn_str) << Arg::Gds(isc_transliteration_failed)
|
||||
<< Arg::Windows(err));
|
||||
status_exception::raise(
|
||||
Arg::Gds(isc_bad_conn_str) << Arg::Gds(isc_transliteration_failed) <<
|
||||
Arg::Windows(err));
|
||||
}
|
||||
|
||||
utf16Buffer = utf16.getBuffer(len16);
|
||||
@ -1838,29 +1845,32 @@ void ISC_utf8ToSystem(Firebird::AbstractString& str)
|
||||
}
|
||||
|
||||
BOOL defaultCharUsed;
|
||||
char *ansiBuffer = str.getBuffer(str.capacity());
|
||||
int len8 = WideCharToMultiByte(CP_ACP, 0, utf16Buffer, len16, ansiBuffer, str.capacity(),
|
||||
NULL, &defaultCharUsed);
|
||||
char* ansiBuffer = str.getBuffer(str.capacity());
|
||||
int len8 = WideCharToMultiByte(CP_ACP, 0, utf16Buffer, len16,
|
||||
ansiBuffer, str.capacity(), NULL, &defaultCharUsed);
|
||||
|
||||
if (len8 == 0 || defaultCharUsed)
|
||||
{
|
||||
DWORD err = GetLastError();
|
||||
if (err != ERROR_INSUFFICIENT_BUFFER)
|
||||
{
|
||||
status_exception::raise(Arg::Gds(isc_bad_conn_str) << Arg::Gds(isc_transliteration_failed)
|
||||
<< Arg::Windows(err));
|
||||
status_exception::raise(
|
||||
Arg::Gds(isc_bad_conn_str) << Arg::Gds(isc_transliteration_failed) <<
|
||||
Arg::Windows(err));
|
||||
}
|
||||
|
||||
len8 = WideCharToMultiByte(CP_ACP, 0, utf16Buffer, len16, NULL, 0, NULL, &defaultCharUsed);
|
||||
if (len8 == 0 || defaultCharUsed)
|
||||
{
|
||||
err = GetLastError();
|
||||
status_exception::raise(Arg::Gds(isc_bad_conn_str) << Arg::Gds(isc_transliteration_failed)
|
||||
<< Arg::Windows(err));
|
||||
status_exception::raise(
|
||||
Arg::Gds(isc_bad_conn_str) << Arg::Gds(isc_transliteration_failed) <<
|
||||
Arg::Windows(err));
|
||||
}
|
||||
|
||||
ansiBuffer = str.getBuffer(len8);
|
||||
len8 = WideCharToMultiByte(CP_ACP, 0, utf16Buffer, len16, ansiBuffer, len8, NULL, &defaultCharUsed);
|
||||
len8 = WideCharToMultiByte(CP_ACP, 0, utf16Buffer, len16,
|
||||
ansiBuffer, len8, NULL, &defaultCharUsed);
|
||||
}
|
||||
str.resize(len8);
|
||||
|
||||
|
@ -8813,7 +8813,7 @@ static int process_statement(const TEXT* string, XSQLDA** sqldap)
|
||||
// command-line ISQL only. For WISQL, print the column
|
||||
// headings only once.
|
||||
|
||||
if (printHead &&
|
||||
if (printHead &&
|
||||
(Pagelength && (lines % Pagelength == 0) ||
|
||||
!Pagelength && !lines) )
|
||||
{
|
||||
|
@ -1837,13 +1837,15 @@ RecordSource* WindowSourceNode::compile(thread_db* tdbb, OptimizerBlk* opt, bool
|
||||
if (rsbStreams.getCount() + opt->localStreams.getCount() >= MAX_STREAMS)
|
||||
ERR_post(Arg::Gds(isc_too_many_contexts));
|
||||
|
||||
//for (StreamList::iterator i = rsbStreams.begin(); i != rsbStreams.end(); ++i)
|
||||
//{
|
||||
//fb_assert(opt->localStreams[0] < MAX_STREAMS && opt->localStreams[0] < MAX_UCHAR);
|
||||
//fb_assert(opt->localStreams.getCount() < MAX_STREAMS);
|
||||
//opt->localStreams[++opt->localStreams[0]] = *i;
|
||||
//opt->localStreams.add(*i);
|
||||
//}
|
||||
/***
|
||||
for (StreamList::iterator i = rsbStreams.begin(); i != rsbStreams.end(); ++i)
|
||||
{
|
||||
fb_assert(opt->localStreams[0] < MAX_STREAMS && opt->localStreams[0] < MAX_UCHAR);
|
||||
fb_assert(opt->localStreams.getCount() < MAX_STREAMS);
|
||||
opt->localStreams[++opt->localStreams[0]] = *i;
|
||||
opt->localStreams.add(*i);
|
||||
}
|
||||
***/
|
||||
opt->localStreams.join(rsbStreams);
|
||||
|
||||
return rsb;
|
||||
@ -2531,13 +2533,15 @@ void RseNode::computeRseStreams(const CompilerScratch* csb, StreamList& streams)
|
||||
if (streams.getCount() + sourceStreams.getCount() >= MAX_STREAMS)
|
||||
ERR_post(Arg::Gds(isc_too_many_contexts));
|
||||
|
||||
//for (StreamList::iterator i = sourceStreams.begin(); i != sourceStreams.end(); ++i)
|
||||
//{
|
||||
// //fb_assert(streams[0] < MAX_STREAMS && streams[0] < MAX_UCHAR);
|
||||
// fb_assert(streams.getCount() < MAX_STREAMS);
|
||||
// //streams[++streams[0]] = (UCHAR) *i;
|
||||
// streams.add(*i);
|
||||
//}
|
||||
/***
|
||||
for (StreamList::iterator i = sourceStreams.begin(); i != sourceStreams.end(); ++i)
|
||||
{
|
||||
//fb_assert(streams[0] < MAX_STREAMS && streams[0] < MAX_UCHAR);
|
||||
fb_assert(streams.getCount() < MAX_STREAMS);
|
||||
//streams[++streams[0]] = (UCHAR) *i;
|
||||
streams.add(*i);
|
||||
}
|
||||
***/
|
||||
streams.join(sourceStreams);
|
||||
}
|
||||
}
|
||||
|
@ -43,7 +43,7 @@ class Database;
|
||||
//
|
||||
// Database record counters.
|
||||
//
|
||||
enum RelStatType
|
||||
enum RelStatType
|
||||
{
|
||||
DBB_read_seq_count = 0,
|
||||
DBB_read_idx_count,
|
||||
|
@ -1256,9 +1256,8 @@ bool CCH_free_page(thread_db* tdbb)
|
||||
Database* dbb = tdbb->getDatabase();
|
||||
BufferControl* bcb = dbb->dbb_bcb;
|
||||
|
||||
if (dbb->readOnly()) {
|
||||
if (dbb->readOnly())
|
||||
return false;
|
||||
}
|
||||
|
||||
BufferDesc* bdb;
|
||||
|
||||
|
@ -484,9 +484,9 @@ void CMP_decrement_prc_use_count(thread_db* tdbb, jrd_prc* procedure)
|
||||
if ((procedure->prc_use_count == 0) &&
|
||||
( (*tdbb->getAttachment()->att_procedures)[procedure->getId()] != procedure))
|
||||
{
|
||||
if (procedure->getStatement()) {
|
||||
if (procedure->getStatement())
|
||||
procedure->releaseStatement(tdbb);
|
||||
}
|
||||
|
||||
procedure->prc_flags &= ~PRC_being_altered;
|
||||
MET_remove_procedure(tdbb, procedure->getId(), procedure);
|
||||
}
|
||||
|
@ -532,6 +532,7 @@ public:
|
||||
{
|
||||
// We must zero-initialize this one
|
||||
csb_repeat();
|
||||
|
||||
void activate();
|
||||
void deactivate();
|
||||
|
||||
@ -563,27 +564,27 @@ public:
|
||||
|
||||
// We must zero-initialize this one
|
||||
inline CompilerScratch::csb_repeat::csb_repeat()
|
||||
: csb_stream(0),
|
||||
csb_view_stream(0),
|
||||
csb_flags(0),
|
||||
csb_indices(0),
|
||||
csb_relation(0),
|
||||
csb_alias(0),
|
||||
csb_procedure(0),
|
||||
csb_view(0),
|
||||
csb_idx(0),
|
||||
csb_message(0),
|
||||
csb_format(0),
|
||||
csb_internal_format(0),
|
||||
csb_fields(0),
|
||||
csb_cardinality(0.0), // TMN: Non-natural cardinality?!
|
||||
csb_plan(0),
|
||||
csb_map(0),
|
||||
csb_rsb_ptr(0)
|
||||
{
|
||||
}
|
||||
: csb_stream(0),
|
||||
csb_view_stream(0),
|
||||
csb_flags(0),
|
||||
csb_indices(0),
|
||||
csb_relation(0),
|
||||
csb_alias(0),
|
||||
csb_procedure(0),
|
||||
csb_view(0),
|
||||
csb_idx(0),
|
||||
csb_message(0),
|
||||
csb_format(0),
|
||||
csb_internal_format(0),
|
||||
csb_fields(0),
|
||||
csb_cardinality(0.0), // TMN: Non-natural cardinality?!
|
||||
csb_plan(0),
|
||||
csb_map(0),
|
||||
csb_rsb_ptr(0)
|
||||
{
|
||||
}
|
||||
|
||||
//CompilerScratch.csb_g_flags' values.
|
||||
// CompilerScratch.csb_g_flags' values.
|
||||
const int csb_internal = 1; // "csb_g_flag" switch
|
||||
const int csb_get_dependencies = 2; // we are retrieving dependencies
|
||||
const int csb_ignore_perm = 4; // ignore permissions checks
|
||||
@ -594,7 +595,7 @@ const int csb_validation = 64; // we're in a validation expression (RDB hack)
|
||||
const int csb_reuse_context = 128; // allow context reusage
|
||||
const int csb_subroutine = 256; // sub routine
|
||||
|
||||
//CompilerScratch.csb_rpt[].csb_flags's values.
|
||||
// CompilerScratch.csb_rpt[].csb_flags's values.
|
||||
const int csb_active = 1; // stream is active
|
||||
const int csb_used = 2; // context has already been defined (BLR parsing only)
|
||||
const int csb_view_update = 4; // view update w/wo trigger is in progress
|
||||
@ -618,7 +619,6 @@ inline void CompilerScratch::csb_repeat::deactivate()
|
||||
}
|
||||
|
||||
|
||||
|
||||
class StatusXcp
|
||||
{
|
||||
ISC_STATUS_ARRAY status;
|
||||
|
@ -4749,12 +4749,12 @@ void JAttachment::ping(IStatus* user_status)
|
||||
|
||||
void jrd_prc::releaseStatement(thread_db* tdbb)
|
||||
{
|
||||
if (getStatement())
|
||||
if (getStatement())
|
||||
{
|
||||
getStatement()->release(tdbb);
|
||||
setStatement(NULL);
|
||||
}
|
||||
|
||||
|
||||
setInputFormat(NULL);
|
||||
setOutputFormat(NULL);
|
||||
|
||||
|
@ -2669,9 +2669,7 @@ void MET_parse_sys_trigger(thread_db* tdbb, jrd_rel* relation)
|
||||
// hvlad: GTT with ON COMMIT DELETE ROWS clause is writable
|
||||
|
||||
if (dbb->readOnly() && !(relation->rel_flags & REL_temp_tran))
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
relation->rel_flags |= REL_sys_trigs_being_loaded;
|
||||
|
||||
@ -3074,12 +3072,10 @@ jrd_prc* MET_procedure(thread_db* tdbb, int id, bool noscan, USHORT flags)
|
||||
{
|
||||
delete csb;
|
||||
|
||||
if (procedure->getStatement()) {
|
||||
if (procedure->getStatement())
|
||||
procedure->releaseStatement(tdbb);
|
||||
}
|
||||
else {
|
||||
else
|
||||
attachment->deletePool(csb_pool);
|
||||
}
|
||||
|
||||
ERR_post(Arg::Gds(isc_bad_proc_BLR) << Arg::Str(procedure->getName().toString()));
|
||||
}
|
||||
|
@ -102,7 +102,7 @@ namespace Jrd
|
||||
class River
|
||||
{
|
||||
public:
|
||||
River(CompilerScratch* csb, RecordSource* rsb, RecordSourceNode* node, const StreamList& streams)//size_t count, UCHAR* streams)
|
||||
River(CompilerScratch* csb, RecordSource* rsb, RecordSourceNode* node, const StreamList& streams)
|
||||
: m_rsb(rsb), m_node(node), m_streams(csb->csb_pool)
|
||||
{
|
||||
//m_streams.resize(count);
|
||||
@ -133,14 +133,16 @@ namespace Jrd
|
||||
return m_rsb;
|
||||
}
|
||||
|
||||
//size_t getStreamCount() const
|
||||
//{
|
||||
// return m_streams.getCount();
|
||||
//}
|
||||
/***
|
||||
size_t getStreamCount() const
|
||||
{
|
||||
return m_streams.getCount();
|
||||
}
|
||||
***/
|
||||
|
||||
const StreamList& getStreams() const
|
||||
{
|
||||
return m_streams; //.begin();
|
||||
return m_streams;
|
||||
}
|
||||
|
||||
void activate(CompilerScratch* csb)
|
||||
|
@ -47,7 +47,6 @@
|
||||
#include "../jrd/exe.h"
|
||||
#include "../jrd/extds/ExtDS.h"
|
||||
#include "../jrd/lls.h"
|
||||
//#include "../jrd/rse.h"
|
||||
#include "../jrd/scl.h"
|
||||
#include "../jrd/req.h"
|
||||
#include "../jrd/blb.h"
|
||||
|
@ -275,7 +275,7 @@ Sort* SortedStream::init(thread_db* tdbb) const
|
||||
{
|
||||
StreamType stream = INVALID_STREAM;
|
||||
|
||||
const SortMap::Item* const end_item = m_map->items.end();//.begin() + m_map->items.getCount();
|
||||
const SortMap::Item* const end_item = m_map->items.end();
|
||||
for (const SortMap::Item* item = m_map->items.begin(); item < end_item; item++)
|
||||
{
|
||||
if (item->node && !item->node->is<FieldNode>())
|
||||
|
@ -1119,7 +1119,7 @@ void LockManager::acquire_shmem(SRQ_PTR owner_offset)
|
||||
locked = true;
|
||||
break;
|
||||
}
|
||||
|
||||
|
||||
m_blockage = true;
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user