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

Small meta name (#271)

Keep metadata name strings in hash table having just a pointer to a hash table member in all places where metadata name is needed in order to save RAM. Hash table of metadata names is almost lock-less: mutex is used only when new segment of memory is needed or hash table should be grown.

Co-authored-by: hvlad <hvlad@users.sourceforge.net>
This commit is contained in:
Alexander Peshkov 2020-06-16 19:22:15 +03:00 committed by GitHub
parent 0d9511f4ef
commit cb6fee68eb
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
132 changed files with 1983 additions and 1009 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

@ -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

@ -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"

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

@ -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

@ -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

@ -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

@ -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

View File

@ -3701,7 +3701,7 @@ dsc* CoalesceNode::execute(thread_db* tdbb, jrd_req* request) const
//--------------------
CollateNode::CollateNode(MemoryPool& pool, ValueExprNode* aArg, const Firebird::MetaName& aCollation)
CollateNode::CollateNode(MemoryPool& pool, ValueExprNode* aArg, const MetaName& aCollation)
: TypedNode<ValueExprNode, ExprNode::TYPE_COLLATE>(pool),
arg(aArg),
collation(pool, aCollation)
@ -4813,8 +4813,8 @@ dsc* DecodeNode::execute(thread_db* tdbb, jrd_req* request) const
static RegisterNode<DefaultNode> regDefaultNode({blr_default});
DefaultNode::DefaultNode(MemoryPool& pool, const Firebird::MetaName& aRelationName,
const Firebird::MetaName& aFieldName)
DefaultNode::DefaultNode(MemoryPool& pool, const MetaName& aRelationName,
const MetaName& aFieldName)
: DsqlNode<DefaultNode, ExprNode::TYPE_DEFAULT>(pool),
relationName(aRelationName),
fieldName(aFieldName),
@ -6832,7 +6832,7 @@ dsc* FieldNode::execute(thread_db* tdbb, jrd_req* request) const
static RegisterNode<GenIdNode> regGenIdNode({blr_gen_id, blr_gen_id2});
GenIdNode::GenIdNode(MemoryPool& pool, bool aDialect1,
const Firebird::MetaName& name,
const MetaName& name,
ValueExprNode* aArg,
bool aImplicit, bool aIdentity)
: TypedNode<ValueExprNode, ExprNode::TYPE_GEN_ID>(pool),
@ -12007,7 +12007,7 @@ void SysFuncCallNode::genBlr(DsqlCompilerScratch* dsqlScratch)
}
dsqlScratch->appendUChar(blr_sys_function);
dsqlScratch->appendMetaString(function->name.c_str());
dsqlScratch->appendMetaString(function->name);
dsqlScratch->appendUChar(args->items.getCount());
for (auto& arg : args->items)

View File

@ -267,7 +267,7 @@ public:
virtual dsc* execute(thread_db* tdbb, jrd_req* request) const;
public:
Firebird::MetaName dsqlAlias;
MetaName dsqlAlias;
dsql_fld* dsqlField;
NestConst<ValueExprNode> source;
NestConst<ItemInfo> itemInfo;
@ -319,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
{
@ -333,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.
@ -374,7 +374,7 @@ private:
public:
NestConst<ValueExprNode> arg;
Firebird::MetaName collation;
MetaName collation;
};
@ -582,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);
@ -601,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;
@ -795,11 +795,11 @@ 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;
@ -816,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);
@ -942,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),
@ -981,7 +981,7 @@ public:
}
public:
const Firebird::MetaName name;
const MetaName name;
NestConst<ValueExprNode> value;
NestConst<ImplicitJoin> implicitJoin;
};
@ -1033,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
@ -1076,7 +1076,7 @@ public:
}
public:
Firebird::MetaName name;
MetaName name;
NestConst<ValueExprNode> value;
dsql_ctx* context;
USHORT scope;
@ -1392,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,
@ -1458,7 +1458,7 @@ public:
}
public:
const Firebird::MetaName* name;
const MetaName* name;
NestConst<ValueListNode> partition;
NestConst<ValueListNode> order;
NestConst<FrameExtent> extent;
@ -1470,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
@ -1503,7 +1503,7 @@ public:
public:
NestConst<ValueExprNode> aggExpr;
const Firebird::MetaName* windowName;
const MetaName* windowName;
NestConst<WindowClause> window;
};
@ -1563,7 +1563,7 @@ public:
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);
@ -1630,7 +1630,7 @@ private:
void raiseError(dsql_ctx* context) const;
public:
Firebird::MetaName dsqlQualifier;
MetaName dsqlQualifier;
NestConst<RecordSourceNode> dsqlRelation;
StreamType recStream;
const UCHAR blrOp;
@ -1963,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);
@ -1988,7 +1988,7 @@ public:
virtual dsc* execute(thread_db* tdbb, jrd_req* request) const;
public:
Firebird::MetaName name;
MetaName name;
NestConst<ValueListNode> args;
const SysFunction* function;
bool dsqlSpecialSyntax;
@ -2043,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);
@ -2074,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;
@ -2147,7 +2147,7 @@ public:
virtual dsc* execute(thread_db* tdbb, jrd_req* request) const;
public:
Firebird::MetaName dsqlName;
MetaName dsqlName;
NestConst<dsql_var> dsqlVar;
NestConst<DeclareVariableNode> varDecl;
NestConst<ItemInfo> varInfo;

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

