8
0
mirror of https://github.com/FirebirdSQL/firebird.git synced 2025-02-02 10:00:38 +01:00

Merge remote-tracking branch 'origin/master' into work/core-6322-rebase

This commit is contained in:
Adriano dos Santos Fernandes 2020-06-16 23:03:07 -03:00
commit ea2bc54f05
182 changed files with 2988 additions and 1922 deletions

View File

@ -1,7 +1,7 @@
#!/bin/sh
# install - install a program, script, or datafile
scriptversion=2016-01-11.22; # UTC
scriptversion=2018-03-11.20; # UTC
# This originates from X11R5 (mit/util/scripts/install.sh), which was
# later released in X11R6 (xc/config/util/install.sh) with the
@ -271,15 +271,18 @@ do
fi
dst=$dst_arg
# If destination is a directory, append the input filename; won't work
# if double slashes aren't ignored.
# If destination is a directory, append the input filename.
if test -d "$dst"; then
if test "$is_target_a_directory" = never; then
echo "$0: $dst_arg: Is a directory" >&2
exit 1
fi
dstdir=$dst
dst=$dstdir/`basename "$src"`
dstbase=`basename "$src"`
case $dst in
*/) dst=$dst$dstbase;;
*) dst=$dst/$dstbase;;
esac
dstdir_status=0
else
dstdir=`dirname "$dst"`
@ -288,6 +291,11 @@ do
fi
fi
case $dstdir in
*/) dstdirslash=$dstdir;;
*) dstdirslash=$dstdir/;;
esac
obsolete_mkdir_used=false
if test $dstdir_status != 0; then
@ -324,34 +332,43 @@ do
# is incompatible with FreeBSD 'install' when (umask & 300) != 0.
;;
*)
# Note that $RANDOM variable is not portable (e.g. dash); Use it
# here however when possible just to lower collision chance.
tmpdir=${TMPDIR-/tmp}/ins$RANDOM-$$
trap 'ret=$?; rmdir "$tmpdir/d" "$tmpdir" 2>/dev/null; exit $ret' 0
trap 'ret=$?; rmdir "$tmpdir/a/b" "$tmpdir/a" "$tmpdir" 2>/dev/null; exit $ret' 0
# Because "mkdir -p" follows existing symlinks and we likely work
# directly in world-writeable /tmp, make sure that the '$tmpdir'
# directory is successfully created first before we actually test
# 'mkdir -p' feature.
if (umask $mkdir_umask &&
exec $mkdirprog $mkdir_mode -p -- "$tmpdir/d") >/dev/null 2>&1
$mkdirprog $mkdir_mode "$tmpdir" &&
exec $mkdirprog $mkdir_mode -p -- "$tmpdir/a/b") >/dev/null 2>&1
then
if test -z "$dir_arg" || {
# Check for POSIX incompatibilities with -m.
# HP-UX 11.23 and IRIX 6.5 mkdir -m -p sets group- or
# other-writable bit of parent directory when it shouldn't.
# FreeBSD 6.1 mkdir -m -p sets mode of existing directory.
ls_ld_tmpdir=`ls -ld "$tmpdir"`
test_tmpdir="$tmpdir/a"
ls_ld_tmpdir=`ls -ld "$test_tmpdir"`
case $ls_ld_tmpdir in
d????-?r-*) different_mode=700;;
d????-?--*) different_mode=755;;
*) false;;
esac &&
$mkdirprog -m$different_mode -p -- "$tmpdir" && {
ls_ld_tmpdir_1=`ls -ld "$tmpdir"`
$mkdirprog -m$different_mode -p -- "$test_tmpdir" && {
ls_ld_tmpdir_1=`ls -ld "$test_tmpdir"`
test "$ls_ld_tmpdir" = "$ls_ld_tmpdir_1"
}
}
then posix_mkdir=:
fi
rmdir "$tmpdir/d" "$tmpdir"
rmdir "$tmpdir/a/b" "$tmpdir/a" "$tmpdir"
else
# Remove any dirs left behind by ancient mkdir implementations.
rmdir ./$mkdir_mode ./-p ./-- 2>/dev/null
rmdir ./$mkdir_mode ./-p ./-- "$tmpdir" 2>/dev/null
fi
trap '' 0;;
esac;;
@ -427,8 +444,8 @@ do
else
# Make a couple of temp file names in the proper directory.
dsttmp=$dstdir/_inst.$$_
rmtmp=$dstdir/_rm.$$_
dsttmp=${dstdirslash}_inst.$$_
rmtmp=${dstdirslash}_rm.$$_
# Trap to clean up those temp files at exit.
trap 'ret=$?; rm -f "$dsttmp" "$rmtmp" && exit $ret' 0
@ -493,7 +510,7 @@ do
done
# Local variables:
# eval: (add-hook 'write-file-hooks 'time-stamp)
# eval: (add-hook 'before-save-hook 'time-stamp)
# time-stamp-start: "scriptversion="
# time-stamp-format: "%:y-%02m-%02d.%02H"
# time-stamp-time-zone: "UTC0"

View File

@ -36,7 +36,7 @@
<ClCompile Include="..\..\..\src\common\classes\init.cpp" />
<ClCompile Include="..\..\..\src\common\classes\InternalMessageBuffer.cpp" />
<ClCompile Include="..\..\..\src\common\classes\locks.cpp" />
<ClCompile Include="..\..\..\src\common\classes\MetaName.cpp" />
<ClCompile Include="..\..\..\src\common\classes\MetaString.cpp" />
<ClCompile Include="..\..\..\src\common\classes\MsgPrint.cpp" />
<ClCompile Include="..\..\..\src\common\classes\NoThrowTimeStamp.cpp" />
<ClCompile Include="..\..\..\src\common\classes\ParsedList.cpp" />
@ -135,7 +135,7 @@
<ClInclude Include="..\..\..\src\common\classes\init.h" />
<ClInclude Include="..\..\..\src\common\classes\InternalMessageBuffer.h" />
<ClInclude Include="..\..\..\src\common\classes\locks.h" />
<ClInclude Include="..\..\..\src\common\classes\MetaName.h" />
<ClInclude Include="..\..\..\src\common\classes\MetaString.h" />
<ClInclude Include="..\..\..\src\common\classes\MsgPrint.h" />
<ClInclude Include="..\..\..\src\common\classes\NestConst.h" />
<ClInclude Include="..\..\..\src\common\classes\NoThrowTimeStamp.h" />

View File

@ -120,7 +120,7 @@
<ClCompile Include="..\..\..\src\common\classes\locks.cpp">
<Filter>classes</Filter>
</ClCompile>
<ClCompile Include="..\..\..\src\common\classes\MetaName.cpp">
<ClCompile Include="..\..\..\src\common\classes\MetaString.cpp">
<Filter>classes</Filter>
</ClCompile>
<ClCompile Include="..\..\..\src\common\classes\MsgPrint.cpp">
@ -422,7 +422,7 @@
<ClInclude Include="..\..\..\src\common\classes\locks.h">
<Filter>headers</Filter>
</ClInclude>
<ClInclude Include="..\..\..\src\common\classes\MetaName.h">
<ClInclude Include="..\..\..\src\common\classes\MetaString.h">
<Filter>headers</Filter>
</ClInclude>
<ClInclude Include="..\..\..\src\common\classes\MsgPrint.h">

View File

@ -92,6 +92,7 @@
<ClCompile Include="..\..\..\src\jrd\JrdStatement.cpp" />
<ClCompile Include="..\..\..\src\jrd\lck.cpp" />
<ClCompile Include="..\..\..\src\jrd\Mapping.cpp" />
<ClCompile Include="..\..\..\src\jrd\MetaName.cpp" />
<ClCompile Include="..\..\..\src\jrd\Monitoring.cpp" />
<ClCompile Include="..\..\..\src\jrd\mov.cpp" />
<ClCompile Include="..\..\..\src\jrd\nbak.cpp" />
@ -279,6 +280,7 @@
<ClInclude Include="..\..\..\src\jrd\license.h" />
<ClInclude Include="..\..\..\src\jrd\lls.h" />
<ClInclude Include="..\..\..\src\jrd\Mapping.h" />
<ClInclude Include="..\..\..\src\jrd\MetaName.h" />
<ClInclude Include="..\..\..\src\jrd\Monitoring.h" />
<ClInclude Include="..\..\..\src\jrd\met.h" />
<ClInclude Include="..\..\..\src\jrd\met_proto.h" />
@ -297,6 +299,7 @@
<ClInclude Include="..\..\..\src\jrd\pag_proto.h" />
<ClInclude Include="..\..\..\src\jrd\par_proto.h" />
<ClInclude Include="..\..\..\src\jrd\PreparedStatement.h" />
<ClInclude Include="..\..\..\src\jrd\QualifiedName.h" />
<ClInclude Include="..\..\..\src\jrd\que.h" />
<ClInclude Include="..\..\..\src\jrd\RandomGenerator.h" />
<ClInclude Include="..\..\..\src\jrd\RecordBuffer.h" />

View File

@ -495,6 +495,9 @@
<ClCompile Include="..\..\..\src\jrd\Coercion.cpp">
<Filter>JRD files</Filter>
</ClCompile>
<ClCompile Include="..\..\..\src\jrd\MetaName.cpp">
<Filter>JRD files</Filter>
</ClCompile>
</ItemGroup>
<ItemGroup>
<ClInclude Include="..\..\..\src\jrd\recsrc\RecordSource.h">
@ -1028,6 +1031,12 @@
<ClInclude Include="..\..\..\src\jrd\Coercion.h">
<Filter>Header files</Filter>
</ClInclude>
<ClInclude Include="..\..\..\src\jrd\MetaName.h">
<Filter>Header files</Filter>
</ClInclude>
<ClInclude Include="..\..\..\src\jrd\QualifiedName.h">
<Filter>Header files</Filter>
</ClInclude>
</ItemGroup>
<ItemGroup>
<None Include="..\..\..\src\dsql\DdlNodes.epp">

View File

@ -36,7 +36,7 @@
<ClCompile Include="..\..\..\src\common\classes\init.cpp" />
<ClCompile Include="..\..\..\src\common\classes\InternalMessageBuffer.cpp" />
<ClCompile Include="..\..\..\src\common\classes\locks.cpp" />
<ClCompile Include="..\..\..\src\common\classes\MetaName.cpp" />
<ClCompile Include="..\..\..\src\common\classes\MetaString.cpp" />
<ClCompile Include="..\..\..\src\common\classes\MsgPrint.cpp" />
<ClCompile Include="..\..\..\src\common\classes\NoThrowTimeStamp.cpp" />
<ClCompile Include="..\..\..\src\common\classes\ParsedList.cpp" />
@ -135,7 +135,7 @@
<ClInclude Include="..\..\..\src\common\classes\init.h" />
<ClInclude Include="..\..\..\src\common\classes\InternalMessageBuffer.h" />
<ClInclude Include="..\..\..\src\common\classes\locks.h" />
<ClInclude Include="..\..\..\src\common\classes\MetaName.h" />
<ClInclude Include="..\..\..\src\common\classes\MetaString.h" />
<ClInclude Include="..\..\..\src\common\classes\MsgPrint.h" />
<ClInclude Include="..\..\..\src\common\classes\NestConst.h" />
<ClInclude Include="..\..\..\src\common\classes\NoThrowTimeStamp.h" />

View File

@ -120,7 +120,7 @@
<ClCompile Include="..\..\..\src\common\classes\locks.cpp">
<Filter>classes</Filter>
</ClCompile>
<ClCompile Include="..\..\..\src\common\classes\MetaName.cpp">
<ClCompile Include="..\..\..\src\common\classes\MetaString.cpp">
<Filter>classes</Filter>
</ClCompile>
<ClCompile Include="..\..\..\src\common\classes\MsgPrint.cpp">
@ -422,7 +422,7 @@
<ClInclude Include="..\..\..\src\common\classes\locks.h">
<Filter>headers</Filter>
</ClInclude>
<ClInclude Include="..\..\..\src\common\classes\MetaName.h">
<ClInclude Include="..\..\..\src\common\classes\MetaString.h">
<Filter>headers</Filter>
</ClInclude>
<ClInclude Include="..\..\..\src\common\classes\MsgPrint.h">

View File

@ -92,6 +92,7 @@
<ClCompile Include="..\..\..\src\jrd\JrdStatement.cpp" />
<ClCompile Include="..\..\..\src\jrd\lck.cpp" />
<ClCompile Include="..\..\..\src\jrd\Mapping.cpp" />
<ClCompile Include="..\..\..\src\jrd\MetaName.cpp" />
<ClCompile Include="..\..\..\src\jrd\Monitoring.cpp" />
<ClCompile Include="..\..\..\src\jrd\mov.cpp" />
<ClCompile Include="..\..\..\src\jrd\nbak.cpp" />
@ -279,6 +280,7 @@
<ClInclude Include="..\..\..\src\jrd\license.h" />
<ClInclude Include="..\..\..\src\jrd\lls.h" />
<ClInclude Include="..\..\..\src\jrd\Mapping.h" />
<ClInclude Include="..\..\..\src\jrd\MetaName.h" />
<ClInclude Include="..\..\..\src\jrd\Monitoring.h" />
<ClInclude Include="..\..\..\src\jrd\met.h" />
<ClInclude Include="..\..\..\src\jrd\met_proto.h" />
@ -297,6 +299,7 @@
<ClInclude Include="..\..\..\src\jrd\pag_proto.h" />
<ClInclude Include="..\..\..\src\jrd\par_proto.h" />
<ClInclude Include="..\..\..\src\jrd\PreparedStatement.h" />
<ClInclude Include="..\..\..\src\jrd\QualifiedName.h" />
<ClInclude Include="..\..\..\src\jrd\que.h" />
<ClInclude Include="..\..\..\src\jrd\RandomGenerator.h" />
<ClInclude Include="..\..\..\src\jrd\RecordBuffer.h" />

View File

@ -495,6 +495,9 @@
<ClCompile Include="..\..\..\src\jrd\Coercion.cpp">
<Filter>JRD files</Filter>
</ClCompile>
<ClCompile Include="..\..\..\src\jrd\MetaName.cpp">
<Filter>JRD files</Filter>
</ClCompile>
</ItemGroup>
<ItemGroup>
<ClInclude Include="..\..\..\src\jrd\recsrc\RecordSource.h">
@ -1028,6 +1031,12 @@
<ClInclude Include="..\..\..\src\jrd\Coercion.h">
<Filter>Header files</Filter>
</ClInclude>
<ClInclude Include="..\..\..\src\jrd\MetaName.h">
<Filter>Header files</Filter>
</ClInclude>
<ClInclude Include="..\..\..\src\jrd\QualifiedName.h">
<Filter>Header files</Filter>
</ClInclude>
</ItemGroup>
<ItemGroup>
<None Include="..\..\..\src\dsql\DdlNodes.epp">

View File

@ -45,6 +45,17 @@ New items for isc_database_info
isc_dpb_addr_flag_conn_encrypted - connection is encrypted;
fb_info_wire_crypt - name of connection encryption plugin.
6. fb_info_provider_features:
return list of features supported by current connection's provider.
Each byte in returned array shall be one of following info_provider_features:
fb_feature_multi_statements - multiple prepared statements in single attachment
fb_feature_multi_transactions - multiple concurrent transactions in single attachment
fb_feature_named_parameters - query parameters can be named
fb_feature_session_reset - ALTER SESSION RESET is supported
fb_feature_read_consistency - read consistency TIL is supported
fb_feature_statement_timeout - statement timeout is supported
New items for isc_transaction_info:

View File

