mirror of
https://github.com/FirebirdSQL/firebird.git
synced 2025-01-22 22:43:03 +01:00
Fixed CORE-6033 - SUBSTRING(CURRENT_TIMESTAMP) does not work.
This commit is contained in:
parent
1c2afb4717
commit
e438bdeb60
@ -549,7 +549,7 @@ void CVT_string_to_datetime(const dsc* desc,
|
||||
unsigned int position_day = 2;
|
||||
bool have_english_month = false;
|
||||
char date_sep = '\0';
|
||||
VaryStr<100> buffer; // arbitrarily large
|
||||
VaryStr<TEMP_STR_LENGTH> buffer; // arbitrarily large
|
||||
|
||||
const char* p = NULL;
|
||||
const USHORT length = CVT_make_string(desc, ttype_ascii, &p, &buffer, sizeof(buffer), 0, cb->err);
|
||||
@ -1186,7 +1186,7 @@ bool CVT_get_boolean(const dsc* desc, ErrorFunction err)
|
||||
case dtype_cstring:
|
||||
case dtype_text:
|
||||
{
|
||||
VaryStr<100> buffer; // arbitrarily large
|
||||
VaryStr<TEMP_STR_LENGTH> buffer; // arbitrarily large
|
||||
const char* p = NULL;
|
||||
int len = CVT_make_string(desc, ttype_ascii, &p, &buffer, sizeof(buffer), 0, err);
|
||||
|
||||
@ -1282,7 +1282,7 @@ double CVT_get_double(const dsc* desc, DecimalStatus decSt, ErrorFunction err, b
|
||||
case dtype_cstring:
|
||||
case dtype_text:
|
||||
{
|
||||
VaryStr<50> buffer; // must hold ascii of largest double
|
||||
VaryStr<TEMP_STR_LENGTH> buffer; // must hold ascii of largest double
|
||||
const char* p;
|
||||
|
||||
const USHORT length =
|
||||
@ -2160,7 +2160,7 @@ void CVT_conversion_error(const dsc* desc, ErrorFunction err)
|
||||
try
|
||||
{
|
||||
const char* p;
|
||||
VaryStr<128> s;
|
||||
VaryStr<TEMP_STR_LENGTH> s;
|
||||
const USHORT length =
|
||||
CVT_make_string(desc, ttype_ascii, &p, &s, sizeof(s), 0, localError);
|
||||
message.assign(p, length);
|
||||
|
@ -52,11 +52,6 @@ namespace Jrd {
|
||||
// Bug 10061, bsriram - 19-Apr-1999
|
||||
static const int MAX_MEMBER_LIST = 1500;
|
||||
|
||||
static const int TEMP_LENGTH = 128;
|
||||
|
||||
|
||||
//--------------------
|
||||
|
||||
|
||||
//--------------------
|
||||
|
||||
@ -888,7 +883,7 @@ bool ComparativeBoolNode::stringBoolean(thread_db* tdbb, jrd_req* request, dsc*
|
||||
case blr_like:
|
||||
case blr_similar:
|
||||
{
|
||||
VaryStr<TEMP_LENGTH> temp3;
|
||||
VaryStr<TEMP_STR_LENGTH> temp3;
|
||||
const UCHAR* escape_str = NULL;
|
||||
USHORT escape_length = 0;
|
||||
|
||||
@ -1100,7 +1095,7 @@ bool ComparativeBoolNode::stringFunction(thread_db* tdbb, jrd_req* request,
|
||||
// Handle LIKE and SIMILAR
|
||||
if (blrOp == blr_like || blrOp == blr_similar)
|
||||
{
|
||||
VaryStr<TEMP_LENGTH> temp3;
|
||||
VaryStr<TEMP_STR_LENGTH> temp3;
|
||||
const UCHAR* escape_str = NULL;
|
||||
USHORT escape_length = 0;
|
||||
// ensure 3rd argument (escape char) is in operation text type
|
||||
|
@ -10510,7 +10510,7 @@ dsc* StrCaseNode::execute(thread_db* tdbb, jrd_req* request) const
|
||||
else
|
||||
{
|
||||
UCHAR* ptr;
|
||||
VaryStr<32> temp;
|
||||
VaryStr<TEMP_STR_LENGTH> temp;
|
||||
USHORT ttype;
|
||||
|
||||
dsc desc;
|
||||
@ -10740,7 +10740,7 @@ dsc* StrLenNode::execute(thread_db* tdbb, jrd_req* request) const
|
||||
return &impure->vlu_desc;
|
||||
}
|
||||
|
||||
VaryStr<32> temp;
|
||||
VaryStr<TEMP_STR_LENGTH> temp;
|
||||
USHORT ttype;
|
||||
UCHAR* p;
|
||||
|
||||
@ -11575,7 +11575,7 @@ dsc* SubstringNode::perform(thread_db* tdbb, impure_value* impure, const dsc* va
|
||||
// - The types that can cause an error() issued inside the low level MOV/CVT
|
||||
// routines because the "temp" is not enough are blob and array but at this time
|
||||
// they aren't accepted, so they will cause error() to be called anyway.
|
||||
VaryStr<32> temp;
|
||||
VaryStr<TEMP_STR_LENGTH> temp;
|
||||
USHORT ttype;
|
||||
desc.dsc_length = MOV_get_string_ptr(tdbb, valueDsc, &ttype, &desc.dsc_address,
|
||||
&temp, sizeof(temp));
|
||||
|
@ -9902,7 +9902,7 @@ static void validateExpressions(thread_db* tdbb, const Array<ValidateInfo>& vali
|
||||
{
|
||||
// Validation error -- report result
|
||||
const char* value;
|
||||
VaryStr<128> temp;
|
||||
VaryStr<TEMP_STR_LENGTH> temp;
|
||||
|
||||
const dsc* desc = EVL_expr(tdbb, request, i->value);
|
||||
const USHORT length = (desc && !(request->req_flags & req_null)) ?
|
||||
|
@ -57,6 +57,8 @@ const ULONG MAX_VARY_COLUMN_SIZE = MAX_COLUMN_SIZE - sizeof(USHORT);
|
||||
|
||||
const ULONG MAX_STR_SIZE = 65535;
|
||||
|
||||
const int TEMP_STR_LENGTH = 128;
|
||||
|
||||
// Metadata constants
|
||||
|
||||
// When changing these constants, change MaxIdentifierByteLength and MaxIdentifierCharLength in
|
||||
|
@ -480,7 +480,7 @@ void EVL_make_value(thread_db* tdbb, const dsc* desc, impure_value* value, Memor
|
||||
break;
|
||||
}
|
||||
|
||||
VaryStr<128> temp;
|
||||
VaryStr<TEMP_STR_LENGTH> temp;
|
||||
UCHAR* address;
|
||||
USHORT ttype;
|
||||
|
||||
@ -550,7 +550,7 @@ void EVL_validate(thread_db* tdbb, const Item& item, const ItemInfo* itemInfo, d
|
||||
err = true;
|
||||
|
||||
const char* value = NULL_STRING_MARK;
|
||||
VaryStr<128> temp;
|
||||
VaryStr<TEMP_STR_LENGTH> temp;
|
||||
|
||||
MapFieldInfo::ValueType fieldInfo;
|
||||
if (!err && itemInfo->fullDomain &&
|
||||
|
@ -39,6 +39,7 @@
|
||||
#include "../common/classes/UserBlob.h"
|
||||
#include "../common/classes/VaryStr.h"
|
||||
#include "../common/gdsassert.h"
|
||||
#include "../jrd/constants.h"
|
||||
|
||||
|
||||
static SLONG execute_any(qli_nod*);
|
||||
@ -57,7 +58,6 @@ static int sleuth_merge(const UCHAR*, const UCHAR*, const UCHAR* const, UCHAR* c
|
||||
static bool string_boolean(qli_nod*);
|
||||
static bool string_function(qli_nod*, SSHORT, const TEXT*, SSHORT, const TEXT*);
|
||||
|
||||
const int TEMP_LENGTH = 128;
|
||||
const USHORT SLEUTH_insensitive = 1;
|
||||
//#define COND_UPPER(c) ((flags & SLEUTH_insensitive) ? UPPER(c) : c)
|
||||
inline UCHAR cond_upper(const UCHAR c, const USHORT flags)
|
||||
@ -959,15 +959,15 @@ static bool sleuth( qli_nod* node, const dsc* desc1, const dsc* desc2, const dsc
|
||||
|
||||
// Get operator definition string (control string)
|
||||
|
||||
Firebird::VaryStr<TEMP_LENGTH> temp1;
|
||||
Firebird::VaryStr<TEMP_STR_LENGTH> temp1;
|
||||
const TEXT* p1;
|
||||
SSHORT l1 = MOVQ_get_string(desc3, &p1, &temp1, TEMP_LENGTH);
|
||||
SSHORT l1 = MOVQ_get_string(desc3, &p1, &temp1, TEMP_STR_LENGTH);
|
||||
|
||||
// Get address and length of search string
|
||||
|
||||
Firebird::VaryStr<TEMP_LENGTH> temp2;
|
||||
Firebird::VaryStr<TEMP_STR_LENGTH> temp2;
|
||||
const TEXT* p2;
|
||||
SSHORT l2 = MOVQ_get_string(desc2, &p2, &temp2, TEMP_LENGTH);
|
||||
SSHORT l2 = MOVQ_get_string(desc2, &p2, &temp2, TEMP_STR_LENGTH);
|
||||
|
||||
// Merge search and control strings
|
||||
|
||||
@ -978,7 +978,7 @@ static bool sleuth( qli_nod* node, const dsc* desc1, const dsc* desc2, const dsc
|
||||
|
||||
if (desc1->dsc_dtype != dtype_blob)
|
||||
{
|
||||
l1 = MOVQ_get_string(desc1, &p1, &temp1, TEMP_LENGTH);
|
||||
l1 = MOVQ_get_string(desc1, &p1, &temp1, TEMP_STR_LENGTH);
|
||||
return sleuth_check(0, (const UCHAR*) p1, (const UCHAR*) (p1 + l1), control, control + l2);
|
||||
}
|
||||
|
||||
@ -1309,16 +1309,16 @@ static bool string_boolean( qli_nod* node)
|
||||
// Get address and length of strings
|
||||
|
||||
const TEXT* p2;
|
||||
Firebird::VaryStr<TEMP_LENGTH> temp2;
|
||||
SSHORT l2 = MOVQ_get_string(desc2, &p2, &temp2, TEMP_LENGTH);
|
||||
Firebird::VaryStr<TEMP_STR_LENGTH> temp2;
|
||||
SSHORT l2 = MOVQ_get_string(desc2, &p2, &temp2, TEMP_STR_LENGTH);
|
||||
|
||||
// If source is not a blob, do a simple search
|
||||
|
||||
if (desc1->dsc_dtype != dtype_blob)
|
||||
{
|
||||
Firebird::VaryStr<TEMP_LENGTH> temp1;
|
||||
Firebird::VaryStr<TEMP_STR_LENGTH> temp1;
|
||||
const TEXT* p1;
|
||||
SSHORT l1 = MOVQ_get_string(desc1, &p1, &temp1, TEMP_LENGTH);
|
||||
SSHORT l1 = MOVQ_get_string(desc1, &p1, &temp1, TEMP_STR_LENGTH);
|
||||
return string_function(node, l1, p1, l2, p2);
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user