@ -184,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.
@ -218,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.
@ -243,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());
@ -1590,7 +1590,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)
{}
@ -1607,8 +1607,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

@ -8535,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;
@ -8556,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;

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"
@ -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;
@ -330,14 +330,14 @@ 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),
@ -361,7 +361,7 @@ public:
virtual const StmtNode* execute(thread_db* tdbb, jrd_req* request, ExeState* exeState) const;
public:
Firebird::MetaName dsqlName;
MetaName dsqlName;
ValueListNode* dsqlIntoStmt;
NestConst<ValueExprNode> scrollExpr;
NestConst<StmtNode> intoStmt;
@ -379,7 +379,7 @@ 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),
dsqlName(aDsqlName),
@ -404,7 +404,7 @@ public:
virtual const StmtNode* execute(thread_db* tdbb, jrd_req* request, ExeState* exeState) const;
public:
Firebird::MetaName dsqlName;
MetaName dsqlName;
NestConst<SelectNode> dsqlSelect;
NestConst<RseNode> rse;
NestConst<ValueListNode> refs;
@ -418,7 +418,7 @@ public:
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),
dsqlParameters(pool),
@ -454,7 +454,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;
@ -472,7 +472,7 @@ public:
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),
@ -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;
@ -591,7 +591,7 @@ public:
NestConst<PlanNode> dsqlPlan;
NestConst<ValueListNode> dsqlOrder;
NestConst<RowsClause> dsqlRows;
Firebird::MetaName dsqlCursorName;
MetaName dsqlCursorName;
NestConst<ReturningClause> dsqlReturning;
NestConst<RseNode> dsqlRse;
dsql_ctx* dsqlContext;
@ -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;
@ -714,7 +714,7 @@ private:
Firebird::string& str, bool useAttCS = false) const;
public:
Firebird::MetaName* dsqlLabelName;
MetaName* dsqlLabelName;
NestConst<ValueExprNode> sql;
NestConst<ValueExprNode> dataSource;
NestConst<ValueExprNode> userName;
@ -848,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),
@ -955,7 +955,7 @@ public:
NestConst<SelectNode> dsqlSelect;
NestConst<ValueListNode> dsqlInto;
DeclareCursorNode* dsqlCursor;
Firebird::MetaName* dsqlLabelName;
MetaName* dsqlLabelName;
NestConst<StmtNode> stall;
NestConst<RseNode> rse;
NestConst<StmtNode> statement;
@ -1063,7 +1063,7 @@ public:
virtual const StmtNode* execute(thread_db* tdbb, jrd_req* request, ExeState* exeState) const;
public:
Firebird::MetaName* dsqlLabelName;
MetaName* dsqlLabelName;
NestConst<BoolExprNode> dsqlExpr;
NestConst<StmtNode> statement;
USHORT dsqlLabelNumber;
@ -1206,7 +1206,7 @@ public:
NestConst<PlanNode> dsqlPlan;
NestConst<ValueListNode> dsqlOrder;
NestConst<RowsClause> dsqlRows;
Firebird::MetaName dsqlCursorName;
MetaName dsqlCursorName;
NestConst<ReturningClause> dsqlReturning;
NestConst<RecordSourceNode> dsqlRse;
dsql_ctx* dsqlContext;
@ -1358,7 +1358,7 @@ public:
public:
Command command;
Firebird::MetaName name;
MetaName name;
};
@ -1398,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)
{
@ -1580,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),
@ -1588,7 +1588,7 @@ public:
{
}
Firebird::ObjectsArray<Firebird::MetaName>* tables;
Firebird::ObjectsArray<MetaName>* tables;
unsigned lockMode;
};
@ -1685,7 +1685,7 @@ public:
{
}
SetRoleNode(MemoryPool& pool, Firebird::MetaName* name)
SetRoleNode(MemoryPool& pool, MetaName* name)
: SessionManagementNode(pool),
trusted(false),
roleName(pool, *name)
@ -1707,7 +1707,7 @@ public:
public:
bool trusted;
Firebird::MetaName roleName;
MetaName roleName;
};
@ -1735,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
@ -1775,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;

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;

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