@ -1305,7 +1305,7 @@ void PascalGenerator::generate()
fprintf(out, "\t%sImpl_vTable := %sVTable.create;\n",
escapeName(interface->name, true).c_str(), escapeName(interface->name).c_str());
fprintf(out, "\t%sImpl_vTable.version := %d;\n",
escapeName(interface->name, true).c_str(), (int) methods.size());
escapeName(interface->name, true).c_str(), interface->version);
for (deque<Method*>::iterator j = methods.begin(); j != methods.end(); ++j)
{

View File

@ -522,13 +522,13 @@ initialization
DisposableImpl_vTable.dispose := @DisposableImpl_disposeDispatcher;
StatusImpl_vTable := StatusVTable.create;
StatusImpl_vTable.version := 3;
StatusImpl_vTable.version := 2;
StatusImpl_vTable.dispose := @StatusImpl_disposeDispatcher;
StatusImpl_vTable.getCode := @StatusImpl_getCodeDispatcher;
StatusImpl_vTable.setCode := @StatusImpl_setCodeDispatcher;
FactoryImpl_vTable := FactoryVTable.create;
FactoryImpl_vTable.version := 5;
FactoryImpl_vTable.version := 2;
FactoryImpl_vTable.dispose := @FactoryImpl_disposeDispatcher;
FactoryImpl_vTable.createStatus := @FactoryImpl_createStatusDispatcher;
FactoryImpl_vTable.createCalculator := @FactoryImpl_createCalculatorDispatcher;
@ -536,7 +536,7 @@ initialization
FactoryImpl_vTable.createBrokenCalculator := @FactoryImpl_createBrokenCalculatorDispatcher;
CalculatorImpl_vTable := CalculatorVTable.create;
CalculatorImpl_vTable.version := 5;
CalculatorImpl_vTable.version := 4;
CalculatorImpl_vTable.dispose := @CalculatorImpl_disposeDispatcher;
CalculatorImpl_vTable.sum := @CalculatorImpl_sumDispatcher;
CalculatorImpl_vTable.getMemory := @CalculatorImpl_getMemoryDispatcher;
@ -544,7 +544,7 @@ initialization
CalculatorImpl_vTable.sumAndStore := @CalculatorImpl_sumAndStoreDispatcher;
Calculator2Impl_vTable := Calculator2VTable.create;
Calculator2Impl_vTable.version := 8;
Calculator2Impl_vTable.version := 6;
Calculator2Impl_vTable.dispose := @Calculator2Impl_disposeDispatcher;
Calculator2Impl_vTable.sum := @Calculator2Impl_sumDispatcher;
Calculator2Impl_vTable.getMemory := @Calculator2Impl_getMemoryDispatcher;

View File

@ -41,7 +41,7 @@
#include "../common/UtilSvc.h"
#include "../common/classes/array.h"
#include "../common/classes/fb_pair.h"
#include "../common/classes/MetaName.h"
#include "../common/classes/MetaString.h"
#include "../common/SimilarToRegex.h"
#include "../common/status.h"
#include "../common/sha.h"
@ -1168,7 +1168,7 @@ public:
Firebird::FbLocalStatus status_vector;
Firebird::ThrowLocalStatus throwStatus;
Firebird::Array<Firebird::Pair<Firebird::NonPooled<Firebird::MetaName, Firebird::MetaName> > >
Firebird::Array<Firebird::Pair<Firebird::NonPooled<Firebird::MetaString, Firebird::MetaString> > >
defaultCollations;
Firebird::UtilSvc* uSvc;
ULONG verboseInterval; // How many records should be backed up or restored before we show this message

View File

@ -2473,7 +2473,7 @@ bool get_character_set(BurpGlobals* tdgbl)
!X.RDB$CHARACTER_SET_NAME.NULL)
{
tdgbl->defaultCollations.add(
Firebird::Pair<Firebird::NonPooled<Firebird::MetaName, Firebird::MetaName> >(
Firebird::Pair<Firebird::NonPooled<Firebird::MetaString, Firebird::MetaString> >(
X.RDB$CHARACTER_SET_NAME, X.RDB$DEFAULT_COLLATE_NAME));
throw AbortException(); // prevent the STORE
}
@ -2572,7 +2572,7 @@ bool get_character_set(BurpGlobals* tdgbl)
!X.RDB$CHARACTER_SET_NAME.NULL)
{
tdgbl->defaultCollations.add(
Firebird::Pair<Firebird::NonPooled<Firebird::MetaName, Firebird::MetaName> >(
Firebird::Pair<Firebird::NonPooled<Firebird::MetaString, Firebird::MetaString> >(
X.RDB$CHARACTER_SET_NAME, X.RDB$DEFAULT_COLLATE_NAME));
throw AbortException(); // prevent the STORE
}

View File

@ -35,7 +35,6 @@
#include <string.h>
#include "classes/fb_string.h"
#include "classes/MetaName.h"
extern "C"
{
@ -50,9 +49,9 @@ struct DecFloatConstant
const char* name;
USHORT val;
static const DecFloatConstant* getByText(const MetaName& text, const DecFloatConstant* constants, unsigned offset)
static const DecFloatConstant* getByText(const char* text, const DecFloatConstant* constants, unsigned offset)
{
NoCaseString name(text.c_str(), text.length());
NoCaseString name(text);
for (const DecFloatConstant* dfConst = constants; dfConst->name; ++dfConst)
{

View File

@ -35,7 +35,6 @@
#include <string.h>
#include "classes/fb_string.h"
#include "classes/MetaName.h"
#include "../../extern/ttmath/ttmath.h"

View File

@ -25,7 +25,7 @@
#include "firebird.h"
#include "../common/MsgMetadata.h"
#include "../common/utils_proto.h"
#include "../common/classes/MetaName.h"
#include "../common/classes/MetaString.h"
#include "../common/StatusHolder.h"
#include "../jrd/align.h"
@ -335,10 +335,10 @@ void MetadataBuilder::indexError(unsigned index, const char* functionName)
// Add an item based on a descriptor.
void MsgMetadata::addItem(const MetaName& name, bool nullable, const dsc& desc)
void MsgMetadata::addItem(const MetaString& name, bool nullable, const dsc& desc)
{
Item& item = items.add();
item.field = name.c_str();
item.field.assign(name.c_str(), name.length());
item.nullable = nullable;
SLONG sqlLen, sqlSubType, sqlScale, sqlType;

View File

@ -35,6 +35,7 @@
namespace Firebird {
class MetadataBuilder;
class MetaString;
class StatementMetadata;
class MetadataFromBlr;
@ -283,7 +284,7 @@ public:
}
public:
void addItem(const MetaName& name, bool nullable, const dsc& desc);
void addItem(const MetaString& name, bool nullable, const dsc& desc);
unsigned makeOffsets();
private:

View File

@ -852,7 +852,7 @@ bool SimilarToRegex::matches(const char* buffer, unsigned bufferLen, Array<Match
{
matchPosArray->clear();
for (const auto resSp : resSps)
for (const auto& resSp : resSps)
{
matchPosArray->push(MatchPos{
static_cast<unsigned>(resSp.data() - sp.begin()),

View File

@ -30,7 +30,7 @@
#include "../common/StatusArg.h"
#include "../common/utils_proto.h"
#include "../common/classes/MetaName.h"
#include "../common/classes/MetaString.h"
#include "../common/classes/alloc.h"
#include "fb_exception.h"
#include "gen/iberror.h"
@ -312,7 +312,7 @@ void StatusVector::ImplStatusVector::shiftLeft(const AbstractString& text) throw
shiftLeft(Str(text));
}
void StatusVector::ImplStatusVector::shiftLeft(const MetaName& text) throw()
void StatusVector::ImplStatusVector::shiftLeft(const MetaString& text) throw()
{
shiftLeft(Str(text));
}
@ -439,7 +439,7 @@ Str::Str(const char* text) throw() :
Str::Str(const AbstractString& text) throw() :
Base(isc_arg_string, (ISC_STATUS)(IPTR) text.c_str()) { }
Str::Str(const MetaName& text) throw() :
Str::Str(const MetaString& text) throw() :
Base(isc_arg_string, (ISC_STATUS)(IPTR) text.c_str()) { }
SqlState::SqlState(const char* text) throw() :

View File

@ -37,7 +37,7 @@
namespace Firebird {
class AbstractString;
class MetaName;
class MetaString;
class Exception;
namespace Arg {
@ -80,7 +80,7 @@ protected:
virtual void shiftLeft(const Warning&) throw() { }
virtual void shiftLeft(const char*) throw() { }
virtual void shiftLeft(const AbstractString&) throw() { }
virtual void shiftLeft(const MetaName&) throw() { }
virtual void shiftLeft(const MetaString&) throw() { }
virtual bool compare(const StatusVector& /*v*/) const throw() { return false; }
@ -137,7 +137,7 @@ protected:
virtual void shiftLeft(const Warning& arg) throw();
virtual void shiftLeft(const char* text) throw();
virtual void shiftLeft(const AbstractString& text) throw();
virtual void shiftLeft(const MetaName& text) throw();
virtual void shiftLeft(const MetaString& text) throw();
virtual bool compare(const StatusVector& v) const throw();
ImplStatusVector(ISC_STATUS k, ISC_STATUS c) throw()
@ -211,7 +211,7 @@ public:
return *this;
}
StatusVector& operator<<(const MetaName& text) throw()
StatusVector& operator<<(const MetaString& text) throw()
{
implementation->shiftLeft(text);
return *this;
@ -248,7 +248,7 @@ class Str : public Base
public:
explicit Str(const char* text) throw();
explicit Str(const AbstractString& text) throw();
explicit Str(const MetaName& text) throw();
explicit Str(const MetaString& text) throw();
};
class Num : public Base

View File

@ -30,7 +30,7 @@
#ifndef JRD_TEXTTYPE_H
#define JRD_TEXTTYPE_H
#include "../common/classes/MetaName.h"
#include "../common/classes/MetaString.h"
struct texttype;
@ -96,7 +96,7 @@ public:
USHORT getFlags() const;
public:
Firebird::MetaName name;
Firebird::MetaString name;
protected:
texttype* tt;

View File

@ -25,8 +25,8 @@
#include "iberror.h"
#include "../common/classes/fb_string.h"
#include "../common/classes/MetaName.h"
#include "../common/StatusArg.h"
#include "../jrd/constants.h"
namespace Firebird {
@ -163,7 +163,8 @@ public:
seekForward(len);
}
void getMetaName(MetaName& name)
template <typename STR>
void getMetaName(STR& name)
{
string str;
getString(str);

View File

@ -24,7 +24,7 @@
#include "../common/classes/alloc.h"
#include "../common/classes/array.h"
#include "../common/classes/fb_string.h"
#include "../common/classes/MetaName.h"
#include "../common/classes/MetaString.h"
#include "../common/StatusArg.h"
namespace Firebird {
@ -108,12 +108,8 @@ public:
void appendString(UCHAR verb, const char* string, USHORT len);
void appendString(UCHAR verb, const Firebird::MetaName& name)
{
appendString(verb, name.c_str(), static_cast<USHORT>(name.length()));
}
void appendString(UCHAR verb, const Firebird::string& name)
template <class S>
void appendString(UCHAR verb, const S& name)
{
appendString(verb, name.c_str(), static_cast<USHORT>(name.length()));
}

View File

@ -29,7 +29,6 @@
#include "firebird.h"
#include "../common/classes/ClumpletReader.h"
#include "../common/classes/MetaName.h"
#include "fb_exception.h"
#include "ibase.h"
@ -859,14 +858,6 @@ string& ClumpletReader::getString(string& str) const
return str;
}
MetaName& ClumpletReader::getString(MetaName& str) const
{
const UCHAR* ptr = getBytes();
const FB_SIZE_T length = getClumpLength();
str.assign(reinterpret_cast<const char*>(ptr), length);
return str;
}
PathName& ClumpletReader::getPath(PathName& str) const
{
const UCHAR* ptr = getBytes();

View File

@ -40,8 +40,6 @@
namespace Firebird {
class MetaName;
// This class provides read access for clumplet structure
// Note: it doesn't make a copy of buffer it reads
class ClumpletReader : protected AutoStorage
@ -103,7 +101,6 @@ public:
bool getBoolean() const;
SINT64 getBigInt() const;
string& getString(string& str) const;
MetaName& getString(MetaName& str) const;
PathName& getPath(PathName& str) const;
void getData(UCharBuffer& data) const;
const UCHAR* getBytes() const;
@ -112,6 +109,15 @@ public:
ISC_TIME getTime() const { return getInt(); }
ISC_DATE getDate() const { return getInt(); }
template <typename STR>
STR& getString(STR& str) const
{
const UCHAR* ptr = getBytes();
const FB_SIZE_T length = getClumpLength();
str.assign(reinterpret_cast<const char*>(ptr), length);
return str;
}
// get the most generic representation of clumplet
SingleClumplet getClumplet() const;

View File

@ -30,7 +30,7 @@
#include "firebird.h"
#include "../common/classes/ClumpletWriter.h"
#include "../common/classes/MetaName.h"
#include "../common/classes/MetaString.h"
#include "fb_exception.h"
#include "ibase.h"
@ -245,21 +245,16 @@ void ClumpletWriter::insertTimeStamp(UCHAR tag, const ISC_TIMESTAMP value)
insertBytesLengthCheck(tag, bytes, sizeof(bytes));
}
void ClumpletWriter::insertString(UCHAR tag, const AbstractString& str)
{
insertString(tag, str.c_str(), str.length());
}
void ClumpletWriter::insertString(UCHAR tag, const MetaName& str)
{
insertString(tag, str.c_str(), str.length());
}
void ClumpletWriter::insertString(UCHAR tag, const char* str)
{
insertString(tag, str, strlen(str));
}
void ClumpletWriter::insertString(UCHAR tag, char* str)
{
insertString(tag, str, strlen(str));
}
void ClumpletWriter::insertString(UCHAR tag, const char* str, FB_SIZE_T length)
{
insertBytesLengthCheck(tag, str, length);

View File

@ -72,10 +72,9 @@ public:
void insertInt(UCHAR tag, const SLONG value);
void insertBigInt(UCHAR tag, const SINT64 value);
void insertBytes(UCHAR tag, const void* bytes, FB_SIZE_T length);
void insertString(UCHAR tag, const AbstractString& str);
void insertString(UCHAR tag, const MetaName& str);
void insertString(UCHAR tag, const char* str);
void insertString(UCHAR tag, const char* str, FB_SIZE_T length);
void insertString(UCHAR tag, const char* str);
void insertString(UCHAR tag, char* str);
void insertData(UCHAR tag, const UCharBuffer& data);
void insertByte(UCHAR tag, const UCHAR byte);
void insertTag(UCHAR tag);
@ -86,6 +85,12 @@ public:
void insertEndMarker(UCHAR tag);
void insertClumplet(const SingleClumplet& clumplet);
template <typename S>
void insertString(UCHAR tag, const S& str)
{
insertString(tag, str.c_str(), str.length());
}
// Delete currently selected clumplet from buffer
void deleteClumplet();
@ -113,6 +118,13 @@ private:
void create(const UCHAR* buffer, FB_SIZE_T buffLen, UCHAR tag);
static void toVaxInteger(UCHAR* ptr, FB_SIZE_T length, const SINT64 value);
};
/*
template <>
void ClumpletWriter::insertString(UCHAR tag, const char*& str)
{
insertString(tag, str, strlen(str));
}
*/
} // namespace Firebird

View File

@ -1,124 +0,0 @@
/*
* PROGRAM: Client/Server Common Code
* MODULE: MetaName.cpp
* DESCRIPTION: metadata name holder
*
* The contents of this file are subject to the Initial
* Developer's Public License Version 1.0 (the "License");
* you may not use this file except in compliance with the
* License. You may obtain a copy of the License at
* http://www.ibphoenix.com/main.nfs?a=ibphoenix&page=ibp_idpl.
*
* Software distributed under the License is distributed AS IS,
* WITHOUT WARRANTY OF ANY KIND, either express or implied.
* See the License for the specific language governing rights
* and limitations under the License.
*
* The Original Code was created by Alexander Peshkov
* for the Firebird Open Source RDBMS project.
*
* Copyright (c) 2005 Alexander Peshkov <peshkoff@mail.ru>
* and all contributors signed below.
*
* All Rights Reserved.
* Contributor(s): ______________________________________.
*
*
*/
#include "firebird.h"
#include <stdarg.h>
#include "../common/classes/MetaName.h"
namespace Firebird {
MetaName& MetaName::assign(const char* s, FB_SIZE_T l)
{
init();
if (s)
{
adjustLength(s, l);
count = l;
memcpy(data, s, l);
}
else {
count = 0;
}
return *this;
}
char* MetaName::getBuffer(const FB_SIZE_T l)
{
fb_assert (l < MAX_SQL_IDENTIFIER_SIZE);
init();
count = l;
return data;
}
int MetaName::compare(const char* s, FB_SIZE_T l) const
{
if (s)
{
adjustLength(s, l);
FB_SIZE_T x = length() < l ? length() : l;
int rc = memcmp(c_str(), s, x);
if (rc)
{
return rc;
}
}
return length() - l;
}
void MetaName::adjustLength(const char* const s, FB_SIZE_T& l)
{
fb_assert(s);
if (l > MAX_SQL_IDENTIFIER_LEN)
{
#ifdef DEV_BUILD
for (FB_SIZE_T i = MAX_SQL_IDENTIFIER_LEN; i < l; ++i)
fb_assert(s[i] == '\0' || s[i] == ' ');
#endif
l = MAX_SQL_IDENTIFIER_LEN;
}
while (l)
{
if (s[l - 1] != ' ')
{
break;
}
--l;
}
}
void MetaName::printf(const char* format, ...)
{
init();
va_list params;
va_start(params, format);
int l = VSNPRINTF(data, MAX_SQL_IDENTIFIER_LEN, format, params);
if (l < 0 || FB_SIZE_T(l) > MAX_SQL_IDENTIFIER_LEN)
{
l = MAX_SQL_IDENTIFIER_LEN;
}
data[l] = 0;
count = l;
va_end(params);
}
FB_SIZE_T MetaName::copyTo(char* to, FB_SIZE_T toSize) const
{
fb_assert(to);
fb_assert(toSize);
if (--toSize > length())
{
toSize = length();
}
memcpy(to, c_str(), toSize);
to[toSize] = 0;
return toSize;
}
} // namespace Firebird

View File

@ -0,0 +1,124 @@
/*
* PROGRAM: Client/Server Common Code
* MODULE: MetaString.cpp
* DESCRIPTION: metadata name holder
*
* The contents of this file are subject to the Initial
* Developer's Public License Version 1.0 (the "License");
* you may not use this file except in compliance with the
* License. You may obtain a copy of the License at
* http://www.ibphoenix.com/main.nfs?a=ibphoenix&page=ibp_idpl.
*
* Software distributed under the License is distributed AS IS,
* WITHOUT WARRANTY OF ANY KIND, either express or implied.
* See the License for the specific language governing rights
* and limitations under the License.
*
* The Original Code was created by Alexander Peshkov
* for the Firebird Open Source RDBMS project.
*
* Copyright (c) 2005 Alexander Peshkov <peshkoff@mail.ru>
* and all contributors signed below.
*
* All Rights Reserved.
* Contributor(s): ______________________________________.
*
*
*/
#include "firebird.h"
#include <stdarg.h>
#include "../common/classes/MetaString.h"
namespace Firebird {
MetaString& MetaString::assign(const char* s, FB_SIZE_T l)
{
init();
if (s)
{
adjustLength(s, l);
count = l;
memcpy(data, s, l);
}
else {
count = 0;
}
return *this;
}
char* MetaString::getBuffer(const FB_SIZE_T l)
{
fb_assert (l < MAX_SQL_IDENTIFIER_SIZE);
init();
count = l;
return data;
}
int MetaString::compare(const char* s, FB_SIZE_T l) const
{
if (s)
{
adjustLength(s, l);
FB_SIZE_T x = length() < l ? length() : l;
int rc = memcmp(c_str(), s, x);
if (rc)
{
return rc;
}
}
return length() - l;
}
void MetaString::adjustLength(const char* const s, FB_SIZE_T& l)
{
fb_assert(s);
if (l > MAX_SQL_IDENTIFIER_LEN)
{
#ifdef DEV_BUILD
for (FB_SIZE_T i = MAX_SQL_IDENTIFIER_LEN; i < l; ++i)
fb_assert(s[i] == '\0' || s[i] == ' ');
#endif
l = MAX_SQL_IDENTIFIER_LEN;
}
while (l)
{
if (s[l - 1] != ' ')
{
break;
}
--l;
}
}
void MetaString::printf(const char* format, ...)
{
init();
va_list params;
va_start(params, format);
int l = VSNPRINTF(data, MAX_SQL_IDENTIFIER_LEN, format, params);
if (l < 0 || FB_SIZE_T(l) > MAX_SQL_IDENTIFIER_LEN)
{
l = MAX_SQL_IDENTIFIER_LEN;
}
data[l] = 0;
count = l;
va_end(params);
}
FB_SIZE_T MetaString::copyTo(char* to, FB_SIZE_T toSize) const
{
fb_assert(to);
fb_assert(toSize);
if (--toSize > length())
{
toSize = length();
}
memcpy(to, c_str(), toSize);
to[toSize] = 0;
return toSize;
}
} // namespace Firebird

View File

@ -1,6 +1,6 @@
/*
* PROGRAM: Client/Server Common Code
* MODULE: MetaName.h
* MODULE: MetaString.h
* DESCRIPTION: metadata name holder
*
* The contents of this file are subject to the Initial
@ -26,8 +26,8 @@
*
*/
#ifndef METANAME_H
#define METANAME_H
#ifndef METASTRING_H
#define METASTRING_H
#include "../common/classes/fb_string.h"
#include "../common/classes/fb_pair.h"
@ -39,7 +39,7 @@
namespace Firebird {
class MetaName
class MetaString
{
private:
char data[MAX_SQL_IDENTIFIER_SIZE];
@ -49,7 +49,7 @@ private:
{
memset(data, 0, MAX_SQL_IDENTIFIER_SIZE);
}
MetaName& set(const MetaName& m)
MetaString& set(const MetaString& m)
{
memcpy(data, m.data, MAX_SQL_IDENTIFIER_SIZE);
count = m.count;
@ -57,22 +57,22 @@ private:
}
public:
MetaName() { init(); count = 0; }
MetaName(const char* s) { assign(s); }
MetaName(const char* s, FB_SIZE_T l) { assign(s, l); }
MetaName(const MetaName& m) { set(m); }
MetaName(const AbstractString& s) { assign(s.c_str(), s.length()); }
explicit MetaName(MemoryPool&) { init(); count = 0; }
MetaName(MemoryPool&, const char* s) { assign(s); }
MetaName(MemoryPool&, const char* s, FB_SIZE_T l) { assign(s, l); }
MetaName(MemoryPool&, const MetaName& m) { set(m); }
MetaName(MemoryPool&, const AbstractString& s) { assign(s.c_str(), s.length()); }
MetaString() { init(); count = 0; }
MetaString(const char* s) { assign(s); }
MetaString(const char* s, FB_SIZE_T l) { assign(s, l); }
MetaString(const MetaString& m) { set(m); }
MetaString(const AbstractString& s) { assign(s.c_str(), s.length()); }
explicit MetaString(MemoryPool&) { init(); count = 0; }
MetaString(MemoryPool&, const char* s) { assign(s); }
MetaString(MemoryPool&, const char* s, FB_SIZE_T l) { assign(s, l); }
MetaString(MemoryPool&, const MetaString& m) { set(m); }
MetaString(MemoryPool&, const AbstractString& s) { assign(s.c_str(), s.length()); }
MetaName& assign(const char* s, FB_SIZE_T l);
MetaName& assign(const char* s) { return assign(s, s ? fb_strlen(s) : 0); }
MetaName& operator=(const char* s) { return assign(s); }
MetaName& operator=(const AbstractString& s) { return assign(s.c_str(), s.length()); }
MetaName& operator=(const MetaName& m) { return set(m); }
MetaString& assign(const char* s, FB_SIZE_T l);
MetaString& assign(const char* s) { return assign(s, s ? fb_strlen(s) : 0); }
MetaString& operator=(const char* s) { return assign(s); }
MetaString& operator=(const AbstractString& s) { return assign(s.c_str(), s.length()); }
MetaString& operator=(const MetaString& m) { return set(m); }
char* getBuffer(const FB_SIZE_T l);
FB_SIZE_T length() const { return count; }
@ -90,18 +90,18 @@ public:
int compare(const char* s, FB_SIZE_T l) const;
int compare(const char* s) const { return compare(s, s ? fb_strlen(s) : 0); }
int compare(const AbstractString& s) const { return compare(s.c_str(), s.length()); }
int compare(const MetaName& m) const { return memcmp(data, m.data, MAX_SQL_IDENTIFIER_SIZE); }
int compare(const MetaString& m) const { return memcmp(data, m.data, MAX_SQL_IDENTIFIER_SIZE); }
bool operator==(const char* s) const { return compare(s) == 0; }
bool operator!=(const char* s) const { return compare(s) != 0; }
bool operator==(const AbstractString& s) const { return compare(s) == 0; }
bool operator!=(const AbstractString& s) const { return compare(s) != 0; }
bool operator==(const MetaName& m) const { return compare(m) == 0; }
bool operator!=(const MetaName& m) const { return compare(m) != 0; }
bool operator<=(const MetaName& m) const { return compare(m) <= 0; }
bool operator>=(const MetaName& m) const { return compare(m) >= 0; }
bool operator< (const MetaName& m) const { return compare(m) < 0; }
bool operator> (const MetaName& m) const { return compare(m) > 0; }
bool operator==(const MetaString& m) const { return compare(m) == 0; }
bool operator!=(const MetaString& m) const { return compare(m) != 0; }
bool operator<=(const MetaString& m) const { return compare(m) <= 0; }
bool operator>=(const MetaString& m) const { return compare(m) >= 0; }
bool operator< (const MetaString& m) const { return compare(m) < 0; }
bool operator> (const MetaString& m) const { return compare(m) > 0; }
void printf(const char*, ...);
FB_SIZE_T copyTo(char* to, FB_SIZE_T toSize) const;
@ -110,8 +110,6 @@ protected:
static void adjustLength(const char* const s, FB_SIZE_T& l);
};
typedef Pair<Full<MetaName, MetaName> > MetaNamePair;
} // namespace Firebird
#endif // METANAME_H
#endif // METASTRING_H

View File

@ -25,7 +25,7 @@
#include "firebird.h"
#include "../common/classes/fb_string.h"
#include "../common/classes/MetaName.h"
#include "../jrd/constants.h"
// Auxiliary template to build an empty value.

View File

@ -28,7 +28,7 @@
#include "firebird.h"
#include "../common/classes/fb_string.h"
#include "../common/classes/MetaName.h"
#include "../common/classes/MetaString.h"
#include <ctype.h>
#include <stdarg.h>
@ -96,13 +96,6 @@ namespace Firebird
memcpy(stringBuffer, v.c_str(), v.length());
}
AbstractString::AbstractString(const size_type limit, const MetaName& v)
: max_length(static_cast<internal_size_type>(limit))
{
initialize(v.length());
memcpy(stringBuffer, v.c_str(), v.length());
}
AbstractString::AbstractString(const size_type limit, const size_type sizeL, const void* dataL)
: max_length(static_cast<internal_size_type>(limit))
{

View File

@ -41,7 +41,7 @@
namespace Firebird
{
class MetaName;
class MetaString;
class AbstractString : private AutoStorage
{
@ -160,12 +160,18 @@ namespace Firebird
protected:
AbstractString(const size_type limit, const size_type sizeL, const void* datap);
AbstractString(const size_type limit, const_pointer p1, const size_type n1,
const_pointer p2, const size_type n2);
AbstractString(const size_type limit, const AbstractString& v);
AbstractString(const size_type limit, const MetaName& v);
template <class S>
AbstractString(const size_type limit, const S& v)
: max_length(static_cast<internal_size_type>(limit))
{
FB_SIZE_T l = v.length();
initialize(l);
memcpy(stringBuffer, v.c_str(), l);
}
explicit AbstractString(const size_type limit) :
max_length(static_cast<internal_size_type>(limit)),
@ -655,11 +661,11 @@ namespace Firebird
public:
StringBase() : AbstractString(Comparator::getMaxLength()) {}
StringBase(const StringType& v) : AbstractString(Comparator::getMaxLength(), v) {}
explicit StringBase(const MetaName& v) : AbstractString(Comparator::getMaxLength(), v) {}
StringBase(const void* s, size_type n) : AbstractString(Comparator::getMaxLength(), n, s) {}
StringBase(const_pointer s) : AbstractString(Comparator::getMaxLength(), static_cast<size_type>(strlen(s)), s) {}
explicit StringBase(const unsigned char* s) :
AbstractString(Comparator::getMaxLength(), static_cast<size_type>(strlen((char*)s)), (char*)s) {}
StringBase(const MetaString& v) : AbstractString(Comparator::getMaxLength(), v) {}
StringBase(size_type n, char_type c) : AbstractString(Comparator::getMaxLength(), n, c) {}
StringBase(const_iterator first, const_iterator last) :
AbstractString(Comparator::getMaxLength(), last - first, first) {}

View File

@ -29,6 +29,7 @@
#include "fb_types.h"
#include "../common/classes/alloc.h"
#include <atomic>
namespace Firebird {
@ -166,7 +167,7 @@ template <typename C>
class InitMutex
{
private:
volatile bool flag;
std::atomic<bool> flag;
#ifdef DEV_BUILD
const char* from;
#endif
@ -224,12 +225,48 @@ public:
}
};
template <typename T, class A = DefaultInstanceAllocator<T> >
class InitInstance : private InstanceControl
template <class I>
class DeleteInstance : private InstanceControl
{
public:
void registerInstance(I* instance)
{
// Put ourselves into linked list for cleanup.
// Allocated pointer is saved by InstanceList::constructor.
FB_NEW InstanceControl::InstanceLink<I>(instance);
}
};
template <class I>
class TraditionalDelete
{
public:
TraditionalDelete()
: instance(nullptr)
{ }
void registerInstance(I* inst)
{
fb_assert(!instance);
instance = inst;
}
~TraditionalDelete()
{
if (instance)
instance->dtor();
}
private:
I* instance;
};
template <typename T, class A = DefaultInstanceAllocator<T>, template <class I> class DestroyControl = DeleteInstance >
class InitInstance : private DestroyControl<InitInstance<T, A, DestroyControl> >
{
private:
T* instance;
volatile bool flag;
std::atomic<bool> flag;
A allocator;
public:
@ -246,9 +283,7 @@ public:
{
instance = allocator.create();
flag = true;
// Put ourselves into linked list for cleanup.
// Allocated pointer is saved by InstanceList::constructor.
FB_NEW InstanceControl::InstanceLink<InitInstance>(this);
DestroyControl<InitInstance<T, A, DestroyControl> >::registerInstance(this);
}
}
return *instance;
@ -258,7 +293,7 @@ public:
{
MutexLockGuard guard(*StaticMutex::mutex, "InitInstance - dtor");
flag = false;
A::destroy(instance);
allocator.destroy(instance);
instance = NULL;
}
};

View File

@ -59,7 +59,7 @@ public:
// Compare with path given by constant
bool operator==(const char* path) const
{
return PathName(*this) == path;
return this->operator PathName() == path;
}
// Check, whether pPath lies inside directory tree,
// specified by *this ParsedPath. Also checks against

View File

@ -51,7 +51,7 @@
#include "../common/classes/timestamp.h"
#include "../common/cvt.h"
#include "../jrd/intl.h"
#include "../jrd/val.h"
#include "../jrd/constants.h"
#include "../common/classes/VaryStr.h"
#include "../common/classes/FpeControl.h"
#include "../common/dsc_proto.h"
@ -3536,7 +3536,7 @@ static void hex_to_value(const char*& string, const char* end, RetPtr* retValue)
int nibble = ((end - string) & 1);
char ch;
while ((DIGIT((ch = UPPER(*string)))) || ((ch >= 'A') && (ch <= 'F')))
while ((string < end) && ((DIGIT((ch = UPPER(*string)))) || ((ch >= 'A') && (ch <= 'F'))))
{
// Now convert the character to a nibble
SSHORT c;

View File

@ -604,4 +604,6 @@ inline SCHAR NUMERIC_SCALE(const dsc desc)
return ((DTYPE_IS_TEXT(desc.dsc_dtype)) ? 0 : desc.dsc_scale);
}
const UCHAR DEFAULT_DOUBLE = dtype_double;
#endif // JRD_DSC_H

View File

@ -42,10 +42,8 @@
#include "gen/iberror.h"
#include "ibase.h"
#include "../jrd/scl.h"
#include "../yvalve/gds_proto.h"
#include "../common/isc_proto.h"
#include "../jrd/jrd_proto.h"
#include "../common/os/os_utils.h"
#include "../common/os/path_utils.h"

View File

@ -30,6 +30,7 @@
#include "../common/classes/array.h"
#include "../common/classes/init.h"
#include "../common/gdsassert.h"
#include "../common/os/guid.h"
#include "../common/os/os_utils.h"
#include "../jrd/constants.h"
#include "../common/os/path_utils.h"
@ -51,6 +52,80 @@
using namespace Firebird;
namespace
{
// The types below are defined in SDK 8 for _WIN32_WINNT_WIN8 (0x0602) and above,
// so we need to define them manually when building with older SDK and/or Windows version
#if (_WIN32_WINNT < 0x0602)
typedef enum _FILE_INFO_BY_HANDLE_CLASS
{
FileBasicInfo,
FileStandardInfo,
FileNameInfo,
FileRenameInfo,
FileDispositionInfo,
FileAllocationInfo,
FileEndOfFileInfo,
FileStreamInfo,
FileCompressionInfo,
FileAttributeTagInfo,
FileIdBothDirectoryInfo,
FileIdBothDirectoryRestartInfo,
FileIoPriorityHintInfo,
FileRemoteProtocolInfo,
FileFullDirectoryInfo,
FileFullDirectoryRestartInfo,
FileStorageInfo,
FileAlignmentInfo,
FileIdInfo,
FileIdExtdDirectoryInfo,
FileIdExtdDirectoryRestartInfo,
FileDispositionInfoEx,
FileRenameInfoEx,
FileCaseSensitiveInfo,
FileNormalizedNameInfo,
MaximumFileInfoByHandleClass
} FILE_INFO_BY_HANDLE_CLASS;
typedef struct _FILE_ID_128
{
BYTE Identifier[16];
} FILE_ID_128;
typedef struct _FILE_ID_INFO
{
ULONGLONG VolumeSerialNumber;
FILE_ID_128 FileId;
} FILE_ID_INFO;
#endif
typedef DWORD (WINAPI *pfnGetFinalPathNameByHandle)
(HANDLE, LPSTR, DWORD, DWORD);
typedef BOOL (WINAPI *pfnGetFileInformationByHandleEx)
(HANDLE, FILE_INFO_BY_HANDLE_CLASS, LPVOID, DWORD);
pfnGetFinalPathNameByHandle fnGetFinalPathNameByHandle = NULL;
pfnGetFileInformationByHandleEx fnGetFileInformationByHandleEx = NULL;
struct EntryPointLoader
{
static void init()
{
const HMODULE hmodKernel32 = GetModuleHandle("kernel32.dll");
if (hmodKernel32)
{
fnGetFinalPathNameByHandle = (pfnGetFinalPathNameByHandle)
GetProcAddress(hmodKernel32, "GetFinalPathNameByHandleA");
fnGetFileInformationByHandleEx = (pfnGetFileInformationByHandleEx)
GetProcAddress(hmodKernel32, "GetFileInformationByHandleEx");
}
}
};
InitMutex<EntryPointLoader> entryLoader("EntryPointLoader");
} // anonymous namespace
namespace os_utils
{
@ -317,24 +392,155 @@ FILE* fopen(const char* pathname, const char* mode)
void getUniqueFileId(HANDLE fd, UCharBuffer& id)
{
entryLoader.init();
id.clear();
// Let's try getting the file identifier. It's not as easy as it may look.
// MSDN says: "After a process opens a file, the identifier is constant until
// the file is closed". So far so good, this is perfectly OK for us.
// But MSDN also says: "An application can use this identifier and the
// volume serial number to determine whether two handles refer to the same file".
// And this part is not true, unfortunately. Volume serial number (VSN) is not
// guaranteed to be unique. It's generated when then volume is formatted and
// it's stored inside the volume's master boot record. But if the volume is cloned
// at the physical block level, or if a virtual (preformatted) drive is used,
// or if volume snapshot is attached as a different logical volume, then VSN may
// duplicate an existing VSN. And we would stay confused thinking that two
// different files are actually the same file. To avoid such a disaster we
// retrieve the final pathname (with symlinks and mount points expanded)
// and extract the volume GUID (for local drives) or its share name
// (for remote drives) as unique volume ID.
if (fnGetFinalPathNameByHandle)
{
char pathbuf[MAX_PATH + 1];
DWORD res = fnGetFinalPathNameByHandle(fd,
pathbuf, sizeof(pathbuf), VOLUME_NAME_GUID);
if (res && res < sizeof(pathbuf))
{
string path(pathbuf);
// Expected format is \\?\Volume{GUID}\pathname,
// we extract {GUID} and convert into binary format
const char* const pattern = "\\\\?\\Volume";
const FB_SIZE_T pos1 = (FB_SIZE_T) strlen(pattern);
if (path.find(pattern) == 0)
{
const FB_SIZE_T pos2 = path.find_first_of('}');
if (path.find_first_of('{') == pos1 && pos2 != string::npos)
{
fb_assert(id.isEmpty());
id.resize(sizeof(Guid));
UCHAR* ptr = id.begin();
bool num_start = true;
for (FB_SIZE_T n = pos1 + 1; n < pos2 && ptr < id.end(); n++)
{
const char symbol = path[n];
if (symbol == '-')
continue;
fb_assert(isalpha(symbol) || isdigit(symbol));
if (symbol >= '0' && symbol <= '9')
*ptr += symbol - '0';
else if (symbol >= 'a' && symbol <= 'z')
*ptr += symbol - 'a' + 10;
else if (symbol >= 'A' && symbol <= 'Z')
*ptr += symbol - 'A' + 10;
if (num_start)
*ptr *= 16;
else
ptr++;
num_start = !num_start;
}
fb_assert(ptr == id.end());
}
}
}
if (!res && GetLastError() == ERROR_PATH_NOT_FOUND)
{
res = fnGetFinalPathNameByHandle(fd,
pathbuf, sizeof(pathbuf), VOLUME_NAME_DOS);
if (res && res < sizeof(pathbuf))
{
const string path(pathbuf);
// Expected format is \\?\UNC\server\share\pathname,
// we extract <server> and <share> and use them together
const char* const pattern = "\\\\?\\UNC\\";
const FB_SIZE_T pos1 = (FB_SIZE_T) strlen(pattern);
if (path.find(pattern) == 0)
{
const FB_SIZE_T pos2 = path.find_first_of('\\', pos1);
if (pos2 != string::npos)
{
// add <server>
id.add(reinterpret_cast<const UCHAR*>(path.begin() + pos1),
pos2 - pos1);
const FB_SIZE_T pos3 = path.find_first_of('\\', pos2 + 1);
if (pos3 != string::npos)
{
// add <share>
id.add(reinterpret_cast<const UCHAR*>(path.begin() + pos2 + 1),
pos3 - pos2 - 1);
}
}
}
}
}
}
if (fnGetFileInformationByHandleEx)
{
// This function returns the volume serial number and 128-bit file ID.
// We use the VSN only if we failed to get the other volume ID above.
FILE_ID_INFO file_id;
if (fnGetFileInformationByHandleEx(fd, FileIdInfo, &file_id, sizeof(file_id)))
{
if (id.isEmpty())
{
id.add(reinterpret_cast<UCHAR*>(&file_id.VolumeSerialNumber),
sizeof(file_id.VolumeSerialNumber));
}
id.add(reinterpret_cast<UCHAR*>(&file_id.FileId),
sizeof(file_id.FileId));
return;
}
}
// This function returns the volume serial number and 64-bit file ID.
// We use the VSN only if we failed to get the other volume ID above.
BY_HANDLE_FILE_INFORMATION file_info;
GetFileInformationByHandle(fd, &file_info);
if (!GetFileInformationByHandle(fd, &file_info))
system_call_failed::raise("GetFileInformationByHandle");
// The identifier is [nFileIndexHigh, nFileIndexLow]
// MSDN says: After a process opens a file, the identifier is constant until
// the file is closed. An application can use this identifier and the
// volume serial number to determine whether two handles refer to the same file.
const size_t len1 = sizeof(file_info.dwVolumeSerialNumber);
const size_t len2 = sizeof(file_info.nFileIndexHigh);
const size_t len3 = sizeof(file_info.nFileIndexLow);
if (id.isEmpty())
{
id.add(reinterpret_cast<UCHAR*>(&file_info.dwVolumeSerialNumber),
sizeof(file_info.dwVolumeSerialNumber));
}
UCHAR* p = id.getBuffer(len1 + len2 + len3);
memcpy(p, &file_info.dwVolumeSerialNumber, len1);
p += len1;
memcpy(p, &file_info.nFileIndexHigh, len2);
p += len2;
memcpy(p, &file_info.nFileIndexLow, len3);
id.add(reinterpret_cast<UCHAR*>(&file_info.nFileIndexHigh),
sizeof(file_info.nFileIndexHigh));
id.add(reinterpret_cast<UCHAR*>(&file_info.nFileIndexLow),
sizeof(file_info.nFileIndexLow));
}

View File

@ -24,12 +24,11 @@
#include "firebird.h"
#include <string.h>
#include "ibase.h"
#include "../jrd/val.h"
#include "../common/sdl.h"
#include "../jrd/intl.h"
#include "../yvalve/gds_proto.h"
#include "../common/sdl_proto.h"
#include "../jrd/err_proto.h"
#include "../common/StatusArg.h"
const int COMPILE_SIZE = 256;

View File

@ -24,14 +24,15 @@
#ifndef JRD_SDL_H
#define JRD_SDL_H
#include "../common/classes/MetaName.h"
#include "../common/classes/MetaString.h"
#include "../common/dsc.h"
struct sdl_info
{
USHORT sdl_info_fid;
USHORT sdl_info_rid;
Firebird::MetaName sdl_info_field;
Firebird::MetaName sdl_info_relation;
Firebird::MetaString sdl_info_field;
Firebird::MetaString sdl_info_relation;
dsc sdl_info_element;
USHORT sdl_info_dimensions;
SLONG sdl_info_lower[MAX_ARRAY_DIMENSIONS];

View File

@ -28,7 +28,7 @@
#include "../common/classes/ImplementHelper.h"
#include "../common/classes/GetPlugins.h"
#include "../common/classes/array.h"
#include "../common/classes/MetaName.h"
#include "../common/classes/MetaString.h"
#include "../common/classes/objects_array.h"
namespace Auth {
@ -225,7 +225,7 @@ public:
CharField database, dba, dbaPassword, role;
AuthenticationBlock authenticationBlock;
Firebird::MetaName plugin;
Firebird::MetaString plugin;
// deprecated
CharField group;

View File

@ -48,7 +48,7 @@ using namespace Jrd;
namespace Jrd {
static RegisterNode<AggNode> regAggNode(blr_agg_function);
static RegisterNode<AggNode> regAggNode({blr_agg_function});
AggNode::Factory* AggNode::factories = NULL;
@ -351,7 +351,7 @@ AggNode* AggNode::pass2(thread_db* tdbb, CompilerScratch* csb)
dsc desc;
getDesc(tdbb, csb, &desc);
impureOffset = CMP_impure(csb, sizeof(impure_value_ex));
impureOffset = csb->allocImpure<impure_value_ex>();
return this;
}
@ -653,7 +653,7 @@ AggNode* AvgAggNode::pass2(thread_db* tdbb, CompilerScratch* csb)
nodFlags |= FLAG_DOUBLE;
// We need a second descriptor in the impure area for AVG.
tempImpure = CMP_impure(csb, sizeof(impure_value_ex));
tempImpure = csb->allocImpure<impure_value_ex>();
return this;
}
@ -898,7 +898,7 @@ AggNode* ListAggNode::dsqlCopy(DsqlCompilerScratch* dsqlScratch) /*const*/
//--------------------
static RegisterNode<CountAggNode> regCountAggNodeLegacy(blr_agg_count);
static RegisterNode<CountAggNode> regCountAggNodeLegacy({blr_agg_count});
static AggNode::Register<CountAggNode> countAggInfo("COUNT", blr_agg_count2, blr_agg_count_distinct);
@ -1416,7 +1416,7 @@ AggNode* StdDevAggNode::pass2(thread_db* tdbb, CompilerScratch* csb)
{
AggNode::pass2(tdbb, csb);
impure2Offset = CMP_impure(csb, sizeof(StdDevImpure));
impure2Offset = csb->allocImpure<StdDevImpure>();
return this;
}
@ -1625,7 +1625,7 @@ AggNode* CorrAggNode::pass2(thread_db* tdbb, CompilerScratch* csb)
{
AggNode::pass2(tdbb, csb);
impure2Offset = CMP_impure(csb, sizeof(CorrImpure));
impure2Offset = csb->allocImpure<CorrImpure>();
return this;
}
@ -1901,7 +1901,7 @@ AggNode* RegrAggNode::pass2(thread_db* tdbb, CompilerScratch* csb)
{
AggNode::pass2(tdbb, csb);
impure2Offset = CMP_impure(csb, sizeof(RegrImpure));
impure2Offset = csb->allocImpure<RegrImpure>();
return this;
}

View File

@ -45,9 +45,9 @@ public:
void beginDebug();
void endDebug();
void putDebugSrcInfo(ULONG, ULONG);
void putDebugVariable(USHORT, const Firebird::MetaName&);
void putDebugVariable(USHORT, const MetaName&);
void putDebugArgument(UCHAR, USHORT, const TEXT*);
void putDebugCursor(USHORT, const Firebird::MetaName&);
void putDebugCursor(USHORT, const MetaName&);
void putDebugSubFunction(DeclareSubFuncNode* subFuncNode);
void putDebugSubProcedure(DeclareSubProcNode* subProcNode);

View File

@ -88,8 +88,7 @@ BoolExprNode* BoolExprNode::pass2(thread_db* tdbb, CompilerScratch* csb)
//--------------------
static RegisterBoolNode<BinaryBoolNode> regBinaryBoolNodeAnd(blr_and);
static RegisterBoolNode<BinaryBoolNode> regBinaryBoolNodeOr(blr_or);
static RegisterBoolNode<BinaryBoolNode> regBinaryBoolNode({blr_and, blr_or});
BinaryBoolNode::BinaryBoolNode(MemoryPool& pool, UCHAR aBlrOp, BoolExprNode* aArg1,
BoolExprNode* aArg2)
@ -260,21 +259,23 @@ TriState BinaryBoolNode::executeOr(thread_db* tdbb, jrd_req* request) const
//--------------------
static RegisterBoolNode<ComparativeBoolNode> regComparativeBoolNodeEql(blr_eql);
static RegisterBoolNode<ComparativeBoolNode> regComparativeBoolNodeGeq(blr_geq);
static RegisterBoolNode<ComparativeBoolNode> regComparativeBoolNodeGtr(blr_gtr);
static RegisterBoolNode<ComparativeBoolNode> regComparativeBoolNodeLeq(blr_leq);
static RegisterBoolNode<ComparativeBoolNode> regComparativeBoolNodeLss(blr_lss);
static RegisterBoolNode<ComparativeBoolNode> regComparativeBoolNodeNeq(blr_neq);
static RegisterBoolNode<ComparativeBoolNode> regComparativeBoolNodeEquiv(blr_equiv);
static RegisterBoolNode<ComparativeBoolNode> regComparativeBoolNodeBetween(blr_between);
static RegisterBoolNode<ComparativeBoolNode> regComparativeBoolNodeLike(blr_like);
static RegisterBoolNode<ComparativeBoolNode> regComparativeBoolNodeAnsiLike(blr_ansi_like);
static RegisterBoolNode<ComparativeBoolNode> regComparativeBoolNodeContaining(blr_containing);
static RegisterBoolNode<ComparativeBoolNode> regComparativeBoolNodeStarting(blr_starting);
static RegisterBoolNode<ComparativeBoolNode> regComparativeBoolNodeSimilar(blr_similar);
static RegisterBoolNode<ComparativeBoolNode> regComparativeBoolNodeMatching(blr_matching);
static RegisterBoolNode<ComparativeBoolNode> regComparativeBoolNodeMatching2(blr_matching2); // sleuth
static RegisterBoolNode<ComparativeBoolNode> regComparativeBoolNode({
blr_eql,
blr_geq,
blr_gtr,
blr_leq,
blr_lss,
blr_neq,
blr_equiv,
blr_between,
blr_like,
blr_ansi_like,
blr_containing,
blr_starting,
blr_similar,
blr_matching,
blr_matching2
});
ComparativeBoolNode::ComparativeBoolNode(MemoryPool& pool, UCHAR aBlrOp,
ValueExprNode* aArg1, ValueExprNode* aArg2, ValueExprNode* aArg3)
@ -613,7 +614,7 @@ void ComparativeBoolNode::pass2Boolean2(thread_db* tdbb, CompilerScratch* csb)
if (nodFlags & FLAG_INVARIANT)
{
// This may currently happen for nod_like, nod_contains and nod_similar
impureOffset = CMP_impure(csb, sizeof(impure_value));
impureOffset = csb->allocImpure<impure_value>();
}
}
@ -1262,7 +1263,7 @@ BoolExprNode* ComparativeBoolNode::createRseNode(DsqlCompilerScratch* dsqlScratc
//--------------------
static RegisterBoolNode<MissingBoolNode> regMissingBoolNode(blr_missing);
static RegisterBoolNode<MissingBoolNode> regMissingBoolNode({blr_missing});
MissingBoolNode::MissingBoolNode(MemoryPool& pool, ValueExprNode* aArg, bool aDsqlUnknown)
: TypedNode<BoolExprNode, ExprNode::TYPE_MISSING_BOOL>(pool),
@ -1350,7 +1351,7 @@ TriState MissingBoolNode::execute(thread_db* tdbb, jrd_req* request) const
//--------------------
static RegisterBoolNode<NotBoolNode> regNotBoolNode(blr_not);
static RegisterBoolNode<NotBoolNode> regNotBoolNode({blr_not});
NotBoolNode::NotBoolNode(MemoryPool& pool, BoolExprNode* aArg)
: TypedNode<BoolExprNode, ExprNode::TYPE_NOT_BOOL>(pool),
@ -1517,11 +1518,8 @@ BoolExprNode* NotBoolNode::process(DsqlCompilerScratch* dsqlScratch, bool invert
//--------------------
static RegisterBoolNode<RseBoolNode> regRseBoolNodeAny(blr_any);
static RegisterBoolNode<RseBoolNode> regRseBoolNodeUnique(blr_unique);
static RegisterBoolNode<RseBoolNode> regRseBoolNodeAnsiAny(blr_ansi_any);
static RegisterBoolNode<RseBoolNode> regRseBoolNodeAnsiAll(blr_ansi_all);
static RegisterBoolNode<RseBoolNode> regRseBoolNodeExists(blr_exists); // ASF: Where is this handled?
// ASF: Where is blr_exists handled?
static RegisterBoolNode<RseBoolNode> regRseBoolNode({blr_any, blr_unique, blr_ansi_any, blr_ansi_all, blr_exists});
RseBoolNode::RseBoolNode(MemoryPool& pool, UCHAR aBlrOp, RecordSourceNode* aDsqlRse)
: TypedNode<BoolExprNode, ExprNode::TYPE_RSE_BOOL>(pool),
@ -1708,13 +1706,6 @@ BoolExprNode* RseBoolNode::copy(thread_db* tdbb, NodeCopier& copier) const
return node;
}
BoolExprNode* RseBoolNode::pass1(thread_db* tdbb, CompilerScratch* csb)
{
rse->ignoreDbKey(tdbb, csb);
return BoolExprNode::pass1(tdbb, csb);
}
void RseBoolNode::pass2Boolean1(thread_db* tdbb, CompilerScratch* csb)
{
if (!(rse->flags & RseNode::FLAG_VARIANT))
@ -1729,7 +1720,7 @@ void RseBoolNode::pass2Boolean1(thread_db* tdbb, CompilerScratch* csb)
void RseBoolNode::pass2Boolean2(thread_db* tdbb, CompilerScratch* csb)
{
if (nodFlags & FLAG_INVARIANT)
impureOffset = CMP_impure(csb, sizeof(impure_value));
impureOffset = csb->allocImpure<impure_value>();
RecordSource* const rsb = CMP_post_rse(tdbb, csb, rse);

View File

@ -70,7 +70,7 @@ public:
class ComparativeBoolNode : public TypedNode<BoolExprNode, ExprNode::TYPE_COMPARATIVE_BOOL>
{
public:
enum DsqlFlag
enum DsqlFlag : UCHAR
{
DFLAG_NONE,
DFLAG_ANSI_ALL,
@ -233,7 +233,6 @@ public:
virtual BoolExprNode* copy(thread_db* tdbb, NodeCopier& copier) const;
virtual bool dsqlMatch(DsqlCompilerScratch* dsqlScratch, const ExprNode* other, bool ignoreMapCast) const;
virtual bool sameAs(CompilerScratch* csb, const ExprNode* other, bool ignoreStreams) const;
virtual BoolExprNode* pass1(thread_db* tdbb, CompilerScratch* csb);
virtual void pass2Boolean1(thread_db* tdbb, CompilerScratch* csb);
virtual void pass2Boolean2(thread_db* tdbb, CompilerScratch* csb);
virtual TriState execute(thread_db* tdbb, jrd_req* request) const;

View File

@ -907,7 +907,7 @@ void DdlNode::storePrivileges(thread_db* tdbb, jrd_tra* transaction,
const char* privileges)
{
Attachment* const attachment = transaction->tra_attachment;
const MetaName& userName = attachment->att_user->getUserName();
const MetaString& userName = attachment->att_user->getUserName();
AutoCacheRequest request(tdbb, drq_s_usr_prvs, DYN_REQUESTS);
@ -970,7 +970,7 @@ void DdlNode::storeGlobalField(thread_db* tdbb, jrd_tra* transaction, MetaName&
const TypeClause* field, const string& computedSource, const BlrDebugWriter::BlrData& computedValue)
{
Attachment* const attachment = transaction->tra_attachment;
const MetaName& userName = attachment->att_user->getUserName();
const MetaString& userName = attachment->att_user->getUserName();
const ValueListNode* elements = field->ranges;
const USHORT dims = elements ? elements->items.getCount() / 2 : 0;
@ -1768,7 +1768,7 @@ void CreateAlterFunctionNode::executeCreate(thread_db* tdbb, DsqlCompilerScratch
jrd_tra* transaction)
{
Attachment* const attachment = transaction->getAttachment();
const MetaName& userName = attachment->att_user->getUserName();
const MetaString& userName = attachment->att_user->getUserName();
if (package.isEmpty())
{
@ -2776,7 +2776,7 @@ void CreateAlterProcedureNode::executeCreate(thread_db* tdbb, DsqlCompilerScratc
jrd_tra* transaction)
{
Attachment* const attachment = transaction->getAttachment();
const MetaName& userName = attachment->att_user->getUserName();
const MetaString& userName = attachment->att_user->getUserName();
if (package.isEmpty())
{
@ -3932,7 +3932,7 @@ void CreateCollationNode::execute(thread_db* tdbb, DsqlCompilerScratch* dsqlScra
jrd_tra* transaction)
{
Attachment* const attachment = transaction->tra_attachment;
const MetaName& userName = attachment->att_user->getUserName();
const MetaString& userName = attachment->att_user->getUserName();
// run all statements under savepoint control
AutoSavePoint savePoint(tdbb, transaction);
@ -5488,7 +5488,7 @@ void CreateAlterExceptionNode::executeCreate(thread_db* tdbb, DsqlCompilerScratc
jrd_tra* transaction)
{
Attachment* const attachment = transaction->getAttachment();
const MetaName& userName = attachment->att_user->getUserName();
const MetaString& userName = attachment->att_user->getUserName();
executeDdlTrigger(tdbb, dsqlScratch, transaction, DTW_BEFORE,
DDL_TRIGGER_CREATE_EXCEPTION, name, NULL);
@ -5862,7 +5862,7 @@ SSHORT CreateAlterSequenceNode::store(thread_db* tdbb, jrd_tra* transaction, con
fb_sysflag sysFlag, SINT64 val, SLONG step)
{
Attachment* const attachment = transaction->tra_attachment;
const MetaName& userName = attachment->att_user->getUserName();
const MetaString& userName = attachment->att_user->getUserName();
DYN_UTIL_check_unique_name(tdbb, transaction, name, obj_generator);
@ -8711,7 +8711,7 @@ void CreateAlterViewNode::execute(thread_db* tdbb, DsqlCompilerScratch* dsqlScra
jrd_tra* transaction)
{
Attachment* const attachment = transaction->tra_attachment;
const MetaName& userName = attachment->att_user->getUserName();
const MetaString& userName = attachment->att_user->getUserName();
const dsql_rel* modifyingView = NULL;
@ -10356,7 +10356,7 @@ void DropShadowNode::execute(thread_db* tdbb, DsqlCompilerScratch* /*dsqlScratch
//----------------------
USHORT PrivilegesNode::convertPrivilegeFromString(thread_db* tdbb, jrd_tra* transaction, Firebird::MetaName privilege)
USHORT PrivilegesNode::convertPrivilegeFromString(thread_db* tdbb, jrd_tra* transaction, MetaName privilege)
{
string priv(privilege.c_str());
priv.upper();
@ -11004,7 +11004,7 @@ void DropRoleNode::execute(thread_db* tdbb, DsqlCompilerScratch* dsqlScratch, jr
//----------------------
Firebird::MetaName UserNode::upper(const Firebird::MetaName& str)
MetaName UserNode::upper(const MetaName& str)
{
return str;
}
@ -11747,7 +11747,7 @@ void GrantRevokeNode::grantRevoke(thread_db* tdbb, jrd_tra* transaction, const G
if (grantor && !attachment->locksmith(tdbb, USE_GRANTED_BY_CLAUSE))
{
const Firebird::MetaName& owner(tdbb->getDatabase()->dbb_owner);
const MetaName& owner(tdbb->getDatabase()->dbb_owner);
if (owner == DBA_USER_NAME)
(Arg::PrivateDyn(252) << DBA_USER_NAME).raise();
@ -12360,7 +12360,7 @@ void GrantRevokeNode::checkGrantorCanGrantDdl(thread_db* tdbb, jrd_tra* transact
// Check if the grantor has grant option on generator privilege
void GrantRevokeNode::checkGrantorCanGrantObject(thread_db* tdbb, jrd_tra* transaction, const char* grantor,
const char* privilege, const Firebird::MetaName& objName, SSHORT objType)
const char* privilege, const MetaName& objName, SSHORT objType)
{
const Attachment* attachment = tdbb->getAttachment();

View File

@ -155,7 +155,7 @@ public:
public:
Firebird::string name;
Firebird::MetaName engine;
MetaName engine;
Firebird::string udfModule;
};
@ -163,14 +163,14 @@ public:
class ParameterClause : public Printable
{
public:
ParameterClause(MemoryPool& pool, dsql_fld* field, const Firebird::MetaName& aCollate,
ParameterClause(MemoryPool& pool, dsql_fld* field, const MetaName& aCollate,
ValueSourceClause* aDefaultClause = NULL, ValueExprNode* aParameterExpr = NULL);
public:
virtual Firebird::string internalPrint(NodePrinter& printer) const;
public:
Firebird::MetaName name;
MetaName name;
NestConst<dsql_fld> type;
NestConst<ValueSourceClause> defaultClause;
NestConst<ValueExprNode> parameterExpr;
@ -193,7 +193,7 @@ struct CollectedParameter
};
typedef Firebird::GenericMap<
Firebird::Pair<Firebird::Left<Firebird::MetaName, CollectedParameter> > >
Firebird::Pair<Firebird::Left<MetaName, CollectedParameter> > >
CollectedParameterMap;
@ -271,8 +271,8 @@ protected:
class AlterCharSetNode : public DdlNode
{
public:
AlterCharSetNode(MemoryPool& pool, const Firebird::MetaName& aCharSet,
const Firebird::MetaName& aDefaultCollation)
AlterCharSetNode(MemoryPool& pool, const MetaName& aCharSet,
const MetaName& aDefaultCollation)
: DdlNode(pool),
charSet(pool, aCharSet),
defaultCollation(pool, aDefaultCollation)
@ -291,8 +291,8 @@ protected:
}
private:
Firebird::MetaName charSet;
Firebird::MetaName defaultCollation;
MetaName charSet;
MetaName defaultCollation;
};
@ -369,7 +369,7 @@ class CommentOnNode : public DdlNode
{
public:
CommentOnNode(MemoryPool& pool, int aObjType,
const Firebird::QualifiedName& aObjName, const Firebird::MetaName& aSubName,
const QualifiedName& aObjName, const MetaName& aSubName,
const Firebird::string aText)
: DdlNode(pool),
objType(aObjType),
@ -398,8 +398,8 @@ protected:
private:
int objType;
Firebird::QualifiedName objName;
Firebird::MetaName subName;
QualifiedName objName;
MetaName subName;
Firebird::string text, str;
};
@ -407,7 +407,7 @@ private:
class CreateAlterFunctionNode : public DdlNode
{
public:
CreateAlterFunctionNode(MemoryPool& pool, const Firebird::MetaName& aName)
CreateAlterFunctionNode(MemoryPool& pool, const MetaName& aName)
: DdlNode(pool),
name(pool, aName),
create(true),
@ -462,7 +462,7 @@ private:
void collectParameters(thread_db* tdbb, jrd_tra* transaction, CollectedParameterMap& items);
public:
Firebird::MetaName name;
MetaName name;
bool create;
bool alter;
NestConst<ExternalClause> external;
@ -474,8 +474,8 @@ public:
NestConst<StmtNode> body;
bool compiled;
bool invalid;
Firebird::MetaName package;
Firebird::MetaName packageOwner;
MetaName package;
MetaName packageOwner;
bool privateScope;
bool preserveDefaults;
SLONG udfReturnPos;
@ -486,7 +486,7 @@ public:
class AlterExternalFunctionNode : public DdlNode
{
public:
AlterExternalFunctionNode(MemoryPool& p, const Firebird::MetaName& aName)
AlterExternalFunctionNode(MemoryPool& p, const MetaName& aName)
: DdlNode(p),
name(p, aName),
clauses(p)
@ -505,7 +505,7 @@ protected:
}
public:
Firebird::MetaName name;
MetaName name;
ExternalClause clauses;
};
@ -513,7 +513,7 @@ public:
class DropFunctionNode : public DdlNode
{
public:
DropFunctionNode(MemoryPool& pool, const Firebird::MetaName& aName)
DropFunctionNode(MemoryPool& pool, const MetaName& aName)
: DdlNode(pool),
name(pool, aName),
silent(false),
@ -523,7 +523,7 @@ public:
public:
static void dropArguments(thread_db* tdbb, jrd_tra* transaction,
const Firebird::MetaName& functionName, const Firebird::MetaName& packageName);
const MetaName& functionName, const MetaName& packageName);
public:
virtual Firebird::string internalPrint(NodePrinter& printer) const;
@ -538,9 +538,9 @@ protected:
}
public:
Firebird::MetaName name;
MetaName name;
bool silent;
Firebird::MetaName package;
MetaName package;
};
@ -551,7 +551,7 @@ typedef RecreateNode<CreateAlterFunctionNode, DropFunctionNode, isc_dsql_recreat
class CreateAlterProcedureNode : public DdlNode
{
public:
CreateAlterProcedureNode(MemoryPool& pool, const Firebird::MetaName& aName)
CreateAlterProcedureNode(MemoryPool& pool, const MetaName& aName)
: DdlNode(pool),
name(pool, aName),
create(true),
@ -598,7 +598,7 @@ private:
void collectParameters(thread_db* tdbb, jrd_tra* transaction, CollectedParameterMap& items);
public:
Firebird::MetaName name;
MetaName name;
bool create;
bool alter;
NestConst<ExternalClause> external;
@ -609,8 +609,8 @@ public:
NestConst<StmtNode> body;
bool compiled;
bool invalid;
Firebird::MetaName package;
Firebird::MetaName packageOwner;
MetaName package;
MetaName packageOwner;
bool privateScope;
bool preserveDefaults;
Nullable<bool> ssDefiner;
@ -620,7 +620,7 @@ public:
class DropProcedureNode : public DdlNode
{
public:
DropProcedureNode(MemoryPool& pool, const Firebird::MetaName& aName)
DropProcedureNode(MemoryPool& pool, const MetaName& aName)
: DdlNode(pool),
name(pool, aName),
silent(false),
@ -630,7 +630,7 @@ public:
public:
static void dropParameters(thread_db* tdbb, jrd_tra* transaction,
const Firebird::MetaName& procedureName, const Firebird::MetaName& packageName);
const MetaName& procedureName, const MetaName& packageName);
public:
virtual Firebird::string internalPrint(NodePrinter& printer) const;
@ -645,9 +645,9 @@ protected:
}
public:
Firebird::MetaName name;
MetaName name;
bool silent;
Firebird::MetaName package;
MetaName package;
};
@ -694,8 +694,8 @@ protected:
}
public:
Firebird::MetaName name;
Firebird::MetaName relationName;
MetaName name;
MetaName relationName;
Nullable<FB_UINT64> type;
Nullable<bool> active;
Nullable<int> position;
@ -712,7 +712,7 @@ public:
class CreateAlterTriggerNode : public DdlNode, public TriggerDefinition
{
public:
CreateAlterTriggerNode(MemoryPool& p, const Firebird::MetaName& aName)
CreateAlterTriggerNode(MemoryPool& p, const MetaName& aName)
: DdlNode(p),
TriggerDefinition(p),
create(true),
@ -792,7 +792,7 @@ public:
class DropTriggerNode : public DdlNode
{
public:
DropTriggerNode(MemoryPool& p, const Firebird::MetaName& aName)
DropTriggerNode(MemoryPool& p, const MetaName& aName)
: DdlNode(p),
name(p, aName),
silent(false)
@ -812,7 +812,7 @@ protected:
}
public:
Firebird::MetaName name;
MetaName name;
bool silent;
};
@ -824,8 +824,8 @@ typedef RecreateNode<CreateAlterTriggerNode, DropTriggerNode, isc_dsql_recreate_
class CreateCollationNode : public DdlNode
{
public:
CreateCollationNode(MemoryPool& p, const Firebird::MetaName& aName,
const Firebird::MetaName& aForCharSet)
CreateCollationNode(MemoryPool& p, const MetaName& aName,
const MetaName& aForCharSet)
: DdlNode(p),
name(p, aName),
forCharSet(p, aForCharSet),
@ -876,9 +876,9 @@ protected:
}
public:
Firebird::MetaName name;
Firebird::MetaName forCharSet;
Firebird::MetaName fromName;
MetaName name;
MetaName forCharSet;
MetaName fromName;
Firebird::string fromExternal;
Firebird::UCharBuffer specificAttributes;
@ -893,7 +893,7 @@ private:
class DropCollationNode : public DdlNode
{
public:
DropCollationNode(MemoryPool& p, const Firebird::MetaName& aName)
DropCollationNode(MemoryPool& p, const MetaName& aName)
: DdlNode(p),
name(p, aName)
{
@ -911,7 +911,7 @@ protected:
}
public:
Firebird::MetaName name;
MetaName name;
};
@ -947,7 +947,7 @@ public:
class AlterDomainNode : public DdlNode
{
public:
AlterDomainNode(MemoryPool& p, const Firebird::MetaName& aName)
AlterDomainNode(MemoryPool& p, const MetaName& aName)
: DdlNode(p),
name(p, aName),
dropConstraint(false),
@ -963,8 +963,8 @@ public:
static ULONG checkUpdateNumericType(const dyn_fld& origFld, const dyn_fld& newFld);
static void getDomainType(thread_db* tdbb, jrd_tra* transaction, dyn_fld& dynFld);
static void modifyLocalFieldIndex(thread_db* tdbb, jrd_tra* transaction,
const Firebird::MetaName& relationName, const Firebird::MetaName& fieldName,
const Firebird::MetaName& newFieldName);
const MetaName& relationName, const MetaName& fieldName,
const MetaName& newFieldName);
virtual Firebird::string internalPrint(NodePrinter& printer) const;
virtual void checkPermission(thread_db* tdbb, jrd_tra* transaction);
@ -980,12 +980,12 @@ private:
void rename(thread_db* tdbb, jrd_tra* transaction, SSHORT dimensions);
public:
Firebird::MetaName name;
MetaName name;
bool dropConstraint;
bool dropDefault;
NestConst<BoolSourceClause> setConstraint;
NestConst<ValueSourceClause> setDefault;
Firebird::MetaName renameTo;
MetaName renameTo;
Firebird::AutoPtr<dsql_fld> type;
Nullable<bool> notNullFlag; // true = NOT NULL / false = NULL
};
@ -994,14 +994,14 @@ public:
class DropDomainNode : public DdlNode
{
public:
DropDomainNode(MemoryPool& p, const Firebird::MetaName& aName)
DropDomainNode(MemoryPool& p, const MetaName& aName)
: DdlNode(p),
name(p, aName)
{
}
static bool deleteDimensionRecords(thread_db* tdbb, jrd_tra* transaction,
const Firebird::MetaName& name);
const MetaName& name);
public:
virtual Firebird::string internalPrint(NodePrinter& printer) const;
@ -1018,14 +1018,14 @@ private:
void check(thread_db* tdbb, jrd_tra* transaction);
public:
Firebird::MetaName name;
MetaName name;
};
class CreateAlterExceptionNode : public DdlNode
{
public:
CreateAlterExceptionNode(MemoryPool& p, const Firebird::MetaName& aName,
CreateAlterExceptionNode(MemoryPool& p, const MetaName& aName,
const Firebird::string& aMessage)
: DdlNode(p),
name(p, aName),
@ -1055,7 +1055,7 @@ private:
bool executeAlter(thread_db* tdbb, DsqlCompilerScratch* dsqlScratch, jrd_tra* transaction);
public:
Firebird::MetaName name;
MetaName name;
Firebird::string message;
bool create;
bool alter;
@ -1065,7 +1065,7 @@ public:
class DropExceptionNode : public DdlNode
{
public:
DropExceptionNode(MemoryPool& p, const Firebird::MetaName& aName)
DropExceptionNode(MemoryPool& p, const MetaName& aName)
: DdlNode(p),
name(p, aName),
silent(false)
@ -1084,7 +1084,7 @@ protected:
}
public:
Firebird::MetaName name;
MetaName name;
bool silent;
};
@ -1096,7 +1096,7 @@ typedef RecreateNode<CreateAlterExceptionNode, DropExceptionNode, isc_dsql_recre
class CreateAlterSequenceNode : public DdlNode
{
public:
CreateAlterSequenceNode(MemoryPool& pool, const Firebird::MetaName& aName)
CreateAlterSequenceNode(MemoryPool& pool, const MetaName& aName)
: DdlNode(pool),
create(true),
alter(false),
@ -1119,7 +1119,7 @@ public:
value.specified = false;
}
static SSHORT store(thread_db* tdbb, jrd_tra* transaction, const Firebird::MetaName& name,
static SSHORT store(thread_db* tdbb, jrd_tra* transaction, const MetaName& name,
fb_sysflag sysFlag, SINT64 value, SLONG step);
public:
@ -1146,7 +1146,7 @@ public:
bool alter;
bool legacy;
bool restartSpecified;
const Firebird::MetaName name;
const MetaName name;
BaseNullable<SINT64> value;
Nullable<SLONG> step;
};
@ -1155,7 +1155,7 @@ public:
class DropSequenceNode : public DdlNode
{
public:
DropSequenceNode(MemoryPool& pool, const Firebird::MetaName& aName)
DropSequenceNode(MemoryPool& pool, const MetaName& aName)
: DdlNode(pool),
name(pool, aName),
silent(false)
@ -1163,7 +1163,7 @@ public:
}
static void deleteIdentity(thread_db* tdbb, jrd_tra* transaction,
const Firebird::MetaName& name);
const MetaName& name);
public:
virtual Firebird::string internalPrint(NodePrinter& printer) const;
@ -1177,7 +1177,7 @@ protected:
}
public:
Firebird::MetaName name;
MetaName name;
bool silent;
};
@ -1206,10 +1206,10 @@ public:
void store(thread_db* tdbb, jrd_tra* transaction);
public:
Firebird::MetaName name;
Firebird::MetaName relationName;
Firebird::MetaName fieldSource;
Firebird::MetaName identitySequence;
MetaName name;
MetaName relationName;
MetaName fieldSource;
MetaName identitySequence;
Nullable<IdentityType> identityType;
Nullable<USHORT> collationId;
Nullable<bool> notNullFlag; // true = NOT NULL / false = NULL
@ -1217,7 +1217,7 @@ public:
Firebird::string defaultSource;
Firebird::ByteChunk defaultValue;
Nullable<USHORT> viewContext;
Firebird::MetaName baseField;
MetaName baseField;
};
struct IndexConstraintClause
@ -1228,7 +1228,7 @@ public:
{
}
Firebird::MetaName name;
MetaName name;
bool descending;
};
@ -1277,10 +1277,10 @@ public:
}
Constraint::Type type;
Firebird::ObjectsArray<Firebird::MetaName> columns;
Firebird::ObjectsArray<MetaName> columns;
NestConst<IndexConstraintClause> index;
Firebird::MetaName refRelation;
Firebird::ObjectsArray<Firebird::MetaName> refColumns;
MetaName refRelation;
Firebird::ObjectsArray<MetaName> refColumns;
const char* refUpdateAction;
const char* refDeleteAction;
Firebird::ObjectsArray<TriggerDefinition> triggers;
@ -1294,7 +1294,7 @@ public:
{
}
Firebird::MetaName name;
MetaName name;
Firebird::AutoPtr<Constraint> create;
};
@ -1363,12 +1363,12 @@ public:
{
}
Firebird::MetaName name;
MetaName name;
ConstraintType constraintType;
Firebird::ObjectsArray<Firebird::MetaName> columns;
Firebird::ObjectsArray<MetaName> columns;
NestConst<IndexConstraintClause> index;
Firebird::MetaName refRelation;
Firebird::ObjectsArray<Firebird::MetaName> refColumns;
MetaName refRelation;
Firebird::ObjectsArray<MetaName> refColumns;
NestConst<RefActionClause> refAction;
NestConst<BoolSourceClause> check;
};
@ -1409,7 +1409,7 @@ public:
dsql_fld* field;
NestConst<ValueSourceClause> defaultValue;
Firebird::ObjectsArray<AddConstraintClause> constraints;
Firebird::MetaName collate;
MetaName collate;
NestConst<ValueSourceClause> computed;
NestConst<IdentityOptions> identityOptions;
bool notNullSpecified;
@ -1424,8 +1424,8 @@ public:
{
}
Firebird::MetaName fromName;
Firebird::MetaName toName;
MetaName fromName;
MetaName toName;
};
struct AlterColNullClause : public Clause
@ -1437,7 +1437,7 @@ public:
{
}
Firebird::MetaName name;
MetaName name;
bool notNullFlag;
};
@ -1450,7 +1450,7 @@ public:
{
}
Firebird::MetaName name;
MetaName name;
SSHORT newPos;
};
@ -1484,7 +1484,7 @@ public:
{
}
Firebird::MetaName name;
MetaName name;
bool cascade;
};
@ -1496,18 +1496,18 @@ public:
{
}
Firebird::MetaName name;
MetaName name;
};
RelationNode(MemoryPool& p, RelationSourceNode* aDsqlNode);
static void deleteLocalField(thread_db* tdbb, jrd_tra* transaction,
const Firebird::MetaName& relationName, const Firebird::MetaName& fieldName);
const MetaName& relationName, const MetaName& fieldName);
static void addToPublication(thread_db* tdbb, jrd_tra* transaction,
const Firebird::MetaName& tableName, const Firebird::MetaName& pubTame);
const MetaName& tableName, const MetaName& pubTame);
static void dropFromPublication(thread_db* tdbb, jrd_tra* transaction,
const Firebird::MetaName& tableName, const Firebird::MetaName& pubTame);
const MetaName& tableName, const MetaName& pubTame);
protected:
virtual Firebird::string internalPrint(NodePrinter& printer) const
@ -1523,14 +1523,14 @@ protected:
void defineField(thread_db* tdbb, DsqlCompilerScratch* dsqlScratch, jrd_tra* transaction,
AddColumnClause* clause, SSHORT position,
const Firebird::ObjectsArray<Firebird::MetaName>* pkcols);
const Firebird::ObjectsArray<MetaName>* pkcols);
bool defineDefault(thread_db* tdbb, DsqlCompilerScratch* dsqlScratch, dsql_fld* field,
ValueSourceClause* clause, Firebird::string& source, BlrDebugWriter::BlrData& value);
void makeConstraint(thread_db* tdbb, DsqlCompilerScratch* dsqlScratch, jrd_tra* transaction,
AddConstraintClause* clause, Firebird::ObjectsArray<CreateDropConstraint>& constraints,
bool* notNull = NULL);
void defineConstraint(thread_db* tdbb, DsqlCompilerScratch* dsqlScratch, jrd_tra* transaction,
Firebird::MetaName& constraintName, Constraint& constraint);
MetaName& constraintName, Constraint& constraint);
void defineCheckConstraint(DsqlCompilerScratch* dsqlScratch, Constraint& constraint,
BoolSourceClause* clause);
void defineCheckConstraintTrigger(DsqlCompilerScratch* dsqlScratch, Constraint& constraint,
@ -1549,7 +1549,7 @@ protected:
public:
NestConst<RelationSourceNode> dsqlNode;
Firebird::MetaName name;
MetaName name;
Firebird::Array<NestConst<Clause> > clauses;
Nullable<bool> ssDefiner;
Nullable<bool> replicationState;
@ -1579,7 +1579,7 @@ protected:
}
private:
const Firebird::ObjectsArray<Firebird::MetaName>* findPkColumns();
const Firebird::ObjectsArray<MetaName>* findPkColumns();
public:
const Firebird::string* externalFile;
@ -1617,7 +1617,7 @@ private:
class DropRelationNode : public DdlNode
{
public:
DropRelationNode(MemoryPool& p, const Firebird::MetaName& aName, bool aView = false)
DropRelationNode(MemoryPool& p, const MetaName& aName, bool aView = false)
: DdlNode(p),
name(p, aName),
view(aView),
@ -1626,7 +1626,7 @@ public:
}
static void deleteGlobalField(thread_db* tdbb, jrd_tra* transaction,
const Firebird::MetaName& globalName);
const MetaName& globalName);
public:
virtual Firebird::string internalPrint(NodePrinter& printer) const;
@ -1640,7 +1640,7 @@ protected:
}
public:
Firebird::MetaName name;
MetaName name;
bool view;
bool silent;
};
@ -1720,20 +1720,20 @@ public:
expressionSource.clear();
}
Firebird::MetaName relation;
Firebird::ObjectsArray<Firebird::MetaName> columns;
MetaName relation;
Firebird::ObjectsArray<MetaName> columns;
Nullable<bool> unique;
Nullable<bool> descending;
Nullable<bool> inactive;
SSHORT type;
bid expressionBlr;
bid expressionSource;
Firebird::MetaName refRelation;
Firebird::ObjectsArray<Firebird::MetaName> refColumns;
MetaName refRelation;
Firebird::ObjectsArray<MetaName> refColumns;
};
public:
CreateIndexNode(MemoryPool& p, const Firebird::MetaName& aName)
CreateIndexNode(MemoryPool& p, const MetaName& aName)
: DdlNode(p),
name(p, aName),
unique(false),
@ -1745,8 +1745,8 @@ public:
}
public:
static void store(thread_db* tdbb, jrd_tra* transaction, Firebird::MetaName& name,
const Definition& definition, Firebird::MetaName* referredIndexName = NULL);
static void store(thread_db* tdbb, jrd_tra* transaction, MetaName& name,
const Definition& definition, MetaName* referredIndexName = NULL);
public:
virtual Firebird::string internalPrint(NodePrinter& printer) const;
@ -1760,7 +1760,7 @@ protected:
}
public:
Firebird::MetaName name;
MetaName name;
bool unique;
bool descending;
NestConst<RelationSourceNode> relation;
@ -1772,7 +1772,7 @@ public:
class AlterIndexNode : public DdlNode
{
public:
AlterIndexNode(MemoryPool& p, const Firebird::MetaName& aName, bool aActive)
AlterIndexNode(MemoryPool& p, const MetaName& aName, bool aActive)
: DdlNode(p),
name(p, aName),
active(aActive)
@ -1791,7 +1791,7 @@ protected:
}
public:
Firebird::MetaName name;
MetaName name;
bool active;
};
@ -1799,7 +1799,7 @@ public:
class SetStatisticsNode : public DdlNode
{
public:
SetStatisticsNode(MemoryPool& p, const Firebird::MetaName& aName)
SetStatisticsNode(MemoryPool& p, const MetaName& aName)
: DdlNode(p),
name(p, aName)
{
@ -1818,21 +1818,21 @@ protected:
}
public:
Firebird::MetaName name;
MetaName name;
};
class DropIndexNode : public DdlNode
{
public:
DropIndexNode(MemoryPool& p, const Firebird::MetaName& aName)
DropIndexNode(MemoryPool& p, const MetaName& aName)
: DdlNode(p),
name(p, aName)
{
}
static bool deleteSegmentRecords(thread_db* tdbb, jrd_tra* transaction,
const Firebird::MetaName& name);
const MetaName& name);
public:
virtual Firebird::string internalPrint(NodePrinter& printer) const;
@ -1846,7 +1846,7 @@ protected:
}
public:
Firebird::MetaName name;
MetaName name;
};
@ -1856,7 +1856,7 @@ public:
class NameNumber : public Printable
{
public:
NameNumber(MemoryPool& p, const Firebird::MetaName& aName)
NameNumber(MemoryPool& p, const MetaName& aName)
: name(p, aName),
number(0)
{
@ -1878,12 +1878,12 @@ public:
}
public:
Firebird::MetaName name;
MetaName name;
SSHORT number;
};
public:
CreateFilterNode(MemoryPool& p, const Firebird::MetaName& aName)
CreateFilterNode(MemoryPool& p, const MetaName& aName)
: DdlNode(p),
name(p, aName),
inputFilter(NULL),
@ -1905,7 +1905,7 @@ protected:
}
public:
Firebird::MetaName name;
MetaName name;
NestConst<NameNumber> inputFilter;
NestConst<NameNumber> outputFilter;
Firebird::string entryPoint;
@ -1916,7 +1916,7 @@ public:
class DropFilterNode : public DdlNode
{
public:
DropFilterNode(MemoryPool& p, const Firebird::MetaName& aName)
DropFilterNode(MemoryPool& p, const MetaName& aName)
: DdlNode(p),
name(p, aName)
{
@ -1934,7 +1934,7 @@ protected:
}
public:
Firebird::MetaName name;
MetaName name;
};
@ -2017,13 +2017,13 @@ public:
protected:
static USHORT convertPrivilegeFromString(thread_db* tdbb, jrd_tra* transaction,
Firebird::MetaName privilege);
MetaName privilege);
};
class CreateAlterRoleNode : public PrivilegesNode
{
public:
CreateAlterRoleNode(MemoryPool& p, const Firebird::MetaName& aName)
CreateAlterRoleNode(MemoryPool& p, const MetaName& aName)
: PrivilegesNode(p),
name(p, aName),
createFlag(false),
@ -2048,17 +2048,17 @@ private:
bool isItUserName(thread_db* tdbb, jrd_tra* transaction);
public:
Firebird::MetaName name;
MetaName name;
bool createFlag, sysPrivDrop;
void addPrivilege(const Firebird::MetaName* privName)
void addPrivilege(const MetaName* privName)
{
fb_assert(privName);
privileges.push(*privName);
}
private:
Firebird::HalfStaticArray<Firebird::MetaName, 4> privileges;
Firebird::HalfStaticArray<MetaName, 4> privileges;
};
@ -2067,7 +2067,7 @@ class MappingNode : public DdlNode, private ExecInSecurityDb
public:
enum OP {MAP_ADD, MAP_MOD, MAP_RPL, MAP_DROP};
MappingNode(MemoryPool& p, OP o, const Firebird::MetaName& nm)
MappingNode(MemoryPool& p, OP o, const MetaName& nm)
: DdlNode(p),
name(p, nm),
fromUtf8(p),
@ -2103,13 +2103,13 @@ private:
void addItem(Firebird::string& ddl, const char* text, char quote = '"');
public:
Firebird::MetaName name;
MetaName name;
Firebird::string fromUtf8;
Firebird::MetaName* plugin;
Firebird::MetaName* db;
Firebird::MetaName* fromType;
MetaName* plugin;
MetaName* db;
MetaName* fromType;
IntlString* from;
Firebird::MetaName* to;
MetaName* to;
OP op;
char mode; // * - any source, P - plugin, M - mapping, S - any serverwide plugin
bool global;
@ -2120,7 +2120,7 @@ public:
class DropRoleNode : public DdlNode
{
public:
DropRoleNode(MemoryPool& p, const Firebird::MetaName& aName)
DropRoleNode(MemoryPool& p, const MetaName& aName)
: DdlNode(p),
name(p, aName)
{
@ -2138,7 +2138,7 @@ protected:
}
public:
Firebird::MetaName name;
MetaName name;
};
@ -2150,7 +2150,7 @@ public:
{ }
protected:
Firebird::MetaName upper(const Firebird::MetaName& str);
MetaName upper(const MetaName& str);
};
@ -2159,7 +2159,7 @@ class CreateAlterUserNode : public UserNode
public:
enum Mode {USER_ADD, USER_MOD, USER_RPL};
CreateAlterUserNode(MemoryPool& p, Mode md, const Firebird::MetaName& aName)
CreateAlterUserNode(MemoryPool& p, Mode md, const MetaName& aName)
: UserNode(p),
properties(p),
name(p, upper(aName)),
@ -2197,23 +2197,23 @@ public:
: value(p)
{ }
Firebird::MetaName property;
MetaName property;
Firebird::string value;
};
Firebird::ObjectsArray<Property> properties;
const Firebird::MetaName name;
const MetaName name;
Firebird::string* password;
Firebird::string* firstName;
Firebird::string* middleName;
Firebird::string* lastName;
Firebird::MetaName* plugin;
MetaName* plugin;
Firebird::string* comment;
Nullable<bool> adminRole;
Nullable<bool> active;
Mode mode;
void addProperty(Firebird::MetaName* pr, Firebird::string* val = NULL)
void addProperty(MetaName* pr, Firebird::string* val = NULL)
{
fb_assert(pr);
@ -2230,7 +2230,7 @@ public:
class DropUserNode : public UserNode
{
public:
DropUserNode(MemoryPool& p, const Firebird::MetaName& aName, const Firebird::MetaName* aPlugin = NULL)
DropUserNode(MemoryPool& p, const MetaName& aName, const MetaName* aPlugin = NULL)
: UserNode(p),
name(p, upper(aName)),
plugin(p),
@ -2257,8 +2257,8 @@ protected:
}
public:
const Firebird::MetaName name;
Firebird::MetaName plugin;
const MetaName name;
MetaName plugin;
bool silent;
};
@ -2278,7 +2278,7 @@ typedef RecreateNode<CreateAlterUserNode, DropUserNode, isc_dsql_recreate_user_f
typedef Firebird::Pair<Firebird::NonPooled<char, ValueListNode*> > PrivilegeClause;
typedef Firebird::Pair<Firebird::NonPooled<SSHORT, Firebird::MetaName> > GranteeClause;
typedef Firebird::Pair<Firebird::NonPooled<SSHORT, MetaName> > GranteeClause;
class GrantRevokeNode : public PrivilegesNode, private ExecInSecurityDb
{
@ -2314,22 +2314,22 @@ protected:
private:
void modifyPrivileges(thread_db* tdbb, jrd_tra* transaction, SSHORT option, const GranteeClause* user);
void grantRevoke(thread_db* tdbb, jrd_tra* transaction, const GranteeClause* object,
const GranteeClause* userNod, const char* privs, Firebird::MetaName field, int options);
const GranteeClause* userNod, const char* privs, MetaName field, int options);
static void checkGrantorCanGrantRelation(thread_db* tdbb, jrd_tra* transaction, const char* grantor,
const char* privilege, const Firebird::MetaName& relationName,
const Firebird::MetaName& fieldName, bool topLevel);
const char* privilege, const MetaName& relationName,
const MetaName& fieldName, bool topLevel);
static void checkGrantorCanGrantRole(thread_db* tdbb, jrd_tra* transaction,
const Firebird::MetaName& grantor, const Firebird::MetaName& roleName);
const MetaName& grantor, const MetaName& roleName);
static void checkGrantorCanGrantDdl(thread_db* tdbb, jrd_tra* transaction,
const Firebird::MetaName& grantor, const char* privilege, const Firebird::MetaName& objName);
const MetaName& grantor, const char* privilege, const MetaName& objName);
static void checkGrantorCanGrantObject(thread_db* tdbb, jrd_tra* transaction, const char* grantor,
const char* privilege, const Firebird::MetaName& objName, SSHORT objType);
const char* privilege, const MetaName& objName, SSHORT objType);
static void storePrivilege(thread_db* tdbb, jrd_tra* transaction,
const Firebird::MetaName& object, const Firebird::MetaName& user,
const Firebird::MetaName& field, const TEXT* privilege, SSHORT userType,
SSHORT objType, int option, const Firebird::MetaName& grantor);
const MetaName& object, const MetaName& user,
const MetaName& field, const TEXT* privilege, SSHORT userType,
SSHORT objType, int option, const MetaName& grantor);
static void setFieldClassName(thread_db* tdbb, jrd_tra* transaction,
const Firebird::MetaName& relation, const Firebird::MetaName& field);
const MetaName& relation, const MetaName& field);
// Diagnostics print helper.
static const char* privilegeName(char symbol)
@ -2356,14 +2356,14 @@ private:
struct CreateDbJob
{
CreateDbJob(SSHORT a_userType, const Firebird::MetaName& a_user)
CreateDbJob(SSHORT a_userType, const MetaName& a_user)
: allOnAll(false), grantErased(false), badGrantor(false),
userType(a_userType), user(a_user)
{ }
bool allOnAll, grantErased, badGrantor;
SSHORT userType;
Firebird::MetaName user, revoker;
MetaName user, revoker;
};
Firebird::Array<CreateDbJob> createDbJobs;
@ -2375,7 +2375,7 @@ public:
NestConst<GranteeClause> object;
Firebird::Array<GranteeClause> users;
bool grantAdminOption;
NestConst<Firebird::MetaName> grantor;
NestConst<MetaName> grantor;
// ddl rights
bool isDdl;
};
@ -2446,13 +2446,13 @@ public:
SLONG createLength, linger;
unsigned clauses;
Firebird::string differenceFile;
Firebird::MetaName setDefaultCharSet;
Firebird::MetaName setDefaultCollation;
MetaName setDefaultCharSet;
MetaName setDefaultCollation;
Firebird::Array<NestConst<DbFileClause> > files;
Firebird::MetaName cryptPlugin;
Firebird::MetaName keyName;
MetaName cryptPlugin;
MetaName keyName;
Nullable<bool> ssDefiner;
Firebird::Array<Firebird::MetaName> pubTables;
Firebird::Array<MetaName> pubTables;
};

View File

@ -331,9 +331,9 @@ void DsqlCompilerScratch::putLocalVariables(CompoundStmtNode* parameters, USHORT
++locals;
}
else if (StmtNode::is<DeclareCursorNode>(parameter) ||
StmtNode::is<DeclareSubProcNode>(parameter) ||
StmtNode::is<DeclareSubFuncNode>(parameter))
else if (nodeIs<DeclareCursorNode>(parameter) ||
nodeIs<DeclareSubProcNode>(parameter) ||
nodeIs<DeclareSubFuncNode>(parameter))
{
parameter->dsqlPass(this);
parameter->genBlr(this);
@ -660,7 +660,7 @@ void DsqlCompilerScratch::checkUnusedCTEs()
}
}
DeclareSubFuncNode* DsqlCompilerScratch::getSubFunction(const Firebird::MetaName& name)
DeclareSubFuncNode* DsqlCompilerScratch::getSubFunction(const MetaName& name)
{
DeclareSubFuncNode* subFunc = NULL;
subFunctions.get(name, subFunc);
@ -682,7 +682,7 @@ void DsqlCompilerScratch::putSubFunction(DeclareSubFuncNode* subFunc, bool repla
subFunctions.put(subFunc->name, subFunc);
}
DeclareSubProcNode* DsqlCompilerScratch::getSubProcedure(const Firebird::MetaName& name)
DeclareSubProcNode* DsqlCompilerScratch::getSubProcedure(const MetaName& name)
{
DeclareSubProcNode* subProc = NULL;
subProcedures.get(name, subProc);

View File

@ -26,7 +26,7 @@
#include "../dsql/dsql.h"
#include "../dsql/BlrDebugWriter.h"
#include "../common/classes/array.h"
#include "../common/classes/MetaName.h"
#include "../jrd/MetaName.h"
#include "../common/classes/stack.h"
#include "../common/classes/alloc.h"
@ -174,10 +174,10 @@ public:
void putType(const TypeClause* type, bool useSubType);
void putLocalVariables(CompoundStmtNode* parameters, USHORT locals);
void putLocalVariable(dsql_var* variable, const DeclareVariableNode* hostParam,
const Firebird::MetaName& collationName);
const MetaName& collationName);
dsql_var* makeVariable(dsql_fld*, const char*, const dsql_var::Type type, USHORT,
USHORT, USHORT);
dsql_var* resolveVariable(const Firebird::MetaName& varName);
dsql_var* resolveVariable(const MetaName& varName);
void genReturn(bool eosFlag = false);
void genParameters(Firebird::Array<NestConst<ParameterClause> >& parameters,
@ -202,7 +202,7 @@ public:
}
void addCTEs(WithClause* withClause);
SelectExprNode* findCTE(const Firebird::MetaName& name);
SelectExprNode* findCTE(const MetaName& name);
void clearCTEs();
void checkUnusedCTEs();
@ -249,10 +249,10 @@ public:
bool isPsql() const { return psql; }
void setPsql(bool value) { psql = value; }
DeclareSubFuncNode* getSubFunction(const Firebird::MetaName& name);
DeclareSubFuncNode* getSubFunction(const MetaName& name);
void putSubFunction(DeclareSubFuncNode* subFunc, bool replace = false);
DeclareSubProcNode* getSubProcedure(const Firebird::MetaName& name);
DeclareSubProcNode* getSubProcedure(const MetaName& name);
void putSubProcedure(DeclareSubProcNode* subProc, bool replace = false);
private:
@ -280,7 +280,7 @@ public:
USHORT derivedContextNumber; // Next available context number for derived tables
USHORT scopeLevel; // Scope level for parsing aliases in subqueries
USHORT loopLevel; // Loop level
Firebird::Stack<Firebird::MetaName*> labels; // Loop labels
Firebird::Stack<MetaName*> labels; // Loop labels
USHORT cursorNumber; // Cursor number
Firebird::Array<DeclareCursorNode*> cursors; // Cursors
USHORT inSelectList; // now processing "select list"
@ -292,7 +292,7 @@ public:
USHORT clientDialect; // dialect passed into the API call
USHORT inOuterJoin; // processing inside outer-join part
Firebird::string aliasRelationPrefix; // prefix for every relation-alias.
Firebird::MetaName package; // package being defined
MetaName package; // package being defined
Firebird::Stack<SelectExprNode*> currCtes; // current processing CTE's
class dsql_ctx* recursiveCtx; // context of recursive CTE
USHORT recursiveCtxId; // id of recursive union stream context
@ -310,8 +310,8 @@ private:
Firebird::HalfStaticArray<const Firebird::string*, 4> cteAliases; // CTE aliases in recursive members
bool psql;
DsqlCompilerScratch* mainScratch;
Firebird::GenericMap<Firebird::Left<Firebird::MetaName, DeclareSubFuncNode*> > subFunctions;
Firebird::GenericMap<Firebird::Left<Firebird::MetaName, DeclareSubProcNode*> > subProcedures;
Firebird::GenericMap<Firebird::Left<MetaName, DeclareSubFuncNode*> > subFunctions;
Firebird::GenericMap<Firebird::Left<MetaName, DeclareSubProcNode*> > subProcedures;
};
class PsqlChanger

File diff suppressed because it is too large Load Diff

View File

@ -26,6 +26,7 @@
#include "firebird/impl/blr.h"
#include "../dsql/Nodes.h"
#include "../dsql/NodePrinter.h"
#include "../common/classes/init.h"
#include "../dsql/pass1_proto.h"
class SysFunction;
@ -115,11 +116,11 @@ private:
void getDescDialect3(thread_db* tdbb, dsc* desc, dsc& desc1, dsc& desc2);
public:
const UCHAR blrOp;
bool dialect1;
Firebird::string label;
NestConst<ValueExprNode> arg1;
NestConst<ValueExprNode> arg2;
const UCHAR blrOp;
bool dialect1;
};
@ -266,11 +267,11 @@ public:
virtual dsc* execute(thread_db* tdbb, jrd_req* request) const;
public:
Firebird::MetaName dsqlAlias;
MetaName dsqlAlias;
dsql_fld* dsqlField;
dsc castDesc;
NestConst<ValueExprNode> source;
NestConst<ItemInfo> itemInfo;
dsc castDesc;
bool artificial;
};
@ -318,7 +319,7 @@ public:
class CollateNode : public TypedNode<ValueExprNode, ExprNode::TYPE_COLLATE>
{
public:
CollateNode(MemoryPool& pool, ValueExprNode* aArg, const Firebird::MetaName& aCollation);
CollateNode(MemoryPool& pool, ValueExprNode* aArg, const MetaName& aCollation);
virtual void getChildren(NodeRefsHolder& holder, bool dsql) const
{
@ -332,7 +333,7 @@ public:
virtual ValueExprNode* dsqlPass(DsqlCompilerScratch* dsqlScratch);
static ValueExprNode* pass1Collate(DsqlCompilerScratch* dsqlScratch, ValueExprNode* input,
const Firebird::MetaName& collation);
const MetaName& collation);
// This class is used only in the parser. It turns in a CastNode in dsqlPass.
@ -373,7 +374,7 @@ private:
public:
NestConst<ValueExprNode> arg;
Firebird::MetaName collation;
MetaName collation;
};
@ -581,8 +582,8 @@ public:
class DefaultNode : public DsqlNode<DefaultNode, ExprNode::TYPE_DEFAULT>
{
public:
explicit DefaultNode(MemoryPool& pool, const Firebird::MetaName& aRelationName,
const Firebird::MetaName& aFieldName);
explicit DefaultNode(MemoryPool& pool, const MetaName& aRelationName,
const MetaName& aFieldName);
static DmlNode* parse(thread_db* tdbb, MemoryPool& pool, CompilerScratch* csb, const UCHAR blrOp);
static ValueExprNode* createFromField(thread_db* tdbb, CompilerScratch* csb, StreamType* map, jrd_fld* fld);
@ -600,8 +601,8 @@ public:
virtual ValueExprNode* pass1(thread_db* tdbb, CompilerScratch* csb);
public:
const Firebird::MetaName relationName;
const Firebird::MetaName fieldName;
const MetaName relationName;
const MetaName fieldName;
private:
jrd_fld* field;
@ -794,20 +795,20 @@ public:
private:
static dsql_fld* resolveContext(DsqlCompilerScratch* dsqlScratch,
const Firebird::MetaName& qualifier, dsql_ctx* context, bool resolveByAlias);
const MetaName& qualifier, dsql_ctx* context, bool resolveByAlias);
public:
Firebird::MetaName dsqlQualifier;
Firebird::MetaName dsqlName;
MetaName dsqlQualifier;
MetaName dsqlName;
dsql_ctx* const dsqlContext;
dsql_fld* const dsqlField;
NestConst<ValueListNode> dsqlIndices;
const StreamType fieldStream;
const Format* format;
const StreamType fieldStream;
Nullable<USHORT> cursorNumber;
const USHORT fieldId;
const bool byId;
bool dsqlCursorField;
Nullable<USHORT> cursorNumber;
};
@ -815,7 +816,7 @@ class GenIdNode : public TypedNode<ValueExprNode, ExprNode::TYPE_GEN_ID>
{
public:
GenIdNode(MemoryPool& pool, bool aDialect1,
const Firebird::MetaName& name,
const MetaName& name,
ValueExprNode* aArg,
bool aImplicit, bool aIdentity);
@ -844,10 +845,10 @@ public:
virtual dsc* execute(thread_db* tdbb, jrd_req* request) const;
public:
const bool dialect1;
GeneratorItem generator;
NestConst<ValueExprNode> arg;
SLONG step;
const bool dialect1;
private:
bool sysGen;
@ -941,7 +942,7 @@ public:
class DsqlAliasNode : public TypedNode<ValueExprNode, ExprNode::TYPE_ALIAS>
{
public:
DsqlAliasNode(MemoryPool& pool, const Firebird::MetaName& aName, ValueExprNode* aValue)
DsqlAliasNode(MemoryPool& pool, const MetaName& aName, ValueExprNode* aValue)
: TypedNode<ValueExprNode, ExprNode::TYPE_ALIAS>(pool),
name(aName),
value(aValue),
@ -980,7 +981,7 @@ public:
}
public:
const Firebird::MetaName name;
const MetaName name;
NestConst<ValueExprNode> value;
NestConst<ImplicitJoin> implicitJoin;
};
@ -1032,7 +1033,7 @@ public:
class DerivedFieldNode : public TypedNode<ValueExprNode, ExprNode::TYPE_DERIVED_FIELD>
{
public:
DerivedFieldNode(MemoryPool& pool, const Firebird::MetaName& aName, USHORT aScope,
DerivedFieldNode(MemoryPool& pool, const MetaName& aName, USHORT aScope,
ValueExprNode* aValue);
virtual void getChildren(NodeRefsHolder& holder, bool dsql) const
@ -1075,10 +1076,10 @@ public:
}
public:
Firebird::MetaName name;
USHORT scope;
MetaName name;
NestConst<ValueExprNode> value;
dsql_ctx* context;
USHORT scope;
};
@ -1169,12 +1170,20 @@ public:
class NullNode : public TypedNode<ValueExprNode, ExprNode::TYPE_NULL>
{
public:
private:
friend class Firebird::GlobalPtr<NullNode>;
explicit NullNode(MemoryPool& pool)
: TypedNode<ValueExprNode, ExprNode::TYPE_NULL>(pool)
{
}
public:
static NullNode* instance()
{
return &INSTANCE;
}
static DmlNode* parse(thread_db* tdbb, MemoryPool& pool, CompilerScratch* csb, const UCHAR blrOp);
virtual Firebird::string internalPrint(NodePrinter& printer) const;
@ -1184,15 +1193,17 @@ public:
virtual void getDesc(thread_db* tdbb, CompilerScratch* csb, dsc* desc);
virtual ValueExprNode* copy(thread_db* tdbb, NodeCopier& copier) const;
virtual ValueExprNode* pass2(thread_db* tdbb, CompilerScratch* csb);
virtual dsc* execute(thread_db* tdbb, jrd_req* request) const;
private:
static Firebird::GlobalPtr<NullNode> INSTANCE;
};
class OrderNode : public DsqlNode<OrderNode, ExprNode::TYPE_ORDER>
{
public:
enum NullsPlacement
enum NullsPlacement : UCHAR
{
NULLS_DEFAULT,
NULLS_FIRST,
@ -1381,7 +1392,7 @@ public:
public:
explicit WindowClause(MemoryPool& pool,
const Firebird::MetaName* aName = NULL,
const MetaName* aName = NULL,
ValueListNode* aPartition = NULL,
ValueListNode* aOrder = NULL,
FrameExtent* aFrameExtent = NULL,
@ -1447,7 +1458,7 @@ public:
}
public:
const Firebird::MetaName* name;
const MetaName* name;
NestConst<ValueListNode> partition;
NestConst<ValueListNode> order;
NestConst<FrameExtent> extent;
@ -1459,7 +1470,7 @@ public:
class OverNode : public TypedNode<ValueExprNode, ExprNode::TYPE_OVER>
{
public:
explicit OverNode(MemoryPool& pool, AggNode* aAggExpr, const Firebird::MetaName* aWindowName);
explicit OverNode(MemoryPool& pool, AggNode* aAggExpr, const MetaName* aWindowName);
explicit OverNode(MemoryPool& pool, AggNode* aAggExpr, WindowClause* aWindow);
virtual void getChildren(NodeRefsHolder& holder, bool dsql) const
@ -1492,7 +1503,7 @@ public:
public:
NestConst<ValueExprNode> aggExpr;
const Firebird::MetaName* windowName;
const MetaName* windowName;
NestConst<WindowClause> window;
};
@ -1539,20 +1550,20 @@ public:
virtual dsc* execute(thread_db* tdbb, jrd_req* request) const;
public:
USHORT dsqlParameterIndex;
dsql_par* dsqlParameter;
NestConst<MessageNode> message;
USHORT argNumber;
NestConst<ValueExprNode> argFlag;
NestConst<ValueExprNode> argIndicator;
NestConst<ItemInfo> argInfo;
USHORT dsqlParameterIndex;
USHORT argNumber;
};
class RecordKeyNode : public TypedNode<ValueExprNode, ExprNode::TYPE_RECORD_KEY>
{
public:
RecordKeyNode(MemoryPool& pool, UCHAR aBlrOp, const Firebird::MetaName& aDsqlQualifier = NULL);
RecordKeyNode(MemoryPool& pool, UCHAR aBlrOp, const MetaName& aDsqlQualifier = NULL);
static DmlNode* parse(thread_db* tdbb, MemoryPool& pool, CompilerScratch* csb, const UCHAR blrOp);
@ -1619,10 +1630,10 @@ private:
void raiseError(dsql_ctx* context) const;
public:
const UCHAR blrOp;
Firebird::MetaName dsqlQualifier;
MetaName dsqlQualifier;
NestConst<RecordSourceNode> dsqlRelation;
StreamType recStream;
const UCHAR blrOp;
bool aggregate;
};
@ -1861,13 +1872,13 @@ public:
virtual dsc* execute(thread_db* tdbb, jrd_req* request) const;
public:
const UCHAR blrOp;
bool ownSavepoint;
NestConst<RecordSourceNode> dsqlRse;
NestConst<RseNode> rse;
NestConst<ValueExprNode> value1;
NestConst<ValueExprNode> value2;
NestConst<SubQuery> subQuery;
const UCHAR blrOp;
bool ownSavepoint;
};
@ -1952,7 +1963,7 @@ public:
class SysFuncCallNode : public TypedNode<ValueExprNode, ExprNode::TYPE_SYSFUNC_CALL>
{
public:
explicit SysFuncCallNode(MemoryPool& pool, const Firebird::MetaName& aName,
explicit SysFuncCallNode(MemoryPool& pool, const MetaName& aName,
ValueListNode* aArgs = NULL);
static DmlNode* parse(thread_db* tdbb, MemoryPool& pool, CompilerScratch* csb, const UCHAR blrOp);
@ -1977,10 +1988,10 @@ public:
virtual dsc* execute(thread_db* tdbb, jrd_req* request) const;
public:
Firebird::MetaName name;
bool dsqlSpecialSyntax;
MetaName name;
NestConst<ValueListNode> args;
const SysFunction* function;
bool dsqlSpecialSyntax;
};
@ -2032,7 +2043,7 @@ private:
};
public:
explicit UdfCallNode(MemoryPool& pool, const Firebird::QualifiedName& aName,
explicit UdfCallNode(MemoryPool& pool, const QualifiedName& aName,
ValueListNode* aArgs = NULL);
static DmlNode* parse(thread_db* tdbb, MemoryPool& pool, CompilerScratch* csb, const UCHAR blrOp);
@ -2063,7 +2074,7 @@ public:
virtual dsc* execute(thread_db* tdbb, jrd_req* request) const;
public:
Firebird::QualifiedName name;
QualifiedName name;
NestConst<ValueListNode> args;
NestConst<Function> function;
@ -2136,11 +2147,11 @@ public:
virtual dsc* execute(thread_db* tdbb, jrd_req* request) const;
public:
Firebird::MetaName dsqlName;
MetaName dsqlName;
NestConst<dsql_var> dsqlVar;
USHORT varId;
NestConst<DeclareVariableNode> varDecl;
NestConst<ItemInfo> varInfo;
USHORT varId;
};

View File

@ -63,7 +63,7 @@ public:
text += ">\n";
}
void print(const Firebird::string& s, const Firebird::MetaName& value)
void print(const Firebird::string& s, const MetaName& value)
{
printIndent();
@ -76,7 +76,7 @@ public:
text += ">\n";
}
void print(const Firebird::string& s, const Firebird::QualifiedName& value)
void print(const Firebird::string& s, const QualifiedName& value)
{
printIndent();

View File

@ -29,6 +29,7 @@
#include "../common/classes/array.h"
#include "../common/classes/NestConst.h"
#include <functional>
#include <initializer_list>
#include <type_traits>
namespace Jrd {
@ -87,9 +88,10 @@ template <typename T>
class RegisterNode
{
public:
explicit RegisterNode(UCHAR blr)
explicit RegisterNode(std::initializer_list<UCHAR> blrList)
{
PAR_register(blr, T::parse);
for (const auto blr : blrList)
PAR_register(blr, T::parse);
}
};
@ -97,9 +99,10 @@ template <typename T>
class RegisterBoolNode
{
public:
explicit RegisterBoolNode(UCHAR blr)
explicit RegisterBoolNode(std::initializer_list<UCHAR> blrList)
{
PAR_register(blr, T::parse);
for (const auto blr : blrList)
PAR_register(blr, T::parse);
}
};
@ -181,10 +184,10 @@ public:
}
static bool deleteSecurityClass(thread_db* tdbb, jrd_tra* transaction,
const Firebird::MetaName& secClass);
const MetaName& secClass);
static void storePrivileges(thread_db* tdbb, jrd_tra* transaction,
const Firebird::MetaName& name, int type, const char* privileges);
const MetaName& name, int type, const char* privileges);
public:
// Check permission on DDL operation. Return true if everything is OK.
@ -215,11 +218,11 @@ public:
enum DdlTriggerWhen { DTW_BEFORE, DTW_AFTER };
static void executeDdlTrigger(thread_db* tdbb, jrd_tra* transaction,
DdlTriggerWhen when, int action, const Firebird::MetaName& objectName,
const Firebird::MetaName& oldNewObjectName, const Firebird::string& sqlText);
DdlTriggerWhen when, int action, const MetaName& objectName,
const MetaName& oldNewObjectName, const Firebird::string& sqlText);
protected:
typedef Firebird::Pair<Firebird::Left<Firebird::MetaName, bid> > MetaNameBidPair;
typedef Firebird::Pair<Firebird::Left<MetaName, bid> > MetaNameBidPair;
typedef Firebird::GenericMap<MetaNameBidPair> MetaNameBidMap;
// Return exception code based on combination of create and alter clauses.
@ -240,9 +243,9 @@ protected:
}
void executeDdlTrigger(thread_db* tdbb, DsqlCompilerScratch* dsqlScratch, jrd_tra* transaction,
DdlTriggerWhen when, int action, const Firebird::MetaName& objectName,
const Firebird::MetaName& oldNewObjectName);
void storeGlobalField(thread_db* tdbb, jrd_tra* transaction, Firebird::MetaName& name,
DdlTriggerWhen when, int action, const MetaName& objectName,
const MetaName& oldNewObjectName);
void storeGlobalField(thread_db* tdbb, jrd_tra* transaction, MetaName& name,
const TypeClause* field,
const Firebird::string& computedSource = "",
const BlrDebugWriter::BlrData& computedValue = BlrDebugWriter::BlrData());
@ -348,6 +351,12 @@ public:
{
}
public:
typename T::Type getType() const override
{
return typeConst;
}
public:
const static typename T::Type TYPE = typeConst;
};
@ -355,32 +364,32 @@ public:
template <typename To, typename From> static To* nodeAs(From* fromNode)
{
return fromNode && fromNode->type == To::TYPE ? static_cast<To*>(fromNode) : NULL;
return fromNode && fromNode->getType() == To::TYPE ? static_cast<To*>(fromNode) : NULL;
}
template <typename To, typename From> static To* nodeAs(NestConst<From>& fromNode)
{
return fromNode && fromNode->type == To::TYPE ? static_cast<To*>(fromNode.getObject()) : NULL;
return fromNode && fromNode->getType() == To::TYPE ? static_cast<To*>(fromNode.getObject()) : NULL;
}
template <typename To, typename From> static const To* nodeAs(const From* fromNode)
{
return fromNode && fromNode->type == To::TYPE ? static_cast<const To*>(fromNode) : NULL;
return fromNode && fromNode->getType() == To::TYPE ? static_cast<const To*>(fromNode) : NULL;
}
template <typename To, typename From> static const To* nodeAs(const NestConst<From>& fromNode)
{
return fromNode && fromNode->type == To::TYPE ? static_cast<const To*>(fromNode.getObject()) : NULL;
return fromNode && fromNode->getType() == To::TYPE ? static_cast<const To*>(fromNode.getObject()) : NULL;
}
template <typename To, typename From> static bool nodeIs(const From* fromNode)
{
return fromNode && fromNode->type == To::TYPE;
return fromNode && fromNode->getType() == To::TYPE;
}
template <typename To, typename From> static bool nodeIs(const NestConst<From>& fromNode)
{
return fromNode && fromNode->type == To::TYPE;
return fromNode && fromNode->getType() == To::TYPE;
}
@ -509,24 +518,23 @@ public:
};
// Generic flags.
static const unsigned FLAG_INVARIANT = 0x01; // Node is recognized as being invariant.
static const USHORT FLAG_INVARIANT = 0x01; // Node is recognized as being invariant.
// Boolean flags.
static const unsigned FLAG_DEOPTIMIZE = 0x02; // Boolean which requires deoptimization - currently never defined.
static const unsigned FLAG_RESIDUAL = 0x04; // Boolean which must remain residual - currently never defined.
static const USHORT FLAG_DEOPTIMIZE = 0x02; // Boolean which requires deoptimization - currently never defined.
static const USHORT FLAG_RESIDUAL = 0x04; // Boolean which must remain residual - currently never defined.
// Value flags.
static const unsigned FLAG_DOUBLE = 0x10;
static const unsigned FLAG_DATE = 0x20;
static const unsigned FLAG_DECFLOAT = 0x40;
static const unsigned FLAG_VALUE = 0x80; // Full value area required in impure space.
static const unsigned FLAG_INT128 = 0x100;
static const USHORT FLAG_DOUBLE = 0x10;
static const USHORT FLAG_DATE = 0x20;
static const USHORT FLAG_DECFLOAT = 0x40;
static const USHORT FLAG_VALUE = 0x80; // Full value area required in impure space.
static const USHORT FLAG_INT128 = 0x100;
explicit ExprNode(Type aType, MemoryPool& pool)
: DmlNode(pool),
type(aType),
nodFlags(0),
impureOffset(0)
impureOffset(0),
nodFlags(0)
{
}
@ -544,6 +552,7 @@ public:
*node = (*node)->pass2(tdbb, csb);
}
virtual Type getType() const = 0;
virtual Firebird::string internalPrint(NodePrinter& printer) const = 0;
virtual bool dsqlAggregateFinder(AggregateFinder& visitor)
@ -680,9 +689,8 @@ public:
virtual ExprNode* copy(thread_db* tdbb, NodeCopier& copier) const = 0;
public:
const Type type;
unsigned nodFlags;
ULONG impureOffset;
USHORT nodFlags;
};
@ -907,7 +915,7 @@ public:
AggNode* newInstance(MemoryPool& pool) const
{
return FB_NEW T(pool);
return FB_NEW_POOL(pool) T(pool);
}
};
@ -923,7 +931,7 @@ public:
AggNode* newInstance(MemoryPool& pool) const
{
return FB_NEW T(pool, type);
return FB_NEW_POOL(pool) T(pool, type);
}
public:
@ -936,20 +944,18 @@ public:
public:
explicit Register(const char* aName, UCHAR blr, UCHAR blrDistinct)
: AggInfo(aName, blr, blrDistinct),
registerNode1(blr),
registerNode2(blrDistinct)
registerNode({blr, blrDistinct})
{
}
explicit Register(const char* aName, UCHAR blr)
: AggInfo(aName, blr, blr),
registerNode1(blr),
registerNode2(blr)
registerNode({blr})
{
}
private:
RegisterNode<T> registerNode1, registerNode2;
RegisterNode<T> registerNode;
};
public:
@ -1059,20 +1065,20 @@ public:
class RecordSourceNode : public ExprNode
{
public:
static const unsigned DFLAG_SINGLETON = 0x01;
static const unsigned DFLAG_VALUE = 0x02;
static const unsigned DFLAG_RECURSIVE = 0x04; // recursive member of recursive CTE
static const unsigned DFLAG_DERIVED = 0x08;
static const unsigned DFLAG_DT_IGNORE_COLUMN_CHECK = 0x10;
static const unsigned DFLAG_DT_CTE_USED = 0x20;
static const unsigned DFLAG_CURSOR = 0x40;
static const unsigned DFLAG_LATERAL = 0x80;
static const USHORT DFLAG_SINGLETON = 0x01;
static const USHORT DFLAG_VALUE = 0x02;
static const USHORT DFLAG_RECURSIVE = 0x04; // recursive member of recursive CTE
static const USHORT DFLAG_DERIVED = 0x08;
static const USHORT DFLAG_DT_IGNORE_COLUMN_CHECK = 0x10;
static const USHORT DFLAG_DT_CTE_USED = 0x20;
static const USHORT DFLAG_CURSOR = 0x40;
static const USHORT DFLAG_LATERAL = 0x80;
RecordSourceNode(Type aType, MemoryPool& pool)
: ExprNode(aType, pool),
dsqlFlags(0),
dsqlContext(NULL),
stream(INVALID_STREAM)
stream(INVALID_STREAM),
dsqlFlags(0)
{
}
@ -1106,7 +1112,6 @@ public:
}
virtual RecordSourceNode* copy(thread_db* tdbb, NodeCopier& copier) const = 0;
virtual void ignoreDbKey(thread_db* tdbb, CompilerScratch* csb) const = 0;
virtual RecordSourceNode* pass1(thread_db* tdbb, CompilerScratch* csb) = 0;
virtual void pass1Source(thread_db* tdbb, CompilerScratch* csb, RseNode* rse,
BoolExprNode** boolean, RecordSourceNodeStack& stack) = 0;
@ -1151,11 +1156,13 @@ public:
virtual RecordSource* compile(thread_db* tdbb, OptimizerBlk* opt, bool innerSubStream) = 0;
public:
unsigned dsqlFlags;
dsql_ctx* dsqlContext;
protected:
StreamType stream;
public:
USHORT dsqlFlags;
};
@ -1382,7 +1389,7 @@ public:
TYPE_EXT_TRIGGER
};
enum WhichTrigger
enum WhichTrigger : UCHAR
{
ALL_TRIGS = 0,
PRE_TRIG = 1,
@ -1402,13 +1409,13 @@ public:
oldPool(tdbb->getDefaultPool()),
oldRequest(tdbb->getRequest()),
oldTransaction(tdbb->getTransaction()),
errorPending(false),
catchDisabled(false),
topNode(NULL),
prevNode(NULL),
whichEraseTrig(ALL_TRIGS),
whichStoTrig(ALL_TRIGS),
whichModTrig(ALL_TRIGS),
topNode(NULL),
prevNode(NULL),
errorPending(false),
catchDisabled(false),
exit(false)
{
savedTdbb->setTransaction(transaction);
@ -1425,55 +1432,26 @@ public:
MemoryPool* oldPool; // Save the old pool to restore on exit.
jrd_req* oldRequest; // Save the old request to restore on exit.
jrd_tra* oldTransaction; // Save the old transcation to restore on exit.
bool errorPending; // Is there an error pending to be handled?
bool catchDisabled; // Catch errors so we can unwind cleanly.
const StmtNode* topNode;
const StmtNode* prevNode;
WhichTrigger whichEraseTrig;
WhichTrigger whichStoTrig;
WhichTrigger whichModTrig;
const StmtNode* topNode;
const StmtNode* prevNode;
bool errorPending; // Is there an error pending to be handled?
bool catchDisabled; // Catch errors so we can unwind cleanly.
bool exit; // Exit the looper when true.
};
public:
explicit StmtNode(Type aType, MemoryPool& pool)
: DmlNode(pool),
type(aType),
parentStmt(NULL),
impureOffset(0),
hasLineColumn(false)
{
}
template <typename T> T* as()
{
return type == T::TYPE ? static_cast<T*>(this) : NULL;
}
template <typename T> const T* as() const
{
return type == T::TYPE ? static_cast<const T*>(this) : NULL;
}
template <typename T> bool is() const
{
return type == T::TYPE;
}
template <typename T, typename T2> static T* as(T2* node)
{
return node ? node->template as<T>() : NULL;
}
template <typename T, typename T2> static const T* as(const T2* node)
{
return node ? node->template as<T>() : NULL;
}
template <typename T, typename T2> static bool is(const T2* node)
{
return node && node->template is<T>();
}
virtual Type getType() const = 0;
// Allocate and assign impure space for various nodes.
template <typename T> static void doPass2(thread_db* tdbb, CompilerScratch* csb, T** node,
@ -1509,7 +1487,7 @@ public:
fb_assert(false);
Firebird::status_exception::raise(
Firebird::Arg::Gds(isc_cannot_copy_stmt) <<
Firebird::Arg::Num(int(type)));
Firebird::Arg::Num(int(getType())));
return NULL;
}
@ -1517,7 +1495,6 @@ public:
virtual const StmtNode* execute(thread_db* tdbb, jrd_req* request, ExeState* exeState) const = 0;
public:
const Type type;
NestConst<StmtNode> parentStmt;
ULONG impureOffset; // Inpure offset from request block.
bool hasLineColumn;
@ -1612,7 +1589,7 @@ public:
class GeneratorItem : public Printable
{
public:
GeneratorItem(Firebird::MemoryPool& pool, const Firebird::MetaName& name)
GeneratorItem(Firebird::MemoryPool& pool, const MetaName& name)
: id(0), name(pool, name), secName(pool)
{}
@ -1629,8 +1606,8 @@ public:
public:
SLONG id;
Firebird::MetaName name;
Firebird::MetaName secName;
MetaName name;
MetaName secName;
};
typedef Firebird::Array<StreamType> StreamMap;

View File

@ -331,7 +331,7 @@ void CreateAlterPackageNode::executeCreate(thread_db* tdbb, DsqlCompilerScratch*
jrd_tra* transaction)
{
Attachment* attachment = transaction->getAttachment();
const MetaName& userName = attachment->att_user->getUserName();
const MetaString& userName = attachment->att_user->getUserName();
executeDdlTrigger(tdbb, dsqlScratch, transaction, DTW_BEFORE,
DDL_TRIGGER_CREATE_PACKAGE, name, NULL);

View File

@ -68,7 +68,7 @@ public:
};
public:
CreateAlterPackageNode(MemoryPool& pool, const Firebird::MetaName& aName)
CreateAlterPackageNode(MemoryPool& pool, const MetaName& aName)
: DdlNode(pool),
name(pool, aName),
create(true),
@ -103,24 +103,24 @@ private:
void executeItems(thread_db* tdbb, DsqlCompilerScratch* dsqlScratch, jrd_tra* transaction);
public:
Firebird::MetaName name;
MetaName name;
bool create;
bool alter;
Firebird::string source;
Firebird::Array<Item>* items;
Firebird::SortedArray<Firebird::MetaName> functionNames;
Firebird::SortedArray<Firebird::MetaName> procedureNames;
Firebird::SortedArray<MetaName> functionNames;
Firebird::SortedArray<MetaName> procedureNames;
Nullable<bool> ssDefiner;
private:
Firebird::MetaName owner;
MetaName owner;
};
class DropPackageNode : public DdlNode
{
public:
DropPackageNode(MemoryPool& pool, const Firebird::MetaName& aName)
DropPackageNode(MemoryPool& pool, const MetaName& aName)
: DdlNode(pool),
name(pool, aName),
silent(false)
@ -139,7 +139,7 @@ protected:
}
public:
Firebird::MetaName name;
MetaName name;
bool silent;
};
@ -151,7 +151,7 @@ typedef RecreateNode<CreateAlterPackageNode, DropPackageNode, isc_dsql_recreate_
class CreatePackageBodyNode : public DdlNode
{
public:
CreatePackageBodyNode(MemoryPool& pool, const Firebird::MetaName& aName)
CreatePackageBodyNode(MemoryPool& pool, const MetaName& aName)
: DdlNode(pool),
name(pool, aName),
source(pool),
@ -174,7 +174,7 @@ protected:
}
public:
Firebird::MetaName name;
MetaName name;
Firebird::string source;
Firebird::Array<CreateAlterPackageNode::Item>* declaredItems;
Firebird::Array<CreateAlterPackageNode::Item>* items;
@ -187,7 +187,7 @@ private:
class DropPackageBodyNode : public DdlNode
{
public:
DropPackageBodyNode(MemoryPool& pool, const Firebird::MetaName& aName)
DropPackageBodyNode(MemoryPool& pool, const MetaName& aName)
: DdlNode(pool),
name(pool, aName),
silent(false)
@ -206,7 +206,7 @@ protected:
}
public:
Firebird::MetaName name;
MetaName name;
bool silent; // Unused. Just to please RecreateNode template.
};

View File

@ -40,10 +40,8 @@ using namespace Firebird;
using namespace Jrd;
namespace
namespace Jrd
{
const int HASH_SIZE = 1021;
struct Keyword
{
Keyword(int aKeyword, MetaName* aStr)
@ -75,7 +73,28 @@ namespace
}
};
GlobalPtr<KeywordsMap> keywordsMap;
KeywordsMap* KeywordsMapAllocator::create()
{
thread_db* tdbb = JRD_get_thread_data();
fb_assert(tdbb);
Database* dbb = tdbb->getDatabase();
fb_assert(dbb);
return FB_NEW_POOL(*dbb->dbb_permanent) KeywordsMap(*dbb->dbb_permanent);
}
void KeywordsMapAllocator::destroy(KeywordsMap* inst)
{
delete inst;
}
}
namespace
{
const Keyword* getKeyword(Database* dbb, const MetaName& str)
{
return dbb->dbb_keywords_map().get(str);
}
}
@ -1212,7 +1231,7 @@ int Parser::yylexAux()
yyabandon(yyposn, -104, isc_dyn_name_longer);
const MetaName str(string, p - string);
const Keyword* const keyVer = keywordsMap->get(str);
const Keyword* const keyVer = getKeyword(dbb, str);
if (keyVer && (keyVer->keyword != TOK_COMMENT || lex.prev_keyword == -1))
{
@ -1235,7 +1254,7 @@ int Parser::yylexAux()
if (lex.last_token + 1 < lex.end && !isspace(UCHAR(lex.last_token[1])))
{
const MetaName str(lex.last_token, 2);
const Keyword* const keyVer = keywordsMap->get(str);
const Keyword* const keyVer = getKeyword(dbb, str);
if (keyVer)
{

View File

@ -254,9 +254,9 @@ private:
void yyabandon(const Position& position, SLONG, ISC_STATUS);
void yyabandon(const Position& position, SLONG, const Firebird::Arg::StatusVector& status);
Firebird::MetaName optName(Firebird::MetaName* name)
MetaName optName(MetaName* name)
{
return (name ? *name : Firebird::MetaName());
return (name ? *name : MetaName());
}
void transformString(const char* start, unsigned length, Firebird::string& dest);
@ -337,7 +337,7 @@ private:
return clause != 0;
}
bool isDuplicateClause(const Firebird::MetaName& clause)
bool isDuplicateClause(const MetaName& clause)
{
return clause.hasData();
}

View File

@ -326,7 +326,7 @@ void SavepointEncloseNode::genBlr(DsqlCompilerScratch* dsqlScratch)
//--------------------
static RegisterNode<AssignmentNode> regAssignmentNode(blr_assignment);
static RegisterNode<AssignmentNode> regAssignmentNode({blr_assignment});
DmlNode* AssignmentNode::parse(thread_db* tdbb, MemoryPool& pool, CompilerScratch* csb, const UCHAR /*blrOp*/)
{
@ -550,7 +550,7 @@ const StmtNode* AssignmentNode::execute(thread_db* tdbb, jrd_req* request, ExeSt
//--------------------
static RegisterNode<BlockNode> regBlockNode(blr_block);
static RegisterNode<BlockNode> regBlockNode({blr_block});
DmlNode* BlockNode::parse(thread_db* tdbb, MemoryPool& pool, CompilerScratch* csb, const UCHAR /*blrOp*/)
{
@ -632,7 +632,7 @@ BlockNode* BlockNode::pass2(thread_db* tdbb, CompilerScratch* csb)
doPass2(tdbb, csb, action.getAddress(), this);
doPass2(tdbb, csb, handlers.getAddress(), this);
impureOffset = CMP_impure(csb, sizeof(SavNumber));
impureOffset = csb->allocImpure<SavNumber>();
return this;
}
@ -890,7 +890,7 @@ bool BlockNode::testAndFixupError(thread_db* tdbb, jrd_req* request, const Excep
//--------------------
static RegisterNode<CompoundStmtNode> regCompoundStmtNode(blr_begin);
static RegisterNode<CompoundStmtNode> regCompoundStmtNode({blr_begin});
DmlNode* CompoundStmtNode::parse(thread_db* tdbb, MemoryPool& pool, CompilerScratch* csb, const UCHAR /*blrOp*/)
{
@ -976,11 +976,11 @@ CompoundStmtNode* CompoundStmtNode::pass2(thread_db* tdbb, CompilerScratch* csb)
for (NestConst<StmtNode>* i = statements.begin(); i != statements.end(); ++i)
doPass2(tdbb, csb, i->getAddress(), this);
impureOffset = CMP_impure(csb, sizeof(impure_state));
impureOffset = csb->allocImpure<impure_state>();
for (NestConst<StmtNode>* i = statements.begin(); i != statements.end(); ++i)
{
if (!StmtNode::is<AssignmentNode>(i->getObject()))
if (!nodeIs<AssignmentNode>(i->getObject()))
return this;
}
@ -1043,8 +1043,7 @@ const StmtNode* CompoundStmtNode::execute(thread_db* tdbb, jrd_req* request, Exe
//--------------------
static RegisterNode<ContinueLeaveNode> regContinueLeaveNodeContinue(blr_continue_loop);
static RegisterNode<ContinueLeaveNode> regContinueLeaveNodeLeave(blr_leave);
static RegisterNode<ContinueLeaveNode> regContinueLeaveNode({blr_continue_loop, blr_leave});
DmlNode* ContinueLeaveNode::parse(thread_db* /*tdbb*/, MemoryPool& pool, CompilerScratch* csb, const UCHAR blrOp)
{
@ -1102,7 +1101,7 @@ const StmtNode* ContinueLeaveNode::execute(thread_db* /*tdbb*/, jrd_req* request
//--------------------
static RegisterNode<CursorStmtNode> regCursorStmtNode(blr_cursor_stmt);
static RegisterNode<CursorStmtNode> regCursorStmtNode({blr_cursor_stmt});
DmlNode* CursorStmtNode::parse(thread_db* tdbb, MemoryPool& pool, CompilerScratch* csb, const UCHAR /*blrOp*/)
{
@ -1355,7 +1354,7 @@ const StmtNode* CursorStmtNode::execute(thread_db* tdbb, jrd_req* request, ExeSt
//--------------------
static RegisterNode<DeclareCursorNode> regDeclareCursorNode(blr_dcl_cursor);
static RegisterNode<DeclareCursorNode> regDeclareCursorNode({blr_dcl_cursor});
DmlNode* DeclareCursorNode::parse(thread_db* tdbb, MemoryPool& pool, CompilerScratch* csb, const UCHAR blrOp)
{
@ -1502,7 +1501,7 @@ const StmtNode* DeclareCursorNode::execute(thread_db* /*tdbb*/, jrd_req* request
//--------------------
static RegisterNode<DeclareSubFuncNode> regDeclareSubFuncNode(blr_subfunc_decl);
static RegisterNode<DeclareSubFuncNode> regDeclareSubFuncNode({blr_subfunc_decl});
DmlNode* DeclareSubFuncNode::parse(thread_db* tdbb, MemoryPool& pool, CompilerScratch* csb,
const UCHAR /*blrOp*/)
@ -1835,7 +1834,7 @@ const StmtNode* DeclareSubFuncNode::execute(thread_db* /*tdbb*/, jrd_req* reques
//--------------------
static RegisterNode<DeclareSubProcNode> regDeclareSubProcNode(blr_subproc_decl);
static RegisterNode<DeclareSubProcNode> regDeclareSubProcNode({blr_subproc_decl});
DmlNode* DeclareSubProcNode::parse(thread_db* tdbb, MemoryPool& pool, CompilerScratch* csb, const UCHAR /*blrOp*/)
{
@ -2175,7 +2174,7 @@ const StmtNode* DeclareSubProcNode::execute(thread_db* /*tdbb*/, jrd_req* reques
//--------------------
static RegisterNode<DeclareVariableNode> regDeclareVariableNode(blr_dcl_variable);
static RegisterNode<DeclareVariableNode> regDeclareVariableNode({blr_dcl_variable});
DmlNode* DeclareVariableNode::parse(thread_db* tdbb, MemoryPool& pool, CompilerScratch* csb, const UCHAR /*blrOp*/)
{
@ -2249,7 +2248,7 @@ DeclareVariableNode* DeclareVariableNode::pass1(thread_db* tdbb, CompilerScratch
DeclareVariableNode* DeclareVariableNode::pass2(thread_db* /*tdbb*/, CompilerScratch* csb)
{
impureOffset = CMP_impure(csb, sizeof(impure_value));
impureOffset = csb->allocImpure<impure_value>();
return this;
}
@ -2285,7 +2284,7 @@ const StmtNode* DeclareVariableNode::execute(thread_db* tdbb, jrd_req* request,
//--------------------
static RegisterNode<EraseNode> regEraseNode(blr_erase);
static RegisterNode<EraseNode> regEraseNode({blr_erase});
DmlNode* EraseNode::parse(thread_db* /*tdbb*/, MemoryPool& pool, CompilerScratch* csb, const UCHAR /*blrOp*/)
{
@ -2520,6 +2519,7 @@ void EraseNode::pass1Erase(thread_db* tdbb, CompilerScratch* csb, EraseNode* nod
EraseNode* viewNode = FB_NEW_POOL(*tdbb->getDefaultPool()) EraseNode(*tdbb->getDefaultPool());
viewNode->stream = node->stream;
viewNode->marks = node->marks & (StmtNode::MARK_POSITIONED | StmtNode::MARK_MERGE);
node->subStatement = viewNode;
@ -2568,7 +2568,6 @@ EraseNode* EraseNode::pass2(thread_db* tdbb, CompilerScratch* csb)
if (!(marks & StmtNode::MARK_POSITIONED))
forNode = pass2FindForNode(parentStmt, stream);
impureOffset = CMP_impure(csb, sizeof(SLONG));
csb->csb_rpt[stream].csb_flags |= csb_update;
return this;
@ -2738,7 +2737,7 @@ const StmtNode* EraseNode::erase(thread_db* tdbb, jrd_req* request, WhichTrigger
//--------------------
static RegisterNode<ErrorHandlerNode> regErrorHandlerNode(blr_error_handler);
static RegisterNode<ErrorHandlerNode> regErrorHandlerNode({blr_error_handler});
DmlNode* ErrorHandlerNode::parse(thread_db* tdbb, MemoryPool& pool, CompilerScratch* csb, const UCHAR /*blrOp*/)
{
@ -2901,10 +2900,8 @@ const StmtNode* ErrorHandlerNode::execute(thread_db* /*tdbb*/, jrd_req* request,
//--------------------
static RegisterNode<ExecProcedureNode> regExecProcedureNodeProc(blr_exec_proc);
static RegisterNode<ExecProcedureNode> regExecProcedureNodeProc2(blr_exec_proc2);
static RegisterNode<ExecProcedureNode> regExecProcedureNodePid(blr_exec_pid);
static RegisterNode<ExecProcedureNode> regExecProcedureNodeSubProc(blr_exec_subproc);
static RegisterNode<ExecProcedureNode> regExecProcedureNode(
{blr_exec_proc, blr_exec_proc2, blr_exec_pid, blr_exec_subproc});
// Parse an execute procedure reference.
DmlNode* ExecProcedureNode::parse(thread_db* tdbb, MemoryPool& pool, CompilerScratch* csb, const UCHAR blrOp)
@ -3334,9 +3331,7 @@ void ExecProcedureNode::executeProcedure(thread_db* tdbb, jrd_req* request) cons
//--------------------
static RegisterNode<ExecStatementNode> regExecStatementSql(blr_exec_sql);
static RegisterNode<ExecStatementNode> regExecStatementInto(blr_exec_into);
static RegisterNode<ExecStatementNode> regExecStatementStmt(blr_exec_stmt);
static RegisterNode<ExecStatementNode> regExecStatementNode({blr_exec_sql, blr_exec_into, blr_exec_stmt});
DmlNode* ExecStatementNode::parse(thread_db* tdbb, MemoryPool& pool, CompilerScratch* csb, const UCHAR blrOp)
{
@ -3741,7 +3736,7 @@ ExecStatementNode* ExecStatementNode::pass2(thread_db* tdbb, CompilerScratch* cs
}
}
impureOffset = CMP_impure(csb, sizeof(EDS::Statement*));
impureOffset = csb->allocImpure<EDS::Statement*>();
return this;
}
@ -3811,7 +3806,7 @@ const StmtNode* ExecStatementNode::execute(thread_db* tdbb, jrd_req* request, Ex
if (request->req_operation == jrd_req::req_unwind)
{
const LabelNode* label = StmtNode::as<LabelNode>(parentStmt.getObject());
const LabelNode* label = nodeAs<LabelNode>(parentStmt.getObject());
if (label && request->req_label == label->labelNumber &&
(request->req_flags & req_continue_loop))
@ -3851,7 +3846,7 @@ void ExecStatementNode::getString(thread_db* tdbb, jrd_req* request, const Value
//--------------------
static RegisterNode<IfNode> regIfNode(blr_if);
static RegisterNode<IfNode> regIfNode({blr_if});
DmlNode* IfNode::parse(thread_db* tdbb, MemoryPool& pool, CompilerScratch* csb, const UCHAR /*blrOp*/)
{
@ -3943,7 +3938,7 @@ const StmtNode* IfNode::execute(thread_db* tdbb, jrd_req* request, ExeState* /*e
//--------------------
static RegisterNode<InAutonomousTransactionNode> regInAutonomousTransactionNode(blr_auto_trans);
static RegisterNode<InAutonomousTransactionNode> regInAutonomousTransactionNode({blr_auto_trans});
DmlNode* InAutonomousTransactionNode::parse(thread_db* tdbb, MemoryPool& pool, CompilerScratch* csb,
const UCHAR /*blrOp*/)
@ -3978,7 +3973,6 @@ string InAutonomousTransactionNode::internalPrint(NodePrinter& printer) const
StmtNode::internalPrint(printer);
NODE_PRINT(printer, action);
NODE_PRINT(printer, impureOffset);
return "InAutonomousTransactionNode";
}
@ -3998,7 +3992,7 @@ InAutonomousTransactionNode* InAutonomousTransactionNode::pass1(thread_db* tdbb,
InAutonomousTransactionNode* InAutonomousTransactionNode::pass2(thread_db* tdbb, CompilerScratch* csb)
{
impureOffset = CMP_impure(csb, sizeof(Impure));
impureOffset = csb->allocImpure<Impure>();
doPass2(tdbb, csb, action.getAddress(), this);
return this;
}
@ -4163,7 +4157,7 @@ const StmtNode* InAutonomousTransactionNode::execute(thread_db* tdbb, jrd_req* r
//--------------------
static RegisterNode<InitVariableNode> regInitVariableNode(blr_init_variable);
static RegisterNode<InitVariableNode> regInitVariableNode({blr_init_variable});
DmlNode* InitVariableNode::parse(thread_db* /*tdbb*/, MemoryPool& pool, CompilerScratch* csb, const UCHAR /*blrOp*/)
{
@ -4525,7 +4519,7 @@ void ExecBlockNode::revertParametersOrder(Array<dsql_par*>& parameters)
//--------------------
static RegisterNode<ExceptionNode> regExceptionNode(blr_abort);
static RegisterNode<ExceptionNode> regExceptionNode({blr_abort});
DmlNode* ExceptionNode::parse(thread_db* tdbb, MemoryPool& pool, CompilerScratch* csb,
const UCHAR /*blrOp*/)
@ -4851,7 +4845,7 @@ void ExitNode::genBlr(DsqlCompilerScratch* dsqlScratch)
//--------------------
static RegisterNode<ForNode> regForNode(blr_for);
static RegisterNode<ForNode> regForNode({blr_for});
DmlNode* ForNode::parse(thread_db* tdbb, MemoryPool& pool, CompilerScratch* csb, const UCHAR blrOp)
{
@ -4960,6 +4954,7 @@ string ForNode::internalPrint(NodePrinter& printer) const
NODE_PRINT(printer, cursor);
NODE_PRINT(printer, parBlrBeginCnt);
NODE_PRINT(printer, forUpdate);
NODE_PRINT(printer, isMerge);
NODE_PRINT(printer, withLock);
return "ForNode";
@ -5021,7 +5016,12 @@ void ForNode::genBlr(DsqlCompilerScratch* dsqlScratch)
StmtNode* ForNode::pass1(thread_db* tdbb, CompilerScratch* csb)
{
doPass1(tdbb, csb, stall.getAddress());
doPass1(tdbb, csb, rse.getAddress());
{ // scope
AutoSetRestore<bool> autoImplicitCursor(&csb->csb_implicit_cursor, forUpdate);
doPass1(tdbb, csb, rse.getAddress());
}
doPass1(tdbb, csb, statement.getAddress());
return this;
}
@ -5051,7 +5051,10 @@ StmtNode* ForNode::pass2(thread_db* tdbb, CompilerScratch* csb)
if (rse->flags & RseNode::FLAG_WRITELOCK)
withLock = true;
impureOffset = CMP_impure(csb, isMerge ? sizeof(ImpureMerge) : sizeof(Impure));
if (isMerge)
impureOffset = csb->allocImpure<ImpureMerge>();
else
impureOffset = csb->allocImpure<Impure>();
return this;
}
@ -5119,7 +5122,7 @@ const StmtNode* ForNode::execute(thread_db* tdbb, jrd_req* request, ExeState* /*
case jrd_req::req_unwind:
{
const LabelNode* label = StmtNode::as<LabelNode>(parentStmt.getObject());
const LabelNode* label = nodeAs<LabelNode>(parentStmt.getObject());
if (label && request->req_label == label->labelNumber &&
(request->req_flags & req_continue_loop))
@ -5207,7 +5210,7 @@ void ForNode::setRecordUpdated(thread_db* tdbb, jrd_req* request, record_param*
//--------------------
static RegisterNode<HandlerNode> regHandlerNode(blr_handler);
static RegisterNode<HandlerNode> regHandlerNode({blr_handler});
DmlNode* HandlerNode::parse(thread_db* tdbb, MemoryPool& pool, CompilerScratch* csb, const UCHAR /*blrOp*/)
{
@ -5266,7 +5269,7 @@ const StmtNode* HandlerNode::execute(thread_db* /*tdbb*/, jrd_req* request, ExeS
//--------------------
static RegisterNode<LabelNode> regLabelNode(blr_label);
static RegisterNode<LabelNode> regLabelNode({blr_label});
DmlNode* LabelNode::parse(thread_db* tdbb, MemoryPool& pool, CompilerScratch* csb, const UCHAR /*blrOp*/)
{
@ -5361,7 +5364,7 @@ void LineColumnNode::genBlr(DsqlCompilerScratch* dsqlScratch)
//--------------------
static RegisterNode<LoopNode> regLoopNode(blr_loop);
static RegisterNode<LoopNode> regLoopNode({blr_loop});
DmlNode* LoopNode::parse(thread_db* tdbb, MemoryPool& pool, CompilerScratch* csb, const UCHAR /*blrOp*/)
{
@ -5437,7 +5440,7 @@ const StmtNode* LoopNode::execute(thread_db* /*tdbb*/, jrd_req* request, ExeStat
case jrd_req::req_unwind:
{
const LabelNode* label = StmtNode::as<LabelNode>(parentStmt.getObject());
const LabelNode* label = nodeAs<LabelNode>(parentStmt.getObject());
if (label && request->req_label == label->labelNumber &&
(request->req_flags & req_continue_loop))
@ -5925,7 +5928,7 @@ void MergeNode::genBlr(DsqlCompilerScratch* /*dsqlScratch*/)
//--------------------
static RegisterNode<MessageNode> regMessageNode(blr_message);
static RegisterNode<MessageNode> regMessageNode({blr_message});
// Parse a message declaration, including operator byte.
DmlNode* MessageNode::parse(thread_db* tdbb, MemoryPool& pool, CompilerScratch* csb, const UCHAR /*blrOp*/)
@ -6036,8 +6039,8 @@ MessageNode* MessageNode::pass2(thread_db* /*tdbb*/, CompilerScratch* csb)
{
fb_assert(format);
impureOffset = CMP_impure(csb, FB_ALIGN(format->fmt_length, 2));
impureFlags = CMP_impure(csb, sizeof(USHORT) * format->fmt_count);
impureOffset = csb->allocImpure(FB_ALIGNMENT, FB_ALIGN(format->fmt_length, 2));
impureFlags = csb->allocImpure(FB_ALIGNMENT, sizeof(USHORT) * format->fmt_count);
return this;
}
@ -6058,8 +6061,7 @@ const StmtNode* MessageNode::execute(thread_db* /*tdbb*/, jrd_req* request, ExeS
//--------------------
static RegisterNode<ModifyNode> regModifyNode(blr_modify);
static RegisterNode<ModifyNode> regModifyNode2(blr_modify2);
static RegisterNode<ModifyNode> regModifyNode({blr_modify, blr_modify2});
// Parse a modify statement.
DmlNode* ModifyNode::parse(thread_db* tdbb, MemoryPool& pool, CompilerScratch* csb, const UCHAR blrOp)
@ -6477,6 +6479,7 @@ void ModifyNode::pass1Modify(thread_db* tdbb, CompilerScratch* csb, ModifyNode*
ModifyNode* viewNode = FB_NEW_POOL(*tdbb->getDefaultPool()) ModifyNode(*tdbb->getDefaultPool());
viewNode->statement = pass1ExpandView(tdbb, csb, viewStream, newStream, true);
viewNode->marks = node->marks & (StmtNode::MARK_POSITIONED | StmtNode::MARK_MERGE);
node->subMod = viewNode;
@ -6532,7 +6535,7 @@ ModifyNode* ModifyNode::pass2(thread_db* tdbb, CompilerScratch* csb)
if (!(marks & StmtNode::MARK_POSITIONED))
forNode = pass2FindForNode(parentStmt, orgStream);
impureOffset = CMP_impure(csb, sizeof(impure_state));
impureOffset = csb->allocImpure<impure_state>();
return this;
}
@ -6770,8 +6773,7 @@ const StmtNode* ModifyNode::modify(thread_db* tdbb, jrd_req* request, WhichTrigg
//--------------------
static RegisterNode<PostEventNode> regPostEventNode1(blr_post);
static RegisterNode<PostEventNode> regPostEventNode2(blr_post_arg);
static RegisterNode<PostEventNode> regPostEventNode({blr_post, blr_post_arg});
DmlNode* PostEventNode::parse(thread_db* tdbb, MemoryPool& pool, CompilerScratch* csb, const UCHAR blrOp)
{
@ -6860,8 +6862,7 @@ const StmtNode* PostEventNode::execute(thread_db* tdbb, jrd_req* request, ExeSta
//--------------------
static RegisterNode<ReceiveNode> regReceiveNode(blr_receive);
static RegisterNode<ReceiveNode> regReceiveNodeBatch(blr_receive_batch);
static RegisterNode<ReceiveNode> regReceiveNode({blr_receive, blr_receive_batch});
DmlNode* ReceiveNode::parse(thread_db* tdbb, MemoryPool& pool, CompilerScratch* csb, const UCHAR blrOp)
{
@ -6942,9 +6943,7 @@ const StmtNode* ReceiveNode::execute(thread_db* /*tdbb*/, jrd_req* request, ExeS
//--------------------
static RegisterNode<StoreNode> regStoreNode(blr_store);
static RegisterNode<StoreNode> regStoreNode2(blr_store2);
static RegisterNode<StoreNode> regStoreNode3(blr_store3);
static RegisterNode<StoreNode> regStoreNode({blr_store, blr_store2, blr_store3});
// Parse a store statement.
DmlNode* StoreNode::parse(thread_db* tdbb, MemoryPool& pool, CompilerScratch* csb, const UCHAR blrOp)
@ -7191,7 +7190,7 @@ StmtNode* StoreNode::dsqlPass(DsqlCompilerScratch* dsqlScratch)
if (!needSavePoint || nodeIs<SavepointEncloseNode>(node))
return node;
return FB_NEW SavepointEncloseNode(dsqlScratch->getPool(), node);
return FB_NEW_POOL(dsqlScratch->getPool()) SavepointEncloseNode(dsqlScratch->getPool(), node);
}
string StoreNode::internalPrint(NodePrinter& printer) const
@ -7383,7 +7382,7 @@ void StoreNode::makeDefaults(thread_db* tdbb, CompilerScratch* csb)
if (!*ptr1 || !((*ptr1)->fld_generator_name.hasData() || (value = (*ptr1)->fld_default_value)))
continue;
CompoundStmtNode* compoundNode = StmtNode::as<CompoundStmtNode>(statement.getObject());
CompoundStmtNode* compoundNode = nodeAs<CompoundStmtNode>(statement.getObject());
fb_assert(compoundNode);
if (compoundNode)
@ -7392,7 +7391,7 @@ void StoreNode::makeDefaults(thread_db* tdbb, CompilerScratch* csb)
for (FB_SIZE_T i = 0; i < compoundNode->statements.getCount(); ++i)
{
const AssignmentNode* assign = StmtNode::as<AssignmentNode>(
const AssignmentNode* assign = nodeAs<AssignmentNode>(
compoundNode->statements[i].getObject());
fb_assert(assign);
@ -7450,7 +7449,7 @@ StoreNode* StoreNode::pass2(thread_db* tdbb, CompilerScratch* csb)
ExprNode::doPass2(tdbb, csb, i->value.getAddress());
}
impureOffset = CMP_impure(csb, sizeof(impure_state));
impureOffset = csb->allocImpure<impure_state>();
return this;
}
@ -7612,7 +7611,7 @@ const StmtNode* StoreNode::store(thread_db* tdbb, jrd_req* request, WhichTrigger
//--------------------
static RegisterNode<UserSavepointNode> regUserSavepointNode(blr_user_savepoint);
static RegisterNode<UserSavepointNode> regUserSavepointNode({blr_user_savepoint});
DmlNode* UserSavepointNode::parse(thread_db* /*tdbb*/, MemoryPool& pool, CompilerScratch* csb, const UCHAR /*blrOp*/)
{
@ -7635,7 +7634,7 @@ string UserSavepointNode::internalPrint(NodePrinter& printer) const
{
StmtNode::internalPrint(printer);
NODE_PRINT(printer, command);
NODE_PRINT(printer, (SSHORT) command);
NODE_PRINT(printer, name);
return "UserSavepointNode";
@ -7750,7 +7749,7 @@ const StmtNode* UserSavepointNode::execute(thread_db* tdbb, jrd_req* request, Ex
//--------------------
static RegisterNode<SelectNode> regSelectNode(blr_select);
static RegisterNode<SelectNode> regSelectNode({blr_select});
DmlNode* SelectNode::parse(thread_db* tdbb, MemoryPool& pool, CompilerScratch* csb, const UCHAR /*blrOp*/)
{
@ -8003,7 +8002,7 @@ const StmtNode* SelectNode::execute(thread_db* /*tdbb*/, jrd_req* request, ExeSt
// This is only for GPRE's cmp_set_generator().
static RegisterNode<SetGeneratorNode> regSetGeneratorNode(blr_set_generator);
static RegisterNode<SetGeneratorNode> regSetGeneratorNode({blr_set_generator});
DmlNode* SetGeneratorNode::parse(thread_db* tdbb, MemoryPool& pool, CompilerScratch* csb, const UCHAR /*blrOp*/)
{
@ -8075,7 +8074,7 @@ const StmtNode* SetGeneratorNode::execute(thread_db* tdbb, jrd_req* request, Exe
//--------------------
static RegisterNode<StallNode> regStallNode(blr_stall);
static RegisterNode<StallNode> regStallNode({blr_stall});
DmlNode* StallNode::parse(thread_db* /*tdbb*/, MemoryPool& pool, CompilerScratch* /*csb*/, const UCHAR /*blrOp*/)
{
@ -8135,7 +8134,7 @@ const StmtNode* StallNode::execute(thread_db* /*tdbb*/, jrd_req* request, ExeSta
//--------------------
static RegisterNode<SuspendNode> regSuspendNode(blr_send);
static RegisterNode<SuspendNode> regSuspendNode({blr_send});
DmlNode* SuspendNode::parse(thread_db* tdbb, MemoryPool& pool, CompilerScratch* csb, const UCHAR /*blrOp*/)
{
@ -8308,8 +8307,7 @@ void ReturnNode::genBlr(DsqlCompilerScratch* dsqlScratch)
//--------------------
static RegisterNode<SavePointNode> regSavePointNodeStart(blr_start_savepoint);
static RegisterNode<SavePointNode> regSavePointNodeEnd(blr_end_savepoint);
static RegisterNode<SavePointNode> regSavePointNode({blr_start_savepoint, blr_end_savepoint});
DmlNode* SavePointNode::parse(thread_db* /*tdbb*/, MemoryPool& pool, CompilerScratch* /*csb*/, const UCHAR blrOp)
{
@ -8537,11 +8535,11 @@ void SetRoleNode::execute(thread_db* tdbb, dsql_req* request, jrd_tra** /*traHan
//--------------------
SetDecFloatRoundNode::SetDecFloatRoundNode(MemoryPool& pool, Firebird::MetaName* name)
SetDecFloatRoundNode::SetDecFloatRoundNode(MemoryPool& pool, MetaName* name)
: SessionManagementNode(pool)
{
fb_assert(name);
const DecFloatConstant* mode = DecFloatConstant::getByText(*name, FB_DEC_RoundModes, FB_DEC_RMODE_OFFSET);
const DecFloatConstant* mode = DecFloatConstant::getByText(name->c_str(), FB_DEC_RoundModes, FB_DEC_RMODE_OFFSET);
if (!mode)
(Arg::Gds(isc_invalid_decfloat_round) << *name).raise();
rndMode = mode->val;
@ -8558,10 +8556,10 @@ void SetDecFloatRoundNode::execute(thread_db* tdbb, dsql_req* /*request*/, jrd_t
//--------------------
void SetDecFloatTrapsNode::trap(Firebird::MetaName* name)
void SetDecFloatTrapsNode::trap(MetaName* name)
{
fb_assert(name);
const DecFloatConstant* trap = DecFloatConstant::getByText(*name, FB_DEC_IeeeTraps, FB_DEC_TRAPS_OFFSET);
const DecFloatConstant* trap = DecFloatConstant::getByText(name->c_str(), FB_DEC_IeeeTraps, FB_DEC_TRAPS_OFFSET);
if (!trap)
(Arg::Gds(isc_invalid_decfloat_trap) << *name).raise();
traps |= trap->val;
@ -8898,7 +8896,7 @@ StmtNode* UpdateOrInsertNode::dsqlPass(DsqlCompilerScratch* dsqlScratch)
if (!needSavePoint || nodeIs<SavepointEncloseNode>(ret))
return ret;
return FB_NEW SavepointEncloseNode(dsqlScratch->getPool(), ret);
return FB_NEW_POOL(dsqlScratch->getPool()) SavepointEncloseNode(dsqlScratch->getPool(), ret);
}
string UpdateOrInsertNode::internalPrint(NodePrinter& printer) const
@ -9099,11 +9097,11 @@ static StmtNode* dsqlNullifyReturning(DsqlCompilerScratch* dsqlScratch, StmtNode
ModifyNode* modifyNode;
StoreNode* storeNode;
if (eraseNode = nodeAs<EraseNode>(input))
if ((eraseNode = nodeAs<EraseNode>(input)))
returning = eraseNode->statement;
else if (modifyNode = nodeAs<ModifyNode>(input))
else if ((modifyNode = nodeAs<ModifyNode>(input)))
returning = modifyNode->statement2;
else if (storeNode = nodeAs<StoreNode>(input))
else if ((storeNode = nodeAs<StoreNode>(input)))
returning = storeNode->statement2;
else
{
@ -9133,7 +9131,7 @@ static StmtNode* dsqlNullifyReturning(DsqlCompilerScratch* dsqlScratch, StmtNode
++ret_ptr, ++null_ptr)
{
AssignmentNode* assign = FB_NEW_POOL(pool) AssignmentNode(pool);
assign->asgnFrom = FB_NEW_POOL(pool) NullNode(pool);
assign->asgnFrom = NullNode::instance();
assign->asgnTo = nodeAs<AssignmentNode>(*ret_ptr)->asgnTo;
*null_ptr = assign;
}
@ -9363,7 +9361,7 @@ static VariableNode* dsqlPassHiddenVariable(DsqlCompilerScratch* dsqlScratch, Va
thread_db* tdbb = JRD_get_thread_data();
// For some node types, it's better to not create temporary value.
switch (expr->type)
switch (expr->getType())
{
case ExprNode::TYPE_CURRENT_DATE:
case ExprNode::TYPE_CURRENT_TIME:
@ -9592,7 +9590,7 @@ static void dsqlSetParameterName(DsqlCompilerScratch* dsqlScratch, ExprNode* exp
if (fieldNode->nodDesc.dsc_dtype != dtype_array)
return;
switch (exprNode->type)
switch (exprNode->getType())
{
case ExprNode::TYPE_ARITHMETIC:
case ExprNode::TYPE_CONCATENATE:
@ -9884,7 +9882,7 @@ static RelationSourceNode* pass1Update(thread_db* tdbb, CompilerScratch* csb, jr
// we've got a view without triggers, let's check whether it's updateable
if (rse->rse_relations.getCount() != 1 || rse->rse_projection || rse->rse_sorted ||
rse->rse_relations[0]->type != RelationSourceNode::TYPE)
rse->rse_relations[0]->getType() != RelationSourceNode::TYPE)
{
ERR_post(Arg::Gds(isc_read_only_view) << Arg::Str(relation->rel_name));
}

View File

@ -23,7 +23,7 @@
#ifndef DSQL_STMT_NODES_H
#define DSQL_STMT_NODES_H
#include "../common/classes/MetaName.h"
#include "../jrd/MetaName.h"
#include "firebird/impl/blr.h"
#include "../jrd/Function.h"
#include "../jrd/extds/ExtDS.h"
@ -49,7 +49,7 @@ typedef Firebird::Pair<
class ExceptionItem : public Firebird::PermanentStorage, public Printable
{
public:
enum Type
enum Type : UCHAR
{
SQL_CODE = 1,
SQL_STATE = 2,
@ -101,7 +101,7 @@ public:
// while there are system exceptions with 32 chars. The parser always expects metanames, but
// I'm following the legacy code and making this a string.
Firebird::string name;
Firebird::MetaName secName;
MetaName secName;
};
typedef Firebird::ObjectsArray<ExceptionItem> ExceptionArray;
@ -188,7 +188,7 @@ public:
class CommitRollbackNode : public TransactionNode
{
public:
enum Command
enum Command : UCHAR
{
CMD_COMMIT,
CMD_ROLLBACK
@ -330,23 +330,23 @@ public:
public:
UCHAR blrOp;
USHORT labelNumber;
Firebird::MetaName* dsqlLabelName;
MetaName* dsqlLabelName;
};
class CursorStmtNode : public TypedNode<StmtNode, StmtNode::TYPE_CURSOR_STMT>
{
public:
explicit CursorStmtNode(MemoryPool& pool, UCHAR aCursorOp, const Firebird::MetaName& aDsqlName = "",
explicit CursorStmtNode(MemoryPool& pool, UCHAR aCursorOp, const MetaName& aDsqlName = "",
ValueListNode* aDsqlIntoStmt = NULL)
: TypedNode<StmtNode, StmtNode::TYPE_CURSOR_STMT>(pool),
dsqlName(pool, aDsqlName),
dsqlIntoStmt(aDsqlIntoStmt),
cursorOp(aCursorOp),
cursorNumber(0),
scrollOp(0),
scrollExpr(NULL),
intoStmt(NULL)
intoStmt(NULL),
cursorNumber(0),
cursorOp(aCursorOp),
scrollOp(0)
{
}
@ -361,13 +361,13 @@ public:
virtual const StmtNode* execute(thread_db* tdbb, jrd_req* request, ExeState* exeState) const;
public:
Firebird::MetaName dsqlName;
MetaName dsqlName;
ValueListNode* dsqlIntoStmt;
UCHAR cursorOp;
USHORT cursorNumber;
UCHAR scrollOp;
NestConst<ValueExprNode> scrollExpr;
NestConst<StmtNode> intoStmt;
USHORT cursorNumber;
UCHAR cursorOp;
UCHAR scrollOp;
};
@ -379,17 +379,17 @@ public:
static const USHORT CUR_TYPE_FOR = 2;
static const USHORT CUR_TYPE_ALL = (CUR_TYPE_EXPLICIT | CUR_TYPE_FOR);
explicit DeclareCursorNode(MemoryPool& pool, const Firebird::MetaName& aDsqlName = NULL,
explicit DeclareCursorNode(MemoryPool& pool, const MetaName& aDsqlName = NULL,
USHORT aDsqlCursorType = CUR_TYPE_NONE)
: TypedNode<StmtNode, StmtNode::TYPE_DECLARE_CURSOR>(pool),
dsqlCursorType(aDsqlCursorType),
dsqlScroll(false),
dsqlName(aDsqlName),
dsqlSelect(NULL),
rse(NULL),
refs(NULL),
cursor(NULL),
dsqlCursorType(aDsqlCursorType),
cursorNumber(0),
cursor(NULL)
dsqlScroll(false)
{
}
@ -404,24 +404,23 @@ public:
virtual const StmtNode* execute(thread_db* tdbb, jrd_req* request, ExeState* exeState) const;
public:
USHORT dsqlCursorType;
bool dsqlScroll;
Firebird::MetaName dsqlName;
MetaName dsqlName;
NestConst<SelectNode> dsqlSelect;
NestConst<RseNode> rse;
NestConst<ValueListNode> refs;
USHORT cursorNumber;
NestConst<Cursor> cursor;
USHORT dsqlCursorType;
USHORT cursorNumber;
bool dsqlScroll;
};
class DeclareSubFuncNode : public TypedNode<StmtNode, StmtNode::TYPE_DECLARE_SUBFUNC>
{
public:
explicit DeclareSubFuncNode(MemoryPool& pool, const Firebird::MetaName& aName)
explicit DeclareSubFuncNode(MemoryPool& pool, const MetaName& aName)
: TypedNode<StmtNode, StmtNode::TYPE_DECLARE_SUBFUNC>(pool),
name(pool, aName),
dsqlDeterministic(false),
dsqlParameters(pool),
dsqlReturns(pool),
dsqlSignature(pool, aName),
@ -429,9 +428,10 @@ public:
blockScratch(NULL),
dsqlFunction(NULL),
blrStart(NULL),
blrLength(0),
subCsb(NULL),
routine(NULL)
routine(NULL),
blrLength(0),
dsqlDeterministic(false)
{
}
@ -454,8 +454,7 @@ private:
Firebird::Array<NestConst<ParameterClause> >& paramArray);
public:
Firebird::MetaName name;
bool dsqlDeterministic;
MetaName name;
Firebird::Array<NestConst<ParameterClause> > dsqlParameters;
Firebird::Array<NestConst<ParameterClause> > dsqlReturns;
Signature dsqlSignature;
@ -463,16 +462,17 @@ public:
DsqlCompilerScratch* blockScratch;
dsql_udf* dsqlFunction;
const UCHAR* blrStart;
ULONG blrLength;
CompilerScratch* subCsb;
Function* routine;
ULONG blrLength;
bool dsqlDeterministic;
};
class DeclareSubProcNode : public TypedNode<StmtNode, StmtNode::TYPE_DECLARE_SUBPROC>
{
public:
explicit DeclareSubProcNode(MemoryPool& pool, const Firebird::MetaName& aName)
explicit DeclareSubProcNode(MemoryPool& pool, const MetaName& aName)
: TypedNode<StmtNode, StmtNode::TYPE_DECLARE_SUBPROC>(pool),
name(pool, aName),
dsqlParameters(pool),
@ -482,9 +482,9 @@ public:
blockScratch(NULL),
dsqlProcedure(NULL),
blrStart(NULL),
blrLength(0),
subCsb(NULL),
routine(NULL)
routine(NULL),
blrLength(0)
{
}
@ -507,7 +507,7 @@ private:
Firebird::Array<NestConst<ParameterClause> >& paramArray);
public:
Firebird::MetaName name;
MetaName name;
Firebird::Array<NestConst<ParameterClause> > dsqlParameters;
Firebird::Array<NestConst<ParameterClause> > dsqlReturns;
Signature dsqlSignature;
@ -515,9 +515,9 @@ public:
DsqlCompilerScratch* blockScratch;
dsql_prc* dsqlProcedure;
const UCHAR* blrStart;
ULONG blrLength;
CompilerScratch* subCsb;
jrd_prc* routine;
ULONG blrLength;
};
@ -545,8 +545,8 @@ public:
public:
NestConst<ParameterClause> dsqlDef;
USHORT varId;
dsc varDesc;
USHORT varId;
};
@ -591,14 +591,14 @@ public:
NestConst<PlanNode> dsqlPlan;
NestConst<ValueListNode> dsqlOrder;
NestConst<RowsClause> dsqlRows;
Firebird::MetaName dsqlCursorName;
MetaName dsqlCursorName;
NestConst<ReturningClause> dsqlReturning;
NestConst<RseNode> dsqlRse;
dsql_ctx* dsqlContext;
NestConst<StmtNode> statement;
NestConst<StmtNode> subStatement;
StreamType stream;
NestConst<ForNode> forNode; // parent implicit cursor, if present
StreamType stream;
unsigned marks; // see StmtNode::IUD_MARK_xxx
};
@ -633,7 +633,7 @@ class ExecProcedureNode : public TypedNode<StmtNode, StmtNode::TYPE_EXEC_PROCEDU
{
public:
explicit ExecProcedureNode(MemoryPool& pool,
const Firebird::QualifiedName& aDsqlName = Firebird::QualifiedName(),
const QualifiedName& aDsqlName = QualifiedName(),
ValueListNode* aInputs = NULL, ValueListNode* aOutputs = NULL)
: TypedNode<StmtNode, StmtNode::TYPE_EXEC_PROCEDURE>(pool),
dsqlName(pool, aDsqlName),
@ -663,7 +663,7 @@ private:
void executeProcedure(thread_db* tdbb, jrd_req* request) const;
public:
Firebird::QualifiedName dsqlName;
QualifiedName dsqlName;
dsql_prc* dsqlProcedure;
NestConst<ValueListNode> inputSources;
NestConst<ValueListNode> inputTargets;
@ -681,7 +681,6 @@ public:
explicit ExecStatementNode(MemoryPool& pool)
: TypedNode<StmtNode, StmtNode::TYPE_EXEC_STATEMENT>(pool),
dsqlLabelName(NULL),
dsqlLabelNumber(0),
sql(NULL),
dataSource(NULL),
userName(NULL),
@ -690,10 +689,11 @@ public:
innerStmt(NULL),
inputs(NULL),
outputs(NULL),
useCallerPrivs(false),
traScope(EDS::traNotSet), // not defined
inputNames(NULL),
excessInputs(NULL)
excessInputs(NULL),
dsqlLabelNumber(0),
useCallerPrivs(false),
traScope(EDS::traNotSet) // not defined
{
}
@ -714,8 +714,7 @@ private:
Firebird::string& str, bool useAttCS = false) const;
public:
Firebird::MetaName* dsqlLabelName;
USHORT dsqlLabelNumber;
MetaName* dsqlLabelName;
NestConst<ValueExprNode> sql;
NestConst<ValueExprNode> dataSource;
NestConst<ValueExprNode> userName;
@ -724,10 +723,11 @@ public:
NestConst<StmtNode> innerStmt;
NestConst<ValueListNode> inputs;
NestConst<ValueListNode> outputs;
bool useCallerPrivs;
EDS::TraScope traScope;
EDS::ParamNames* inputNames;
EDS::ParamNumbers* excessInputs;
USHORT dsqlLabelNumber;
bool useCallerPrivs;
EDS::TraScope traScope;
};
@ -770,8 +770,7 @@ class InAutonomousTransactionNode : public TypedNode<StmtNode, StmtNode::TYPE_IN
public:
explicit InAutonomousTransactionNode(MemoryPool& pool)
: TypedNode<StmtNode, StmtNode::TYPE_IN_AUTO_TRANS>(pool),
action(NULL),
impureOffset(0)
action(NULL)
{
}
@ -787,7 +786,6 @@ public:
public:
NestConst<StmtNode> action;
SLONG impureOffset;
};
@ -850,7 +848,7 @@ public:
class ExceptionNode : public TypedNode<StmtNode, StmtNode::TYPE_EXCEPTION>
{
public:
ExceptionNode(MemoryPool& pool, const Firebird::MetaName& name,
ExceptionNode(MemoryPool& pool, const MetaName& name,
ValueExprNode* aMessageExpr = NULL, ValueListNode* aParameters = NULL)
: TypedNode<StmtNode, StmtNode::TYPE_EXCEPTION>(pool),
messageExpr(aMessageExpr),
@ -912,13 +910,13 @@ public:
dsqlInto(NULL),
dsqlCursor(NULL),
dsqlLabelName(NULL),
dsqlLabelNumber(0),
dsqlForceSingular(false),
stall(NULL),
rse(NULL),
statement(NULL),
cursor(NULL),
parBlrBeginCnt(0),
dsqlLabelNumber(0),
dsqlForceSingular(false),
forUpdate(false),
isMerge(false),
withLock(false)
@ -957,14 +955,14 @@ public:
NestConst<SelectNode> dsqlSelect;
NestConst<ValueListNode> dsqlInto;
DeclareCursorNode* dsqlCursor;
Firebird::MetaName* dsqlLabelName;
USHORT dsqlLabelNumber;
bool dsqlForceSingular;
MetaName* dsqlLabelName;
NestConst<StmtNode> stall;
NestConst<RseNode> rse;
NestConst<StmtNode> statement;
NestConst<Cursor> cursor;
int parBlrBeginCnt;
USHORT dsqlLabelNumber;
bool dsqlForceSingular;
bool forUpdate; // part of UPDATE\DELETE\MERGE statement
bool isMerge; // part of MERGE statement
bool withLock; // part of SELECT ... WITH LOCK statement
@ -1048,9 +1046,9 @@ public:
explicit LoopNode(MemoryPool& pool)
: TypedNode<StmtNode, StmtNode::TYPE_LOOP>(pool),
dsqlLabelName(NULL),
dsqlLabelNumber(0),
dsqlExpr(NULL),
statement(NULL)
statement(NULL),
dsqlLabelNumber(0)
{
}
@ -1065,10 +1063,10 @@ public:
virtual const StmtNode* execute(thread_db* tdbb, jrd_req* request, ExeState* exeState) const;
public:
Firebird::MetaName* dsqlLabelName;
USHORT dsqlLabelNumber;
MetaName* dsqlLabelName;
NestConst<BoolExprNode> dsqlExpr;
NestConst<StmtNode> statement;
USHORT dsqlLabelNumber;
};
@ -1132,9 +1130,9 @@ class MessageNode : public TypedNode<StmtNode, StmtNode::TYPE_MESSAGE>
public:
explicit MessageNode(MemoryPool& pool)
: TypedNode<StmtNode, StmtNode::TYPE_MESSAGE>(pool),
messageNumber(0),
format(NULL),
impureFlags(0)
impureFlags(0),
messageNumber(0)
{
}
@ -1155,9 +1153,9 @@ public:
virtual const StmtNode* execute(thread_db* tdbb, jrd_req* request, ExeState* exeState) const;
public:
USHORT messageNumber;
NestConst<Format> format;
ULONG impureFlags;
USHORT messageNumber;
};
@ -1173,7 +1171,6 @@ public:
dsqlRows(NULL),
dsqlCursorName(pool),
dsqlReturning(NULL),
dsqlRseFlags(0),
dsqlRse(NULL),
dsqlContext(NULL),
statement(NULL),
@ -1183,7 +1180,8 @@ public:
mapView(NULL),
orgStream(0),
newStream(0),
marks(0)
marks(0),
dsqlRseFlags(0)
{
}
@ -1208,9 +1206,8 @@ public:
NestConst<PlanNode> dsqlPlan;
NestConst<ValueListNode> dsqlOrder;
NestConst<RowsClause> dsqlRows;
Firebird::MetaName dsqlCursorName;
MetaName dsqlCursorName;
NestConst<ReturningClause> dsqlReturning;
USHORT dsqlRseFlags;
NestConst<RecordSourceNode> dsqlRse;
dsql_ctx* dsqlContext;
NestConst<StmtNode> statement;
@ -1218,10 +1215,11 @@ public:
NestConst<StmtNode> subMod;
Firebird::Array<ValidateInfo> validations;
NestConst<StmtNode> mapView;
NestConst<ForNode> forNode; // parent implicit cursor, if present
StreamType orgStream;
StreamType newStream;
NestConst<ForNode> forNode; // parent implicit cursor, if present
unsigned marks; // see StmtNode::IUD_MARK_xxx
USHORT dsqlRseFlags;
};
@ -1331,7 +1329,7 @@ public:
class UserSavepointNode : public TypedNode<StmtNode, StmtNode::TYPE_USER_SAVEPOINT>
{
public:
enum Command
enum Command : SSHORT
{
CMD_NOTHING = -1,
CMD_SET = blr_savepoint_set,
@ -1360,7 +1358,7 @@ public:
public:
Command command;
Firebird::MetaName name;
MetaName name;
};
@ -1370,10 +1368,10 @@ public:
explicit SelectNode(MemoryPool& pool)
: TypedNode<StmtNode, StmtNode::TYPE_SELECT>(pool),
dsqlExpr(NULL),
dsqlForUpdate(false),
dsqlWithLock(false),
dsqlRse(NULL),
statements(pool)
statements(pool),
dsqlForUpdate(false),
dsqlWithLock(false)
{
}
@ -1389,10 +1387,10 @@ public:
public:
NestConst<SelectExprNode> dsqlExpr;
bool dsqlForUpdate;
bool dsqlWithLock;
NestConst<RseNode> dsqlRse;
Firebird::Array<NestConst<StmtNode> > statements;
bool dsqlForUpdate;
bool dsqlWithLock;
};
@ -1400,7 +1398,7 @@ public:
class SetGeneratorNode : public TypedNode<StmtNode, StmtNode::TYPE_SET_GENERATOR>
{
public:
SetGeneratorNode(MemoryPool& pool, const Firebird::MetaName& name, ValueExprNode* aValue = NULL)
SetGeneratorNode(MemoryPool& pool, const MetaName& name, ValueExprNode* aValue = NULL)
: TypedNode<StmtNode, StmtNode::TYPE_SET_GENERATOR>(pool),
generator(pool, name), value(aValue)
{
@ -1582,7 +1580,7 @@ class SetTransactionNode : public TransactionNode
public:
struct RestrictionOption : Firebird::PermanentStorage
{
RestrictionOption(MemoryPool& p, Firebird::ObjectsArray<Firebird::MetaName>* aTables,
RestrictionOption(MemoryPool& p, Firebird::ObjectsArray<MetaName>* aTables,
unsigned aLockMode)
: PermanentStorage(p),
tables(aTables),
@ -1590,7 +1588,7 @@ public:
{
}
Firebird::ObjectsArray<Firebird::MetaName>* tables;
Firebird::ObjectsArray<MetaName>* tables;
unsigned lockMode;
};
@ -1643,17 +1641,17 @@ private:
USHORT lockLevel);
public:
Firebird::Array<RestrictionOption*> reserveList;
Firebird::UCharBuffer tpb;
Nullable<CommitNumber> atSnapshotNumber;
Nullable<unsigned> isoLevel;
Nullable<USHORT> lockTimeout;
Nullable<bool> readOnly;
Nullable<bool> wait;
Nullable<unsigned> isoLevel;
Nullable<bool> noAutoUndo;
Nullable<bool> ignoreLimbo;
Nullable<bool> restartRequests;
Nullable<bool> autoCommit;
Nullable<USHORT> lockTimeout;
Firebird::Array<RestrictionOption*> reserveList;
Firebird::UCharBuffer tpb;
Nullable<CommitNumber> atSnapshotNumber;
};
@ -1687,7 +1685,7 @@ public:
{
}
SetRoleNode(MemoryPool& pool, Firebird::MetaName* name)
SetRoleNode(MemoryPool& pool, MetaName* name)
: SessionManagementNode(pool),
trusted(false),
roleName(pool, *name)
@ -1709,14 +1707,18 @@ public:
public:
bool trusted;
Firebird::MetaName roleName;
MetaName roleName;
};
class SetSessionNode : public SessionManagementNode
{
public:
enum Type { TYPE_IDLE_TIMEOUT, TYPE_STMT_TIMEOUT };
enum Type : UCHAR
{
TYPE_IDLE_TIMEOUT,
TYPE_STMT_TIMEOUT
};
SetSessionNode(MemoryPool& pool, Type aType, ULONG aVal, UCHAR blr_timepart);
@ -1733,7 +1735,7 @@ private:
class SetDecFloatRoundNode : public SessionManagementNode
{
public:
SetDecFloatRoundNode(MemoryPool& pool, Firebird::MetaName* name);
SetDecFloatRoundNode(MemoryPool& pool, MetaName* name);
public:
virtual Firebird::string internalPrint(NodePrinter& printer) const
@ -1773,7 +1775,7 @@ public:
virtual void execute(thread_db* tdbb, dsql_req* request, jrd_tra** traHandle) const;
void trap(Firebird::MetaName* name);
void trap(MetaName* name);
public:
USHORT traps;
@ -1805,8 +1807,8 @@ public:
virtual void execute(thread_db* tdbb, dsql_req* request, jrd_tra** traHandle) const;
public:
dsql_fld *from;
dsql_fld *to;
dsql_fld* from;
dsql_fld* to;
};

View File

@ -142,7 +142,7 @@ ValueExprNode* RankWinNode::copy(thread_db* tdbb, NodeCopier& /*copier*/) const
AggNode* RankWinNode::pass2(thread_db* tdbb, CompilerScratch* csb)
{
AggNode::pass2(tdbb, csb);
tempImpure = CMP_impure(csb, sizeof(impure_value_ex));
tempImpure = csb->allocImpure<impure_value_ex>();
return this;
}
@ -218,7 +218,7 @@ ValueExprNode* PercentRankWinNode::copy(thread_db* tdbb, NodeCopier& /*copier*/)
AggNode* PercentRankWinNode::pass2(thread_db* tdbb, CompilerScratch* csb)
{
AggNode::pass2(tdbb, csb);
tempImpure = CMP_impure(csb, sizeof(impure_value_ex));
tempImpure = csb->allocImpure<impure_value_ex>();
return this;
}
@ -803,7 +803,7 @@ ValueExprNode* NTileWinNode::copy(thread_db* tdbb, NodeCopier& copier) const
AggNode* NTileWinNode::pass2(thread_db* tdbb, CompilerScratch* csb)
{
AggNode::pass2(tdbb, csb);
thisImpureOffset = CMP_impure(csb, sizeof(ThisImpure));
thisImpureOffset = csb->allocImpure<ThisImpure>();
return this;
}

View File

@ -387,7 +387,7 @@ private:
SINT64 buckets;
};
USHORT thisImpureOffset;
ULONG thisImpureOffset;
};

View File

@ -73,7 +73,7 @@
#include <stdio.h>
#include <string.h>
#include "../jrd/SysFunction.h"
#include "../common/classes/MetaName.h"
#include "../jrd/MetaName.h"
#include "../dsql/dsql.h"
#include "../dsql/ExprNodes.h"
#include "ibase.h"

View File

@ -68,7 +68,7 @@ const USHORT blr_dtypes[] = {
};
bool DDL_ids(const Jrd::DsqlCompilerScratch*);
void DDL_resolve_intl_type(Jrd::DsqlCompilerScratch*, Jrd::dsql_fld*, const Firebird::MetaName&,
void DDL_resolve_intl_type(Jrd::DsqlCompilerScratch*, Jrd::dsql_fld*, const Jrd::MetaName&,
bool = false);
#endif // DSQL_DDL_PROTO_H

View File

@ -36,7 +36,7 @@
#include "../common/classes/array.h"
#include "../common/classes/GenericMap.h"
#include "../common/classes/MetaName.h"
#include "../jrd/MetaName.h"
#include "../common/classes/stack.h"
#include "../common/classes/auto.h"
#include "../common/classes/NestConst.h"
@ -95,20 +95,16 @@ namespace Jrd
class dsql_map;
class dsql_intlsym;
class TimeoutTimer;
class MetaName;
typedef Firebird::Stack<dsql_ctx*> DsqlContextStack;
typedef Firebird::Pair<Firebird::Left<Firebird::MetaName, NestConst<Jrd::WindowClause> > >
typedef Firebird::Pair<Firebird::Left<MetaName, NestConst<Jrd::WindowClause> > >
NamedWindowClause;
typedef Firebird::ObjectsArray<NamedWindowClause> NamedWindowsClause;
}
namespace Firebird
{
class MetaName;
}
//======================================================================
// remaining node definitions for local processing
//
@ -126,15 +122,15 @@ class dsql_dbb : public pool_alloc<dsql_type_dbb>
{
public:
Firebird::GenericMap<Firebird::Pair<Firebird::Left<
Firebird::MetaName, class dsql_rel*> > > dbb_relations; // known relations in database
MetaName, class dsql_rel*> > > dbb_relations; // known relations in database
Firebird::GenericMap<Firebird::Pair<Firebird::Left<
Firebird::QualifiedName, class dsql_prc*> > > dbb_procedures; // known procedures in database
QualifiedName, class dsql_prc*> > > dbb_procedures; // known procedures in database
Firebird::GenericMap<Firebird::Pair<Firebird::Left<
Firebird::QualifiedName, class dsql_udf*> > > dbb_functions; // known functions in database
QualifiedName, class dsql_udf*> > > dbb_functions; // known functions in database
Firebird::GenericMap<Firebird::Pair<Firebird::Left<
Firebird::MetaName, class dsql_intlsym*> > > dbb_charsets; // known charsets in database
MetaName, class dsql_intlsym*> > > dbb_charsets; // known charsets in database
Firebird::GenericMap<Firebird::Pair<Firebird::Left<
Firebird::MetaName, class dsql_intlsym*> > > dbb_collations; // known collations in database
MetaName, class dsql_intlsym*> > > dbb_collations; // known collations in database
Firebird::GenericMap<Firebird::Pair<Firebird::NonPooled<
SSHORT, dsql_intlsym*> > > dbb_charsets_by_id; // charsets sorted by charset_id
Firebird::GenericMap<Firebird::Pair<Firebird::Left<
@ -142,7 +138,7 @@ public:
MemoryPool& dbb_pool; // The current pool for the dbb
Attachment* dbb_attachment;
Firebird::MetaName dbb_dfl_charset;
MetaName dbb_dfl_charset;
bool dbb_no_charset;
explicit dsql_dbb(MemoryPool& p)
@ -182,8 +178,8 @@ public:
class dsql_fld* rel_fields; // Field block
//dsql_rel* rel_base_relation; // base relation for an updatable view
Firebird::MetaName rel_name; // Name of relation
Firebird::MetaName rel_owner; // Owner of relation
MetaName rel_name; // Name of relation
MetaName rel_owner; // Owner of relation
USHORT rel_id; // Relation id
USHORT rel_dbkey_length;
USHORT rel_flags;
@ -201,7 +197,7 @@ enum rel_flags_vals {
class TypeClause
{
public:
TypeClause(MemoryPool& pool, const Firebird::MetaName& aCollate)
TypeClause(MemoryPool& pool, const MetaName& aCollate)
: dtype(dtype_unknown),
length(0),
scale(0),
@ -274,12 +270,12 @@ public:
SSHORT textType;
bool fullDomain; // Domain name without TYPE OF prefix
bool notNull; // NOT NULL was explicit specified
Firebird::MetaName fieldSource;
Firebird::MetaName typeOfTable; // TYPE OF table name
Firebird::MetaName typeOfName; // TYPE OF
Firebird::MetaName collate;
Firebird::MetaName charSet; // empty means not specified
Firebird::MetaName subTypeName; // Subtype name for later resolution
MetaName fieldSource;
MetaName typeOfTable; // TYPE OF table name
MetaName typeOfName; // TYPE OF
MetaName collate;
MetaName charSet; // empty means not specified
MetaName subTypeName; // Subtype name for later resolution
USHORT flags;
USHORT elementDtype; // Data type of array element
USHORT elementLength; // Length of array element
@ -312,7 +308,7 @@ public:
dsql_rel* fld_relation; // Parent relation
dsql_prc* fld_procedure; // Parent procedure
USHORT fld_id; // Field in in database
Firebird::MetaName fld_name;
MetaName fld_name;
};
// values used in fld_flags
@ -343,8 +339,8 @@ public:
dsql_fld* prc_inputs; // Input parameters
dsql_fld* prc_outputs; // Output parameters
Firebird::QualifiedName prc_name; // Name of procedure
Firebird::MetaName prc_owner; // Owner of procedure
QualifiedName prc_name; // Name of procedure
MetaName prc_owner; // Owner of procedure
SSHORT prc_in_count;
SSHORT prc_def_count; // number of inputs with default values
SSHORT prc_out_count;
@ -377,7 +373,7 @@ public:
SSHORT udf_character_set_id;
//USHORT udf_character_length;
USHORT udf_flags;
Firebird::QualifiedName udf_name;
QualifiedName udf_name;
Firebird::Array<dsc> udf_arguments;
bool udf_private; // Packaged private function
SSHORT udf_def_count; // number of inputs with default values
@ -439,7 +435,7 @@ public:
{
}
Firebird::MetaName intlsym_name;
MetaName intlsym_name;
USHORT intlsym_type; // what type of name
USHORT intlsym_flags;
SSHORT intlsym_ttype; // id of implementation
@ -815,7 +811,7 @@ public:
DsqlContextStack ctx_main_derived_contexts; // contexts used for blr_derived_expr
DsqlContextStack ctx_childs_derived_table; // Childs derived table context
Firebird::GenericMap<Firebird::Pair<Firebird::Left<
Firebird::MetaName, ImplicitJoin*> > > ctx_imp_join; // Map of USING fieldname to ImplicitJoin
MetaName, ImplicitJoin*> > > ctx_imp_join; // Map of USING fieldname to ImplicitJoin
Firebird::Array<WindowMap*> ctx_win_maps; // Maps for window functions
Firebird::GenericMap<NamedWindowClause> ctx_named_windows;
@ -851,7 +847,7 @@ public:
return "";
}
bool getImplicitJoinField(const Firebird::MetaName& name, NestConst<ValueExprNode>& node);
bool getImplicitJoinField(const MetaName& name, NestConst<ValueExprNode>& node);
WindowMap* getWindowMap(DsqlCompilerScratch* dsqlScratch, WindowClause* windowNode);
};
@ -927,13 +923,13 @@ public:
dsql_msg* par_message; // Parent message
dsql_par* par_null; // Null parameter, if used
ValueExprNode* par_node; // Associated value node, if any
Firebird::MetaName par_dbkey_relname; // Context of internally requested dbkey
Firebird::MetaName par_rec_version_relname; // Context of internally requested rec. version
Firebird::MetaName par_name; // Parameter name, if any
Firebird::MetaName par_rel_name; // Relation name, if any
Firebird::MetaName par_owner_name; // Owner name, if any
Firebird::MetaName par_rel_alias; // Relation alias, if any
Firebird::MetaName par_alias; // Alias, if any
MetaName par_dbkey_relname; // Context of internally requested dbkey
MetaName par_rec_version_relname; // Context of internally requested rec. version
MetaName par_name; // Parameter name, if any
MetaName par_rel_name; // Relation name, if any
MetaName par_owner_name; // Owner name, if any
MetaName par_rel_alias; // Relation alias, if any
MetaName par_alias; // Alias, if any
dsc par_desc; // Field data type
USHORT par_parameter; // BLR parameter number
USHORT par_index; // Index into SQLDA, if appropriate
@ -959,12 +955,12 @@ class IntlString
{
public:
IntlString(Firebird::MemoryPool& p, const Firebird::string& str,
const Firebird::MetaName& cs = NULL)
const MetaName& cs = NULL)
: charset(p, cs),
s(p, str)
{ }
explicit IntlString(const Firebird::string& str, const Firebird::MetaName& cs = NULL)
explicit IntlString(const Firebird::string& str, const MetaName& cs = NULL)
: charset(cs),
s(str)
{ }
@ -981,12 +977,12 @@ public:
Firebird::string toUtf8(DsqlCompilerScratch*) const;
const Firebird::MetaName& getCharSet() const
const MetaName& getCharSet() const
{
return charset;
}
void setCharSet(const Firebird::MetaName& value)
void setCharSet(const MetaName& value)
{
charset = value;
}
@ -1007,7 +1003,7 @@ public:
}
private:
Firebird::MetaName charset;
MetaName charset;
Firebird::string s;
};
@ -1093,13 +1089,13 @@ struct SignatureParameter
SSHORT type;
SSHORT number;
Firebird::MetaName name;
Firebird::MetaName fieldSource;
Firebird::MetaName fieldName;
Firebird::MetaName relationName;
Firebird::MetaName charSetName;
Firebird::MetaName collationName;
Firebird::MetaName subTypeName;
MetaName name;
MetaName fieldSource;
MetaName fieldName;
MetaName relationName;
MetaName charSetName;
MetaName collationName;
MetaName subTypeName;
Nullable<SSHORT> collationId;
Nullable<SSHORT> nullFlag;
SSHORT mechanism;
@ -1157,7 +1153,7 @@ struct Signature
{
const static unsigned FLAG_DETERMINISTIC = 0x01;
Signature(MemoryPool& p, const Firebird::MetaName& aName)
Signature(MemoryPool& p, const MetaName& aName)
: name(p, aName),
parameters(p),
flags(0),
@ -1165,7 +1161,7 @@ struct Signature
{
}
explicit Signature(const Firebird::MetaName& aName)
explicit Signature(const MetaName& aName)
: name(aName),
parameters(*getDefaultMemoryPool()),
flags(0),
@ -1222,7 +1218,7 @@ struct Signature
return !(*this == o);
}
Firebird::MetaName name;
MetaName name;
Firebird::SortedObjectsArray<SignatureParameter> parameters;
unsigned flags;
bool defined;

View File

@ -27,12 +27,12 @@
#define DSQL_METD_PROTO_H
#include "../common/classes/GenericMap.h"
#include "../common/classes/MetaName.h"
#include "../jrd/MetaName.h"
#include "../common/classes/fb_pair.h"
// forward declarations
namespace Jrd {
typedef Firebird::GenericMap<Firebird::MetaNamePair> MetaNamePairMap;
typedef Firebird::GenericMap<Jrd::MetaNamePair> MetaNamePairMap;
class dsql_req;
class DsqlCompilerScratch;
@ -45,26 +45,26 @@ namespace Jrd {
class FieldNode;
};
void METD_drop_charset(Jrd::jrd_tra*, const Firebird::MetaName&);
void METD_drop_collation(Jrd::jrd_tra*, const Firebird::MetaName&);
void METD_drop_function(Jrd::jrd_tra*, const Firebird::QualifiedName&);
void METD_drop_procedure(Jrd::jrd_tra*, const Firebird::QualifiedName&);
void METD_drop_relation(Jrd::jrd_tra*, const Firebird::MetaName&);
void METD_drop_charset(Jrd::jrd_tra*, const Jrd::MetaName&);
void METD_drop_collation(Jrd::jrd_tra*, const Jrd::MetaName&);
void METD_drop_function(Jrd::jrd_tra*, const Jrd::QualifiedName&);
void METD_drop_procedure(Jrd::jrd_tra*, const Jrd::QualifiedName&);
void METD_drop_relation(Jrd::jrd_tra*, const Jrd::MetaName&);
Jrd::dsql_intlsym* METD_get_charset(Jrd::jrd_tra*, USHORT, const char* name);
USHORT METD_get_charset_bpc(Jrd::jrd_tra*, SSHORT);
Firebird::MetaName METD_get_charset_name(Jrd::jrd_tra*, SSHORT);
Jrd::dsql_intlsym* METD_get_collation(Jrd::jrd_tra*, const Firebird::MetaName&, USHORT charset_id);
Firebird::MetaName METD_get_default_charset(Jrd::jrd_tra*);
bool METD_get_domain(Jrd::jrd_tra*, class Jrd::TypeClause*, const Firebird::MetaName& name);
Jrd::MetaName METD_get_charset_name(Jrd::jrd_tra*, SSHORT);
Jrd::dsql_intlsym* METD_get_collation(Jrd::jrd_tra*, const Jrd::MetaName&, USHORT charset_id);
Jrd::MetaName METD_get_default_charset(Jrd::jrd_tra*);
bool METD_get_domain(Jrd::jrd_tra*, class Jrd::TypeClause*, const Jrd::MetaName& name);
Jrd::dsql_udf* METD_get_function(Jrd::jrd_tra*, Jrd::DsqlCompilerScratch*,
const Firebird::QualifiedName&);
void METD_get_primary_key(Jrd::jrd_tra*, const Firebird::MetaName&,
const Jrd::QualifiedName&);
void METD_get_primary_key(Jrd::jrd_tra*, const Jrd::MetaName&,
Firebird::Array<NestConst<Jrd::FieldNode> >&);
Jrd::dsql_prc* METD_get_procedure(Jrd::jrd_tra*, Jrd::DsqlCompilerScratch*,
const Firebird::QualifiedName&);
Jrd::dsql_rel* METD_get_relation(Jrd::jrd_tra*, Jrd::DsqlCompilerScratch*, const Firebird::MetaName&);
bool METD_get_type(Jrd::jrd_tra*, const Firebird::MetaName&, const char*, SSHORT*);
const Jrd::QualifiedName&);
Jrd::dsql_rel* METD_get_relation(Jrd::jrd_tra*, Jrd::DsqlCompilerScratch*, const Jrd::MetaName&);
bool METD_get_type(Jrd::jrd_tra*, const Jrd::MetaName&, const char*, SSHORT*);
Jrd::dsql_rel* METD_get_view_base(Jrd::jrd_tra*, Jrd::DsqlCompilerScratch*, const char* view_name,
Jrd::MetaNamePairMap& fields);
Jrd::dsql_rel* METD_get_view_relation(Jrd::jrd_tra*, Jrd::DsqlCompilerScratch*, const char* view_name,

View File

@ -723,10 +723,10 @@ using namespace Firebird;
Jrd::ComparativeBoolNode::DsqlFlag cmpBoolFlag;
Jrd::dsql_fld* legacyField;
Jrd::ReturningClause* returningClause;
Firebird::MetaName* metaNamePtr;
Firebird::ObjectsArray<Firebird::MetaName>* metaNameArray;
Jrd::MetaName* metaNamePtr;
Firebird::ObjectsArray<Jrd::MetaName>* metaNameArray;
Firebird::PathName* pathNamePtr;
Firebird::QualifiedName* qualifiedNamePtr;
Jrd::QualifiedName* qualifiedNamePtr;
Firebird::string* stringPtr;
Jrd::IntlString* intlStringPtr;
Jrd::Lim64String* lim64ptr;
@ -6723,14 +6723,14 @@ exec_function
: udf
{
AssignmentNode* node = newNode<AssignmentNode>();
node->asgnTo = newNode<NullNode>();
node->asgnTo = NullNode::instance();
node->asgnFrom = $1;
$$ = node;
}
| non_aggregate_function
{
AssignmentNode* node = newNode<AssignmentNode>();
node->asgnTo = newNode<NullNode>();
node->asgnTo = NullNode::instance();
node->asgnFrom = $1;
$$ = node;
}
@ -7750,11 +7750,11 @@ aggregate_function
$$ = $1;
if ($$->aggInfo.blr == blr_agg_count2 && !$$->arg) // count(*)
$$->arg = newNode<ValueIfNode>($5, MAKE_const_slong(1), newNode<NullNode>());
$$->arg = newNode<ValueIfNode>($5, MAKE_const_slong(1), NullNode::instance());
else
{
fb_assert($$->arg);
$$->arg = newNode<ValueIfNode>($5, $$->arg, newNode<NullNode>());
$$->arg = newNode<ValueIfNode>($5, $$->arg, NullNode::instance());
}
}
;
@ -7854,15 +7854,15 @@ window_function
| LAG '(' value ',' value ',' value ')'
{ $$ = newNode<LagWinNode>($3, $5, $7); }
| LAG '(' value ',' value ')'
{ $$ = newNode<LagWinNode>($3, $5, newNode<NullNode>()); }
{ $$ = newNode<LagWinNode>($3, $5, NullNode::instance()); }
| LAG '(' value ')'
{ $$ = newNode<LagWinNode>($3, MAKE_const_slong(1), newNode<NullNode>()); }
{ $$ = newNode<LagWinNode>($3, MAKE_const_slong(1), NullNode::instance()); }
| LEAD '(' value ',' value ',' value ')'
{ $$ = newNode<LeadWinNode>($3, $5, $7); }
| LEAD '(' value ',' value ')'
{ $$ = newNode<LeadWinNode>($3, $5, newNode<NullNode>()); }
{ $$ = newNode<LeadWinNode>($3, $5, NullNode::instance()); }
| LEAD '(' value ')'
{ $$ = newNode<LeadWinNode>($3, MAKE_const_slong(1), newNode<NullNode>()); }
{ $$ = newNode<LeadWinNode>($3, MAKE_const_slong(1), NullNode::instance()); }
| NTILE '(' ntile_arg ')'
{ $$ = newNode<NTileWinNode>($3); }
;
@ -8367,7 +8367,7 @@ case_abbreviation
: NULLIF '(' value ',' value ')'
{
ComparativeBoolNode* condition = newNode<ComparativeBoolNode>(blr_eql, $3, $5);
$$ = newNode<ValueIfNode>(condition, newNode<NullNode>(), $3);
$$ = newNode<ValueIfNode>(condition, NullNode::instance(), $3);
}
| IIF '(' search_condition ',' value ',' value ')'
{ $$ = newNode<ValueIfNode>($3, $5, $7); }
@ -8466,10 +8466,10 @@ searched_case
%type <valueIfNode> searched_when_clause
searched_when_clause
: WHEN search_condition THEN case_result
{ $$ = newNode<ValueIfNode>($2, $4, newNode<NullNode>()); }
{ $$ = newNode<ValueIfNode>($2, $4, NullNode::instance()); }
| searched_when_clause WHEN search_condition THEN case_result
{
ValueIfNode* cond = newNode<ValueIfNode>($3, $5, newNode<NullNode>());
ValueIfNode* cond = newNode<ValueIfNode>($3, $5, NullNode::instance());
ValueIfNode* last = $1;
ValueIfNode* next;
@ -8552,14 +8552,14 @@ distinct_noise
%type <valueExprNode> null_value
null_value
: NULL
{ $$ = newNode<NullNode>(); }
{ $$ = NullNode::instance(); }
| UNKNOWN
{
dsql_fld* field = newNode<dsql_fld>();
field->dtype = dtype_boolean;
field->length = sizeof(UCHAR);
CastNode* castNode = newNode<CastNode>(newNode<NullNode>(), field);
CastNode* castNode = newNode<CastNode>(NullNode::instance(), field);
castNode->dsqlAlias = "CONSTANT";
$$ = castNode;
}

View File

@ -891,7 +891,7 @@ bool PASS1_node_match(DsqlCompilerScratch* dsqlScratch, const ExprNode* node1, c
return PASS1_node_match(dsqlScratch, node1, derivedField2->value, ignoreMapCast);
}
return node1->type == node2->type && node1->dsqlMatch(dsqlScratch, node2, ignoreMapCast);
return node1->getType() == node2->getType() && node1->dsqlMatch(dsqlScratch, node2, ignoreMapCast);
}
@ -1415,7 +1415,7 @@ void PASS1_expand_select_node(DsqlCompilerScratch* dsqlScratch, ExprNode* node,
if (!select_item)
{
if (context->ctx_flags & CTX_null)
select_item = FB_NEW_POOL(*tdbb->getDefaultPool()) NullNode(*tdbb->getDefaultPool());
select_item = NullNode::instance();
else
select_item = MAKE_field(context, field, NULL);
}

View File

@ -37,17 +37,17 @@ namespace Jrd
class ValueListNode;
}
void PASS1_ambiguity_check(Jrd::DsqlCompilerScratch*, const Firebird::MetaName&, const Jrd::DsqlContextStack&);
void PASS1_ambiguity_check(Jrd::DsqlCompilerScratch*, const Jrd::MetaName&, const Jrd::DsqlContextStack&);
void PASS1_check_unique_fields_names(Jrd::StrArray& names, const Jrd::CompoundStmtNode* fields);
Jrd::BoolExprNode* PASS1_compose(Jrd::BoolExprNode*, Jrd::BoolExprNode*, UCHAR);
Jrd::DeclareCursorNode* PASS1_cursor_name(Jrd::DsqlCompilerScratch*, const Firebird::MetaName&, USHORT, bool);
Jrd::DeclareCursorNode* PASS1_cursor_name(Jrd::DsqlCompilerScratch*, const Jrd::MetaName&, USHORT, bool);
Jrd::RseNode* PASS1_derived_table(Jrd::DsqlCompilerScratch*, Jrd::SelectExprNode*, const char*, bool);
Jrd::ValueListNode* PASS1_expand_select_list(Jrd::DsqlCompilerScratch*, Jrd::ValueListNode*, Jrd::RecSourceListNode*);
void PASS1_expand_select_node(Jrd::DsqlCompilerScratch*, Jrd::ExprNode*, Jrd::ValueListNode*, bool);
void PASS1_field_unknown(const TEXT*, const TEXT*, const Jrd::ExprNode*);
void PASS1_limit(Jrd::DsqlCompilerScratch*, NestConst<Jrd::ValueExprNode>,
NestConst<Jrd::ValueExprNode>, Jrd::RseNode*);
Jrd::ValueExprNode* PASS1_lookup_alias(Jrd::DsqlCompilerScratch*, const Firebird::MetaName&,
Jrd::ValueExprNode* PASS1_lookup_alias(Jrd::DsqlCompilerScratch*, const Jrd::MetaName&,
Jrd::ValueListNode*, bool);
Jrd::dsql_ctx* PASS1_make_context(Jrd::DsqlCompilerScratch* statement, Jrd::RecordSourceNode* relationNode);
bool PASS1_node_match(Jrd::DsqlCompilerScratch*, const Jrd::ExprNode*, const Jrd::ExprNode*, bool);

View File

@ -162,6 +162,9 @@ enum db_info_types
fb_info_wire_crypt = 140,
// Return list of features supported by provider of current connection
fb_info_provider_features = 141,
isc_info_db_last_value /* Leave this LAST! */
};
@ -171,6 +174,19 @@ enum db_info_crypt /* flags set in fb_info_crypt_state */
fb_info_crypt_process = 0x02
};
enum info_provider_features // response to fb_info_provider_features
{
fb_feature_multi_statements = 1, // Multiple prepared statements in single attachment
fb_feature_multi_transactions = 2, // Multiple concurrent transaction in single attachment
fb_feature_named_parameters = 3, // Query parameters can be named
fb_feature_session_reset = 4, // ALTER SESSION RESET is supported
fb_feature_read_consistency = 5, // Read consistency TIL is supported
fb_feature_statement_timeout = 6, // Statement timeout is supported
fb_feature_statement_long_life = 7, // Prepared statement can survive transaction end
info_provider_features_max // Not really a feature. Keep this last.
};
#define isc_info_version isc_info_isc_version

View File

@ -47,7 +47,7 @@
#include "../jrd/replication/Manager.h"
#include "../common/classes/fb_string.h"
#include "../common/classes/MetaName.h"
#include "../jrd/MetaName.h"
#include "../common/StatusArg.h"
#include "../common/TimeZoneUtil.h"
#include "../common/isc_proto.h"
@ -1011,7 +1011,7 @@ void Attachment::setupIdleTimer(bool clear)
}
}
UserId* Attachment::getUserId(const MetaName& userName)
UserId* Attachment::getUserId(const MetaString& userName)
{
// It's necessary to keep specified sql role of user
if (att_user && att_user->getUserName() == userName)

View File

@ -36,7 +36,7 @@
#include "../common/classes/ByteChunk.h"
#include "../common/classes/GenericMap.h"
#include "../common/classes/QualifiedName.h"
#include "../jrd/QualifiedName.h"
#include "../common/classes/SyncObject.h"
#include "../common/classes/array.h"
#include "../common/classes/stack.h"
@ -106,7 +106,7 @@ struct DSqlCacheItem
}
Firebird::string key;
Firebird::GenericMap<Firebird::Pair<Firebird::Left<Firebird::QualifiedName, bool> > > obsoleteMap;
Firebird::GenericMap<Firebird::Pair<Firebird::Left<QualifiedName, bool> > > obsoleteMap;
Lock* lock;
bool locked;
};
@ -129,9 +129,9 @@ struct DdlTriggerContext
Firebird::string eventType;
Firebird::string objectType;
Firebird::MetaName objectName;
Firebird::MetaName oldObjectName;
Firebird::MetaName newObjectName;
MetaName objectName;
MetaName oldObjectName;
MetaName newObjectName;
Firebird::string sqlText;
};
@ -324,7 +324,7 @@ public:
: m_objects(pool)
{}
void store(SLONG id, const Firebird::MetaName& name)
void store(SLONG id, const MetaName& name)
{
fb_assert(id >= 0);
fb_assert(name.hasData());
@ -341,7 +341,7 @@ public:
}
}
bool lookup(SLONG id, Firebird::MetaName& name)
bool lookup(SLONG id, MetaName& name)
{
if (id < (int) m_objects.getCount())
{
@ -352,7 +352,7 @@ public:
return false;
}
SLONG lookup(const Firebird::MetaName& name)
SLONG lookup(const MetaName& name)
{
FB_SIZE_T pos;
@ -363,7 +363,7 @@ public:
}
private:
Firebird::Array<Firebird::MetaName> m_objects;
Firebird::Array<MetaName> m_objects;
};
class InitialOptions
@ -407,7 +407,7 @@ public:
UserId* att_user; // User identification
UserId* att_ss_user; // User identification for SQL SECURITY actual user
Firebird::GenericMap<Firebird::Pair<Firebird::Left<
Firebird::MetaName, UserId*> > > att_user_ids; // set of used UserIds
Firebird::MetaString, UserId*> > > att_user_ids; // set of used UserIds
jrd_tra* att_transactions; // Transactions belonging to attachment
jrd_tra* att_dbkey_trans; // transaction to control db-key scope
TraNumber att_oldest_snapshot; // GTT's record versions older than this can be garbage-collected
@ -498,7 +498,7 @@ public:
Firebird::Array<CharSetContainer*> att_charsets; // intl character set descriptions
Firebird::GenericMap<Firebird::Pair<Firebird::Left<
Firebird::MetaName, USHORT> > > att_charset_ids; // Character set ids
MetaName, USHORT> > > att_charset_ids; // Character set ids
void releaseIntlObjects(thread_db* tdbb); // defined in intl.cpp
void destroyIntlObjects(thread_db* tdbb); // defined in intl.cpp
@ -542,8 +542,8 @@ public:
PreparedStatement* prepareUserStatement(thread_db* tdbb, jrd_tra* transaction,
const Firebird::string& text, Firebird::MemoryPool* pool = NULL);
Firebird::MetaName nameToMetaCharSet(thread_db* tdbb, const Firebird::MetaName& name);
Firebird::MetaName nameToUserCharSet(thread_db* tdbb, const Firebird::MetaName& name);
MetaName nameToMetaCharSet(thread_db* tdbb, const MetaName& name);
MetaName nameToUserCharSet(thread_db* tdbb, const MetaName& name);
Firebird::string stringToMetaCharSet(thread_db* tdbb, const Firebird::string& str,
const char* charSet = NULL);
Firebird::string stringToUserCharSet(thread_db* tdbb, const Firebird::string& str);
@ -625,7 +625,7 @@ public:
att_batches.findAndRemove(b);
}
UserId* getUserId(const Firebird::MetaName &userName);
UserId* getUserId(const Firebird::MetaString& userName);
const UserId* getEffectiveUserId() const
{

View File

@ -35,7 +35,7 @@
#include "../common/classes/fb_string.h"
#include "../common/classes/objects_array.h"
#include "../common/classes/condition.h"
#include "../common/classes/MetaName.h"
#include "../jrd/MetaName.h"
#include "../common/classes/GetPlugins.h"
#include "../common/ThreadStart.h"
#include "../jrd/ods.h"
@ -277,8 +277,8 @@ public:
void shutdown(thread_db* tdbb);
void prepareChangeCryptState(thread_db* tdbb, const Firebird::MetaName& plugName,
const Firebird::MetaName& key);
void prepareChangeCryptState(thread_db* tdbb, const MetaName& plugName,
const MetaName& key);
void changeCryptState(thread_db* tdbb, const Firebird::string& plugName);
void attach(thread_db* tdbb, Attachment* att);
void detach(thread_db* tdbb, Attachment* att);
@ -384,7 +384,7 @@ private:
void checkDigitalSignature(thread_db* tdbb, const class Header& hdr);
BarSync sync;
Firebird::MetaName keyName, pluginName;
MetaName keyName, pluginName;
ULONG currentPage;
Firebird::Mutex pluginLoadMtx, cryptThreadMtx, holdersMutex;
AttVector keyProviders, keyConsumers;

View File

@ -40,6 +40,7 @@
#include "../jrd/CryptoManager.h"
#include "../jrd/os/pio_proto.h"
#include "../common/os/os_utils.h"
//#include "../dsql/Parser.h"
// Thread data block
#include "../common/ThreadData.h"

View File

@ -44,7 +44,8 @@
#include "../common/classes/fb_atomic.h"
#include "../common/classes/fb_string.h"
#include "../common/classes/MetaName.h"
#include "../common/classes/auto.h"
#include "../jrd/MetaName.h"
#include "../common/classes/array.h"
#include "../common/classes/Hash.h"
#include "../common/classes/objects_array.h"
@ -82,6 +83,15 @@ class ExternalFileDirectoryList;
class MonitoringData;
class GarbageCollector;
class CryptoManager;
class KeywordsMap;
// allocator for keywords table
class KeywordsMapAllocator
{
public:
static KeywordsMap* create();
static void destroy(KeywordsMap* inst);
};
// general purpose vector
template <class T, BlockType TYPE = type_vec>
@ -442,7 +452,7 @@ private:
DatabaseModules dbb_modules; // external function/filter modules
public:
ExtEngineManager dbb_extManager; // external engine manager
Firebird::AutoPtr<ExtEngineManager> dbb_extManager; // external engine manager
Firebird::SyncObject dbb_flush_count_mutex;
Firebird::RWLock dbb_ast_lock; // avoids delivering AST to going away database
@ -465,7 +475,7 @@ public:
#ifdef HAVE_ID_BY_NAME
Firebird::UCharBuffer dbb_id;
#endif
Firebird::MetaName dbb_owner; // database owner
MetaName dbb_owner; // database owner
Firebird::SyncObject dbb_pools_sync;
Firebird::Array<MemoryPool*> dbb_pools; // pools
@ -521,6 +531,8 @@ public:
ReplicaMode dbb_replica_mode; // replica access mode
unsigned dbb_compatibility_index; // datatype backward compatibility level
Dictionary dbb_dic; // metanames dictionary
Firebird::InitInstance<KeywordsMap, KeywordsMapAllocator, Firebird::TraditionalDelete> dbb_keywords_map;
// returns true if primary file is located on raw device
bool onRawDevice() const;
@ -565,7 +577,7 @@ private:
dbb_page_manager(this, *p),
dbb_file_id(*p),
dbb_modules(*p),
dbb_extManager(*p),
dbb_extManager(nullptr),
dbb_flags(shared ? DBB_shared : 0),
dbb_filename(*p),
dbb_database_name(*p),
@ -587,7 +599,8 @@ private:
dbb_plugin_config(pConf),
dbb_repl_sequence(0),
dbb_replica_mode(REPLICA_NONE),
dbb_compatibility_index(~0U)
dbb_compatibility_index(~0U),
dbb_dic(*p)
{
dbb_pools.add(p);
}

View File

@ -38,7 +38,7 @@
#include "../common/classes/GenericMap.h"
#include "../common/classes/RefMutex.h"
#include "../common/classes/SyncObject.h"
#include "../common/classes/MetaName.h"
#include "../jrd/MetaName.h"
#include "../common/isc_s_proto.h"
#include "../common/isc_proto.h"
#include "../common/ThreadStart.h"
@ -104,8 +104,8 @@ bool openDb(const char* securityDb, RefPtr<IAttachment>& att, RefPtr<ITransactio
namespace Jrd {
bool checkCreateDatabaseGrant(const MetaName& userName, const MetaName& trustedRole,
const MetaName& sqlRole, const char* securityDb)
bool checkCreateDatabaseGrant(const MetaString& userName, const MetaString& trustedRole,
const MetaString& sqlRole, const char* securityDb)
{
if (userName == DBA_USER_NAME)
return true;
@ -115,7 +115,7 @@ bool checkCreateDatabaseGrant(const MetaName& userName, const MetaName& trustedR
bool hasDb = openDb(securityDb, att, tra);
FbLocalStatus st;
MetaName role(sqlRole);
MetaString role(sqlRole);
if (hasDb && role.hasData())
{
const UCHAR info[] = { isc_info_db_sql_dialect, isc_info_end };

View File

@ -36,8 +36,8 @@
namespace Jrd {
bool checkCreateDatabaseGrant(const Firebird::MetaName& userName, const Firebird::MetaName& trustedRole,
const Firebird::MetaName& sqlRole, const char* securityDb);
bool checkCreateDatabaseGrant(const Firebird::MetaString& userName, const Firebird::MetaString& trustedRole,
const Firebird::MetaString& sqlRole, const char* securityDb);
class DbCreatorsScan: public VirtualTableScan
{

View File

@ -35,6 +35,10 @@ const UCHAR DBG_INFO_VERSION_1 = UCHAR(1);
const UCHAR DBG_INFO_VERSION_2 = UCHAR(2);
const UCHAR CURRENT_DBG_INFO_VERSION = DBG_INFO_VERSION_2;
namespace Jrd {
class MetaName;
}
namespace Firebird {
class MapBlrToSrcItem
@ -54,7 +58,7 @@ typedef Firebird::SortedArray<
ULONG,
MapBlrToSrcItem> MapBlrToSrc;
typedef GenericMap<Pair<Right<USHORT, MetaName> > > MapVarIndexToName;
typedef GenericMap<Pair<Right<USHORT, Jrd::MetaName> > > MapVarIndexToName;
struct ArgumentInfo
{
@ -82,7 +86,7 @@ struct ArgumentInfo
}
};
typedef GenericMap<Pair<Right<ArgumentInfo, MetaName> > > MapArgumentInfoToName;
typedef GenericMap<Pair<Right<ArgumentInfo, Jrd::MetaName> > > MapArgumentInfoToName;
struct DbgInfo : public PermanentStorage
{
@ -110,7 +114,7 @@ struct DbgInfo : public PermanentStorage
curIndexToName.clear();
{ // scope
GenericMap<Pair<Left<MetaName, DbgInfo*> > >::Accessor accessor(&subFuncs);
GenericMap<Pair<Left<Jrd::MetaName, DbgInfo*> > >::Accessor accessor(&subFuncs);
for (bool found = accessor.getFirst(); found; found = accessor.getNext())
delete accessor.current()->second;
@ -119,7 +123,7 @@ struct DbgInfo : public PermanentStorage
}
{ // scope
GenericMap<Pair<Left<MetaName, DbgInfo*> > >::Accessor accessor(&subProcs);
GenericMap<Pair<Left<Jrd::MetaName, DbgInfo*> > >::Accessor accessor(&subProcs);
for (bool found = accessor.getFirst(); found; found = accessor.getNext())
delete accessor.current()->second;
@ -132,8 +136,8 @@ struct DbgInfo : public PermanentStorage
MapVarIndexToName varIndexToName; // mapping between variable index and name
MapArgumentInfoToName argInfoToName; // mapping between argument info (type, index) and name
MapVarIndexToName curIndexToName; // mapping between cursor index and name
GenericMap<Pair<Left<MetaName, DbgInfo*> > > subFuncs; // sub functions
GenericMap<Pair<Left<MetaName, DbgInfo*> > > subProcs; // sub procedures
GenericMap<Pair<Left<Jrd::MetaName, DbgInfo*> > > subFuncs; // sub functions
GenericMap<Pair<Left<Jrd::MetaName, DbgInfo*> > > subProcs; // sub procedures
};
} // namespace Firebird

View File

@ -727,7 +727,7 @@ ExtEngineManager::Function::~Function()
void ExtEngineManager::Function::execute(thread_db* tdbb, UCHAR* inMsg, UCHAR* outMsg) const
{
EngineAttachmentInfo* attInfo = extManager->getEngineAttachment(tdbb, engine);
const MetaName& userName = udf->invoker ? udf->invoker->getUserName() : "";
const MetaString& userName = udf->invoker ? udf->invoker->getUserName() : "";
ContextManager<IExternalFunction> ctxManager(tdbb, attInfo, function,
(udf->getName().package.isEmpty() ?
CallerName(obj_udf, udf->getName().identifier, userName) :
@ -781,7 +781,7 @@ ExtEngineManager::ResultSet::ResultSet(thread_db* tdbb, UCHAR* inMsg, UCHAR* out
firstFetch(true)
{
attInfo = procedure->extManager->getEngineAttachment(tdbb, procedure->engine);
const MetaName& userName = procedure->prc->invoker ? procedure->prc->invoker->getUserName() : "";
const MetaString& userName = procedure->prc->invoker ? procedure->prc->invoker->getUserName() : "";
ContextManager<IExternalProcedure> ctxManager(tdbb, attInfo, procedure->procedure,
(procedure->prc->getName().package.isEmpty() ?
CallerName(obj_procedure, procedure->prc->getName().identifier, userName) :
@ -815,7 +815,7 @@ bool ExtEngineManager::ResultSet::fetch(thread_db* tdbb)
if (!resultSet)
return wasFirstFetch;
const MetaName& userName = procedure->prc->invoker ? procedure->prc->invoker->getUserName() : "";
const MetaString& userName = procedure->prc->invoker ? procedure->prc->invoker->getUserName() : "";
ContextManager<IExternalProcedure> ctxManager(tdbb, attInfo, charSet,
(procedure->prc->getName().package.isEmpty() ?
CallerName(obj_procedure, procedure->prc->getName().identifier, userName) :
@ -896,7 +896,7 @@ void ExtEngineManager::Trigger::execute(thread_db* tdbb, jrd_req* request, unsig
EngineAttachmentInfo* attInfo = extManager->getEngineAttachment(tdbb, engine);
const Nullable<bool>& ssDefiner = trg->ssDefiner.specified ? trg->ssDefiner :
(trg->relation && trg->relation->rel_ss_definer.specified ? trg->relation->rel_ss_definer : Nullable<bool>() );
const MetaName& userName = ssDefiner.specified && ssDefiner.value ? trg->relation->rel_owner_name : "";
const MetaString& userName = ssDefiner.specified && ssDefiner.value ? trg->relation->rel_owner_name.c_str() : "";
ContextManager<IExternalTrigger> ctxManager(tdbb, attInfo, trigger,
CallerName(obj_trigger, trg->name, userName));
@ -1270,7 +1270,7 @@ void ExtEngineManager::makeFunction(thread_db* tdbb, CompilerScratch* csb, Jrd::
entryPointTrimmed.trim();
EngineAttachmentInfo* attInfo = getEngineAttachment(tdbb, engine);
const MetaName& userName = udf->invoker ? udf->invoker->getUserName() : "";
const MetaString& userName = udf->invoker ? udf->invoker->getUserName() : "";
ContextManager<IExternalFunction> ctxManager(tdbb, attInfo, attInfo->adminCharSet,
(udf->getName().package.isEmpty() ?
CallerName(obj_udf, udf->getName().identifier, userName) :
@ -1394,7 +1394,7 @@ void ExtEngineManager::makeProcedure(thread_db* tdbb, CompilerScratch* csb, jrd_
entryPointTrimmed.trim();
EngineAttachmentInfo* attInfo = getEngineAttachment(tdbb, engine);
const MetaName& userName = prc->invoker ? prc->invoker->getUserName() : "";
const MetaString& userName = prc->invoker ? prc->invoker->getUserName() : "";
ContextManager<IExternalProcedure> ctxManager(tdbb, attInfo, attInfo->adminCharSet,
(prc->getName().package.isEmpty() ?
CallerName(obj_procedure, prc->getName().identifier, userName) :
@ -1526,7 +1526,7 @@ void ExtEngineManager::makeTrigger(thread_db* tdbb, CompilerScratch* csb, Jrd::T
entryPointTrimmed.trim();
EngineAttachmentInfo* attInfo = getEngineAttachment(tdbb, engine);
const MetaName& userName = trg->ssDefiner.specified && trg->ssDefiner.value ? trg->owner : "";
const MetaString& userName = trg->ssDefiner.specified && trg->ssDefiner.value ? trg->owner.c_str() : "";
ContextManager<IExternalTrigger> ctxManager(tdbb, attInfo, attInfo->adminCharSet,
CallerName(obj_trigger, trg->name, userName));

View File

@ -27,7 +27,7 @@
#include "../common/classes/array.h"
#include "../common/classes/fb_string.h"
#include "../common/classes/GenericMap.h"
#include "../common/classes/MetaName.h"
#include "../jrd/MetaName.h"
#include "../common/classes/NestConst.h"
#include "../common/classes/auto.h"
#include "../common/classes/rwlock.h"
@ -124,14 +124,14 @@ private:
}
public:
Firebird::MetaName package;
Firebird::MetaName name;
MetaName package;
MetaName name;
Firebird::string entryPoint;
Firebird::string body;
Firebird::RefPtr<Firebird::IMessageMetadata> inputParameters;
Firebird::RefPtr<Firebird::IMessageMetadata> outputParameters;
Firebird::RefPtr<Firebird::IMessageMetadata> triggerFields;
Firebird::MetaName triggerTable;
MetaName triggerTable;
unsigned triggerType;
private:
@ -173,7 +173,7 @@ private:
Firebird::IAttachment* externalAttachment;
Firebird::ITransaction* externalTransaction;
Firebird::GenericMap<Firebird::NonPooled<int, void*> > miscInfo;
Firebird::MetaName clientCharSet;
MetaName clientCharSet;
};
struct EngineAttachment
@ -314,20 +314,20 @@ public:
void closeAttachment(thread_db* tdbb, Attachment* attachment);
void makeFunction(thread_db* tdbb, CompilerScratch* csb, Jrd::Function* udf,
const Firebird::MetaName& engine, const Firebird::string& entryPoint,
const MetaName& engine, const Firebird::string& entryPoint,
const Firebird::string& body);
void makeProcedure(thread_db* tdbb, CompilerScratch* csb, jrd_prc* prc,
const Firebird::MetaName& engine, const Firebird::string& entryPoint,
const MetaName& engine, const Firebird::string& entryPoint,
const Firebird::string& body);
void makeTrigger(thread_db* tdbb, CompilerScratch* csb, Jrd::Trigger* trg,
const Firebird::MetaName& engine, const Firebird::string& entryPoint,
const MetaName& engine, const Firebird::string& entryPoint,
const Firebird::string& body, unsigned type);
private:
Firebird::IExternalEngine* getEngine(thread_db* tdbb,
const Firebird::MetaName& name);
const MetaName& name);
EngineAttachmentInfo* getEngineAttachment(thread_db* tdbb,
const Firebird::MetaName& name);
const MetaName& name);
EngineAttachmentInfo* getEngineAttachment(thread_db* tdbb,
Firebird::IExternalEngine* engine, bool closing = false);
void setupAdminCharSet(thread_db* tdbb, Firebird::IExternalEngine* engine,
@ -335,7 +335,7 @@ private:
private:
typedef Firebird::GenericMap<Firebird::Pair<
Firebird::Left<Firebird::MetaName, Firebird::IExternalEngine*> > > EnginesMap;
Firebird::Left<MetaName, Firebird::IExternalEngine*> > > EnginesMap;
typedef Firebird::GenericMap<Firebird::Pair<Firebird::NonPooled<
EngineAttachment, EngineAttachmentInfo*> >, EngineAttachment> EnginesAttachmentsMap;

View File

@ -429,7 +429,7 @@ Function* Function::loadMetadata(thread_db* tdbb, USHORT id, bool noscan, USHORT
else
body.getBuffer(1)[0] = 0;
dbb->dbb_extManager.makeFunction(tdbb, csb, function, X.RDB$ENGINE_NAME,
dbb->dbb_extManager->makeFunction(tdbb, csb, function, X.RDB$ENGINE_NAME,
(X.RDB$ENTRYPOINT.NULL ? "" : X.RDB$ENTRYPOINT), (char*) body.begin());
if (!function->fun_external)

View File

@ -30,6 +30,7 @@
namespace Jrd
{
class ValueListNode;
class QualifiedName;
class Function : public Routine
{
@ -37,7 +38,7 @@ namespace Jrd
public:
static Function* lookup(thread_db* tdbb, USHORT id, bool return_deleted, bool noscan, USHORT flags);
static Function* lookup(thread_db* tdbb, const Firebird::QualifiedName& name, bool noscan);
static Function* lookup(thread_db* tdbb, const QualifiedName& name, bool noscan);
void releaseLocks(thread_db* tdbb);

View File

@ -45,6 +45,19 @@ template <typename T> static void makeSubRoutines(thread_db* tdbb, JrdStatement*
CompilerScratch* csb, T& subs);
ULONG CompilerScratch::allocImpure(ULONG align, ULONG size)
{
const ULONG offset = FB_ALIGN(csb_impure, align);
if (offset + size > JrdStatement::MAX_REQUEST_SIZE)
IBERROR(226); // msg 226: request size limit exceeded
csb_impure = offset + size;
return offset;
}
// Start to turn a parsed scratch into a statement. This is completed by makeStatement.
JrdStatement::JrdStatement(thread_db* tdbb, MemoryPool* p, CompilerScratch* csb)
: pool(p),
@ -734,7 +747,7 @@ void JrdStatement::buildExternalAccess(thread_db* tdbb, ExternalAccessList& list
jrd_prc* const procedure = MET_lookup_procedure_id(tdbb, item->exa_prc_id, false, false, 0);
if (procedure && procedure->getStatement())
{
item->user = procedure->invoker ? procedure->invoker->getUserName() : user;
item->user = procedure->invoker ? MetaName(procedure->invoker->getUserName()) : user;
if (list.find(*item, i))
continue;
list.insert(i, *item);
@ -746,7 +759,7 @@ void JrdStatement::buildExternalAccess(thread_db* tdbb, ExternalAccessList& list
Function* const function = Function::lookup(tdbb, item->exa_fun_id, false, false, 0);
if (function && function->getStatement())
{
item->user = function->invoker ? function->invoker->getUserName() : user;
item->user = function->invoker ? MetaName(function->invoker->getUserName()) : user;
if (list.find(*item, i))
continue;
list.insert(i, *item);

View File

@ -58,10 +58,10 @@ public:
private:
static void verifyTriggerAccess(thread_db* tdbb, jrd_rel* ownerRelation, TrigVector* triggers,
Firebird::MetaName userName);
static void triggersExternalAccess(thread_db* tdbb, ExternalAccessList& list, TrigVector* tvec, const Firebird::MetaName &user);
MetaName userName);
static void triggersExternalAccess(thread_db* tdbb, ExternalAccessList& list, TrigVector* tvec, const MetaName &user);
void buildExternalAccess(thread_db* tdbb, ExternalAccessList& list, const Firebird::MetaName& user);
void buildExternalAccess(thread_db* tdbb, ExternalAccessList& list, const MetaName& user);
public:
MemoryPool* pool;
@ -75,7 +75,7 @@ public:
ResourceList resources; // Resources (relations and indices)
const jrd_prc* procedure; // procedure, if any
const Function* function; // function, if any
Firebird::MetaName triggerName; // name of request (trigger), if any
MetaName triggerName; // name of request (trigger), if any
Jrd::UserId* triggerInvoker; // user name if trigger run with SQL SECURITY DEFINER
JrdStatement* parentStatement; // Sub routine's parent statement
Firebird::Array<JrdStatement*> subStatements; // Array of subroutines' statements

View File

@ -35,7 +35,7 @@
#include "../common/classes/init.h"
#include "../common/classes/RefMutex.h"
#include "../common/classes/SyncObject.h"
#include "../common/classes/MetaName.h"
#include "../jrd/MetaName.h"
#include "../common/isc_s_proto.h"
#include "../common/isc_proto.h"
#include "../common/ThreadStart.h"

492
src/jrd/MetaName.cpp Normal file
View File

@ -0,0 +1,492 @@
/*
* PROGRAM: Client/Server Common Code
* MODULE: MetaName.cpp
* DESCRIPTION: metadata name holder
*
* The contents of this file are subject to the Initial
* Developer's Public License Version 1.0 (the "License");
* you may not use this file except in compliance with the
* License. You may obtain a copy of the License at
* http://www.ibphoenix.com/main.nfs?a=ibphoenix&page=ibp_idpl.
*
* Software distributed under the License is distributed AS IS,
* WITHOUT WARRANTY OF ANY KIND, either express or implied.
* See the License for the specific language governing rights
* and limitations under the License.
*
* The Original Code was created by Alexander Peshkov
* for the Firebird Open Source RDBMS project.
*
* Copyright (c) 2005, 2020 Alexander Peshkov <peshkoff@mail.ru>
* and all contributors signed below.
*
* All Rights Reserved.
* Contributor(s): ______________________________________.
*
*
*/
#include "firebird.h"
#include <stdarg.h>
#include "../jrd/MetaName.h"
#include "../common/classes/MetaString.h"
#include "../common/classes/RefMutex.h"
#include "../jrd/jrd.h"
namespace Jrd {
int MetaName::compare(const char* s, FB_SIZE_T len) const
{
if (s)
{
adjustLength(s, len);
FB_SIZE_T x = length() < len ? length() : len;
int rc = memcmp(c_str(), s, x);
if (rc)
{
return rc;
}
}
else
len = 0;
return length() - len;
}
void MetaName::adjustLength(const char* const s, FB_SIZE_T& len)
{
if (len > MAX_SQL_IDENTIFIER_LEN)
{
fb_assert(s);
#ifdef DEV_BUILD
for (FB_SIZE_T i = MAX_SQL_IDENTIFIER_LEN; i < len; ++i)
fb_assert(s[i] == '\0' || s[i] == ' ');
#endif
len = MAX_SQL_IDENTIFIER_LEN;
}
while (len)
{
if (s[len - 1] != ' ')
{
break;
}
--len;
}
}
void MetaName::printf(const char* format, ...)
{
char data[MAX_SQL_IDENTIFIER_LEN + 1];
va_list params;
va_start(params, format);
int len = VSNPRINTF(data, MAX_SQL_IDENTIFIER_LEN, format, params);
va_end(params);
if (len < 0 || FB_SIZE_T(len) > MAX_SQL_IDENTIFIER_LEN)
{
len = MAX_SQL_IDENTIFIER_LEN;
}
data[len] = 0;
word = get(data, len);
}
FB_SIZE_T MetaName::copyTo(char* to, FB_SIZE_T toSize) const
{
fb_assert(to);
fb_assert(toSize);
if (--toSize > length())
{
toSize = length();
}
memcpy(to, c_str(), toSize);
to[toSize] = 0;
return toSize;
}
MetaName::operator Firebird::MetaString() const
{
return Firebird::MetaString(c_str(), length());
}
MetaName::MetaName(const Firebird::MetaString& s)
{
assign(s.c_str(), s.length());
}
MetaName& MetaName::operator=(const Firebird::MetaString& s)
{
return assign(s.c_str(), s.length());
}
void MetaName::test()
{
#if defined(DEV_BUILD) || GROW_DEBUG > 0
if (word)
{
Dictionary::Word* checkWord = get(word->c_str(), word->length());
fb_assert(checkWord == word);
#ifndef DEV_BUILD
if (word != checkWord)
abort();
#endif
}
#endif
}
const char* MetaName::EMPTY = "";
#if GROW_DEBUG > 1
static const unsigned int hashSize[] = {1000, 2000, 4000, 6000, 8000, 10000,
12000, 14000, 16000, 18000, 20000,
22000, 24000, 26000, 28000, 30000,
32000, 34000, 36000, 38000, 40000,
42000, 44000, 46000, 48000, 50000,
52000, 54000, 56000, 58000, 60000};
#else
static const unsigned int hashSize[] = { 10007, 100003, 1000003 };
#endif
Dictionary::Dictionary(MemoryPool& p)
: Firebird::PermanentStorage(p),
#if DIC_STATS > 0
words(0), totLength(0), lostWords(0), conflicts(0), retriesHash(0), retriesSegment(0),
#endif
hashTable(FB_NEW_POOL(getPool()) HashTable(getPool(), 0)),
nextLevel(0),
segment(FB_NEW_POOL(getPool()) Segment),
segCount(1)
{ }
#if DIC_STATS > 0
Dictionary::~Dictionary()
{
#define LINESEP "\n\t\t"
gds__log("Dictionary statistics:" LINESEP
"words %" UQUADFORMAT LINESEP
"average length %.02f" LINESEP
"hash size at level %u is %u" LINESEP
"lost words %" UQUADFORMAT LINESEP
"conflicts on mutex %" UQUADFORMAT LINESEP
"retries in hash table %" UQUADFORMAT LINESEP
"segments total %u" LINESEP
"retries in segment %" UQUADFORMAT "\n",
words.load(), double(totLength) / words.load(),
hashTable.load()->level, hashSize[hashTable.load()->level],
lostWords.load(), conflicts.load(),
retriesHash.load(), segCount, retriesSegment.load());
}
#endif
Dictionary::HashTable::HashTable(MemoryPool& p, unsigned lvl)
: level(lvl),
table(FB_NEW_POOL(p) TableData[hashSize[level]])
{
for (unsigned n = 0; n < hashSize[level]; ++n)
table[n].store(nullptr, std::memory_order_relaxed);
}
unsigned Dictionary::HashTable::getMaxLevel()
{
return FB_NELEM(hashSize) - 1;
}
void Dictionary::Word::assign(const char* s, FB_SIZE_T len)
{
fb_assert(len < MAX_UCHAR);
textLen = len;
memcpy(text, s, len);
text[len] = '\0';
}
Dictionary::Word* MetaName::get(const char* s, FB_SIZE_T len)
{
// normalize metadata name
adjustLength(s, len);
if (!len)
return nullptr;
// get dictionary from TLS
thread_db* tdbb = JRD_get_thread_data();
fb_assert(tdbb);
fb_assert(tdbb->getDatabase());
Dictionary& dic = tdbb->getDatabase()->dbb_dic;
// use that dictionary to find appropriate word
return dic.get(s, len);
}
Dictionary::TableData* Dictionary::HashTable::getEntryByHash(const char* s, FB_SIZE_T len)
{
unsigned h = Firebird::InternalHash::hash(len, reinterpret_cast<const UCHAR*>(s), hashSize[level]);
return &table[h];
}
bool Dictionary::checkConsistency(Dictionary::HashTable* oldValue)
{
return oldValue->level == nextLevel.load();
}
Dictionary::Word* Dictionary::get(const char* s, FB_SIZE_T len)
{
Word* newWord = nullptr;
// first of all get current hash table and entry appropriate for a string
HashTable* t = hashTable.load();
TableData* d = t->getEntryByHash(s, len);
// restart loop
for(;;)
{
// to be used if adding new word to hash later
Word* hashWord = d->load();
// try to find existing word
Word* word = hashWord;
while (word)
{
if (word->length() == len && memcmp(word->c_str(), s, len) == 0)
{
// Avoid finding duplicate - if at this step when word is located
// hash level did not change we definitely got correct word
if (!checkConsistency(t))
break;
#if DIC_STATS > 0
if (newWord)
++lostWords;
#endif
return word;
}
word = word->next;
}
// check for previously allocated space presence
if (!newWord)
{
// we have not done anything tragic yet
// now it's good time to check - does anyone increments hash size
if (!checkConsistency(t))
{
// Wait for completion, switch to new hash table & repeat everything
t = waitForMutex();
d = t->getEntryByHash(s, len);
continue;
}
// allocate space for new word
newWord = segment->getSpace(len DIC_STAT_SEGMENT_CALL);
if (!newWord)
{
Firebird::MutexEnsureUnlock guard(mutex, FB_FUNCTION);
if (guard.tryEnter())
{
// retry allocation to avoid a case when someone already changed segment
newWord = segment->getSpace(len DIC_STAT_SEGMENT_CALL);
// do we really need new segment?
if (!newWord)
{
segment = FB_NEW_POOL(getPool()) Segment;
++segCount;
unsigned lvl = nextLevel.load();
if (lvl < HashTable::getMaxLevel() &&
segCount * Segment::getWordCapacity() > hashSize[lvl])
{
growHash();
}
}
else
newWord->assign(s, len);
}
else
{
// somebody already changes segment and/or grows hash size - let's wait for it
HashTable* tNew = waitForMutex();
if (tNew != t)
{
t = tNew;
d = t->getEntryByHash(s, len);
}
}
continue;
}
// fill allocated space
newWord->assign(s, len);
}
// by all means minimize a chance of getting duplicate word:
// check consistency right before adding word to dictionary
if (!checkConsistency(t))
{
// Wait for completion, switch to new hash table & repeat everything
t = waitForMutex();
d = t->getEntryByHash(s, len);
continue;
}
// complete operation - try to replace hash pointer
newWord->next = hashWord;
if (d->compare_exchange_weak(hashWord, newWord,
std::memory_order_seq_cst, std::memory_order_relaxed))
{
// very rare case - finally avoid having duplicates
if (!checkConsistency(t))
{
// we do not know when did shit happen
// let's check new word and fix things if something gone wrong
t = waitForMutex(&newWord);
if (t)
{
// must repeat with new hash table
d = t->getEntryByHash(s, len);
continue;
}
}
#if DIC_STATS > 0
++words;
totLength += len;
#endif
return newWord;
}
#if DIC_STATS > 0
++retriesHash;
#endif
}
}
void Dictionary::growHash()
{
fb_assert(mutex.locked());
// move one level up size of hash table
HashTable* tab = hashTable.load();
unsigned lvl = ++nextLevel;
fb_assert(lvl == tab->level + 1);
fb_assert(lvl <= HashTable::getMaxLevel());
#if GROW_DEBUG > 0
fprintf(stderr, "Hash grow to %d\n", hashSize[lvl]);
#endif
// create new hash table
HashTable* newTab = FB_NEW_POOL(getPool()) HashTable(getPool(), lvl);
// we have mutex locked - but it does not mean others will not touch old hash table
// that's why do not forget to be careful when getting elements from it
// on the other hand new table may be modified freely - it's local for this thread after creation
for (unsigned n = 0; n < hashSize[tab->level]; ++n)
{
// detach list of words from old table in safe way
TableData* tableEntry = &tab->table[n];
Word* list = tableEntry->load();
while(!tableEntry->compare_exchange_weak(list, nullptr))
; // empty body of the loop
// append detached list of words to new table word by word
while (list)
{
Word* next = list->next;
TableData* e = newTab->getEntryByHash(list->c_str(), list->length());
list->next = e->load(std::memory_order_relaxed);
e->store(list, std::memory_order_relaxed);
list = next;
}
}
// new hash table is ready - install it
// noone will concurrently modify it but it can be read, i.e. membar is needed
hashTable.store(newTab);
}
Dictionary::HashTable* Dictionary::waitForMutex(Jrd::Dictionary::Word** checkWordPtr)
{
Firebird::MutexLockGuard guard(mutex, FB_FUNCTION);
#if DIC_STATS > 0
++conflicts;
#endif
HashTable* t = hashTable.load();
if (!checkWordPtr)
return t;
// may be we already have that word in new table
FB_SIZE_T len = (*checkWordPtr)->length();
const char* s = (*checkWordPtr)->c_str();
Word* word = t->getEntryByHash(s, len)->load();
while (word)
{
if (word->length() == len && memcmp(word->c_str(), s, len) == 0)
{
// successfully found same word in new table - use it
*checkWordPtr = word;
return nullptr;
}
word = word->next;
}
// checkWord was added to old hash table right now & is missing in new one
// we should repeat adding it to the new hash table
return t;
}
Dictionary::Segment::Segment()
{
position.store(0, std::memory_order_relaxed);
}
unsigned Dictionary::Segment::getWordCapacity()
{
const unsigned AVERAGE_BYTES_LEN = 16;
return SEG_BUFFER_SIZE / getWordLength(AVERAGE_BYTES_LEN);
}
unsigned Dictionary::Segment::getWordLength(FB_SIZE_T len)
{
// calculate length in sizeof(Word*)
len += 2;
return 1 + (len / sizeof(Word*)) + (len % sizeof(Word*) ? 1 : 0);
}
Dictionary::Word* Dictionary::Segment::getSpace(FB_SIZE_T len DIC_STAT_SEGMENT_PAR)
{
len = getWordLength(len);
// get old position value
unsigned oldPos = position.load();
// restart loop
for(;;)
{
// calculate and check new position
unsigned newPos = oldPos + len;
if (newPos >= SEG_BUFFER_SIZE)
break;
// try to store it safely in segment header
if (position.compare_exchange_strong(oldPos, newPos))
{
return reinterpret_cast<Word*>(&buffer[oldPos]);
}
#if DIC_STATS > 0
++retries;
#endif
}
// Segment out of space
return nullptr;
}
} // namespace Jrd

364
src/jrd/MetaName.h Normal file
View File

@ -0,0 +1,364 @@
/*
* PROGRAM: Client/Server Common Code
* MODULE: MetaName.h
* DESCRIPTION: metadata name holder
*
* The contents of this file are subject to the Initial
* Developer's Public License Version 1.0 (the "License");
* you may not use this file except in compliance with the
* License. You may obtain a copy of the License at
* http://www.ibphoenix.com/main.nfs?a=ibphoenix&page=ibp_idpl.
*
* Software distributed under the License is distributed AS IS,
* WITHOUT WARRANTY OF ANY KIND, either express or implied.
* See the License for the specific language governing rights
* and limitations under the License.
*
* The Original Code was created by Alexander Peshkov
* for the Firebird Open Source RDBMS project.
*
* Copyright (c) 2005, 2020 Alexander Peshkov <peshkoff@mail.ru>
* and all contributors signed below.
*
* All Rights Reserved.
* Contributor(s): ______________________________________.
*
*
*/
#ifndef JRD_METANAME_H
#define JRD_METANAME_H
#include "../common/classes/fb_string.h"
#include "../common/classes/fb_pair.h"
#include "../jrd/constants.h"
#include <atomic>
// 0 - debugging off, 1 - prints stats with normal setup tables,
// 2 - special setup tables for often grow operation
#define GROW_DEBUG 0
// 0 - statistics off, 1 - statistics on
#define DIC_STATS 0
#if DIC_STATS > 0
#define DIC_STAT_SEGMENT_CALL , retriesSegment
#define DIC_STAT_SEGMENT_PAR , Dictionary::StatCnt& retries
#else
#define DIC_STAT_SEGMENT_CALL
#define DIC_STAT_SEGMENT_PAR
#endif
namespace Firebird {
class MetaString;
}
namespace Jrd {
class Dictionary : public Firebird::PermanentStorage
{
public:
Dictionary(MemoryPool& p);
#if DIC_STATS > 0
~Dictionary();
#endif
class Word
{
public:
Word* next;
private:
UCHAR textLen;
char text[1];
public:
const char* c_str() const
{
return text;
}
FB_SIZE_T length() const
{
return textLen;
}
void assign(const char* s, FB_SIZE_T l);
};
Word* get(const char* str, FB_SIZE_T l);
void growHash();
#if DIC_STATS > 0
typedef std::atomic<FB_UINT64> StatCnt;
StatCnt words, totLength, lostWords, conflicts, retriesHash, retriesSegment;
#endif
private:
typedef std::atomic<Word*> TableData;
class HashTable
{
public:
HashTable(MemoryPool& p, unsigned lvl);
Dictionary::TableData* getEntryByHash(const char* s, FB_SIZE_T len);
static unsigned getMaxLevel();
const unsigned level;
TableData* table;
};
std::atomic<HashTable*> hashTable;
std::atomic<unsigned> nextLevel;
bool checkConsistency(HashTable* oldValue);
HashTable* waitForMutex(Word** checkWordPtr = nullptr);
class Segment
{
public:
Segment();
Word* getSpace(FB_SIZE_T l DIC_STAT_SEGMENT_PAR);
static unsigned getWordCapacity();
private:
static unsigned getWordLength(FB_SIZE_T len);
#if GROW_DEBUG > 1
static const unsigned SEG_BUFFER_SIZE = 256; // size in sizeof(pointer)
#else
static const unsigned SEG_BUFFER_SIZE = 16384; // size in sizeof(pointer)
#endif
void* buffer[SEG_BUFFER_SIZE];
std::atomic<unsigned> position;
};
Segment* segment;
unsigned segCount;
Firebird::Mutex mutex; // The single mutex to protect dictionary when needed
};
class MetaName
{
private:
Dictionary::Word* word;
static const char* EMPTY;
void test();
Dictionary::Word* get(const char* s, FB_SIZE_T l);
Dictionary::Word* get(const char* s)
{
return get(s, s ? fb_strlen(s) : 0);
}
public:
MetaName()
: word(nullptr)
{ }
MetaName(const char* s)
: word(get(s))
{ }
MetaName(const Firebird::MetaString& s);
MetaName(const char* s, FB_SIZE_T l)
: word(get(s, l))
{ }
MetaName(const MetaName& m)
: word(m.word)
{
test();
}
MetaName(const Firebird::AbstractString& s)
: word(get(s.c_str(), s.length()))
{ }
explicit MetaName(MemoryPool&)
: word(nullptr)
{ }
MetaName(MemoryPool&, const char* s)
: word(get(s))
{ }
MetaName(MemoryPool&, const char* s, FB_SIZE_T l)
: word(get(s, l))
{ }
MetaName(MemoryPool&, const MetaName& m)
: word(m.word)
{
test();
}
MetaName(MemoryPool&, const Firebird::AbstractString& s)
: word(get(s.c_str(), s.length()))
{ }
MetaName& assign(const char* s, FB_SIZE_T l)
{
word = get(s, l);
return *this;
}
MetaName& assign(const char* s)
{
word = get(s);
return *this;
}
MetaName& operator=(const char* s)
{
word = get(s);
return *this;
}
MetaName& operator=(const Firebird::AbstractString& s)
{
word = get(s.c_str(), s.length());
return *this;
}
MetaName& operator=(const MetaName& m)
{
word = m.word;
test();
return *this;
}
MetaName& operator=(const Firebird::MetaString& s);
FB_SIZE_T length() const
{
return word ? word->length() : 0;
}
const char* c_str() const
{
return word ? word->c_str() : EMPTY;
}
const char* nullStr() const
{
return word ? word->c_str() : nullptr;
}
bool isEmpty() const
{
return !word;
}
bool hasData() const
{
return word;
}
char operator[](unsigned n) const
{
fb_assert(n < length());
return word->c_str()[n];
}
const char* begin() const
{
return word ? word->c_str() : EMPTY;
}
const char* end() const
{
return word ? &word->c_str()[length()] : EMPTY;
}
int compare(const char* s, FB_SIZE_T l) const;
int compare(const char* s) const
{
return compare(s, s ? fb_strlen(s) : 0);
}
int compare(const Firebird::AbstractString& s) const
{
return compare(s.c_str(), s.length());
}
int compare(const MetaName& m) const
{
if (word == m.word)
return 0;
return compare(m.begin(), m.length());
}
bool operator==(const char* s) const
{
return compare(s) == 0;
}
bool operator!=(const char* s) const
{
return compare(s) != 0;
}
bool operator==(const Firebird::AbstractString& s) const
{
return compare(s) == 0;
}
bool operator!=(const Firebird::AbstractString& s) const
{
return compare(s) != 0;
}
bool operator<=(const MetaName& m) const
{
return compare(m) <= 0;
}
bool operator>=(const MetaName& m) const
{
return compare(m) >= 0;
}
bool operator< (const MetaName& m) const
{
return compare(m) < 0;
}
bool operator> (const MetaName& m) const
{
return compare(m) > 0;
}
bool operator==(const MetaName& m) const
{
return word == m.word;
}
bool operator!=(const MetaName& m) const
{
return word != m.word;
}
void printf(const char*, ...);
FB_SIZE_T copyTo(char* to, FB_SIZE_T toSize) const;
operator Firebird::MetaString() const;
protected:
static void adjustLength(const char* const s, FB_SIZE_T& l);
};
typedef Firebird::Pair<Firebird::Full<MetaName, MetaName> > MetaNamePair;
} // namespace Jrd
#endif // JRD_METANAME_H

View File

@ -1373,7 +1373,7 @@ void Monitoring::dumpAttachment(thread_db* tdbb, Attachment* attachment)
attachment->mergeStats();
const AttNumber att_id = attachment->att_attachment_id;
const MetaName& user_name = attachment->att_user->getUserName();
const MetaString& user_name = attachment->att_user->getUserName();
fb_assert(dbb->dbb_monitoring_data);

View File

@ -148,19 +148,8 @@ public:
storeField(field_id, VALUE_TIMESTAMP_TZ, sizeof(ISC_TIMESTAMP_TZ), &value);
}
void storeString(int field_id, const Firebird::string& value)
{
if (value.length())
storeField(field_id, VALUE_STRING, value.length(), value.c_str());
}
void storeString(int field_id, const Firebird::PathName& value)
{
if (value.length())
storeField(field_id, VALUE_STRING, value.length(), value.c_str());
}
void storeString(int field_id, const Firebird::MetaName& value)
template <class S>
void storeString(int field_id, const S& value)
{
if (value.length())
storeField(field_id, VALUE_STRING, value.length(), value.c_str());

View File

@ -110,7 +110,7 @@ namespace
cast = FB_NEW_POOL(csb->csb_pool) CastNode(csb->csb_pool);
cast->source = value;
cast->castDesc = desc;
cast->impureOffset = CMP_impure(csb, sizeof(impure_value));
cast->impureOffset = csb->allocImpure<impure_value>();
}
value = cast;
@ -140,7 +140,7 @@ namespace
FB_NEW_POOL(csb->csb_pool) BoolAsValueNode(csb->csb_pool);
newValue->boolean = cmpNode;
newValue->impureOffset = CMP_impure(csb, sizeof(impure_value));
newValue->impureOffset = csb->allocImpure<impure_value>();
return newValue;
}
@ -1290,7 +1290,7 @@ InversionNode* OptimizerRetrieval::makeIndexScanNode(IndexScratch* indexScratch)
{
if (segment[i]->scanType == segmentScanMissing)
{
*lower++ = *upper++ = FB_NEW_POOL(*tdbb->getDefaultPool()) NullNode(*tdbb->getDefaultPool());
*lower++ = *upper++ = NullNode::instance();
ignoreNullsOnScan = false;
}
else
@ -1361,7 +1361,7 @@ InversionNode* OptimizerRetrieval::makeIndexScanNode(IndexScratch* indexScratch)
// mark the index as utilized for the purposes of this compile
idx->idx_runtime_flags |= idx_used;
const ULONG impure = csb ? CMP_impure(csb, sizeof(impure_inversion)) : 0;
const ULONG impure = csb ? csb->allocImpure<impure_inversion>() : 0;
return FB_NEW_POOL(pool) InversionNode(retrieval, impure);
}
@ -2195,7 +2195,7 @@ InversionCandidate* OptimizerRetrieval::matchDbKey(BoolExprNode* boolean) const
fb_assert(lower == upper);
InversionNode* const inversion = FB_NEW_POOL(pool) InversionNode(lower, n);
inversion->impure = CMP_impure(csb, sizeof(impure_inversion));
inversion->impure = csb->allocImpure<impure_inversion>();
invCandidate->inversion = inversion;
}
else

View File

@ -192,6 +192,10 @@ void PreparedStatement::Builder::moveFromResultSet(thread_db* tdbb, ResultSet* r
*(MetaName*) i->address = rs->getMetaName(tdbb, i->number);
break;
case TYPE_METASTRING:
*(MetaString*) i->address = rs->getMetaString(tdbb, i->number);
break;
default:
fb_assert(false);
}
@ -239,6 +243,10 @@ void PreparedStatement::Builder::moveToStatement(thread_db* tdbb, PreparedStatem
stmt->setMetaName(tdbb, i->number, *(MetaName*) i->address);
break;
case TYPE_METASTRING:
stmt->setMetaString(tdbb, i->number, *(MetaString*) i->address);
break;
default:
fb_assert(false);
}

View File

@ -31,7 +31,8 @@
#include "../common/classes/array.h"
#include "../common/classes/auto.h"
#include "../common/classes/fb_string.h"
#include "../common/classes/MetaName.h"
#include "../common/classes/MetaString.h"
#include "../jrd/MetaName.h"
#include "../common/classes/Nullable.h"
namespace Jrd {
@ -60,6 +61,7 @@ public:
TYPE_DOUBLE,
TYPE_METANAME,
TYPE_STRING,
TYPE_METASTRING,
};
// This struct and the member outputParams are used to make the C++ undefined parameter
@ -162,7 +164,8 @@ public:
static Type getType(SINT64) { return TYPE_SINT64; }
static Type getType(double) { return TYPE_DOUBLE; }
static Type getType(const Firebird::AbstractString&) { return TYPE_STRING; }
static Type getType(const Firebird::MetaName&) { return TYPE_METANAME; }
static Type getType(const MetaName&) { return TYPE_METANAME; }
static Type getType(const Firebird::MetaString&) { return TYPE_METASTRING; }
void addInput(Type type, const void* address, Firebird::Array<InputSlot>& slots)
{
@ -233,7 +236,7 @@ public:
}
// Escape a metadata name accordingly to SQL rules.
static Firebird::string escapeName(const Firebird::MetaName& s)
static Firebird::string escapeName(const MetaName& s)
{
Firebird::string ret;
@ -331,7 +334,16 @@ public:
setDesc(tdbb, param, desc);
}
void setMetaName(thread_db* tdbb, unsigned param, const Firebird::MetaName& value)
void setMetaName(thread_db* tdbb, unsigned param, const MetaName& value)
{
fb_assert(param > 0);
dsc desc;
desc.makeText((USHORT) value.length(), CS_METADATA, (UCHAR*) value.c_str());
setDesc(tdbb, param, desc);
}
void setMetaString(thread_db* tdbb, unsigned param, const Firebird::MetaString& value)
{
fb_assert(param > 0);

View File

@ -24,13 +24,13 @@
* Contributor(s): ______________________________________.
*/
#ifndef COMMON_QUALIFIEDNAME_H
#define COMMON_QUALIFIEDNAME_H
#ifndef JRD_QUALIFIEDNAME_H
#define JRD_QUALIFIEDNAME_H
#include "MetaName.h"
#include "array.h"
#include "../common/classes/array.h"
namespace Firebird {
namespace Jrd {
class QualifiedName
{
@ -91,9 +91,9 @@ public:
}
public:
string toString() const
Firebird::string toString() const
{
string s;
Firebird::string s;
if (package.hasData())
{
s = package.c_str();
@ -108,6 +108,6 @@ public:
MetaName package;
};
} // namespace Firebird
} // namespace Jrd
#endif // COMMON_QUALIFIEDNAME_H
#endif // JRD_QUALIFIEDNAME_H

View File

@ -612,47 +612,6 @@ 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:
stream #1 from table T1
stream #2 from table T2
consider a procedure P1 with 2 streams:
stream #1 from table X
stream #2 from view V1
During pass1 of procedure request, the engine tries to expand
all the views into their base tables. It creates a compiler
scratch block which initially looks like this:
stream 1 -------- X
stream 2 -------- V1
while expanding V1 the engine calls copy() with nod_relation.
A new stream 3 is created. Now the CompilerScratch looks like:
stream 1 -------- X
stream 2 -------- V1 map [2,3,4]
stream 3 -------- T1
stream 4 -------- T2
After T1 stream has been created the flags are copied from
stream #1 because V1's definition said the original stream
number for T1 was 1. However since its being merged with
the procedure request, stream #1 belongs to a different table.
The flags should be copied from stream 2 i.e. V1.
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);
if (alias.hasData())
{
element->csb_alias = FB_NEW_POOL(*tdbb->getDefaultPool())
@ -662,21 +621,16 @@ RelationSourceNode* RelationSourceNode::copy(thread_db* tdbb, NodeCopier& copier
return newSource;
}
void RelationSourceNode::ignoreDbKey(thread_db* tdbb, CompilerScratch* csb) const
{
csb->csb_rpt[stream].csb_flags |= csb_no_dbkey;
}
RecordSourceNode* RelationSourceNode::pass1(thread_db* tdbb, CompilerScratch* csb)
{
const CompilerScratch::csb_repeat* const tail = &csb->csb_rpt[stream];
const jrd_rel* const relation = tail->csb_relation;
const auto tail = &csb->csb_rpt[stream];
const auto relation = tail->csb_relation;
if (relation)
if (relation && !csb->csb_implicit_cursor)
{
SLONG ssRelationIdId = tail->csb_view ? tail->csb_view->rel_id :
const SLONG ssRelationId = tail->csb_view ? tail->csb_view->rel_id :
view ? view->rel_id : csb->csb_view ? csb->csb_view->rel_id : 0;
CMP_post_access(tdbb, csb, relation->rel_security_name, ssRelationIdId,
CMP_post_access(tdbb, csb, relation->rel_security_name, ssRelationId,
SCL_select, SCL_object_table, relation->rel_name);
}
@ -1137,11 +1091,6 @@ ProcedureSourceNode* ProcedureSourceNode::copy(thread_db* tdbb, NodeCopier& copi
element->csb_view = newSource->view;
element->csb_view_stream = copier.remap[0];
// dimitr: I doubt we need to inherit this flag for procedures.
// They don't have a DBKEY to be concatenated.
// Neither they have a stream map to be expanded.
copier.csb->inheritViewFlags(newSource->stream, csb_no_dbkey);
if (alias.hasData())
{
element->csb_alias = FB_NEW_POOL(*tdbb->getDefaultPool())
@ -1495,8 +1444,6 @@ AggregateSourceNode* AggregateSourceNode::copy(thread_db* tdbb, NodeCopier& copi
copier.remap[stream] = newSource->stream;
CMP_csb_element(copier.csb, newSource->stream);
copier.csb->inheritViewFlags(newSource->stream, csb_no_dbkey);
newSource->rse = rse->copy(tdbb, copier);
if (group)
newSource->group = group->copy(tdbb, copier);
@ -1505,16 +1452,8 @@ AggregateSourceNode* AggregateSourceNode::copy(thread_db* tdbb, NodeCopier& copi
return newSource;
}
void AggregateSourceNode::ignoreDbKey(thread_db* tdbb, CompilerScratch* csb) const
{
rse->ignoreDbKey(tdbb, csb);
}
RecordSourceNode* AggregateSourceNode::pass1(thread_db* tdbb, CompilerScratch* csb)
{
csb->csb_rpt[stream].csb_flags |= csb_no_dbkey;
rse->ignoreDbKey(tdbb, csb);
doPass1(tdbb, csb, rse.getAddress());
doPass1(tdbb, csb, map.getAddress());
doPass1(tdbb, csb, group.getAddress());
@ -1818,15 +1757,11 @@ UnionSourceNode* UnionSourceNode::copy(thread_db* tdbb, NodeCopier& copier) cons
copier.remap[stream] = newSource->stream;
CMP_csb_element(copier.csb, newSource->stream);
copier.csb->inheritViewFlags(newSource->stream, csb_no_dbkey);
if (newSource->recursive)
{
newSource->mapStream = copier.csb->nextStream();
copier.remap[mapStream] = newSource->mapStream;
CMP_csb_element(copier.csb, newSource->mapStream);
copier.csb->inheritViewFlags(newSource->mapStream, csb_no_dbkey);
}
const NestConst<RseNode>* ptr = clauses.begin();
@ -1841,14 +1776,6 @@ UnionSourceNode* UnionSourceNode::copy(thread_db* tdbb, NodeCopier& copier) cons
return newSource;
}
void UnionSourceNode::ignoreDbKey(thread_db* tdbb, CompilerScratch* csb) const
{
const NestConst<RseNode>* ptr = clauses.begin();
for (const NestConst<RseNode>* const end = clauses.end(); ptr != end; ++ptr)
(*ptr)->ignoreDbKey(tdbb, csb);
}
void UnionSourceNode::pass1Source(thread_db* tdbb, CompilerScratch* csb, RseNode* /*rse*/,
BoolExprNode** /*boolean*/, RecordSourceNodeStack& stack)
{
@ -1954,7 +1881,7 @@ RecordSource* UnionSourceNode::generate(thread_db* tdbb, OptimizerBlk* opt, cons
CompilerScratch* csb = opt->opt_csb;
HalfStaticArray<RecordSource*, OPT_STATIC_ITEMS> rsbs;
const ULONG baseImpure = CMP_impure(csb, 0);
const ULONG baseImpure = csb->allocImpure(FB_ALIGNMENT, 0);
NestConst<RseNode>* ptr = clauses.begin();
NestConst<MapNode>* ptr2 = maps.begin();
@ -2237,8 +2164,6 @@ WindowSourceNode* WindowSourceNode::copy(thread_db* tdbb, NodeCopier& copier) co
copier.remap[inputWindow->stream] = copyWindow.stream;
CMP_csb_element(copier.csb, copyWindow.stream);
copier.csb->inheritViewFlags(copyWindow.stream, csb_no_dbkey);
if (inputWindow->group)
copyWindow.group = inputWindow->group->copy(tdbb, copier);
@ -2258,21 +2183,8 @@ WindowSourceNode* WindowSourceNode::copy(thread_db* tdbb, NodeCopier& copier) co
return newSource;
}
void WindowSourceNode::ignoreDbKey(thread_db* tdbb, CompilerScratch* csb) const
{
rse->ignoreDbKey(tdbb, csb);
}
RecordSourceNode* WindowSourceNode::pass1(thread_db* tdbb, CompilerScratch* csb)
{
for (ObjectsArray<Window>::iterator window = windows.begin();
window != windows.end();
++window)
{
csb->csb_rpt[window->stream].csb_flags |= csb_no_dbkey;
}
rse->ignoreDbKey(tdbb, csb);
doPass1(tdbb, csb, rse.getAddress());
for (ObjectsArray<Window>::iterator window = windows.begin();
@ -2815,15 +2727,6 @@ RseNode* RseNode::copy(thread_db* tdbb, NodeCopier& copier) const
return newSource;
}
// For each relation or aggregate in the RseNode, mark it as not having a dbkey.
void RseNode::ignoreDbKey(thread_db* tdbb, CompilerScratch* csb) const
{
const NestConst<RecordSourceNode>* ptr = rse_relations.begin();
for (const NestConst<RecordSourceNode>* const end = rse_relations.end(); ptr != end; ++ptr)
(*ptr)->ignoreDbKey(tdbb, csb);
}
// Process a record select expression during pass 1 of compilation.
// Mostly this involves expanding views.
RseNode* RseNode::pass1(thread_db* tdbb, CompilerScratch* csb)
@ -3110,7 +3013,7 @@ void RseNode::planCheck(const CompilerScratch* csb) const
{
const RecordSourceNode* node = *ptr;
if (node->type == RelationSourceNode::TYPE)
if (nodeIs<RelationSourceNode>(node))
{
const StreamType stream = node->getStream();
@ -3120,7 +3023,7 @@ void RseNode::planCheck(const CompilerScratch* csb) const
Arg::Str(csb->csb_rpt[stream].csb_relation->rel_name));
}
}
else if (node->type == RseNode::TYPE)
else if (nodeIs<RseNode>(node))
static_cast<const RseNode*>(node)->planCheck(csb);
}
}

View File

@ -25,7 +25,7 @@
#include "../common/classes/array.h"
#include "../common/classes/objects_array.h"
#include "../common/classes/NestConst.h"
#include "../common/classes/QualifiedName.h"
#include "../jrd/QualifiedName.h"
#include "../dsql/ExprNodes.h"
#include "../jrd/jrd.h"
#include "../jrd/exe.h"
@ -122,7 +122,7 @@ public:
class PlanNode : public Firebird::PermanentStorage, public Printable
{
public:
enum Type
enum Type : UCHAR
{
TYPE_JOIN,
TYPE_RETRIEVE
@ -146,12 +146,12 @@ public:
SLONG relationId;
SLONG indexId;
Firebird::MetaName indexName;
MetaName indexName;
};
struct AccessType
{
enum Type
enum Type : UCHAR
{
TYPE_SEQUENTIAL,
TYPE_NAVIGATIONAL,
@ -192,7 +192,7 @@ public:
private:
dsql_ctx* dsqlPassAliasList(DsqlCompilerScratch* dsqlScratch);
static dsql_ctx* dsqlPassAlias(DsqlCompilerScratch* dsqlScratch, DsqlContextStack& stack,
const Firebird::MetaName& alias);
const MetaName& alias);
public:
Type const type;
@ -200,13 +200,13 @@ public:
RelationSourceNode* relationNode;
Firebird::Array<NestConst<PlanNode> > subNodes;
RecordSourceNode* dsqlRecordSourceNode;
Firebird::ObjectsArray<Firebird::MetaName>* dsqlNames;
Firebird::ObjectsArray<MetaName>* dsqlNames;
};
class InversionNode
{
public:
enum Type
enum Type : UCHAR
{
TYPE_AND,
TYPE_OR,
@ -216,45 +216,45 @@ public:
};
InversionNode(Type aType, InversionNode* aNode1, InversionNode* aNode2)
: type(aType),
impure(0),
: impure(0),
id(0),
type(aType),
retrieval(NULL),
node1(aNode1),
node2(aNode2),
value(NULL),
id(0)
value(NULL)
{
}
InversionNode(IndexRetrieval* aRetrieval, ULONG anImpure)
: type(TYPE_INDEX),
impure(anImpure),
: impure(anImpure),
id(0),
type(TYPE_INDEX),
retrieval(aRetrieval),
node1(NULL),
node2(NULL),
value(NULL),
id(0)
value(NULL)
{
}
InversionNode(ValueExprNode* aValue, USHORT aId)
: type(TYPE_DBKEY),
impure(0),
: impure(0),
id(aId),
type(TYPE_DBKEY),
retrieval(NULL),
node1(NULL),
node2(NULL),
value(aValue),
id(aId)
value(aValue)
{
}
Type type;
ULONG impure;
USHORT id;
Type type;
NestConst<IndexRetrieval> retrieval;
NestConst<InversionNode> node1;
NestConst<InversionNode> node2;
NestConst<ValueExprNode> value;
USHORT id;
};
class DbKeyRangeNode
@ -286,13 +286,13 @@ public:
class RelationSourceNode : public TypedNode<RecordSourceNode, RecordSourceNode::TYPE_RELATION>
{
public:
explicit RelationSourceNode(MemoryPool& pool, const Firebird::MetaName& aDsqlName = NULL)
explicit RelationSourceNode(MemoryPool& pool, const MetaName& aDsqlName = NULL)
: TypedNode<RecordSourceNode, RecordSourceNode::TYPE_RELATION>(pool),
dsqlName(pool, aDsqlName),
alias(pool),
relation(NULL),
context(0),
view(NULL)
view(NULL),
context(0)
{
}
@ -311,7 +311,6 @@ public:
virtual void genBlr(DsqlCompilerScratch* dsqlScratch);
virtual RelationSourceNode* copy(thread_db* tdbb, NodeCopier& copier) const;
virtual void ignoreDbKey(thread_db* tdbb, CompilerScratch* csb) const;
virtual RecordSourceNode* pass1(thread_db* tdbb, CompilerScratch* csb);
@ -349,20 +348,22 @@ public:
virtual RecordSource* compile(thread_db* tdbb, OptimizerBlk* opt, bool innerSubStream);
public:
Firebird::MetaName dsqlName;
MetaName dsqlName;
Firebird::string alias; // SQL alias for the relation
jrd_rel* relation;
SSHORT context; // user-specified context number for the relation reference
private:
jrd_rel* view; // parent view for posting access
public:
SSHORT context; // user-specified context number for the relation reference
};
class ProcedureSourceNode : public TypedNode<RecordSourceNode, RecordSourceNode::TYPE_PROCEDURE>
{
public:
explicit ProcedureSourceNode(MemoryPool& pool,
const Firebird::QualifiedName& aDsqlName = Firebird::QualifiedName())
const QualifiedName& aDsqlName = QualifiedName())
: TypedNode<RecordSourceNode, RecordSourceNode::TYPE_PROCEDURE>(pool),
dsqlName(pool, aDsqlName),
alias(pool),
@ -370,10 +371,10 @@ public:
targetList(NULL),
in_msg(NULL),
procedure(NULL),
isSubRoutine(false),
procedureId(0),
view(NULL),
context(0)
procedureId(0),
context(0),
isSubRoutine(false)
{
}
@ -394,10 +395,6 @@ public:
virtual ProcedureSourceNode* copy(thread_db* tdbb, NodeCopier& copier) const;
virtual void ignoreDbKey(thread_db* /*tdbb*/, CompilerScratch* /*csb*/) const
{
}
virtual RecordSourceNode* pass1(thread_db* tdbb, CompilerScratch* csb);
virtual void pass1Source(thread_db* tdbb, CompilerScratch* csb, RseNode* rse,
BoolExprNode** boolean, RecordSourceNodeStack& stack);
@ -426,7 +423,7 @@ private:
ProcedureScan* generate(thread_db* tdbb, OptimizerBlk* opt);
public:
Firebird::QualifiedName dsqlName;
QualifiedName dsqlName;
Firebird::string alias;
NestConst<ValueListNode> sourceList;
NestConst<ValueListNode> targetList;
@ -452,10 +449,10 @@ private:
cache management policies yet, so I leave it for the other day.
***/
jrd_prc* procedure;
bool isSubRoutine;
USHORT procedureId;
jrd_rel* view;
USHORT procedureId;
SSHORT context;
bool isSubRoutine;
};
class AggregateSourceNode : public TypedNode<RecordSourceNode, RecordSourceNode::TYPE_AGGREGATE_SOURCE>
@ -465,10 +462,10 @@ public:
: TypedNode<RecordSourceNode, RecordSourceNode::TYPE_AGGREGATE_SOURCE>(pool),
dsqlGroup(NULL),
dsqlRse(NULL),
dsqlWindow(false),
group(NULL),
map(NULL),
rse(NULL)
rse(NULL),
dsqlWindow(false)
{
}
@ -486,7 +483,6 @@ public:
virtual void genBlr(DsqlCompilerScratch* dsqlScratch);
virtual AggregateSourceNode* copy(thread_db* tdbb, NodeCopier& copier) const;
virtual void ignoreDbKey(thread_db* tdbb, CompilerScratch* csb) const;
virtual RecordSourceNode* pass1(thread_db* tdbb, CompilerScratch* csb);
virtual void pass1Source(thread_db* tdbb, CompilerScratch* csb, RseNode* rse,
BoolExprNode** boolean, RecordSourceNodeStack& stack);
@ -514,12 +510,14 @@ private:
public:
NestConst<ValueListNode> dsqlGroup;
NestConst<RseNode> dsqlRse;
bool dsqlWindow;
NestConst<SortNode> group;
NestConst<MapNode> map;
private:
NestConst<RseNode> rse;
public:
bool dsqlWindow;
};
class UnionSourceNode : public TypedNode<RecordSourceNode, RecordSourceNode::TYPE_UNION>
@ -527,13 +525,13 @@ class UnionSourceNode : public TypedNode<RecordSourceNode, RecordSourceNode::TYP
public:
explicit UnionSourceNode(MemoryPool& pool)
: TypedNode<RecordSourceNode, RecordSourceNode::TYPE_UNION>(pool),
dsqlAll(false),
recursive(false),
dsqlClauses(NULL),
dsqlParentRse(NULL),
clauses(pool),
maps(pool),
mapStream(0)
mapStream(0),
dsqlAll(false),
recursive(false)
{
}
@ -550,7 +548,6 @@ public:
virtual void genBlr(DsqlCompilerScratch* dsqlScratch);
virtual UnionSourceNode* copy(thread_db* tdbb, NodeCopier& copier) const;
virtual void ignoreDbKey(thread_db* tdbb, CompilerScratch* csb) const;
virtual RecordSourceNode* pass1(thread_db* /*tdbb*/, CompilerScratch* /*csb*/)
{
@ -575,8 +572,6 @@ private:
FB_SIZE_T nstreams, BoolExprNodeStack* parentStack, StreamType shellStream);
public:
bool dsqlAll; // UNION ALL
bool recursive; // union node is a recursive union
RecSourceListNode* dsqlClauses;
RseNode* dsqlParentRse;
@ -584,6 +579,10 @@ private:
Firebird::Array<NestConst<RseNode> > clauses; // RseNode's for union
Firebird::Array<NestConst<MapNode> > maps; // RseNode's maps
StreamType mapStream; // stream for next level record of recursive union
public:
bool dsqlAll; // UNION ALL
bool recursive; // union node is a recursive union
};
class WindowSourceNode : public TypedNode<RecordSourceNode, RecordSourceNode::TYPE_WINDOW>
@ -629,7 +628,6 @@ public:
virtual Firebird::string internalPrint(NodePrinter& printer) const;
virtual WindowSourceNode* copy(thread_db* tdbb, NodeCopier& copier) const;
virtual void ignoreDbKey(thread_db* tdbb, CompilerScratch* csb) const;
virtual RecordSourceNode* pass1(thread_db* tdbb, CompilerScratch* csb);
virtual void pass1Source(thread_db* tdbb, CompilerScratch* csb, RseNode* rse,
BoolExprNode** boolean, RecordSourceNodeStack& stack);
@ -658,13 +656,13 @@ private:
class RseNode : public TypedNode<RecordSourceNode, RecordSourceNode::TYPE_RSE>
{
public:
static const unsigned FLAG_VARIANT = 0x01; // variant (not invariant?)
static const unsigned FLAG_SINGULAR = 0x02; // singleton select
static const unsigned FLAG_WRITELOCK = 0x04; // locked for write
static const unsigned FLAG_SCROLLABLE = 0x08; // scrollable cursor
static const unsigned FLAG_DSQL_COMPARATIVE = 0x10; // transformed from DSQL ComparativeBoolNode
static const unsigned FLAG_OPT_FIRST_ROWS = 0x20; // optimize retrieval for first rows
static const unsigned FLAG_LATERAL = 0x40; // lateral derived table
static const USHORT FLAG_VARIANT = 0x01; // variant (not invariant?)
static const USHORT FLAG_SINGULAR = 0x02; // singleton select
static const USHORT FLAG_WRITELOCK = 0x04; // locked for write
static const USHORT FLAG_SCROLLABLE = 0x08; // scrollable cursor
static const USHORT FLAG_DSQL_COMPARATIVE = 0x10; // transformed from DSQL ComparativeBoolNode
static const USHORT FLAG_OPT_FIRST_ROWS = 0x20; // optimize retrieval for first rows
static const USHORT FLAG_LATERAL = 0x40; // lateral derived table
explicit RseNode(MemoryPool& pool)
: TypedNode<RecordSourceNode, RecordSourceNode::TYPE_RSE>(pool),
@ -680,11 +678,11 @@ public:
dsqlNamedWindows(NULL),
dsqlOrder(NULL),
dsqlStreams(NULL),
dsqlExplicitJoin(false),
rse_jointype(0),
rse_invariants(NULL),
rse_relations(pool),
flags(0)
flags(0),
rse_jointype(0),
dsqlExplicitJoin(false)
{
}
@ -751,7 +749,6 @@ public:
virtual RseNode* dsqlPass(DsqlCompilerScratch* dsqlScratch);
virtual RseNode* copy(thread_db* tdbb, NodeCopier& copier) const;
virtual void ignoreDbKey(thread_db* tdbb, CompilerScratch* csb) const;
virtual RseNode* pass1(thread_db* tdbb, CompilerScratch* csb);
virtual void pass1Source(thread_db* tdbb, CompilerScratch* csb, RseNode* rse,
BoolExprNode** boolean, RecordSourceNodeStack& stack);
@ -791,8 +788,6 @@ public:
NamedWindowsClause* dsqlNamedWindows;
NestConst<ValueListNode> dsqlOrder;
NestConst<RecSourceListNode> dsqlStreams;
bool dsqlExplicitJoin;
USHORT rse_jointype; // inner, left, full
NestConst<ValueExprNode> rse_first;
NestConst<ValueExprNode> rse_skip;
NestConst<BoolExprNode> rse_boolean;
@ -802,7 +797,9 @@ public:
NestConst<PlanNode> rse_plan; // user-specified access plan
NestConst<VarInvariantArray> rse_invariants; // Invariant nodes bound to top-level RSE
Firebird::Array<NestConst<RecordSourceNode> > rse_relations;
unsigned flags;
USHORT flags;
USHORT rse_jointype; // inner, left, full
bool dsqlExplicitJoin;
};
class SelectExprNode : public TypedNode<RecordSourceNode, RecordSourceNode::TYPE_SELECT_EXPR>
@ -828,11 +825,6 @@ public:
return NULL;
}
virtual void ignoreDbKey(thread_db* /*tdbb*/, CompilerScratch* /*csb*/) const
{
fb_assert(false);
}
virtual RseNode* pass1(thread_db* /*tdbb*/, CompilerScratch* /*csb*/)
{
fb_assert(false);
@ -879,7 +871,7 @@ public:
NestConst<RowsClause> rowsClause;
NestConst<WithClause> withClause;
Firebird::string alias;
Firebird::ObjectsArray<Firebird::MetaName>* columns;
Firebird::ObjectsArray<MetaName>* columns;
};

View File

@ -133,7 +133,7 @@ RelationPages* jrd_rel::getPagesInternal(thread_db* tdbb, TraNumber tran, bool a
const index_desc* const end = indices->items + idx_count;
for (index_desc* idx = indices->items; idx < end; idx++)
{
Firebird::MetaName idx_name;
MetaName idx_name;
MET_lookup_index(tdbb, idx_name, this->rel_name, idx->idx_id + 1);
idx->idx_root = 0;

View File

@ -57,7 +57,7 @@ public:
}
const Firebird::string vcx_context_name;
const Firebird::MetaName vcx_relation_name;
const MetaName vcx_relation_name;
const USHORT vcx_context;
const ViewContextType vcx_type;
};
@ -229,9 +229,9 @@ public:
ULONG rel_flags;
Format* rel_current_format; // Current record format
Firebird::MetaName rel_name; // ascii relation name
Firebird::MetaName rel_owner_name; // ascii owner
Firebird::MetaName rel_security_name; // security class name for relation
MetaName rel_name; // ascii relation name
MetaName rel_owner_name; // ascii owner
MetaName rel_security_name; // security class name for relation
vec<Format*>* rel_formats; // Known record formats
vec<jrd_fld*>* rel_fields; // vector of field blocks
@ -482,10 +482,10 @@ public:
ValueExprNode* fld_source; // source for view fields
ValueExprNode* fld_default_value; // default value, if any
ArrayField* fld_array; // array description, if array
Firebird::MetaName fld_name; // Field name
Firebird::MetaName fld_security_name; // security class name for field
Firebird::MetaName fld_generator_name; // identity generator name
Firebird::MetaNamePair fld_source_rel_field; // Relation/field source name
MetaName fld_name; // Field name
MetaName fld_security_name; // security class name for field
MetaName fld_generator_name; // identity generator name
MetaNamePair fld_source_rel_field; // Relation/field source name
Nullable<IdentityType> fld_identity_type;
public:

View File

@ -115,19 +115,15 @@ Firebird::string ResultSet::getString(thread_db* tdbb, unsigned param)
}
Firebird::MetaName ResultSet::getMetaName(thread_db* tdbb, unsigned param)
MetaName ResultSet::getMetaName(thread_db* tdbb, unsigned param)
{
fb_assert(param > 0);
return getString(tdbb, param);
}
jrd_req* jrdRequest = stmt->getRequest()->req_request;
// Setup tdbb info necessary for blobs.
AutoSetRestore2<jrd_req*, thread_db> autoRequest(
tdbb, &thread_db::getRequest, &thread_db::setRequest, jrdRequest);
AutoSetRestore<jrd_tra*> autoRequestTrans(&jrdRequest->req_transaction,
tdbb->getTransaction());
return MOV_make_string2(tdbb, &getDesc(param), CS_METADATA);
Firebird::MetaString ResultSet::getMetaString(thread_db* tdbb, unsigned param)
{
return getString(tdbb, param);
}

View File

@ -28,7 +28,8 @@
#include "../common/dsc.h"
#include "../common/classes/auto.h"
#include "../common/classes/fb_string.h"
#include "../common/classes/MetaName.h"
#include "../common/classes/MetaString.h"
#include "../jrd/MetaName.h"
struct dsc;
@ -106,7 +107,8 @@ public:
}
Firebird::string getString(thread_db* tdbb, unsigned param);
Firebird::MetaName getMetaName(thread_db* tdbb, unsigned param);
MetaName getMetaName(thread_db* tdbb, unsigned param);
Firebird::MetaString getMetaString(thread_db* tdbb, unsigned param);
private:
void moveDesc(thread_db* tdbb, unsigned param, dsc& desc);

Some files were not shown because too many files have changed in this diff Show More