mirror of
https://github.com/FirebirdSQL/firebird.git
synced 2025-01-22 18:03:03 +01:00
Misc
This commit is contained in:
parent
291845fab1
commit
79e89d573d
@ -8,16 +8,19 @@ Architecture
|
||||
------------
|
||||
|
||||
Firebird allow you to specify character sets and collations in every field/variable declaration.
|
||||
You can also specify the default character set at database create time and every CHAR/VARCHAR declaration that omit character set will use it.
|
||||
You can also specify the default character set at database create time and every CHAR/VARCHAR
|
||||
declaration that omit character set will use it.
|
||||
|
||||
At attachment time you can specify the character set that the client want to read all the strings.
|
||||
If you don't specify one, NONE is assumed.
|
||||
|
||||
There are two specials character sets: NONE and OCTETS.
|
||||
Both can be used in declarations but OCTETS can't be used in attachment.
|
||||
They are very similar with the exception that space of NONE is ASCII 0x20 and space of OCTETS is 0x00.
|
||||
They are very similar with the exception that space of NONE is ASCII 0x20 and space of OCTETS
|
||||
is 0x00.
|
||||
They are specials because they don't follow the rule of others character sets regarding conversions.
|
||||
With others character sets conversion is performed with CHARSET1->UNICODE->CHARSET2. With NONE/OCTETS the bytes is just copied: NONE/OCTETS->CHARSET2 and CHARSET1->NONE/OCTETS.
|
||||
With others character sets conversion is performed with CHARSET1->UNICODE->CHARSET2. With
|
||||
NONE/OCTETS the bytes is just copied: NONE/OCTETS->CHARSET2 and CHARSET1->NONE/OCTETS.
|
||||
|
||||
|
||||
Enhancements
|
||||
@ -28,13 +31,15 @@ Enhancements
|
||||
----------------------
|
||||
|
||||
Some character sets (specially multi-byte) don't accept everything.
|
||||
Now, the engine verifies if strings are wellformed when assigning from NONE/OCTETS and strings sent by the client (the statement string and parameters).
|
||||
Now, the engine verifies if strings are wellformed when assigning from NONE/OCTETS and strings
|
||||
sent by the client (the statement string and parameters).
|
||||
|
||||
|
||||
Uppercase
|
||||
---------
|
||||
|
||||
In FB 1.5.X only ASCII characters are uppercased in character sets default collation order (without collation specified). Ex:
|
||||
In FB 1.5.X only ASCII characters are uppercased in character sets default collation order
|
||||
(without collation specified). Ex:
|
||||
|
||||
isql -q -ch dos850
|
||||
SQL> create database 'test.fdb';
|
||||
@ -91,7 +96,9 @@ New character sets and collations
|
||||
UTF8 character set
|
||||
------------------
|
||||
|
||||
The UNICODE_FSS character set has a number of problems: it's an old version of UTF8, accepts malformed strings and doesn't enforce correct maximum string length. In FB 1.5.X UTF8 it's an alias to UNICODE_FSS.
|
||||
The UNICODE_FSS character set has a number of problems: it's an old version of UTF8, accepts
|
||||
malformed strings and doesn't enforce correct maximum string length. In FB 1.5.X UTF8 it's an
|
||||
alias to UNICODE_FSS.
|
||||
Now UTF8 is a new character set, without these problems of UNICODE_FSS.
|
||||
|
||||
|
||||
@ -134,7 +141,8 @@ New character sets and collations
|
||||
Brazilian collations
|
||||
--------------------
|
||||
|
||||
Two case-insensitive/accent-insensitive collations was created for Brazil: PT_BR/WIN_PTBR (for WIN1252) and PT_BR (for ISO8859_1).
|
||||
Two case-insensitive/accent-insensitive collations was created for Brazil: PT_BR/WIN_PTBR
|
||||
(for WIN1252) and PT_BR (for ISO8859_1).
|
||||
Sort order and equality sample:
|
||||
|
||||
isql -q -ch dos850
|
||||
@ -202,9 +210,10 @@ ICU character sets
|
||||
------------------
|
||||
|
||||
All non-wide and ascii-based character sets present in ICU can be used by Firebird.
|
||||
But for small distribution kit, we customize ICU to include only essentials character sets or the ones we had feature request.
|
||||
If the character set you need is not included in it, you can replace ICU libraries by a complete one found in our site or
|
||||
installed in your OS.
|
||||
But for small distribution kit, we customize ICU to include only essentials character sets or the
|
||||
ones we had feature request.
|
||||
If the character set you need is not included in it, you can replace ICU libraries by a complete
|
||||
one found in our site or installed in your OS.
|
||||
|
||||
To use, you first need to register it in intl/fbintl.conf as follow:
|
||||
<charset NAME>
|
||||
@ -227,8 +236,10 @@ Example:
|
||||
UNICODE collation
|
||||
-----------------
|
||||
|
||||
You can use unicode collation (case sensitive and case insensitive) in all character sets present in fbintl.
|
||||
They're already registerd in fbintl.conf, but you need to register in the databases you want with the attributes you desire.
|
||||
You can use unicode collation (case sensitive and case insensitive) in all character sets present
|
||||
in fbintl.
|
||||
They're already registerd in fbintl.conf, but you need to register in the databases you want with
|
||||
the attributes you desire.
|
||||
They should use this name convention: charset_collation. Ex:
|
||||
create collation win1252_unicode
|
||||
for win1252;
|
||||
@ -255,7 +266,8 @@ Valid for: collations of narrow character sets.
|
||||
Format: DISABLE-EXPANSIONS={0 | 1}
|
||||
Example: DISABLE-EXPANSIONS=1
|
||||
|
||||
ICU-VERSION: Specify what version of ICU library will be used. Valid values are the ones defined in the config file (intl/fbintl.conf) in entry intl_module/icu_versions.
|
||||
ICU-VERSION: Specify what version of ICU library will be used. Valid values are the ones defined in
|
||||
the config file (intl/fbintl.conf) in entry intl_module/icu_versions.
|
||||
Valid for: UNICODE and UNICODE_CI.
|
||||
Format: ICU-VERSION={default | major.minor}
|
||||
Example: ICU-VERSION=3.0
|
||||
|
@ -92,8 +92,7 @@ int EXE_action(const TEXT* database, const ULONG switches)
|
||||
if (tdgbl->status[1] &&
|
||||
// Ignore isc_shutdown error produced when we switch to full shutdown mode. It is expected.
|
||||
(tdgbl->status[1] != isc_shutdown || !(switches & sw_shut) ||
|
||||
tdgbl->ALICE_data.ua_shutdown_mode != SHUT_FULL)
|
||||
)
|
||||
tdgbl->ALICE_data.ua_shutdown_mode != SHUT_FULL))
|
||||
{
|
||||
error = true;
|
||||
}
|
||||
|
@ -1513,12 +1513,14 @@ static void close_out_transaction(gbak_action action, isc_tr_handle* handle)
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
/* A backup shouldn't touch any data - we ensure that
|
||||
* by never writing data during a backup, but let's double
|
||||
* ensure it by doing a rollback
|
||||
*/
|
||||
if (isc_rollback_transaction(status_vector, handle))
|
||||
BURP_print_status(status_vector);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ -2090,4 +2092,3 @@ static ULONG get_size(const SCHAR* string, burp_fil* file)
|
||||
file->fil_length = size;
|
||||
return size;
|
||||
}
|
||||
|
||||
|
@ -554,7 +554,6 @@ UCHAR MVOL_write(const UCHAR c, int* io_cnt, UCHAR** io_ptr)
|
||||
#ifndef WIN_NT
|
||||
cnt = write(tdgbl->file_desc, ptr, nBytesToWrite);
|
||||
#else
|
||||
|
||||
DWORD ret = 0;
|
||||
if (!WriteFile(tdgbl->file_desc, ptr, (DWORD) nBytesToWrite, &cnt, NULL))
|
||||
{
|
||||
@ -1282,12 +1281,12 @@ static bool write_header(DESC handle,
|
||||
{
|
||||
#ifdef WIN_NT
|
||||
DWORD bytes_written = 0;
|
||||
const bool err = WriteFile(handle, tdgbl->mvol_io_header,
|
||||
tdgbl->mvol_io_buffer_size, &bytes_written, NULL) == 0;
|
||||
const BOOL err = !WriteFile(handle, tdgbl->mvol_io_header,
|
||||
tdgbl->mvol_io_buffer_size, &bytes_written, NULL);
|
||||
#else
|
||||
ULONG bytes_written = write(handle, tdgbl->mvol_io_header,
|
||||
tdgbl->mvol_io_buffer_size);
|
||||
const bool err = false;
|
||||
const BOOL err = FALSE;
|
||||
#endif // WIN_NT
|
||||
|
||||
if (err || bytes_written != tdgbl->mvol_io_buffer_size)
|
||||
|
@ -363,13 +363,12 @@ void system_call_failed::raise(const char* syscall)
|
||||
fatal_exception::fatal_exception(const char* message) :
|
||||
status_exception(0, false)
|
||||
{
|
||||
const ISC_STATUS temp[] =
|
||||
{
|
||||
isc_arg_gds,
|
||||
isc_random,
|
||||
isc_arg_string, dupStringTemp(message),
|
||||
isc_arg_end
|
||||
};
|
||||
const ISC_STATUS temp[] = {
|
||||
isc_arg_gds,
|
||||
isc_random,
|
||||
isc_arg_string, dupStringTemp(message),
|
||||
isc_arg_end
|
||||
};
|
||||
set_status(temp, false);
|
||||
}
|
||||
|
||||
|
@ -6904,7 +6904,6 @@ void CompiledStatement::append_meta_string(const char* string)
|
||||
{
|
||||
thread_db* tdbb = JRD_get_thread_data();
|
||||
|
||||
//ISC_STATUS_ARRAY status_vector = {0};
|
||||
UCharBuffer nameBuffer;
|
||||
|
||||
CsConvert cv(INTL_charset_lookup(tdbb, CS_dynamic)->getStruct(),
|
||||
|
@ -1428,10 +1428,10 @@ static bool file_rename(TEXT* file_nameL, const TEXT* extension, const TEXT* new
|
||||
// back up to the last extension (if any)
|
||||
|
||||
#ifdef WIN_NT
|
||||
while ((p != file_nameL) && (*p != '.') && (*p != '/') && (*p != '\\'))
|
||||
while (p != file_nameL && *p != '.' && *p != '/' && *p != '\\')
|
||||
--p;
|
||||
#else
|
||||
while ((p != file_nameL) && (*p != '.') && (*p != '/'))
|
||||
while (p != file_nameL && *p != '.' && *p != '/')
|
||||
--p;
|
||||
#endif
|
||||
|
||||
@ -2892,4 +2892,3 @@ static SSHORT skip_white()
|
||||
|
||||
return c;
|
||||
}
|
||||
|
||||
|
@ -2202,8 +2202,6 @@ static dsc* evlOverlay(Jrd::thread_db* tdbb, const SysFunction* function, Jrd::j
|
||||
length = len2 / cs->maxBytesPerChar();
|
||||
}
|
||||
|
||||
// Not sure "length" is set in all paths, Adriano please review. Set it to zero by default
|
||||
// several lines above when it was defined.
|
||||
length = MIN(length, len1 - from + 1);
|
||||
|
||||
blb* newBlob = NULL;
|
||||
|
@ -564,10 +564,7 @@ bool TempSpace::validate(offset_t& free) const
|
||||
for (const Segment* space = freeSegments; space; space = space->next)
|
||||
{
|
||||
free += space->size;
|
||||
#ifdef DEV_BUILD
|
||||
bool ok = !(space->next) || (space->next->position > space->position);
|
||||
fb_assert(ok);
|
||||
#endif
|
||||
fb_assert(!(space->next) || (space->next->position > space->position));
|
||||
}
|
||||
|
||||
offset_t disk = 0;
|
||||
|
@ -2794,7 +2794,7 @@ static USHORT compress_root(thread_db* tdbb, index_root_page* page)
|
||||
UCHAR* p = (UCHAR*) page + dbb->dbb_page_size;
|
||||
|
||||
index_root_page::irt_repeat* root_idx = page->irt_rpt;
|
||||
for (const index_root_page::irt_repeat* const end = root_idx + page->irt_count;
|
||||
for (const index_root_page::irt_repeat* const end = root_idx + page->irt_count;
|
||||
root_idx < end; root_idx++)
|
||||
{
|
||||
if (root_idx->irt_root) {
|
||||
|
@ -378,9 +378,6 @@ GDS_TIMESTAMP CVT_get_timestamp(const dsc* desc)
|
||||
|
||||
static bool transliterate(const dsc* from, dsc* to, CHARSET_ID& charset2, ErrorFunction err)
|
||||
{
|
||||
//UCHAR* p = to->dsc_address;
|
||||
//const UCHAR* q = from->dsc_address;
|
||||
|
||||
CHARSET_ID charset1;
|
||||
if (INTL_TTYPE(from) == ttype_dynamic)
|
||||
charset1 = INTL_charset(NULL, INTL_TTYPE(from));
|
||||
|
@ -78,11 +78,11 @@ typedef struct dsc
|
||||
{
|
||||
dsc()
|
||||
: dsc_dtype(0),
|
||||
dsc_scale(0),
|
||||
dsc_length(0),
|
||||
dsc_sub_type(0),
|
||||
dsc_flags(0),
|
||||
dsc_address(0)
|
||||
dsc_scale(0),
|
||||
dsc_length(0),
|
||||
dsc_sub_type(0),
|
||||
dsc_flags(0),
|
||||
dsc_address(0)
|
||||
{}
|
||||
|
||||
UCHAR dsc_dtype;
|
||||
@ -292,11 +292,11 @@ typedef struct dsc
|
||||
// between Ods::Descriptor and struct dsc
|
||||
dsc(const Ods::Descriptor& od)
|
||||
: dsc_dtype(od.dsc_dtype),
|
||||
dsc_scale(od.dsc_scale),
|
||||
dsc_length(od.dsc_length),
|
||||
dsc_sub_type(od.dsc_sub_type),
|
||||
dsc_flags(od.dsc_flags),
|
||||
dsc_address((UCHAR*)(IPTR)(od.dsc_offset))
|
||||
dsc_scale(od.dsc_scale),
|
||||
dsc_length(od.dsc_length),
|
||||
dsc_sub_type(od.dsc_sub_type),
|
||||
dsc_flags(od.dsc_flags),
|
||||
dsc_address((UCHAR*)(IPTR)(od.dsc_offset))
|
||||
{}
|
||||
|
||||
operator Ods::Descriptor() const
|
||||
|
@ -47,11 +47,11 @@ struct dsc
|
||||
|
||||
dsc()
|
||||
: dsc_dtype(0),
|
||||
dsc_scale(0),
|
||||
dsc_length(0),
|
||||
dsc_sub_type(0),
|
||||
dsc_flags(0),
|
||||
dsc_address(0)
|
||||
dsc_scale(0),
|
||||
dsc_length(0),
|
||||
dsc_sub_type(0),
|
||||
dsc_flags(0),
|
||||
dsc_address(0)
|
||||
{}
|
||||
|
||||
explicit dsc(const dtype_t dtype) :
|
||||
|
@ -343,7 +343,6 @@ static ULONG internal_fss_substring(charset* obj, ULONG srcLen, const UCHAR* src
|
||||
if (length == 0)
|
||||
return 0;
|
||||
|
||||
//const UCHAR* srcStart = src;
|
||||
const UCHAR* dstStart = dst;
|
||||
const UCHAR* const srcEnd = src + srcLen;
|
||||
const UCHAR* const dstEnd = dst + dstLen;
|
||||
|
@ -105,7 +105,6 @@ void ConfigRoot::osConfigRoot()
|
||||
// go to the parent directory
|
||||
const size_t index = install_dir().rfind(PathUtils::dir_sep, install_dir().length());
|
||||
root_dir = (index ? install_dir().substr(0, index) : install_dir()) + PathUtils::dir_sep;
|
||||
|
||||
#endif
|
||||
return;
|
||||
}
|
||||
|
@ -1382,7 +1382,7 @@ void PAG_header_init(thread_db* tdbb)
|
||||
const ArchitectureType* matrix = ods_version < ODS_VERSION11 ? archMatrix10 : archMatrix;
|
||||
const int hdrImpl = header->hdr_implementation;
|
||||
if (hdrImpl < 0 || hdrImpl > classmax ||
|
||||
matrix[hdrImpl] == archUnknown || matrix[hdrImpl] != matrix[CLASS])
|
||||
matrix[hdrImpl] == archUnknown || matrix[hdrImpl] != matrix[CLASS])
|
||||
{
|
||||
ERR_post(Arg::Gds(isc_bad_db_format) << Arg::Str(attachment->att_filename));
|
||||
}
|
||||
|
@ -58,7 +58,7 @@ private:
|
||||
|
||||
public:
|
||||
ICU()
|
||||
: inModule(NULL), ucModule(NULL)
|
||||
: inModule(NULL), ucModule(NULL)
|
||||
{
|
||||
}
|
||||
|
||||
@ -356,7 +356,6 @@ ULONG UnicodeUtil::utf16ToUtf8(ULONG srcLen, const USHORT* src, ULONG dstLen, UC
|
||||
|
||||
srcLen /= sizeof(*src);
|
||||
|
||||
//const USHORT* const srcEnd = src + srcLen;
|
||||
const UCHAR* const dstStart = dst;
|
||||
const UCHAR* const dstEnd = dst + dstLen;
|
||||
|
||||
@ -423,7 +422,6 @@ ULONG UnicodeUtil::utf8ToUtf16(ULONG srcLen, const UCHAR* src, ULONG dstLen, USH
|
||||
if (dst == NULL)
|
||||
return srcLen * sizeof(*dst);
|
||||
|
||||
//const UCHAR* const srcEnd = src + srcLen;
|
||||
const USHORT* const dstStart = dst;
|
||||
const USHORT* const dstEnd = dst + dstLen / sizeof(*dst);
|
||||
|
||||
@ -615,7 +613,6 @@ ULONG UnicodeUtil::utf16Substring(ULONG srcLen, const USHORT* src, ULONG dstLen,
|
||||
if (length == 0)
|
||||
return 0;
|
||||
|
||||
//const USHORT* const srcStart = src;
|
||||
const USHORT* const dstStart = dst;
|
||||
const USHORT* const srcEnd = src + srcLen / sizeof(*src);
|
||||
const USHORT* const dstEnd = dst + dstLen / sizeof(*dst);
|
||||
|
@ -3327,7 +3327,7 @@ ISC_STATUS API_ROUTINE GDS_DSQL_PREPARE(ISC_STATUS* user_status,
|
||||
sqlda_sup& dasup = statement->das;
|
||||
|
||||
const USHORT buffer_len = sqlda_buffer_size(PREPARE_BUFFER_SIZE, sqlda, dialect);
|
||||
//Attachment* attachment = statement->parent;
|
||||
//Attachment* attachment = statement->parent;
|
||||
Array<SCHAR> db_prepare_buffer;
|
||||
SCHAR* const buffer = db_prepare_buffer.getBuffer(buffer_len);
|
||||
|
||||
|
@ -565,6 +565,7 @@ static bool connect_init(ISC_STATUS* status)
|
||||
}
|
||||
#endif
|
||||
|
||||
|
||||
static void connect_fini()
|
||||
{
|
||||
/**************************************
|
||||
@ -1080,7 +1081,6 @@ static rem_port* connect_client(PACKET* packet, ISC_STATUS* status_vector)
|
||||
#ifndef SUPERCLIENT
|
||||
return NULL;
|
||||
#else
|
||||
|
||||
if (!xnet_initialized)
|
||||
{
|
||||
Firebird::MutexLockGuard guard(xnet_mutex);
|
||||
|
@ -77,8 +77,8 @@ int CLIB_ROUTINE main( int argc, char **argv)
|
||||
|
||||
const TEXT* instance = FB_DEFAULT_INSTANCE;
|
||||
|
||||
const TEXT* username = 0;
|
||||
const TEXT* password = 0;
|
||||
const TEXT* username = NULL;
|
||||
const TEXT* password = NULL;
|
||||
|
||||
// Let's get the root directory from the instance path of this program.
|
||||
// argv[0] is only _mostly_ guaranteed to give this info,
|
||||
@ -214,7 +214,7 @@ int CLIB_ROUTINE main( int argc, char **argv)
|
||||
if (sw_version)
|
||||
printf("instsvc version %s\n", GDS_VERSION);
|
||||
|
||||
if (sw_command == COMMAND_NONE || (username != 0 && sw_command != COMMAND_INSTALL))
|
||||
if (sw_command == COMMAND_NONE || (username && sw_command != COMMAND_INSTALL))
|
||||
{
|
||||
usage_exit();
|
||||
}
|
||||
|
@ -82,7 +82,7 @@ static int* database_handle;
|
||||
static int* request_handle;
|
||||
|
||||
|
||||
void stats_analyze(const fb_stats* before, const fb_stats* after, print_callback callback, SCHAR *arg)
|
||||
void stats_analyze(const fb_stats* before, const fb_stats* after, print_callback callback, SCHAR* arg)
|
||||
{
|
||||
/**************************************
|
||||
*
|
||||
|
Loading…
Reference in New Issue
Block a user