@ -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

@ -732,7 +732,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) :
@ -786,7 +786,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) :
@ -820,7 +820,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) :
@ -901,7 +901,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));
@ -1275,7 +1275,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) :
@ -1399,7 +1399,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) :
@ -1531,7 +1531,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

@ -747,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);
@ -759,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

@ -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

@ -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"
@ -146,7 +146,7 @@ public:
SLONG relationId;
SLONG indexId;
Firebird::MetaName indexName;
MetaName indexName;
};
struct AccessType
@ -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,7 +200,7 @@ public:
RelationSourceNode* relationNode;
Firebird::Array<NestConst<PlanNode> > subNodes;
RecordSourceNode* dsqlRecordSourceNode;
Firebird::ObjectsArray<Firebird::MetaName>* dsqlNames;
Firebird::ObjectsArray<MetaName>* dsqlNames;
};
class InversionNode
@ -286,7 +286,7 @@ 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),
@ -348,7 +348,7 @@ 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;
@ -363,7 +363,7 @@ class ProcedureSourceNode : public TypedNode<RecordSourceNode, RecordSourceNode:
{
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),
@ -423,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;
@ -871,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);

View File

@ -24,8 +24,8 @@
#include "../common/classes/array.h"
#include "../common/classes/alloc.h"
#include "../common/classes/BlrReader.h"
#include "../common/classes/MetaName.h"
#include "../common/classes/QualifiedName.h"
#include "../jrd/MetaName.h"
#include "../jrd/QualifiedName.h"
#include "../common/classes/NestConst.h"
#include "../common/MsgMetadata.h"
#include "../common/classes/Nullable.h"
@ -97,11 +97,11 @@ namespace Jrd
void setId(USHORT value) { id = value; }
const Firebird::QualifiedName& getName() const { return name; }
void setName(const Firebird::QualifiedName& value) { name = value; }
const QualifiedName& getName() const { return name; }
void setName(const QualifiedName& value) { name = value; }
const Firebird::MetaName& getSecurityName() const { return securityName; }
void setSecurityName(const Firebird::MetaName& value) { securityName = value; }
const MetaName& getSecurityName() const { return securityName; }
void setSecurityName(const MetaName& value) { securityName = value; }
/*const*/ JrdStatement* getStatement() const { return statement; }
void setStatement(JrdStatement* value) { statement = value; }
@ -160,8 +160,8 @@ namespace Jrd
private:
USHORT id; // routine ID
Firebird::QualifiedName name; // routine name
Firebird::MetaName securityName; // security class name
QualifiedName name; // routine name
MetaName securityName; // security class name
JrdStatement* statement; // compiled routine statement
bool subRoutine; // Is this a subroutine?
bool implemented; // Is the packaged routine missing the body/entrypoint?
@ -182,7 +182,7 @@ namespace Jrd
USHORT alterCount; // No. of times the routine was altered
Lock* existenceLock; // existence lock, if any
Firebird::MetaName owner;
MetaName owner;
Jrd::UserId* invoker; // Invoker ID
};
}

View File

