mirror of
https://github.com/FirebirdSQL/firebird.git
synced 2025-01-22 21:23:04 +01:00
Fixed CORE-4061 - isql does not insert boolean values correctly, always shown as False.
This commit is contained in:
parent
37a7f1c40b
commit
b1644df1c8
@ -92,7 +92,7 @@ LiteralNode* MAKE_const_slong(SLONG value)
|
||||
@param numeric_flag
|
||||
|
||||
**/
|
||||
ValueExprNode* MAKE_constant(const string& str, dsql_constant_type numeric_flag)
|
||||
ValueExprNode* MAKE_constant(const char* str, dsql_constant_type numeric_flag)
|
||||
{
|
||||
thread_db* tdbb = JRD_get_thread_data();
|
||||
|
||||
@ -109,10 +109,10 @@ ValueExprNode* MAKE_constant(const string& str, dsql_constant_type numeric_flag)
|
||||
|
||||
literal->litDesc.dsc_dtype = dtype_double;
|
||||
// Scale has no use for double
|
||||
literal->litDesc.dsc_scale = static_cast<signed char>(str.length());
|
||||
literal->litDesc.dsc_scale = static_cast<signed char>(strlen(str));
|
||||
literal->litDesc.dsc_sub_type = 0;
|
||||
literal->litDesc.dsc_length = sizeof(double);
|
||||
literal->litDesc.dsc_address = (UCHAR*) str.c_str();
|
||||
literal->litDesc.dsc_address = (UCHAR*) str;
|
||||
literal->litDesc.dsc_ttype() = ttype_ascii;
|
||||
break;
|
||||
|
||||
@ -140,14 +140,14 @@ ValueExprNode* MAKE_constant(const string& str, dsql_constant_type numeric_flag)
|
||||
// And, they will fit in a SINT64 without overflow.
|
||||
|
||||
SINT64 value = 0;
|
||||
const UCHAR* p = reinterpret_cast<const UCHAR*>(str.c_str());
|
||||
const UCHAR* p = reinterpret_cast<const UCHAR*>(str);
|
||||
|
||||
if (*p == 'X')
|
||||
{
|
||||
// oh no, a hex string!
|
||||
++p; // skip the 'X' part.
|
||||
UCHAR byte = 0;
|
||||
bool nibble = ((str.length() - 1) & 1);
|
||||
bool nibble = ((strlen(str) - 1) & 1);
|
||||
SSHORT c;
|
||||
|
||||
// hex string is already upper-cased
|
||||
@ -239,8 +239,8 @@ ValueExprNode* MAKE_constant(const string& str, dsql_constant_type numeric_flag)
|
||||
tmp.dsc_scale = 0;
|
||||
tmp.dsc_flags = 0;
|
||||
tmp.dsc_ttype() = ttype_ascii;
|
||||
tmp.dsc_length = static_cast<USHORT>(str.length());
|
||||
tmp.dsc_address = (UCHAR*) str.c_str();
|
||||
tmp.dsc_length = static_cast<USHORT>(strlen(str));
|
||||
tmp.dsc_address = (UCHAR*) str;
|
||||
|
||||
// Now invoke the string_to_date/time/timestamp routines
|
||||
|
||||
@ -249,7 +249,7 @@ ValueExprNode* MAKE_constant(const string& str, dsql_constant_type numeric_flag)
|
||||
}
|
||||
|
||||
case CONSTANT_BOOLEAN:
|
||||
literal->litDesc.makeBoolean((UCHAR*) str.c_str());
|
||||
literal->litDesc.makeBoolean((UCHAR*) str);
|
||||
break;
|
||||
|
||||
default:
|
||||
|
@ -56,7 +56,7 @@ namespace Jrd {
|
||||
|
||||
|
||||
Jrd::LiteralNode* MAKE_const_slong(SLONG);
|
||||
Jrd::ValueExprNode* MAKE_constant(const Firebird::string&, Jrd::dsql_constant_type);
|
||||
Jrd::ValueExprNode* MAKE_constant(const char*, Jrd::dsql_constant_type);
|
||||
Jrd::LiteralNode* MAKE_str_constant(const Jrd::IntlString*, SSHORT);
|
||||
void MAKE_desc(Jrd::DsqlCompilerScratch*, dsc*, Jrd::ValueExprNode*);
|
||||
void MAKE_desc_from_field(dsc*, const Jrd::dsql_fld*);
|
||||
|
@ -1523,9 +1523,9 @@ sequence_value
|
||||
: signed_long_integer
|
||||
{ $$ = MAKE_const_slong($1); }
|
||||
| NUMBER64BIT
|
||||
{ $$ = MAKE_constant(*$1, CONSTANT_SINT64); }
|
||||
{ $$ = MAKE_constant($1->c_str(), CONSTANT_SINT64); }
|
||||
| '-' NUMBER64BIT
|
||||
{ $$ = newNode<NegateNode>(MAKE_constant(*$2, CONSTANT_SINT64)); }
|
||||
{ $$ = newNode<NegateNode>(MAKE_constant($2->c_str(), CONSTANT_SINT64)); }
|
||||
;
|
||||
|
||||
|
||||
@ -5959,9 +5959,9 @@ constant
|
||||
%type <valueExprNode> u_numeric_constant
|
||||
u_numeric_constant
|
||||
: NUMBER { $$ = MAKE_const_slong($1); }
|
||||
| FLOAT_NUMBER { $$ = MAKE_constant(*$1, CONSTANT_DOUBLE); }
|
||||
| NUMBER64BIT { $$ = MAKE_constant(*$1, CONSTANT_SINT64); }
|
||||
| SCALEDINT { $$ = MAKE_constant(*$1, CONSTANT_SINT64); }
|
||||
| FLOAT_NUMBER { $$ = MAKE_constant($1->c_str(), CONSTANT_DOUBLE); }
|
||||
| NUMBER64BIT { $$ = MAKE_constant($1->c_str(), CONSTANT_SINT64); }
|
||||
| SCALEDINT { $$ = MAKE_constant($1->c_str(), CONSTANT_SINT64); }
|
||||
;
|
||||
|
||||
%type <valueExprNode> u_constant
|
||||
@ -5983,7 +5983,7 @@ u_constant
|
||||
Arg::Gds(isc_sql_db_dialect_dtype_unsupport) << Arg::Num(db_dialect) <<
|
||||
Arg::Str("DATE"));
|
||||
}
|
||||
$$ = MAKE_constant($2->getString(), CONSTANT_DATE);
|
||||
$$ = MAKE_constant($2->getString().c_str(), CONSTANT_DATE);
|
||||
}
|
||||
| TIME STRING
|
||||
{
|
||||
@ -5999,10 +5999,10 @@ u_constant
|
||||
Arg::Gds(isc_sql_db_dialect_dtype_unsupport) << Arg::Num(db_dialect) <<
|
||||
Arg::Str("TIME"));
|
||||
}
|
||||
$$ = MAKE_constant($2->getString(), CONSTANT_TIME);
|
||||
$$ = MAKE_constant($2->getString().c_str(), CONSTANT_TIME);
|
||||
}
|
||||
| TIMESTAMP STRING
|
||||
{ $$ = MAKE_constant($2->getString(), CONSTANT_TIMESTAMP); }
|
||||
{ $$ = MAKE_constant($2->getString().c_str(), CONSTANT_TIMESTAMP); }
|
||||
;
|
||||
|
||||
%type <valueExprNode> boolean_literal
|
||||
|
Loading…
Reference in New Issue
Block a user