@ -21,7 +21,7 @@
#define JRD_SAVEPOINT_H
#include "../common/classes/File.h"
#include "../common/classes/MetaName.h"
#include "../jrd/MetaName.h"
#include "../jrd/Record.h"
#include "../jrd/RecordNumber.h"
@ -171,12 +171,12 @@ namespace Jrd
return m_number;
}
const Firebird::MetaName& getName() const
const MetaName& getName() const
{
return m_name;
}
void setName(const Firebird::MetaName& name)
void setName(const MetaName& name)
{
m_name = name;
}
@ -316,7 +316,7 @@ namespace Jrd
SavNumber m_number; // savepoint number
USHORT m_flags; // misc flags
USHORT m_count; // active verb count
Firebird::MetaName m_name; // savepoint name
MetaName m_name; // savepoint name
Savepoint* m_next; // next savepoint in the list

View File

@ -497,7 +497,7 @@ void setParamsFromList(DataTypeUtilBase* dataTypeUtil, const SysFunction* functi
int argsCount, dsc** args)
{
dsc desc;
dataTypeUtil->makeFromList(&desc, function->name.c_str(), argsCount, const_cast<const dsc**>(args));
dataTypeUtil->makeFromList(&desc, function->name, argsCount, const_cast<const dsc**>(args));
for (int i = 0; i < argsCount; ++i)
{
@ -885,7 +885,7 @@ void makeFromListResult(DataTypeUtilBase* dataTypeUtil, const SysFunction* funct
int argsCount, const dsc** args)
{
result->clear();
dataTypeUtil->makeFromList(result, function->name.c_str(), argsCount, args);
dataTypeUtil->makeFromList(result, function->name, argsCount, args);
}
@ -6257,9 +6257,9 @@ const SysFunction SysFunction::functions[] =
const SysFunction* SysFunction::lookup(const MetaName& name)
{
for (const SysFunction* f = functions; f->name.length() > 0; ++f)
for (const SysFunction* f = functions; f->name[0]; ++f)
{
if (f->name == name)
if (name == f->name)
return f;
}
@ -6271,6 +6271,6 @@ void SysFunction::checkArgsMismatch(int count) const
{
if (count < minArgCount || (maxArgCount != -1 && count > maxArgCount))
{
status_exception::raise(Arg::Gds(isc_funmismat) << Arg::Str(name.c_str()));
status_exception::raise(Arg::Gds(isc_funmismat) << Arg::Str(name));
}
}

View File

@ -31,7 +31,7 @@
#ifndef JRD_SYSFUNCTION_H
#define JRD_SYSFUNCTION_H
#include "../common/classes/MetaName.h"
#include "../jrd/MetaName.h"
#include "../jrd/DataTypeUtil.h"
#include "../dsql/Nodes.h"
#include "../common/dsc.h"
@ -51,7 +51,7 @@ public:
typedef dsc* (*EvlFunc)(Jrd::thread_db*, const SysFunction* function,
const Jrd::NestValueArray&, Jrd::impure_value*);
const Firebird::MetaName name;
const char* name;
int minArgCount;
int maxArgCount; // -1 for no limit
SetParamsFunc setParamsFunc;
@ -59,7 +59,7 @@ public:
EvlFunc evlFunc;
void* misc;
static const SysFunction* lookup(const Firebird::MetaName& name);
static const SysFunction* lookup(const Jrd::MetaName& name);
void checkArgsMismatch(int count) const;

View File

@ -72,7 +72,7 @@ public:
private:
thread_db* threadDbb;
Firebird::HalfStaticArray<Auth::DynamicUserData*, 8> commands;
typedef Firebird::Pair<Firebird::NonPooled<Firebird::MetaName, Firebird::IManagement*> > Manager;
typedef Firebird::Pair<Firebird::NonPooled<MetaName, Firebird::IManagement*> > Manager;
Firebird::ObjectsArray<Manager> managers;
Firebird::NoCaseString plugins;
Attachment* att;

View File

@ -192,10 +192,10 @@ public:
}
IndexRetrieval(MemoryPool& pool, jrd_rel* relation, const index_desc* idx,
const Firebird::MetaName& name)
const MetaName& name)
: irb_relation(relation), irb_index(idx->idx_id),
irb_generic(0), irb_lower_count(0), irb_upper_count(0), irb_key(NULL),
irb_name(FB_NEW_POOL(pool) Firebird::MetaName(name)),
irb_name(FB_NEW_POOL(pool) MetaName(name)),
irb_value(FB_NEW_POOL(pool) ValueExprNode*[idx->idx_count * 2])
{
memcpy(&irb_desc, idx, sizeof(irb_desc));
@ -214,7 +214,7 @@ public:
USHORT irb_lower_count; // Number of segments for retrieval
USHORT irb_upper_count; // Number of segments for retrieval
temporary_key* irb_key; // Key for equality retrieval
Firebird::MetaName* irb_name; // Index name
MetaName* irb_name; // Index name
ValueExprNode** irb_value;
};

View File

@ -323,12 +323,12 @@ IndexLock* CMP_get_index_lock(thread_db* tdbb, jrd_rel* relation, USHORT id)
void CMP_post_access(thread_db* tdbb,
CompilerScratch* csb,
const Firebird::MetaName& security_name,
const MetaName& security_name,
SLONG ssRelationId, // SQL SECURITY relation in which context permissions should be check
SecurityClass::flags_t mask,
SLONG type_name,
const Firebird::MetaName& name,
const Firebird::MetaName& r_name)
const MetaName& name,
const MetaName& r_name)
{
/**************************************
*

View File

@ -45,9 +45,9 @@ Jrd::IndexLock* CMP_get_index_lock(Jrd::thread_db*, Jrd::jrd_rel*, USHORT);
Jrd::jrd_req* CMP_make_request(Jrd::thread_db*, Jrd::CompilerScratch*, bool);
Jrd::ItemInfo* CMP_pass2_validation(Jrd::thread_db*, Jrd::CompilerScratch*, const Jrd::Item&);
void CMP_post_access(Jrd::thread_db*, Jrd::CompilerScratch*, const Firebird::MetaName&, SLONG ssRelationId,
Jrd::SecurityClass::flags_t, SLONG type_name, const Firebird::MetaName&,
const Firebird::MetaName& = "");
void CMP_post_access(Jrd::thread_db*, Jrd::CompilerScratch*, const Jrd::MetaName&, SLONG ssRelationId,
Jrd::SecurityClass::flags_t, SLONG type_name, const Jrd::MetaName&,
const Jrd::MetaName& = "");
void CMP_post_procedure_access(Jrd::thread_db*, Jrd::CompilerScratch*, Jrd::jrd_prc*);
void CMP_post_resource(Jrd::ResourceList*, void*, Jrd::Resource::rsc_s, USHORT);

View File

@ -492,7 +492,7 @@ static bool change_repl_state(thread_db*, SSHORT, DeferredWork*, jrd_tra*);
static bool create_expression_index(thread_db* tdbb, SSHORT phase, DeferredWork* work,
jrd_tra* transaction);
static void check_computed_dependencies(thread_db* tdbb, jrd_tra* transaction,
const Firebird::MetaName& fieldName);
const MetaName& fieldName);
static void check_dependencies(thread_db*, const TEXT*, const TEXT*, const TEXT*, int, jrd_tra*);
static void check_filename(const Firebird::string&, bool);
static void cleanup_index_creation(thread_db*, DeferredWork*, jrd_tra*);
@ -992,8 +992,8 @@ namespace
{
Jrd::ContextPoolHolder context(tdbb, new_pool);
const Firebird::MetaName depName(work->dfw_package.isEmpty() ?
Firebird::MetaName(work->dfw_name) : work->dfw_package);
const MetaName depName(work->dfw_package.isEmpty() ?
MetaName(work->dfw_name) : work->dfw_package);
MET_get_dependencies(tdbb, NULL, NULL, 0, NULL, &blobId,
(compile ? &statement : NULL),
NULL, depName,
@ -1239,7 +1239,7 @@ static const deferred_task task_table[] =
};
USHORT DFW_assign_index_type(thread_db* tdbb, const Firebird::MetaName& name, SSHORT field_type,
USHORT DFW_assign_index_type(thread_db* tdbb, const MetaName& name, SSHORT field_type,
SSHORT ttype)
{
/**************************************
@ -2834,7 +2834,7 @@ static bool create_expression_index(thread_db* tdbb, SSHORT phase, DeferredWork*
static void check_computed_dependencies(thread_db* tdbb, jrd_tra* transaction,
const Firebird::MetaName& fieldName)
const MetaName& fieldName)
{
/**************************************
*
@ -2849,8 +2849,8 @@ static void check_computed_dependencies(thread_db* tdbb, jrd_tra* transaction,
SET_TDBB(tdbb);
bool err = false;
Firebird::SortedObjectsArray<Firebird::MetaName> sortedNames(*tdbb->getDefaultPool());
Firebird::ObjectsArray<Firebird::MetaName> names;
Firebird::SortedObjectsArray<MetaName> sortedNames(*tdbb->getDefaultPool());
Firebird::ObjectsArray<MetaName> names;
sortedNames.add(fieldName);
names.add(fieldName);
@ -2868,7 +2868,7 @@ static void check_computed_dependencies(thread_db* tdbb, jrd_tra* transaction,
RFL.RDB$RELATION_NAME = DEP.RDB$DEPENDED_ON_NAME AND
RFL.RDB$FIELD_NAME = DEP.RDB$FIELD_NAME
{
Firebird::MetaName fieldSource(RFL.RDB$FIELD_SOURCE);
MetaName fieldSource(RFL.RDB$FIELD_SOURCE);
if (fieldName == fieldSource)
{
@ -3540,7 +3540,7 @@ static bool create_index(thread_db* tdbb, SSHORT phase, DeferredWork* work, jrd_
if (!partner_relation)
{
Firebird::MetaName constraint_name;
MetaName constraint_name;
MET_lookup_cnstrt_for_index(tdbb, constraint_name, work->dfw_name);
ERR_post(Arg::Gds(isc_partner_idx_not_found) << Arg::Str(constraint_name));
}
@ -3977,7 +3977,7 @@ void DFW_reset_icu(thread_db* tdbb)
transaction = TRA_start(tdbb, 0, 0);
tdbb->setTransaction(transaction);
SortedArray<Firebird::MetaName> indices;
SortedArray<MetaName> indices;
ProtectRelations tables(tdbb, transaction);
// Get list of affected indices & tables
@ -4043,7 +4043,7 @@ void DFW_reset_icu(thread_db* tdbb)
AutoResultSet rs(ps->executeQuery(tdbb, transaction));
while(rs->fetch(tdbb))
{
Firebird::MetaName collName(rs->getMetaName(tdbb, 1));
MetaName collName(rs->getMetaName(tdbb, 1));
const USHORT charSetId(rs->getSmallInt(tdbb, 2));
setupSpecificCollationAttributes(tdbb, transaction, charSetId, collName.c_str());
@ -4052,7 +4052,7 @@ void DFW_reset_icu(thread_db* tdbb)
// Reactivate indices
{ // scope
for (Firebird::MetaName* idx = indices.begin(); idx != indices.end(); ++idx)
for (MetaName* idx = indices.begin(); idx != indices.end(); ++idx)
{
AutoRequest request;
@ -4246,7 +4246,7 @@ static bool create_field(thread_db* tdbb, SSHORT phase, DeferredWork* work, jrd_
{
case 1:
{
const Firebird::MetaName depName(work->dfw_name);
const MetaName depName(work->dfw_name);
AutoRequest handle;
bid validation;
validation.clear();
@ -4373,7 +4373,7 @@ static bool modify_field(thread_db* tdbb, SSHORT phase, DeferredWork* work, jrd_
{
case 1:
{
const Firebird::MetaName depName(work->dfw_name);
const MetaName depName(work->dfw_name);
AutoRequest handle;
// If a domain is being changed to NOT NULL, schedule validation of involved relations.
@ -4997,7 +4997,7 @@ static bool delete_rfr(thread_db* tdbb, SSHORT phase, DeferredWork* work, jrd_tr
**************************************/
int rel_exists, field_count;
AutoRequest handle;
Firebird::MetaName f;
MetaName f;
jrd_rel* relation;
SET_TDBB(tdbb);
@ -5440,7 +5440,7 @@ static void get_trigger_dependencies(DeferredWork* work, bool compile, jrd_tra*
par_flags = 0;
Jrd::ContextPoolHolder context(tdbb, new_pool);
const Firebird::MetaName depName(work->dfw_name);
const MetaName depName(work->dfw_name);
MET_get_dependencies(tdbb, relation, NULL, 0, NULL, &blob_id, (compile ? &statement : NULL),
NULL, depName, obj_trigger, par_flags, transaction);
@ -6166,7 +6166,7 @@ static bool modify_trigger(thread_db* tdbb, SSHORT phase, DeferredWork* work, jr
const DeferredWork* arg = work->findArg(dfw_arg_check_blr);
if (arg)
{
const Firebird::MetaName relation_name(arg->dfw_name);
const MetaName relation_name(arg->dfw_name);
SSHORT valid_blr = FALSE;
try

View File

@ -31,7 +31,7 @@ namespace Jrd
enum dfw_t;
}
USHORT DFW_assign_index_type(Jrd::thread_db*, const Firebird::MetaName&, SSHORT, SSHORT);
USHORT DFW_assign_index_type(Jrd::thread_db*, const Jrd::MetaName&, SSHORT, SSHORT);
void DFW_delete_deferred(Jrd::jrd_tra*, SavNumber);
Firebird::SortedArray<int>& DFW_get_ids(Jrd::DeferredWork* work);
void DFW_merge_work(Jrd::jrd_tra*, SavNumber, SavNumber);
@ -40,9 +40,9 @@ void DFW_perform_work(Jrd::thread_db*, Jrd::jrd_tra*);
void DFW_perform_post_commit_work(Jrd::jrd_tra*);
Jrd::DeferredWork* DFW_post_system_work(Jrd::thread_db*, Jrd::dfw_t, const dsc*, USHORT);
Jrd::DeferredWork* DFW_post_work(Jrd::jrd_tra*, Jrd::dfw_t, const dsc*, USHORT,
const Firebird::MetaName& package = NULL);
const Jrd::MetaName& package = NULL);
Jrd::DeferredWork* DFW_post_work(Jrd::jrd_tra*, Jrd::dfw_t, const Firebird::string&, USHORT,
const Firebird::MetaName& package = NULL);
const Jrd::MetaName& package = NULL);
Jrd::DeferredWork* DFW_post_work_arg(Jrd::jrd_tra*, Jrd::DeferredWork*, const dsc*, USHORT);
Jrd::DeferredWork* DFW_post_work_arg(Jrd::jrd_tra*, Jrd::DeferredWork*, const dsc*, USHORT, Jrd::dfw_t);
void DFW_update_index(const TEXT*, USHORT, const Jrd::SelectivityList&, Jrd::jrd_tra*);

View File

@ -25,7 +25,7 @@
#define JRD_DYN_H
#include "../common/classes/MsgPrint.h"
#include "../common/classes/MetaName.h"
#include "../jrd/MetaName.h"
#include "../common/classes/array.h"
#include "../common/classes/fb_string.h"
#include "../common/dsc.h"
@ -53,9 +53,9 @@ public:
SSHORT dyn_collation;
SSHORT dyn_charset;
SSHORT dyn_sub_type;
Firebird::MetaName dyn_fld_source;
Firebird::MetaName dyn_rel_name;
Firebird::MetaName dyn_fld_name;
MetaName dyn_fld_source;
MetaName dyn_rel_name;
MetaName dyn_fld_name;
USHORT dyn_charbytelen; // Used to check modify operations on string types.
const UCHAR* dyn_default_src;
const UCHAR* dyn_default_val;

View File

@ -26,19 +26,19 @@
#define JRD_DYN_UT_PROTO_H
void DYN_UTIL_store_check_constraints(Jrd::thread_db*, Jrd::jrd_tra*,
const Firebird::MetaName&, const Firebird::MetaName&);
const Jrd::MetaName&, const Jrd::MetaName&);
bool DYN_UTIL_find_field_source(Jrd::thread_db* tdbb, Jrd::jrd_tra* transaction,
const Firebird::MetaName& view_name, USHORT context, const TEXT* local_name,
const Jrd::MetaName& view_name, USHORT context, const TEXT* local_name,
TEXT* output_field_name);
void DYN_UTIL_generate_generator_name(Jrd::thread_db*, Firebird::MetaName&);
void DYN_UTIL_generate_trigger_name(Jrd::thread_db*, Jrd::jrd_tra*, Firebird::MetaName&);
void DYN_UTIL_generate_index_name(Jrd::thread_db*, Jrd::jrd_tra*, Firebird::MetaName&, UCHAR);
void DYN_UTIL_generate_field_position(Jrd::thread_db*, const Firebird::MetaName&, SLONG*);
void DYN_UTIL_generate_generator_name(Jrd::thread_db*, Jrd::MetaName&);
void DYN_UTIL_generate_trigger_name(Jrd::thread_db*, Jrd::jrd_tra*, Jrd::MetaName&);
void DYN_UTIL_generate_index_name(Jrd::thread_db*, Jrd::jrd_tra*, Jrd::MetaName&, UCHAR);
void DYN_UTIL_generate_field_position(Jrd::thread_db*, const Jrd::MetaName&, SLONG*);
void DYN_UTIL_generate_field_name(Jrd::thread_db*, TEXT*);
void DYN_UTIL_generate_field_name(Jrd::thread_db*, Firebird::MetaName&);
void DYN_UTIL_generate_constraint_name(Jrd::thread_db*, Firebird::MetaName&);
void DYN_UTIL_generate_field_name(Jrd::thread_db*, Jrd::MetaName&);
void DYN_UTIL_generate_constraint_name(Jrd::thread_db*, Jrd::MetaName&);
void DYN_UTIL_check_unique_name(Jrd::thread_db* tdbb, Jrd::jrd_tra* transaction,
const Firebird::MetaName& object_name, int object_type);
const Jrd::MetaName& object_name, int object_type);
SINT64 DYN_UTIL_gen_unique_id(Jrd::thread_db*, SSHORT, const char*);
#endif // JRD_DYN_UT_PROTO_H

View File

@ -79,7 +79,7 @@ static const UCHAR gen_id_blr2[] =
};
void DYN_UTIL_check_unique_name(thread_db* tdbb, jrd_tra* transaction,
const Firebird::MetaName& object_name, int object_type)
const MetaName& object_name, int object_type)
{
/**************************************
*
@ -279,13 +279,13 @@ void DYN_UTIL_generate_field_name(thread_db* tdbb, TEXT* buffer)
* Stub to make it work with char* too.
*
**************************************/
Firebird::MetaName temp;
MetaName temp;
DYN_UTIL_generate_field_name(tdbb, temp);
strcpy(buffer, temp.c_str());
}
void DYN_UTIL_generate_field_name(thread_db* tdbb, Firebird::MetaName& buffer)
void DYN_UTIL_generate_field_name(thread_db* tdbb, MetaName& buffer)
{
/**************************************
*
@ -356,7 +356,7 @@ void DYN_UTIL_generate_field_position(thread_db* tdbb, const MetaName& relation_
void DYN_UTIL_generate_index_name(thread_db* tdbb, jrd_tra* /*transaction*/,
Firebird::MetaName& buffer, UCHAR verb)
MetaName& buffer, UCHAR verb)
{
/**************************************
*
@ -405,7 +405,7 @@ void DYN_UTIL_generate_index_name(thread_db* tdbb, jrd_tra* /*transaction*/,
// Generate a name unique to RDB$GENERATORS.
void DYN_UTIL_generate_generator_name(thread_db* tdbb, Firebird::MetaName& buffer)
void DYN_UTIL_generate_generator_name(thread_db* tdbb, MetaName& buffer)
{
SET_TDBB(tdbb);
Jrd::Attachment* attachment = tdbb->getAttachment();
@ -467,7 +467,7 @@ void DYN_UTIL_generate_trigger_name(thread_db* tdbb, jrd_tra* /*transaction*/, M
bool DYN_UTIL_find_field_source(thread_db* tdbb,
jrd_tra* transaction,
const Firebird::MetaName& view_name,
const MetaName& view_name,
USHORT context,
const TEXT* local_name,
TEXT* output_field_name)

View File

@ -26,7 +26,7 @@
#include "fb_exception.h"
#include "../common/classes/fb_string.h"
#include "../common/classes/MetaName.h"
#include "../jrd/MetaName.h"
#include "../common/StatusArg.h"
#include "../jrd/status.h"

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