|
From: <asf...@us...> - 2010-12-18 02:17:15
|
Revision: 52054
http://firebird.svn.sourceforge.net/firebird/?rev=52054&view=rev
Author: asfernandes
Date: 2010-12-18 02:17:06 +0000 (Sat, 18 Dec 2010)
Log Message:
-----------
Feature CORE-726 - Boolean data type
Modified Paths:
--------------
firebird/trunk/lang_helpers/gds_codes.ftn
firebird/trunk/lang_helpers/gds_codes.pas
firebird/trunk/src/common/cvt.cpp
firebird/trunk/src/common/cvt.h
firebird/trunk/src/common/dsc.cpp
firebird/trunk/src/common/dsc.h
firebird/trunk/src/common/dsc_pub.h
firebird/trunk/src/dsql/BoolNodes.cpp
firebird/trunk/src/dsql/BoolNodes.h
firebird/trunk/src/dsql/ExprNodes.cpp
firebird/trunk/src/dsql/ExprNodes.h
firebird/trunk/src/dsql/Nodes.h
firebird/trunk/src/dsql/ddl_proto.h
firebird/trunk/src/dsql/dsql.cpp
firebird/trunk/src/dsql/gen.cpp
firebird/trunk/src/dsql/make.cpp
firebird/trunk/src/dsql/make_proto.h
firebird/trunk/src/dsql/parse.y
firebird/trunk/src/dsql/pass1.cpp
firebird/trunk/src/dsql/sqlda_pub.h
firebird/trunk/src/include/gen/codetext.h
firebird/trunk/src/include/gen/iberror.h
firebird/trunk/src/include/gen/msgs.h
firebird/trunk/src/include/gen/sql_code.h
firebird/trunk/src/include/gen/sql_state.h
firebird/trunk/src/isql/isql.epp
firebird/trunk/src/isql/isql.h
firebird/trunk/src/jrd/DataTypeUtil.cpp
firebird/trunk/src/jrd/Optimizer.cpp
firebird/trunk/src/jrd/align.h
firebird/trunk/src/jrd/blp.h
firebird/trunk/src/jrd/blr.h
firebird/trunk/src/jrd/btr.cpp
firebird/trunk/src/jrd/btr.h
firebird/trunk/src/jrd/cvt2.cpp
firebird/trunk/src/jrd/dfw.epp
firebird/trunk/src/jrd/evl.cpp
firebird/trunk/src/jrd/extds/IscDS.cpp
firebird/trunk/src/jrd/fun.epp
firebird/trunk/src/jrd/mov.cpp
firebird/trunk/src/jrd/mov_proto.h
firebird/trunk/src/jrd/opt.cpp
firebird/trunk/src/jrd/par.cpp
firebird/trunk/src/msgs/facilities2.sql
firebird/trunk/src/msgs/messages2.sql
firebird/trunk/src/msgs/system_errors2.sql
firebird/trunk/src/remote/parser.cpp
firebird/trunk/src/remote/protocol.cpp
firebird/trunk/src/utilities/ntrace/TracePluginImpl.cpp
firebird/trunk/src/yvalve/array.epp
firebird/trunk/src/yvalve/gds.cpp
firebird/trunk/src/yvalve/keywords.cpp
firebird/trunk/src/yvalve/utly.cpp
Modified: firebird/trunk/lang_helpers/gds_codes.ftn
===================================================================
--- firebird/trunk/lang_helpers/gds_codes.ftn 2010-12-17 22:32:35 UTC (rev 52053)
+++ firebird/trunk/lang_helpers/gds_codes.ftn 2010-12-18 02:17:06 UTC (rev 52054)
@@ -1456,6 +1456,8 @@
PARAMETER (GDS__bad_events_handle = 335545021)
INTEGER*4 GDS__cannot_copy_stmt
PARAMETER (GDS__cannot_copy_stmt = 335545022)
+ INTEGER*4 GDS__invalid_boolean_usage
+ PARAMETER (GDS__invalid_boolean_usage = 335545023)
INTEGER*4 GDS__gfix_db_name
PARAMETER (GDS__gfix_db_name = 335740929)
INTEGER*4 GDS__gfix_invalid_sw
Modified: firebird/trunk/lang_helpers/gds_codes.pas
===================================================================
--- firebird/trunk/lang_helpers/gds_codes.pas 2010-12-17 22:32:35 UTC (rev 52053)
+++ firebird/trunk/lang_helpers/gds_codes.pas 2010-12-18 02:17:06 UTC (rev 52054)
@@ -735,6 +735,7 @@
gds_request_outdated = 335545020;
gds_bad_events_handle = 335545021;
gds_cannot_copy_stmt = 335545022;
+ gds_invalid_boolean_usage = 335545023;
gds_gfix_db_name = 335740929;
gds_gfix_invalid_sw = 335740930;
gds_gfix_incmp_sw = 335740932;
Modified: firebird/trunk/src/common/cvt.cpp
===================================================================
--- firebird/trunk/src/common/cvt.cpp 2010-12-17 22:32:35 UTC (rev 52053)
+++ firebird/trunk/src/common/cvt.cpp 2010-12-18 02:17:06 UTC (rev 52054)
@@ -1001,6 +1001,7 @@
case dtype_timestamp:
case dtype_array:
case dtype_dbkey:
+ case dtype_boolean:
CVT_conversion_error(desc, err);
break;
@@ -1043,6 +1044,17 @@
}
+// Get the value of a boolean descriptor.
+bool CVT_get_boolean(const dsc* desc, ErrorFunction err)
+{
+ if (desc->dsc_dtype == dtype_boolean)
+ return *desc->dsc_address != '\0';
+
+ CVT_conversion_error(desc, err);
+ return false; // silence warning
+}
+
+
double CVT_get_double(const dsc* desc, ErrorFunction err)
{
/**************************************
@@ -1241,6 +1253,7 @@
case dtype_blob:
case dtype_array:
case dtype_dbkey:
+ case dtype_boolean:
CVT_conversion_error(desc, err);
break;
@@ -1340,6 +1353,7 @@
case dtype_quad:
case dtype_real:
case dtype_double:
+ case dtype_boolean:
CVT_conversion_error(from, cb->err);
break;
}
@@ -1372,6 +1386,7 @@
case dtype_quad:
case dtype_real:
case dtype_double:
+ case dtype_boolean:
CVT_conversion_error(from, cb->err);
break;
}
@@ -1404,6 +1419,7 @@
case dtype_quad:
case dtype_real:
case dtype_double:
+ case dtype_boolean:
CVT_conversion_error(from, cb->err);
break;
}
@@ -1608,6 +1624,8 @@
default:
fb_assert(false); // Fall into ...
+
+ case dtype_boolean:
case dtype_blob:
CVT_conversion_error(from, cb->err);
return;
@@ -1695,6 +1713,10 @@
*(double*) p = CVT_get_double(from, cb->err);
#endif
return;
+
+ case dtype_boolean:
+ CVT_conversion_error(from, cb->err);
+ break;
}
if (from->dsc_dtype == dtype_array || from->dsc_dtype == dtype_blob)
@@ -1726,6 +1748,8 @@
p = "BLOB";
else if (desc->dsc_dtype == dtype_array)
p = "ARRAY";
+ else if (desc->dsc_dtype == dtype_boolean)
+ p = "BOOLEAN";
else
{
// CVC: I don't have access here to JRD_get_thread_data())->tdbb_status_vector
@@ -2401,6 +2425,7 @@
case dtype_timestamp:
case dtype_array:
case dtype_dbkey:
+ case dtype_boolean:
CVT_conversion_error(desc, err);
break;
@@ -2547,6 +2572,7 @@
case dtype_timestamp:
case dtype_array:
case dtype_dbkey:
+ case dtype_boolean:
CVT_conversion_error(desc, err);
break;
Modified: firebird/trunk/src/common/cvt.h
===================================================================
--- firebird/trunk/src/common/cvt.h 2010-12-17 22:32:35 UTC (rev 52053)
+++ firebird/trunk/src/common/cvt.h 2010-12-18 02:17:06 UTC (rev 52054)
@@ -69,6 +69,7 @@
void CVT_conversion_error(const dsc*, ErrorFunction);
double CVT_power_of_ten(const int);
SLONG CVT_get_long(const dsc*, SSHORT, ErrorFunction);
+bool CVT_get_boolean(const dsc*, ErrorFunction);
double CVT_get_double(const dsc*, ErrorFunction);
USHORT CVT_make_string(const dsc*, USHORT, const char**, vary*, USHORT, ErrorFunction);
void CVT_move_common(const dsc*, dsc*, Firebird::Callbacks*);
Modified: firebird/trunk/src/common/dsc.cpp
===================================================================
--- firebird/trunk/src/common/dsc.cpp 2010-12-17 22:32:35 UTC (rev 52053)
+++ firebird/trunk/src/common/dsc.cpp 2010-12-18 02:17:06 UTC (rev 52054)
@@ -61,7 +61,8 @@
9, // dtype_blob FFFF:FFFF
9, // dtype_array FFFF:FFFF
20, // dtype_int64 -9223372036854775808
- 0 // dtype_dbkey
+ 0, // dtype_dbkey
+ 5 // dtype_boolean
};
// blr to dsc type conversions
@@ -85,7 +86,8 @@
blr_blob,
blr_blob,
blr_int64,
- blr_null
+ blr_null,
+ blr_bool
};
// Unimplemented names are in lowercase & <brackets>
@@ -112,7 +114,8 @@
"BLOB",
"ARRAY",
"BIGINT",
- "DB_KEY"
+ "DB_KEY",
+ "BOOLEAN"
};
@@ -130,7 +133,7 @@
dtype_short dtype_long dtype_quad dtype_real
dtype_double dtype_d_float dtype_sql_date dtype_sql_time
dtype_timestamp dtype_blob dtype_array dtype_int64
- dtype_dbkey
+ dtype_dbkey, dtype_boolean
*/
// dtype_unknown
@@ -139,7 +142,7 @@
dtype_unknown, dtype_unknown, DTYPE_CANNOT, dtype_unknown,
dtype_unknown, dtype_unknown, dtype_unknown, dtype_unknown,
dtype_unknown, DTYPE_CANNOT, DTYPE_CANNOT, dtype_unknown,
- DTYPE_CANNOT},
+ DTYPE_CANNOT, DTYPE_CANNOT},
// dtype_text
{dtype_unknown, dtype_double, dtype_double, dtype_double,
@@ -147,7 +150,7 @@
dtype_double, dtype_double, DTYPE_CANNOT, dtype_double,
dtype_double, dtype_d_float, DTYPE_CANNOT, DTYPE_CANNOT,
dtype_timestamp, DTYPE_CANNOT, DTYPE_CANNOT, dtype_double,
- DTYPE_CANNOT},
+ DTYPE_CANNOT, DTYPE_CANNOT},
// dtype_cstring
{dtype_unknown, dtype_double, dtype_double, dtype_double,
@@ -155,7 +158,7 @@
dtype_double, dtype_double, DTYPE_CANNOT, dtype_double,
dtype_double, dtype_d_float, DTYPE_CANNOT, DTYPE_CANNOT,
dtype_timestamp, DTYPE_CANNOT, DTYPE_CANNOT, dtype_double,
- DTYPE_CANNOT},
+ DTYPE_CANNOT, DTYPE_CANNOT},
// dtype_varying
{dtype_unknown, dtype_double, dtype_double, dtype_double,
@@ -163,7 +166,7 @@
dtype_double, dtype_double, DTYPE_CANNOT, dtype_double,
dtype_double, dtype_d_float, DTYPE_CANNOT, DTYPE_CANNOT,
dtype_timestamp, DTYPE_CANNOT, DTYPE_CANNOT, dtype_double,
- DTYPE_CANNOT},
+ DTYPE_CANNOT, DTYPE_CANNOT},
// 4 (unused)
{DTYPE_CANNOT, DTYPE_CANNOT, DTYPE_CANNOT, DTYPE_CANNOT,
@@ -171,7 +174,7 @@
DTYPE_CANNOT, DTYPE_CANNOT, DTYPE_CANNOT, DTYPE_CANNOT,
DTYPE_CANNOT, DTYPE_CANNOT, DTYPE_CANNOT, DTYPE_CANNOT,
DTYPE_CANNOT, DTYPE_CANNOT, DTYPE_CANNOT, DTYPE_CANNOT,
- DTYPE_CANNOT},
+ DTYPE_CANNOT, DTYPE_CANNOT},
// 5 (unused)
{DTYPE_CANNOT, DTYPE_CANNOT, DTYPE_CANNOT, DTYPE_CANNOT,
@@ -179,7 +182,7 @@
DTYPE_CANNOT, DTYPE_CANNOT, DTYPE_CANNOT, DTYPE_CANNOT,
DTYPE_CANNOT, DTYPE_CANNOT, DTYPE_CANNOT, DTYPE_CANNOT,
DTYPE_CANNOT, DTYPE_CANNOT, DTYPE_CANNOT, DTYPE_CANNOT,
- DTYPE_CANNOT},
+ DTYPE_CANNOT, DTYPE_CANNOT},
// dtype_packed
{DTYPE_CANNOT, DTYPE_CANNOT, DTYPE_CANNOT, DTYPE_CANNOT,
@@ -187,7 +190,7 @@
DTYPE_CANNOT, DTYPE_CANNOT, DTYPE_CANNOT, DTYPE_CANNOT,
DTYPE_CANNOT, DTYPE_CANNOT, DTYPE_CANNOT, DTYPE_CANNOT,
DTYPE_CANNOT, DTYPE_CANNOT, DTYPE_CANNOT, DTYPE_CANNOT,
- DTYPE_CANNOT},
+ DTYPE_CANNOT, DTYPE_CANNOT},
// dtype_byte
{DTYPE_CANNOT, DTYPE_CANNOT, DTYPE_CANNOT, DTYPE_CANNOT,
@@ -195,7 +198,7 @@
DTYPE_CANNOT, DTYPE_CANNOT, DTYPE_CANNOT, DTYPE_CANNOT,
DTYPE_CANNOT, DTYPE_CANNOT, DTYPE_CANNOT, DTYPE_CANNOT,
DTYPE_CANNOT, DTYPE_CANNOT, DTYPE_CANNOT, DTYPE_CANNOT,
- DTYPE_CANNOT},
+ DTYPE_CANNOT, DTYPE_CANNOT},
// dtype_short
{dtype_unknown, dtype_double, dtype_double, dtype_double,
@@ -203,7 +206,7 @@
dtype_int64, dtype_int64, DTYPE_CANNOT, dtype_double,
dtype_double, dtype_d_float, dtype_sql_date, dtype_sql_time,
dtype_timestamp, DTYPE_CANNOT, DTYPE_CANNOT, dtype_int64,
- DTYPE_CANNOT},
+ DTYPE_CANNOT, DTYPE_CANNOT},
// dtype_long
{dtype_unknown, dtype_double, dtype_double, dtype_double,
@@ -211,7 +214,7 @@
dtype_int64, dtype_int64, DTYPE_CANNOT, dtype_double,
dtype_double, dtype_d_float, dtype_sql_date, dtype_sql_time,
dtype_timestamp, DTYPE_CANNOT, DTYPE_CANNOT, dtype_int64,
- DTYPE_CANNOT},
+ DTYPE_CANNOT, DTYPE_CANNOT},
// dtype_quad
{DTYPE_CANNOT, DTYPE_CANNOT, DTYPE_CANNOT, DTYPE_CANNOT,
@@ -219,7 +222,7 @@
DTYPE_CANNOT, DTYPE_CANNOT, DTYPE_CANNOT, DTYPE_CANNOT,
DTYPE_CANNOT, DTYPE_CANNOT, DTYPE_CANNOT, DTYPE_CANNOT,
DTYPE_CANNOT, DTYPE_CANNOT, DTYPE_CANNOT, DTYPE_CANNOT,
- DTYPE_CANNOT},
+ DTYPE_CANNOT, DTYPE_CANNOT},
// dtype_real
{dtype_unknown, dtype_double, dtype_double, dtype_double,
@@ -227,7 +230,7 @@
dtype_double, dtype_double, DTYPE_CANNOT, dtype_double,
dtype_double, dtype_d_float, dtype_sql_date, dtype_sql_time,
dtype_timestamp, DTYPE_CANNOT, DTYPE_CANNOT, dtype_double,
- DTYPE_CANNOT},
+ DTYPE_CANNOT, DTYPE_CANNOT},
// dtype_double
{dtype_unknown, dtype_double, dtype_double, dtype_double,
@@ -235,7 +238,7 @@
dtype_double, dtype_double, DTYPE_CANNOT, dtype_double,
dtype_double, dtype_d_float, dtype_sql_date, dtype_sql_time,
dtype_timestamp, DTYPE_CANNOT, DTYPE_CANNOT, dtype_double,
- DTYPE_CANNOT},
+ DTYPE_CANNOT, DTYPE_CANNOT},
// dtype_d_float -- VMS deprecated
{dtype_unknown, dtype_d_float, dtype_d_float, dtype_d_float,
@@ -243,7 +246,7 @@
dtype_d_float, dtype_d_float, DTYPE_CANNOT, dtype_d_float,
dtype_d_float, dtype_d_float, dtype_sql_date, dtype_sql_time,
dtype_timestamp, DTYPE_CANNOT, DTYPE_CANNOT, dtype_d_float,
- DTYPE_CANNOT},
+ DTYPE_CANNOT, DTYPE_CANNOT},
// dtype_sql_date
{dtype_unknown, DTYPE_CANNOT, DTYPE_CANNOT, DTYPE_CANNOT,
@@ -251,7 +254,7 @@
dtype_sql_date, dtype_sql_date, DTYPE_CANNOT, dtype_sql_date,
dtype_sql_date, dtype_sql_date, DTYPE_CANNOT, dtype_timestamp,
DTYPE_CANNOT, DTYPE_CANNOT, DTYPE_CANNOT, dtype_sql_date,
- DTYPE_CANNOT},
+ DTYPE_CANNOT, DTYPE_CANNOT},
// dtype_sql_time
{dtype_unknown, DTYPE_CANNOT, DTYPE_CANNOT, DTYPE_CANNOT,
@@ -259,7 +262,7 @@
dtype_sql_time, dtype_sql_time, DTYPE_CANNOT, dtype_sql_time,
dtype_sql_time, dtype_sql_time, dtype_timestamp, DTYPE_CANNOT,
DTYPE_CANNOT, DTYPE_CANNOT, DTYPE_CANNOT, dtype_sql_time,
- DTYPE_CANNOT},
+ DTYPE_CANNOT, DTYPE_CANNOT},
// dtype_timestamp
{dtype_unknown, dtype_timestamp, dtype_timestamp, dtype_timestamp,
@@ -267,7 +270,7 @@
dtype_timestamp, dtype_timestamp, DTYPE_CANNOT, dtype_timestamp,
dtype_timestamp, dtype_timestamp, DTYPE_CANNOT, DTYPE_CANNOT,
DTYPE_CANNOT, DTYPE_CANNOT, DTYPE_CANNOT, dtype_timestamp,
- DTYPE_CANNOT},
+ DTYPE_CANNOT, DTYPE_CANNOT},
// dtype_blob
{DTYPE_CANNOT, DTYPE_CANNOT, DTYPE_CANNOT, DTYPE_CANNOT,
@@ -275,7 +278,7 @@
DTYPE_CANNOT, DTYPE_CANNOT, DTYPE_CANNOT, DTYPE_CANNOT,
DTYPE_CANNOT, DTYPE_CANNOT, DTYPE_CANNOT, DTYPE_CANNOT,
DTYPE_CANNOT, DTYPE_CANNOT, DTYPE_CANNOT, DTYPE_CANNOT,
- DTYPE_CANNOT},
+ DTYPE_CANNOT, DTYPE_CANNOT},
// dtype_array
{DTYPE_CANNOT, DTYPE_CANNOT, DTYPE_CANNOT, DTYPE_CANNOT,
@@ -283,7 +286,7 @@
DTYPE_CANNOT, DTYPE_CANNOT, DTYPE_CANNOT, DTYPE_CANNOT,
DTYPE_CANNOT, DTYPE_CANNOT, DTYPE_CANNOT, DTYPE_CANNOT,
DTYPE_CANNOT, DTYPE_CANNOT, DTYPE_CANNOT, DTYPE_CANNOT,
- DTYPE_CANNOT},
+ DTYPE_CANNOT, DTYPE_CANNOT},
// dtype_int64
{dtype_unknown, dtype_double, dtype_double, dtype_double,
@@ -291,7 +294,7 @@
dtype_int64, dtype_int64, DTYPE_CANNOT, dtype_double,
dtype_double, dtype_d_float, dtype_sql_date, dtype_sql_time,
dtype_timestamp, DTYPE_CANNOT, DTYPE_CANNOT, dtype_int64,
- DTYPE_CANNOT},
+ DTYPE_CANNOT, DTYPE_CANNOT},
// dtype_dbkey
{DTYPE_CANNOT, DTYPE_CANNOT, DTYPE_CANNOT, DTYPE_CANNOT,
@@ -299,8 +302,16 @@
DTYPE_CANNOT, DTYPE_CANNOT, DTYPE_CANNOT, DTYPE_CANNOT,
DTYPE_CANNOT, DTYPE_CANNOT, DTYPE_CANNOT, DTYPE_CANNOT,
DTYPE_CANNOT, DTYPE_CANNOT, DTYPE_CANNOT, DTYPE_CANNOT,
- DTYPE_CANNOT}
+ DTYPE_CANNOT, DTYPE_CANNOT},
+ // dtype_boolean
+ {DTYPE_CANNOT, DTYPE_CANNOT, DTYPE_CANNOT, DTYPE_CANNOT,
+ DTYPE_CANNOT, DTYPE_CANNOT, DTYPE_CANNOT, DTYPE_CANNOT,
+ DTYPE_CANNOT, DTYPE_CANNOT, DTYPE_CANNOT, DTYPE_CANNOT,
+ DTYPE_CANNOT, DTYPE_CANNOT, DTYPE_CANNOT, DTYPE_CANNOT,
+ DTYPE_CANNOT, DTYPE_CANNOT, DTYPE_CANNOT, DTYPE_CANNOT,
+ DTYPE_CANNOT, DTYPE_CANNOT}
+
};
/* The result of subtracting two datatypes in blr_version5 semantics
@@ -317,7 +328,7 @@
dtype_short dtype_long dtype_quad dtype_real
dtype_double dtype_d_float dtype_sql_date dtype_sql_time
dtype_timestamp dtype_blob dtype_array dtype_int64
- dtype_dbkey
+ dtype_dbkey, dtype_boolean
*/
// dtype_unknown
@@ -326,7 +337,7 @@
dtype_unknown, dtype_unknown, DTYPE_CANNOT, dtype_unknown,
dtype_unknown, dtype_unknown, dtype_unknown, dtype_unknown,
dtype_unknown, DTYPE_CANNOT, DTYPE_CANNOT, dtype_unknown,
- DTYPE_CANNOT},
+ DTYPE_CANNOT, DTYPE_CANNOT},
// dtype_text
{dtype_unknown, dtype_double, dtype_double, dtype_double,
@@ -334,7 +345,7 @@
dtype_double, dtype_double, DTYPE_CANNOT, dtype_double,
dtype_double, dtype_d_float, DTYPE_CANNOT, DTYPE_CANNOT,
dtype_timestamp, DTYPE_CANNOT, DTYPE_CANNOT, dtype_double,
- DTYPE_CANNOT},
+ DTYPE_CANNOT, DTYPE_CANNOT},
// dtype_cstring
{dtype_unknown, dtype_double, dtype_double, dtype_double,
@@ -342,7 +353,7 @@
dtype_double, dtype_double, DTYPE_CANNOT, dtype_double,
dtype_double, dtype_d_float, DTYPE_CANNOT, DTYPE_CANNOT,
dtype_timestamp, DTYPE_CANNOT, DTYPE_CANNOT, dtype_double,
- DTYPE_CANNOT},
+ DTYPE_CANNOT, DTYPE_CANNOT},
// dtype_varying
{dtype_unknown, dtype_double, dtype_double, dtype_double,
@@ -350,7 +361,7 @@
dtype_double, dtype_double, DTYPE_CANNOT, dtype_double,
dtype_double, dtype_d_float, DTYPE_CANNOT, DTYPE_CANNOT,
dtype_timestamp, DTYPE_CANNOT, DTYPE_CANNOT, dtype_double,
- DTYPE_CANNOT},
+ DTYPE_CANNOT, DTYPE_CANNOT},
// 4 (unused)
{DTYPE_CANNOT, DTYPE_CANNOT, DTYPE_CANNOT, DTYPE_CANNOT,
@@ -358,7 +369,7 @@
DTYPE_CANNOT, DTYPE_CANNOT, DTYPE_CANNOT, DTYPE_CANNOT,
DTYPE_CANNOT, DTYPE_CANNOT, DTYPE_CANNOT, DTYPE_CANNOT,
DTYPE_CANNOT, DTYPE_CANNOT, DTYPE_CANNOT, DTYPE_CANNOT,
- DTYPE_CANNOT},
+ DTYPE_CANNOT, DTYPE_CANNOT},
// 5 (unused)
{DTYPE_CANNOT, DTYPE_CANNOT, DTYPE_CANNOT, DTYPE_CANNOT,
@@ -366,7 +377,7 @@
DTYPE_CANNOT, DTYPE_CANNOT, DTYPE_CANNOT, DTYPE_CANNOT,
DTYPE_CANNOT, DTYPE_CANNOT, DTYPE_CANNOT, DTYPE_CANNOT,
DTYPE_CANNOT, DTYPE_CANNOT, DTYPE_CANNOT, DTYPE_CANNOT,
- DTYPE_CANNOT},
+ DTYPE_CANNOT, DTYPE_CANNOT},
// dtype_packed
{DTYPE_CANNOT, DTYPE_CANNOT, DTYPE_CANNOT, DTYPE_CANNOT,
@@ -374,7 +385,7 @@
DTYPE_CANNOT, DTYPE_CANNOT, DTYPE_CANNOT, DTYPE_CANNOT,
DTYPE_CANNOT, DTYPE_CANNOT, DTYPE_CANNOT, DTYPE_CANNOT,
DTYPE_CANNOT, DTYPE_CANNOT, DTYPE_CANNOT, DTYPE_CANNOT,
- DTYPE_CANNOT},
+ DTYPE_CANNOT, DTYPE_CANNOT},
// dtype_byte
{DTYPE_CANNOT, DTYPE_CANNOT, DTYPE_CANNOT, DTYPE_CANNOT,
@@ -382,7 +393,7 @@
DTYPE_CANNOT, DTYPE_CANNOT, DTYPE_CANNOT, DTYPE_CANNOT,
DTYPE_CANNOT, DTYPE_CANNOT, DTYPE_CANNOT, DTYPE_CANNOT,
DTYPE_CANNOT, DTYPE_CANNOT, DTYPE_CANNOT, DTYPE_CANNOT,
- DTYPE_CANNOT},
+ DTYPE_CANNOT, DTYPE_CANNOT},
// dtype_short
{dtype_unknown, dtype_double, dtype_double, dtype_double,
@@ -390,7 +401,7 @@
dtype_int64, dtype_int64, DTYPE_CANNOT, dtype_double,
dtype_double, dtype_d_float, DTYPE_CANNOT, DTYPE_CANNOT,
DTYPE_CANNOT, DTYPE_CANNOT, DTYPE_CANNOT, dtype_int64,
- DTYPE_CANNOT},
+ DTYPE_CANNOT, DTYPE_CANNOT},
// dtype_long
{dtype_unknown, dtype_double, dtype_double, dtype_double,
@@ -398,7 +409,7 @@
dtype_int64, dtype_int64, DTYPE_CANNOT, dtype_double,
dtype_double, dtype_d_float, DTYPE_CANNOT, DTYPE_CANNOT,
DTYPE_CANNOT, DTYPE_CANNOT, DTYPE_CANNOT, dtype_int64,
- DTYPE_CANNOT},
+ DTYPE_CANNOT, DTYPE_CANNOT},
// dtype_quad
{DTYPE_CANNOT, DTYPE_CANNOT, DTYPE_CANNOT, DTYPE_CANNOT,
@@ -406,7 +417,7 @@
DTYPE_CANNOT, DTYPE_CANNOT, DTYPE_CANNOT, DTYPE_CANNOT,
DTYPE_CANNOT, DTYPE_CANNOT, DTYPE_CANNOT, DTYPE_CANNOT,
DTYPE_CANNOT, DTYPE_CANNOT, DTYPE_CANNOT, DTYPE_CANNOT,
- DTYPE_CANNOT},
+ DTYPE_CANNOT, DTYPE_CANNOT},
// dtype_real
{dtype_unknown, dtype_double, dtype_double, dtype_double,
@@ -414,7 +425,7 @@
dtype_double, dtype_double, DTYPE_CANNOT, dtype_double,
dtype_double, dtype_d_float, DTYPE_CANNOT, DTYPE_CANNOT,
DTYPE_CANNOT, DTYPE_CANNOT, DTYPE_CANNOT, dtype_double,
- DTYPE_CANNOT},
+ DTYPE_CANNOT, DTYPE_CANNOT},
// dtype_double
{dtype_unknown, dtype_double, dtype_double, dtype_double,
@@ -422,7 +433,7 @@
dtype_double, dtype_double, DTYPE_CANNOT, dtype_double,
dtype_double, dtype_d_float, DTYPE_CANNOT, DTYPE_CANNOT,
DTYPE_CANNOT, DTYPE_CANNOT, DTYPE_CANNOT, dtype_double,
- DTYPE_CANNOT},
+ DTYPE_CANNOT, DTYPE_CANNOT},
// dtype_d_float -- VMS deprecated
{dtype_unknown, dtype_d_float, dtype_d_float, dtype_d_float,
@@ -430,7 +441,7 @@
dtype_d_float, dtype_d_float, DTYPE_CANNOT, dtype_d_float,
dtype_d_float, dtype_d_float, DTYPE_CANNOT, DTYPE_CANNOT,
DTYPE_CANNOT, DTYPE_CANNOT, DTYPE_CANNOT, dtype_d_float,
- DTYPE_CANNOT},
+ DTYPE_CANNOT, DTYPE_CANNOT},
// dtype_sql_date
{dtype_unknown, DTYPE_CANNOT, DTYPE_CANNOT, DTYPE_CANNOT,
@@ -438,7 +449,7 @@
dtype_sql_date, dtype_sql_date, DTYPE_CANNOT, dtype_sql_date,
dtype_sql_date, dtype_sql_date, dtype_long, DTYPE_CANNOT,
DTYPE_CANNOT, DTYPE_CANNOT, DTYPE_CANNOT, dtype_sql_date,
- DTYPE_CANNOT},
+ DTYPE_CANNOT, DTYPE_CANNOT},
// dtype_sql_time
{dtype_unknown, DTYPE_CANNOT, DTYPE_CANNOT, DTYPE_CANNOT,
@@ -446,7 +457,7 @@
dtype_sql_time, dtype_sql_time, DTYPE_CANNOT, dtype_sql_time,
dtype_sql_time, dtype_sql_time, DTYPE_CANNOT, dtype_long,
DTYPE_CANNOT, DTYPE_CANNOT, DTYPE_CANNOT, dtype_sql_time,
- DTYPE_CANNOT},
+ DTYPE_CANNOT, DTYPE_CANNOT},
// dtype_timestamp
{dtype_unknown, dtype_timestamp, dtype_timestamp, dtype_timestamp,
@@ -454,7 +465,7 @@
dtype_timestamp, dtype_timestamp, DTYPE_CANNOT, dtype_timestamp,
dtype_timestamp, dtype_timestamp, DTYPE_CANNOT, DTYPE_CANNOT,
dtype_double, DTYPE_CANNOT, DTYPE_CANNOT, dtype_timestamp,
- DTYPE_CANNOT},
+ DTYPE_CANNOT, DTYPE_CANNOT},
// dtype_blob
{DTYPE_CANNOT, DTYPE_CANNOT, DTYPE_CANNOT, DTYPE_CANNOT,
@@ -462,7 +473,7 @@
DTYPE_CANNOT, DTYPE_CANNOT, DTYPE_CANNOT, DTYPE_CANNOT,
DTYPE_CANNOT, DTYPE_CANNOT, DTYPE_CANNOT, DTYPE_CANNOT,
DTYPE_CANNOT, DTYPE_CANNOT, DTYPE_CANNOT, DTYPE_CANNOT,
- DTYPE_CANNOT},
+ DTYPE_CANNOT, DTYPE_CANNOT},
// dtype_array
{DTYPE_CANNOT, DTYPE_CANNOT, DTYPE_CANNOT, DTYPE_CANNOT,
@@ -470,7 +481,7 @@
DTYPE_CANNOT, DTYPE_CANNOT, DTYPE_CANNOT, DTYPE_CANNOT,
DTYPE_CANNOT, DTYPE_CANNOT, DTYPE_CANNOT, DTYPE_CANNOT,
DTYPE_CANNOT, DTYPE_CANNOT, DTYPE_CANNOT, DTYPE_CANNOT,
- DTYPE_CANNOT},
+ DTYPE_CANNOT, DTYPE_CANNOT},
// dtype_int64
{dtype_unknown, dtype_double, dtype_double, dtype_double,
@@ -478,7 +489,7 @@
dtype_int64, dtype_int64, DTYPE_CANNOT, dtype_double,
dtype_double, dtype_d_float, DTYPE_CANNOT, DTYPE_CANNOT,
DTYPE_CANNOT, DTYPE_CANNOT, DTYPE_CANNOT, dtype_int64,
- DTYPE_CANNOT},
+ DTYPE_CANNOT, DTYPE_CANNOT},
// dtype_dbkey
{DTYPE_CANNOT, DTYPE_CANNOT, DTYPE_CANNOT, DTYPE_CANNOT,
@@ -486,7 +497,15 @@
DTYPE_CANNOT, DTYPE_CANNOT, DTYPE_CANNOT, DTYPE_CANNOT,
DTYPE_CANNOT, DTYPE_CANNOT, DTYPE_CANNOT, DTYPE_CANNOT,
DTYPE_CANNOT, DTYPE_CANNOT, DTYPE_CANNOT, DTYPE_CANNOT,
- DTYPE_CANNOT}
+ DTYPE_CANNOT, DTYPE_CANNOT},
+
+ // dtype_boolean
+ {DTYPE_CANNOT, DTYPE_CANNOT, DTYPE_CANNOT, DTYPE_CANNOT,
+ DTYPE_CANNOT, DTYPE_CANNOT, DTYPE_CANNOT, DTYPE_CANNOT,
+ DTYPE_CANNOT, DTYPE_CANNOT, DTYPE_CANNOT, DTYPE_CANNOT,
+ DTYPE_CANNOT, DTYPE_CANNOT, DTYPE_CANNOT, DTYPE_CANNOT,
+ DTYPE_CANNOT, DTYPE_CANNOT, DTYPE_CANNOT, DTYPE_CANNOT,
+ DTYPE_CANNOT, DTYPE_CANNOT}
};
@@ -504,7 +523,7 @@
dtype_short dtype_long dtype_quad dtype_real
dtype_double dtype_d_float dtype_sql_date dtype_sql_time
dtype_timestamp dtype_blob dtype_array dtype_int64
- dtype_dbkey
+ dtype_dbkey, dtype_boolean
*/
// dtype_unknown
@@ -513,7 +532,7 @@
dtype_unknown, dtype_unknown, DTYPE_CANNOT, dtype_unknown,
dtype_unknown, dtype_unknown, DTYPE_CANNOT, DTYPE_CANNOT,
DTYPE_CANNOT, DTYPE_CANNOT, DTYPE_CANNOT, dtype_unknown,
- DTYPE_CANNOT},
+ DTYPE_CANNOT, DTYPE_CANNOT},
// dtype_text
{dtype_unknown, dtype_double, dtype_double, dtype_double,
@@ -521,7 +540,7 @@
dtype_double, dtype_double, DTYPE_CANNOT, dtype_double,
dtype_double, dtype_d_float, DTYPE_CANNOT, DTYPE_CANNOT,
DTYPE_CANNOT, DTYPE_CANNOT, DTYPE_CANNOT, dtype_double,
- DTYPE_CANNOT},
+ DTYPE_CANNOT, DTYPE_CANNOT},
// dtype_cstring
{dtype_unknown, dtype_double, dtype_double, dtype_double,
@@ -529,7 +548,7 @@
dtype_double, dtype_double, DTYPE_CANNOT, dtype_double,
dtype_double, dtype_d_float, DTYPE_CANNOT, DTYPE_CANNOT,
DTYPE_CANNOT, DTYPE_CANNOT, DTYPE_CANNOT, dtype_double,
- DTYPE_CANNOT},
+ DTYPE_CANNOT, DTYPE_CANNOT},
// dtype_varying
{dtype_unknown, dtype_double, dtype_double, dtype_double,
@@ -537,7 +556,7 @@
dtype_double, dtype_double, DTYPE_CANNOT, dtype_double,
dtype_double, dtype_d_float, DTYPE_CANNOT, DTYPE_CANNOT,
DTYPE_CANNOT, DTYPE_CANNOT, DTYPE_CANNOT, dtype_double,
- DTYPE_CANNOT},
+ DTYPE_CANNOT, DTYPE_CANNOT},
// 4 (unused)
{DTYPE_CANNOT, DTYPE_CANNOT, DTYPE_CANNOT, DTYPE_CANNOT,
@@ -545,7 +564,7 @@
DTYPE_CANNOT, DTYPE_CANNOT, DTYPE_CANNOT, DTYPE_CANNOT,
DTYPE_CANNOT, DTYPE_CANNOT, DTYPE_CANNOT, DTYPE_CANNOT,
DTYPE_CANNOT, DTYPE_CANNOT, DTYPE_CANNOT, DTYPE_CANNOT,
- DTYPE_CANNOT},
+ DTYPE_CANNOT, DTYPE_CANNOT},
// 5 (unused)
{DTYPE_CANNOT, DTYPE_CANNOT, DTYPE_CANNOT, DTYPE_CANNOT,
@@ -553,7 +572,7 @@
DTYPE_CANNOT, DTYPE_CANNOT, DTYPE_CANNOT, DTYPE_CANNOT,
DTYPE_CANNOT, DTYPE_CANNOT, DTYPE_CANNOT, DTYPE_CANNOT,
DTYPE_CANNOT, DTYPE_CANNOT, DTYPE_CANNOT, DTYPE_CANNOT,
- DTYPE_CANNOT},
+ DTYPE_CANNOT, DTYPE_CANNOT},
// dtype_packed
{DTYPE_CANNOT, DTYPE_CANNOT, DTYPE_CANNOT, DTYPE_CANNOT,
@@ -561,7 +580,7 @@
DTYPE_CANNOT, DTYPE_CANNOT, DTYPE_CANNOT, DTYPE_CANNOT,
DTYPE_CANNOT, DTYPE_CANNOT, DTYPE_CANNOT, DTYPE_CANNOT,
DTYPE_CANNOT, DTYPE_CANNOT, DTYPE_CANNOT, DTYPE_CANNOT,
- DTYPE_CANNOT},
+ DTYPE_CANNOT, DTYPE_CANNOT},
// dtype_byte
{DTYPE_CANNOT, DTYPE_CANNOT, DTYPE_CANNOT, DTYPE_CANNOT,
@@ -569,7 +588,7 @@
DTYPE_CANNOT, DTYPE_CANNOT, DTYPE_CANNOT, DTYPE_CANNOT,
DTYPE_CANNOT, DTYPE_CANNOT, DTYPE_CANNOT, DTYPE_CANNOT,
DTYPE_CANNOT, DTYPE_CANNOT, DTYPE_CANNOT, DTYPE_CANNOT,
- DTYPE_CANNOT},
+ DTYPE_CANNOT, DTYPE_CANNOT},
// dtype_short
{dtype_unknown, dtype_double, dtype_double, dtype_double,
@@ -577,7 +596,7 @@
dtype_int64, dtype_int64, DTYPE_CANNOT, dtype_double,
dtype_double, dtype_d_float, DTYPE_CANNOT, DTYPE_CANNOT,
DTYPE_CANNOT, DTYPE_CANNOT, DTYPE_CANNOT, dtype_int64,
- DTYPE_CANNOT},
+ DTYPE_CANNOT, DTYPE_CANNOT},
// dtype_long
{dtype_unknown, dtype_double, dtype_double, dtype_double,
@@ -585,7 +604,7 @@
dtype_int64, dtype_int64, DTYPE_CANNOT, dtype_double,
dtype_double, dtype_d_float, DTYPE_CANNOT, DTYPE_CANNOT,
DTYPE_CANNOT, DTYPE_CANNOT, DTYPE_CANNOT, dtype_int64,
- DTYPE_CANNOT},
+ DTYPE_CANNOT, DTYPE_CANNOT},
// dtype_quad
{DTYPE_CANNOT, DTYPE_CANNOT, DTYPE_CANNOT, DTYPE_CANNOT,
@@ -593,7 +612,7 @@
DTYPE_CANNOT, DTYPE_CANNOT, DTYPE_CANNOT, DTYPE_CANNOT,
DTYPE_CANNOT, DTYPE_CANNOT, DTYPE_CANNOT, DTYPE_CANNOT,
DTYPE_CANNOT, DTYPE_CANNOT, DTYPE_CANNOT, DTYPE_CANNOT,
- DTYPE_CANNOT},
+ DTYPE_CANNOT, DTYPE_CANNOT},
// dtype_real
{dtype_unknown, dtype_double, dtype_double, dtype_double,
@@ -601,7 +620,7 @@
dtype_double, dtype_double, DTYPE_CANNOT, dtype_double,
dtype_double, dtype_d_float, DTYPE_CANNOT, DTYPE_CANNOT,
DTYPE_CANNOT, DTYPE_CANNOT, DTYPE_CANNOT, dtype_double,
- DTYPE_CANNOT},
+ DTYPE_CANNOT, DTYPE_CANNOT},
// dtype_double
{dtype_unknown, dtype_double, dtype_double, dtype_double,
@@ -609,7 +628,7 @@
dtype_double, dtype_double, DTYPE_CANNOT, dtype_double,
dtype_double, dtype_d_float, DTYPE_CANNOT, DTYPE_CANNOT,
DTYPE_CANNOT, DTYPE_CANNOT, DTYPE_CANNOT, dtype_double,
- DTYPE_CANNOT},
+ DTYPE_CANNOT, DTYPE_CANNOT},
// dtype_d_float -- VMS deprecated
{dtype_unknown, dtype_d_float, dtype_d_float, dtype_d_float,
@@ -617,7 +636,7 @@
dtype_d_float, dtype_d_float, DTYPE_CANNOT, dtype_d_float,
dtype_d_float, dtype_d_float, DTYPE_CANNOT, DTYPE_CANNOT,
DTYPE_CANNOT, DTYPE_CANNOT, DTYPE_CANNOT, dtype_d_float,
- DTYPE_CANNOT},
+ DTYPE_CANNOT, DTYPE_CANNOT},
// dtype_sql_date
{DTYPE_CANNOT, DTYPE_CANNOT, DTYPE_CANNOT, DTYPE_CANNOT,
@@ -625,7 +644,7 @@
DTYPE_CANNOT, DTYPE_CANNOT, DTYPE_CANNOT, DTYPE_CANNOT,
DTYPE_CANNOT, DTYPE_CANNOT, DTYPE_CANNOT, DTYPE_CANNOT,
DTYPE_CANNOT, DTYPE_CANNOT, DTYPE_CANNOT, DTYPE_CANNOT,
- DTYPE_CANNOT},
+ DTYPE_CANNOT, DTYPE_CANNOT},
// dtype_sql_time
{DTYPE_CANNOT, DTYPE_CANNOT, DTYPE_CANNOT, DTYPE_CANNOT,
@@ -633,7 +652,7 @@
DTYPE_CANNOT, DTYPE_CANNOT, DTYPE_CANNOT, DTYPE_CANNOT,
DTYPE_CANNOT, DTYPE_CANNOT, DTYPE_CANNOT, DTYPE_CANNOT,
DTYPE_CANNOT, DTYPE_CANNOT, DTYPE_CANNOT, DTYPE_CANNOT,
- DTYPE_CANNOT},
+ DTYPE_CANNOT, DTYPE_CANNOT},
// dtype_timestamp
{DTYPE_CANNOT, DTYPE_CANNOT, DTYPE_CANNOT, DTYPE_CANNOT,
@@ -641,7 +660,7 @@
DTYPE_CANNOT, DTYPE_CANNOT, DTYPE_CANNOT, DTYPE_CANNOT,
DTYPE_CANNOT, DTYPE_CANNOT, DTYPE_CANNOT, DTYPE_CANNOT,
DTYPE_CANNOT, DTYPE_CANNOT, DTYPE_CANNOT, DTYPE_CANNOT,
- DTYPE_CANNOT},
+ DTYPE_CANNOT, DTYPE_CANNOT},
// dtype_blob
{DTYPE_CANNOT, DTYPE_CANNOT, DTYPE_CANNOT, DTYPE_CANNOT,
@@ -649,7 +668,7 @@
DTYPE_CANNOT, DTYPE_CANNOT, DTYPE_CANNOT, DTYPE_CANNOT,
DTYPE_CANNOT, DTYPE_CANNOT, DTYPE_CANNOT, DTYPE_CANNOT,
DTYPE_CANNOT, DTYPE_CANNOT, DTYPE_CANNOT, DTYPE_CANNOT,
- DTYPE_CANNOT},
+ DTYPE_CANNOT, DTYPE_CANNOT},
// dtype_array
{DTYPE_CANNOT, DTYPE_CANNOT, DTYPE_CANNOT, DTYPE_CANNOT,
@@ -657,7 +676,7 @@
DTYPE_CANNOT, DTYPE_CANNOT, DTYPE_CANNOT, DTYPE_CANNOT,
DTYPE_CANNOT, DTYPE_CANNOT, DTYPE_CANNOT, DTYPE_CANNOT,
DTYPE_CANNOT, DTYPE_CANNOT, DTYPE_CANNOT, DTYPE_CANNOT,
- DTYPE_CANNOT},
+ DTYPE_CANNOT, DTYPE_CANNOT},
// dtype_int64
{dtype_unknown, dtype_double, dtype_double, dtype_double,
@@ -665,7 +684,7 @@
dtype_int64, dtype_int64, DTYPE_CANNOT, dtype_double,
dtype_double, dtype_d_float, DTYPE_CANNOT, DTYPE_CANNOT,
DTYPE_CANNOT, DTYPE_CANNOT, DTYPE_CANNOT, dtype_int64,
- DTYPE_CANNOT},
+ DTYPE_CANNOT, DTYPE_CANNOT},
// dtype_dbkey
{DTYPE_CANNOT, DTYPE_CANNOT, DTYPE_CANNOT, DTYPE_CANNOT,
@@ -673,8 +692,16 @@
DTYPE_CANNOT, DTYPE_CANNOT, DTYPE_CANNOT, DTYPE_CANNOT,
DTYPE_CANNOT, DTYPE_CANNOT, DTYPE_CANNOT, DTYPE_CANNOT,
DTYPE_CANNOT, DTYPE_CANNOT, DTYPE_CANNOT, DTYPE_CANNOT,
- DTYPE_CANNOT}
+ DTYPE_CANNOT, DTYPE_CANNOT},
+ // dtype_boolean
+ {DTYPE_CANNOT, DTYPE_CANNOT, DTYPE_CANNOT, DTYPE_CANNOT,
+ DTYPE_CANNOT, DTYPE_CANNOT, DTYPE_CANNOT, DTYPE_CANNOT,
+ DTYPE_CANNOT, DTYPE_CANNOT, DTYPE_CANNOT, DTYPE_CANNOT,
+ DTYPE_CANNOT, DTYPE_CANNOT, DTYPE_CANNOT, DTYPE_CANNOT,
+ DTYPE_CANNOT, DTYPE_CANNOT, DTYPE_CANNOT, DTYPE_CANNOT,
+ DTYPE_CANNOT, DTYPE_CANNOT}
+
};
/* The result of multiplying two datatypes in blr_version4 semantics.
@@ -691,7 +718,7 @@
dtype_short dtype_long dtype_quad dtype_real
dtype_double dtype_d_float dtype_sql_date dtype_sql_time
dtype_timestamp dtype_blob dtype_array dtype_int64
- dtype_dbkey
+ dtype_dbkey, dtype_boolean
*/
// dtype_unknown
@@ -700,7 +727,7 @@
dtype_unknown, dtype_unknown, DTYPE_CANNOT, dtype_unknown,
dtype_unknown, dtype_unknown, DTYPE_CANNOT, DTYPE_CANNOT,
DTYPE_CANNOT, DTYPE_CANNOT, DTYPE_CANNOT, dtype_unknown,
- DTYPE_CANNOT},
+ DTYPE_CANNOT, DTYPE_CANNOT},
// dtype_text
{dtype_unknown, dtype_double, dtype_double, dtype_double,
@@ -708,7 +735,7 @@
dtype_double, dtype_double, DTYPE_CANNOT, dtype_double,
dtype_double, dtype_d_float, DTYPE_CANNOT, DTYPE_CANNOT,
DTYPE_CANNOT, DTYPE_CANNOT, DTYPE_CANNOT, dtype_double,
- DTYPE_CANNOT},
+ DTYPE_CANNOT, DTYPE_CANNOT},
// dtype_cstring
{dtype_unknown, dtype_double, dtype_double, dtype_double,
@@ -716,7 +743,7 @@
dtype_double, dtype_double, DTYPE_CANNOT, dtype_double,
dtype_double, dtype_d_float, DTYPE_CANNOT, DTYPE_CANNOT,
DTYPE_CANNOT, DTYPE_CANNOT, DTYPE_CANNOT, dtype_double,
- DTYPE_CANNOT},
+ DTYPE_CANNOT, DTYPE_CANNOT},
// dtype_varying
{dtype_unknown, dtype_double, dtype_double, dtype_double,
@@ -724,7 +751,7 @@
dtype_double, dtype_double, DTYPE_CANNOT, dtype_double,
dtype_double, dtype_d_float, DTYPE_CANNOT, DTYPE_CANNOT,
DTYPE_CANNOT, DTYPE_CANNOT, DTYPE_CANNOT, dtype_double,
- DTYPE_CANNOT},
+ DTYPE_CANNOT, DTYPE_CANNOT},
// 4 (unused)
{DTYPE_CANNOT, DTYPE_CANNOT, DTYPE_CANNOT, DTYPE_CANNOT,
@@ -732,7 +759,7 @@
DTYPE_CANNOT, DTYPE_CANNOT, DTYPE_CANNOT, DTYPE_CANNOT,
DTYPE_CANNOT, DTYPE_CANNOT, DTYPE_CANNOT, DTYPE_CANNOT,
DTYPE_CANNOT, DTYPE_CANNOT, DTYPE_CANNOT, DTYPE_CANNOT,
- DTYPE_CANNOT},
+ DTYPE_CANNOT, DTYPE_CANNOT},
// 5 (unused)
{DTYPE_CANNOT, DTYPE_CANNOT, DTYPE_CANNOT, DTYPE_CANNOT,
@@ -740,7 +767,7 @@
DTYPE_CANNOT, DTYPE_CANNOT, DTYPE_CANNOT, DTYPE_CANNOT,
DTYPE_CANNOT, DTYPE_CANNOT, DTYPE_CANNOT, DTYPE_CANNOT,
DTYPE_CANNOT, DTYPE_CANNOT, DTYPE_CANNOT, DTYPE_CANNOT,
- DTYPE_CANNOT},
+ DTYPE_CANNOT, DTYPE_CANNOT},
// dtype_packed
{DTYPE_CANNOT, DTYPE_CANNOT, DTYPE_CANNOT, DTYPE_CANNOT,
@@ -748,7 +775,7 @@
DTYPE_CANNOT, DTYPE_CANNOT, DTYPE_CANNOT, DTYPE_CANNOT,
DTYPE_CANNOT, DTYPE_CANNOT, DTYPE_CANNOT, DTYPE_CANNOT,
DTYPE_CANNOT, DTYPE_CANNOT, DTYPE_CANNOT, DTYPE_CANNOT,
- DTYPE_CANNOT},
+ DTYPE_CANNOT, DTYPE_CANNOT},
// dtype_byte
{DTYPE_CANNOT, DTYPE_CANNOT, DTYPE_CANNOT, DTYPE_CANNOT,
@@ -756,7 +783,7 @@
DTYPE_CANNOT, DTYPE_CANNOT, DTYPE_CANNOT, DTYPE_CANNOT,
DTYPE_CANNOT, DTYPE_CANNOT, DTYPE_CANNOT, DTYPE_CANNOT,
DTYPE_CANNOT, DTYPE_CANNOT, DTYPE_CANNOT, DTYPE_CANNOT,
- DTYPE_CANNOT},
+ DTYPE_CANNOT, DTYPE_CANNOT},
// dtype_short
{dtype_unknown, dtype_double, dtype_double, dtype_double,
@@ -764,7 +791,7 @@
dtype_long, dtype_long, DTYPE_CANNOT, dtype_double,
dtype_double, dtype_d_float, DTYPE_CANNOT, DTYPE_CANNOT,
DTYPE_CANNOT, DTYPE_CANNOT, DTYPE_CANNOT, dtype_double,
- DTYPE_CANNOT},
+ DTYPE_CANNOT, DTYPE_CANNOT},
// dtype_long
{dtype_unknown, dtype_double, dtype_double, dtype_double,
@@ -772,7 +799,7 @@
dtype_long, dtype_long, DTYPE_CANNOT, dtype_double,
dtype_double, dtype_d_float, DTYPE_CANNOT, DTYPE_CANNOT,
DTYPE_CANNOT, DTYPE_CANNOT, DTYPE_CANNOT, dtype_double,
- DTYPE_CANNOT},
+ DTYPE_CANNOT, DTYPE_CANNOT},
// dtype_quad
{DTYPE_CANNOT, DTYPE_CANNOT, DTYPE_CANNOT, DTYPE_CANNOT,
@@ -780,7 +807,7 @@
DTYPE_CANNOT, DTYPE_CANNOT, DTYPE_CANNOT, DTYPE_CANNOT,
DTYPE_CANNOT, DTYPE_CANNOT, DTYPE_CANNOT, DTYPE_CANNOT,
DTYPE_CANNOT, DTYPE_CANNOT, DTYPE_CANNOT, DTYPE_CANNOT,
- DTYPE_CANNOT},
+ DTYPE_CANNOT, DTYPE_CANNOT},
// dtype_real
{dtype_unknown, dtype_double, dtype_double, dtype_double,
@@ -788,7 +815,7 @@
dtype_double, dtype_double, DTYPE_CANNOT, dtype_double,
dtype_double, dtype_d_float, DTYPE_CANNOT, DTYPE_CANNOT,
DTYPE_CANNOT, DTYPE_CANNOT, DTYPE_CANNOT, dtype_double,
- DTYPE_CANNOT},
+ DTYPE_CANNOT, DTYPE_CANNOT},
// dtype_double
{dtype_unknown, dtype_double, dtype_double, dtype_double,
@@ -796,7 +823,7 @@
dtype_double, dtype_double, DTYPE_CANNOT, dtype_double,
dtype_double, dtype_d_float, DTYPE_CANNOT, DTYPE_CANNOT,
DTYPE_CANNOT, DTYPE_CANNOT, DTYPE_CANNOT, dtype_double,
- DTYPE_CANNOT},
+ DTYPE_CANNOT, DTYPE_CANNOT},
// dtype_d_float -- VMS deprecated
{dtype_unknown, dtype_d_float, dtype_d_float, dtype_d_float,
@@ -804,7 +831,7 @@
dtype_d_float, dtype_d_float, DTYPE_CANNOT, dtype_d_float,
dtype_d_float, dtype_d_float, DTYPE_CANNOT, DTYPE_CANNOT,
DTYPE_CANNOT, DTYPE_CANNOT, DTYPE_CANNOT, dtype_d_float,
- DTYPE_CANNOT},
+ DTYPE_CANNOT, DTYPE_CANNOT},
// dtype_sql_date
{DTYPE_CANNOT, DTYPE_CANNOT, DTYPE_CANNOT, DTYPE_CANNOT,
@@ -812,7 +839,7 @@
DTYPE_CANNOT, DTYPE_CANNOT, DTYPE_CANNOT, DTYPE_CANNOT,
DTYPE_CANNOT, DTYPE_CANNOT, DTYPE_CANNOT, DTYPE_CANNOT,
DTYPE_CANNOT, DTYPE_CANNOT, DTYPE_CANNOT, DTYPE_CANNOT,
- DTYPE_CANNOT},
+ DTYPE_CANNOT, DTYPE_CANNOT},
// dtype_sql_time
{DTYPE_CANNOT, DTYPE_CANNOT, DTYPE_CANNOT, DTYPE_CANNOT,
@@ -820,7 +847,7 @@
DTYPE_CANNOT, DTYPE_CANNOT, DTYPE_CANNOT, DTYPE_CANNOT,
DTYPE_CANNOT, DTYPE_CANNOT, DTYPE_CANNOT, DTYPE_CANNOT,
DTYPE_CANNOT, DTYPE_CANNOT, DTYPE_CANNOT, DTYPE_CANNOT,
- DTYPE_CANNOT},
+ DTYPE_CANNOT, DTYPE_CANNOT},
// dtype_timestamp
{DTYPE_CANNOT, DTYPE_CANNOT, DTYPE_CANNOT, DTYPE_CANNOT,
@@ -828,7 +855,7 @@
DTYPE_CANNOT, DTYPE_CANNOT, DTYPE_CANNOT, DTYPE_CANNOT,
DTYPE_CANNOT, DTYPE_CANNOT, DTYPE_CANNOT, DTYPE_CANNOT,
DTYPE_CANNOT, DTYPE_CANNOT, DTYPE_CANNOT, DTYPE_CANNOT,
- DTYPE_CANNOT},
+ DTYPE_CANNOT, DTYPE_CANNOT},
// dtype_blob
{DTYPE_CANNOT, DTYPE_CANNOT, DTYPE_CANNOT, DTYPE_CANNOT,
@@ -836,7 +863,7 @@
DTYPE_CANNOT, DTYPE_CANNOT, DTYPE_CANNOT, DTYPE_CANNOT,
DTYPE_CANNOT, DTYPE_CANNOT, DTYPE_CANNOT, DTYPE_CANNOT,
DTYPE_CANNOT, DTYPE_CANNOT, DTYPE_CANNOT, DTYPE_CANNOT,
- DTYPE_CANNOT},
+ DTYPE_CANNOT, DTYPE_CANNOT},
// dtype_array
{DTYPE_CANNOT, DTYPE_CANNOT, DTYPE_CANNOT, DTYPE_CANNOT,
@@ -844,7 +871,7 @@
DTYPE_CANNOT, DTYPE_CANNOT, DTYPE_CANNOT, DTYPE_CANNOT,
DTYPE_CANNOT, DTYPE_CANNOT, DTYPE_CANNOT, DTYPE_CANNOT,
DTYPE_CANNOT, DTYPE_CANNOT, DTYPE_CANNOT, DTYPE_CANNOT,
- DTYPE_CANNOT},
+ DTYPE_CANNOT, DTYPE_CANNOT},
// dtype_int64
{dtype_unknown, dtype_double, dtype_double, dtype_double,
@@ -852,7 +879,7 @@
dtype_double, dtype_double, DTYPE_CANNOT, dtype_double,
dtype_double, dtype_d_float, DTYPE_CANNOT, DTYPE_CANNOT,
DTYPE_CANNOT, DTYPE_CANNOT, DTYPE_CANNOT, dtype_double,
- DTYPE_CANNOT},
+ DTYPE_CANNOT, DTYPE_CANNOT},
// dtype_dbkey
{DTYPE_CANNOT, DTYPE_CANNOT, DTYPE_CANNOT, DTYPE_CANNOT,
@@ -860,8 +887,16 @@
DTYPE_CANNOT, DTYPE_CANNOT, DTYPE_CANNOT, DTYPE_CANNOT,
DTYPE_CANNOT, DTYPE_CANNOT, DTYPE_CANNOT, DTYPE_CANNOT,
DTYPE_CANNOT, DTYPE_CANNOT, DTYPE_CANNOT, DTYPE_CANNOT,
- DTYPE_CANNOT}
+ DTYPE_CANNOT, DTYPE_CANNOT},
+ // dtype_boolean
+ {DTYPE_CANNOT, DTYPE_CANNOT, DTYPE_CANNOT, DTYPE_CANNOT,
+ DTYPE_CANNOT, DTYPE_CANNOT, DTYPE_CANNOT, DTYPE_CANNOT,
+ DTYPE_CANNOT, DTYPE_CANNOT, DTYPE_CANNOT, DTYPE_CANNOT,
+ DTYPE_CANNOT, DTYPE_CANNOT, DTYPE_CANNOT, DTYPE_CANNOT,
+ DTYPE_CANNOT, DTYPE_CANNOT, DTYPE_CANNOT, DTYPE_CANNOT,
+ DTYPE_CANNOT, DTYPE_CANNOT}
+
};
#ifdef DEV_BUILD
@@ -997,6 +1032,11 @@
desc->setTextType(INTL_CS_COLL_TO_TTYPE(charset, collation));
break;
+ case blr_bool:
+ desc->dsc_length = sizeof(UCHAR);
+ desc->dsc_dtype = dtype_boolean;
+ break;
+
default:
fb_assert(FALSE);
desc->dsc_dtype = dtype_unknown;
@@ -1123,6 +1163,8 @@
return "bigint";
case dtype_dbkey:
return "dbkey";
+ case dtype_boolean:
+ return "boolean";
default:
return "out of range";
}
Modified: firebird/trunk/src/common/dsc.h
===================================================================
--- firebird/trunk/src/common/dsc.h 2010-12-17 22:32:35 UTC (rev 52053)
+++ firebird/trunk/src/common/dsc.h 2010-12-18 02:17:06 UTC (rev 52054)
@@ -251,6 +251,14 @@
dsc_address = (UCHAR*) address;
}
+ void makeBoolean(UCHAR* address = NULL)
+ {
+ clear();
+ dsc_dtype = dtype_boolean;
+ dsc_length = sizeof(UCHAR);
+ dsc_address = address;
+ }
+
void makeNullString()
{
clear();
Modified: firebird/trunk/src/common/dsc_pub.h
===================================================================
--- firebird/trunk/src/common/dsc_pub.h 2010-12-17 22:32:35 UTC (rev 52053)
+++ firebird/trunk/src/common/dsc_pub.h 2010-12-18 02:17:06 UTC (rev 52054)
@@ -60,7 +60,8 @@
#define dtype_array 18
#define dtype_int64 19
#define dtype_dbkey 20
-#define DTYPE_TYPE_MAX 21
+#define dtype_boolean 21
+#define DTYPE_TYPE_MAX 22
#define ISC_TIME_SECONDS_PRECISION 10000
#define ISC_TIME_SECONDS_PRECISION_SCALE (-4)
Modified: firebird/trunk/src/dsql/BoolNodes.cpp
===================================================================
--- firebird/trunk/src/dsql/BoolNodes.cpp 2010-12-17 22:32:35 UTC (rev 52053)
+++ firebird/trunk/src/dsql/BoolNodes.cpp 2010-12-18 02:17:06 UTC (rev 52054)
@@ -340,6 +340,7 @@
dsqlArg2(aArg2),
dsqlArg3(aArg3),
dsqlFlag(DFLAG_NONE),
+ dsqlWasValue(false),
arg1(NULL),
arg2(NULL),
arg3(NULL)
@@ -380,6 +381,40 @@
BoolExprNode* ComparativeBoolNode::dsqlPass(DsqlCompilerScratch* dsqlScratch)
{
+ dsql_nod* procArg1 = dsqlArg1;
+ dsql_nod* procArg2 = dsqlArg2;
+ dsql_nod* procArg3 = dsqlArg3;
+
+ // Make INSERTING/UPDATING/DELETING in booleans to read the trigger action.
+
+ if (dsqlWasValue && procArg1->nod_type == Dsql::nod_field_name)
+ {
+ const char* fieldName = ((dsql_str*) procArg1->nod_arg[Dsql::e_fln_name])->str_data;
+
+ static const char* const NAMES[] = {
+ "INSERTING",
+ "UPDATING",
+ "DELETING"
+ };
+
+ for (size_t i = 0; i < FB_NELEM(NAMES); ++i)
+ {
+ if (strcmp(fieldName, NAMES[i]) == 0)
+ {
+ thread_db* tdbb = JRD_get_thread_data();
+
+ InternalInfoNode* infoNode = FB_NEW(*tdbb->getDefaultPool()) InternalInfoNode(
+ *tdbb->getDefaultPool(),
+ MAKE_const_slong(SLONG(InternalInfoNode::INFO_TYPE_TRIGGER_ACTION)));
+
+ procArg1 = MAKE_node(Dsql::nod_class_exprnode, 1);
+ procArg1->nod_arg[0] = reinterpret_cast<dsql_nod*>(infoNode);
+
+ procArg2 = MAKE_const_slong(i + 1);
+ }
+ }
+ }
+
switch (blrOp)
{
case blr_eql:
@@ -388,13 +423,13 @@
case blr_geq:
case blr_lss:
case blr_leq:
- if (dsqlArg2->nod_type == Dsql::nod_list)
+ if (procArg2->nod_type == Dsql::nod_list)
{
int listItemCount = 0;
BoolExprNode* resultNode = NULL;
- dsql_nod** ptr = dsqlArg2->nod_arg;
+ dsql_nod** ptr = procArg2->nod_arg;
- for (const dsql_nod* const* const end = ptr + dsqlArg2->nod_count;
+ for (const dsql_nod* const* const end = ptr + procArg2->nod_count;
ptr != end; ++listItemCount, ++ptr)
{
if (listItemCount >= MAX_MEMBER_LIST)
@@ -407,7 +442,7 @@
DEV_BLKCHK(*ptr, dsql_type_nod);
ComparativeBoolNode* temp = FB_NEW(getPool()) ComparativeBoolNode(getPool(),
- blrOp, dsqlArg1, *ptr);
+ blrOp, procArg1, *ptr);
if (resultNode)
{
@@ -429,8 +464,8 @@
return resultNode->dsqlPass(dsqlScratch);
}
- if (dsqlArg2->nod_type == Dsql::nod_select_expr &&
- !(dsqlArg2->nod_flags & NOD_SELECT_EXPR_SINGLETON))
+ if (procArg2->nod_type == Dsql::nod_select_expr &&
+ !(procArg2->nod_flags & NOD_SELECT_EXPR_SINGLETON))
{
UCHAR newBlrOp = blr_any;
@@ -446,8 +481,8 @@
}
ComparativeBoolNode* node = FB_NEW(getPool()) ComparativeBoolNode(getPool(), blrOp,
- PASS1_node(dsqlScratch, dsqlArg1), PASS1_node(dsqlScratch, dsqlArg2),
- PASS1_node(dsqlScratch, dsqlArg3));
+ PASS1_node(dsqlScratch, procArg1), PASS1_node(dsqlScratch, procArg2),
+ PASS1_node(dsqlScratch, procArg3));
switch (blrOp)
{
@@ -459,6 +494,7 @@
case blr_leq:
case blr_equiv:
case blr_between:
+ {
// Try to force arg1 to be same type as arg2 eg: ? = FIELD case
PASS1_set_parameter_type(dsqlScratch, node->dsqlArg1, node->dsqlArg2, false);
@@ -473,7 +509,21 @@
// ? BETWEEN Y AND ? case
PASS1_set_parameter_type(dsqlScratch, node->dsqlArg3, node->dsqlArg2, false);
}
+
+ dsc desc1, desc2;
+
+ MAKE_desc(dsqlScratch, &desc1, node->dsqlArg1);
+ MAKE_desc(dsqlScratch, &desc2, node->dsqlArg2);
+
+ if ((desc1.dsc_dtype == dtype_boolean || desc2.dsc_dtype == dtype_boolean) &&
+ desc1.dsc_dtype != desc2.dsc_dtype)
+ {
+ ERRD_post(Arg::Gds(isc_sqlerr) << Arg::Num(-104) <<
+ Arg::Gds(isc_invalid_boolean_usage));
+ }
+
break;
+ }
case blr_containing:
case blr_like:
@@ -1546,6 +1596,7 @@
ComparativeBoolNode* node = FB_NEW(getPool()) ComparativeBoolNode(
getPool(), newBlrOp, cmpArg->dsqlArg1, cmpArg->dsqlArg2);
+ node->dsqlWasValue = cmpArg->dsqlWasValue;
if (cmpArg->dsqlFlag == ComparativeBoolNode::DFLAG_ANSI_ANY)
node->dsqlFlag = ComparativeBoolNode::DFLAG_ANSI_ALL;
Modified: firebird/trunk/src/dsql/BoolNodes.h
===================================================================
--- firebird/trunk/src/dsql/BoolNodes.h 2010-12-17 22:32:35 UTC (rev 52053)
+++ firebird/trunk/src/dsql/BoolNodes.h 2010-12-18 02:17:06 UTC (rev 52054)
@@ -110,6 +110,7 @@
dsql_nod* dsqlArg2;
dsql_nod* dsqlArg3;
DsqlFlag dsqlFlag;
+ bool dsqlWasValue;
NestConst<ValueExprNode> arg1;
NestConst<ValueExprNode> arg2;
NestConst<ValueExprNode> arg3;
Modified: firebird/trunk/src/dsql/ExprNodes.cpp
===================================================================
--- firebird/trunk/src/dsql/ExprNodes.cpp 2010-12-17 22:32:35 UTC (rev 52053)
+++ firebird/trunk/src/dsql/ExprNodes.cpp 2010-12-18 02:17:06 UTC (rev 52054)
@@ -20,6 +20,7 @@
#include "firebird.h"
#include <math.h>
+#include <ctype.h>
#include "../common/common.h"
#include "../common/classes/FpeControl.h"
#include "../common/classes/VaryStr.h"
@@ -2490,6 +2491,93 @@
//--------------------
+static RegisterNode<BoolAsValueNode> regBoolAsValueNode(blr_bool_as_value);
+
+BoolAsValueNode::BoolAsValueNode(MemoryPool& pool, dsql_nod* aBoolean)
+ : TypedNode<ValueExprNode, ExprNode::TYPE_BOOL_AS_VALUE>(pool),
+ dsqlBoolean(aBoolean),
+ boolean(NULL)
+{
+ addChildNode(dsqlBoolean, boolean);
+}
+
+DmlNode* BoolAsValueNode::parse(thread_db* tdbb, MemoryPool& pool, CompilerScratch* csb, UCHAR /*blrOp*/)
+{
+ BoolAsValueNode* node = FB_NEW(pool) BoolAsValueNode(pool);
+ node->boolean = PAR_parse_boolean(tdbb, csb);
+ return node;
+}
+
+void BoolAsValueNode::print(string& text, Array<dsql_nod*>& nodes) const
+{
+ text = "BoolAsValueNode";
+ ExprNode::print(text, nodes);
+}
+
+ValueExprNode* BoolAsValueNode::dsqlPass(DsqlCompilerScratch* dsqlScratch)
+{
+ BoolAsValueNode* node = FB_NEW(getPool()) BoolAsValueNode(getPool(),
+ PASS1_node(dsqlScratch, dsqlBoolean));
+
+ return node;
+}
+
+void BoolAsValueNode::genBlr(DsqlCompilerScratch* dsqlScratch)
+{
+ dsqlScratch->appendUChar(blr_bool_as_value);
+ GEN_expr(dsqlScratch, dsqlBoolean);
+}
+
+void BoolAsValueNode::make(DsqlCompilerScratch* dsqlScratch, dsc* desc)
+{
+ desc->makeBoolean();
+ desc->setNullable(true);
+}
+
+void BoolAsValueNode::getDesc(thread_db* tdbb, CompilerScratch* csb, dsc* desc)
+{
+ desc->makeBoolean();
+ desc->setNullable(true);
+}
+
+ValueExprNode* BoolAsValueNode::copy(thread_db* tdbb, NodeCopier& copier)
+{
+ BoolAsValueNode* node = FB_NEW(*tdbb->getDefaultPool()) BoolAsValueNode(*tdbb->getDefaultPool());
+ node->boolean = copier.copy(tdbb, boolean);
+ return node;
+}
+
+ValueExprNode* BoolAsValueNode::pass2(thread_db* tdbb, CompilerScratch* csb)
+{
+ ValueExprNode::pass2(tdbb, csb);
+
+ dsc desc;
+ getDesc(tdbb, csb, &desc);
+ impureOffset = CMP_impure(csb, sizeof(impure_value));
+
+ return this;
+}
+
+dsc* BoolAsValueNode::execute(thread_db* tdbb, jrd_req* request) const
+{
+ UCHAR booleanVal = (UCHAR) boolean->execute(tdbb, request);
+
+ if (request->req_flags & req_null)
+ return NULL;
+
+ impure_value* impure = request->getImpure<impure_value>(impureOffset);
+
+ dsc desc;
+ desc.makeBoolean(&booleanVal);
+ EVL_make_value(tdbb, &desc, impure);
+
+ return &impure->vlu_desc;
+}
+
+
+//--------------------
+
+
static RegisterNode<CastNode> regCastNode(blr_cast);
CastNode::CastNode(MemoryPool& pool, dsql_nod* aDsqlSource, dsql_fld* aDsqlField)
@@ -2749,6 +2837,49 @@
if (!value)
return NULL;
+ dsc desc;
+ char* text;
+ UCHAR tempByte;
+
+ if (value->dsc_dtype == dtype_boolean &&
+ (DTYPE_IS_TEXT(impure->vlu_desc.dsc_dtype) || DTYPE_IS_BLOB(impure->vlu_desc.dsc_dtype)))
+ {
+ text = const_cast<char*>(MOV_get_boolean(value) ? "TRUE" : "FALSE");
+ desc.makeText(strlen(text), CS_ASCII, reinterpret_cast<UCHAR*>(text));
+ value = &desc;
+ }
+ else if (impure->vlu_desc.dsc_dtype == dtype_boolean &&
+ (DTYPE_IS_TEXT(value->dsc_dtype) || DTYPE_IS_BLOB(value->dsc_dtype)))
+ {
+ desc.makeBoolean(&tempByte);
+
+ MoveBuffer buffer;
+ UCHAR* address;
+ int len = MOV_make_string2(tdbb, value, CS_ASCII, &address, buffer);
+
+ // Remove heading and trailing spaces.
+
+ while (len > 0 && isspace(*address))
+ {
+ ++address;
+ --len;
+ }
+
+ while (len > 0 && isspace(address[len - 1]))
+ --len;
+
+ if (len == 4 && fb_utils::strnicmp(reinterpret_cast<char*>(address), "TRUE", len) == 0)
+ {
+ tempByte = '\1';
+ value = &desc;
+ }
+ else if (len == 5 && fb_utils::strnicmp(reinterpret_cast<char*>(address), "FALSE", len) == 0)
+ {
+ tempByte = '\0';
+ value = &desc;
+ }
+ }
+
if (DTYPE_IS_BLOB(value->dsc_dtype) || DTYPE_IS_BLOB(impure->vlu_desc.dsc_dtype))
BLB_move(tdbb, value, &impure->vlu_desc, NULL);
else
@@ -5055,6 +5186,11 @@
memcpy(p, q, l);
break;
+ case dtype_boolean:
+ l = 1;
+ *p = *q;
+ break;
+
default:
fb_assert(FALSE);
}
@@ -5191,6 +5327,11 @@
break;
}
+ case dtype_boolean:
+ GEN_descriptor(dsqlScratch, desc, false);
+ dsqlScratch->appendUChar(*p != 0);
+ break;
+
default:
// gen_constant: datatype not understood
ERRD_post(Arg::Gds(isc_sqlerr) << Arg::Num(-103) <<
Modified: firebird/trunk/src/dsql/ExprNodes.h
===================================================================
--- firebird/trunk/src/dsql/ExprNodes.h 2010-12-17 22:32:35 UTC (rev 52053)
+++ firebird/trunk/src/dsql/ExprNodes.h 2010-12-18 02:17:06 UTC (rev 52054)
@@ -92,6 +92,34 @@
};
+class BoolAsValueNode : public TypedNode<ValueExprNode, ExprNode::TYPE_BOOL_AS_VALUE>
+{
+public:
+ explicit BoolAsValueNode(MemoryPool& pool, dsql_nod* aBoolean = NULL);
+
+ static DmlNode* parse(thread_db* tdbb, MemoryPool& pool, CompilerScratch* csb, UCHAR blrOp);
+
+ virtual void print(Firebird::string& text, Firebird::Array<dsql_nod*>& nodes) const;
+ virtual ValueExprNode* dsqlPass(DsqlCompilerScratch* dsqlScratch);
+
+ virtual void setParameterName(dsql_par* parameter) const
+ {
+ }
+
+ virtual void genBlr(DsqlCompilerScratch* dsqlScratch);
+ virtual void make(DsqlCompilerScratch* dsqlScratch, dsc* desc);
+
+ virtual void getDesc(thread_db* tdbb, CompilerScratch* csb, dsc* desc);
+ virtual ValueExprNode* copy(thread_db* tdbb, NodeCopier& copier);
+ virtual ValueExprNode* pass2(thread_db* tdbb, CompilerScratch* csb);
+ virtual dsc* execute(thread_db* tdbb, jrd_req* request) const;
+
+public:
+ dsql_nod* dsqlBoolean;
+ NestConst<BoolExprNode> boolean;
+};
+
+
class CastNode : public TypedNode<ValueExprNode, ExprNode::TYPE_CAST>
{
public:
Modified: firebird/trunk/src/dsql/Nodes.h
===================================================================
--- firebird/trunk/src/dsql/Nodes.h 2010-12-17 22:32:35 UTC (rev 52053)
+++ firebird/trunk/src/dsql/Nodes.h 2010-12-18 02:17:06 UTC (rev 52054)
@@ -326,6 +326,7 @@
// Value types
TYPE_AGGREGATE,
TYPE_ARITHMETIC,
+ TYPE_BOOL_AS_VALUE,
TYPE_CAST,
TYPE_CONCATENATE,
TYPE_CURRENT_DATE,
@@ -867,7 +868,6 @@
TYPE_SAVEPOINT_ENCLOSE,
TYPE_SELECT,
TYPE_SET_GENERATOR,
- TYPE_SOURCE_INFO,
TYPE_STALL,
TYPE_STORE,
TYPE_SUSPEND,
Modified: firebird/trunk/src/dsql/ddl_proto.h
===================================================================
--- firebird/trunk/src/dsql/ddl_proto.h 2010-12-17 22:32:35 UTC (rev 52053)
+++ firebird/trunk/src/dsql/ddl_proto.h 2010-12-18 02:17:06 UTC (rev 52054)
@@ -58,7 +58,9 @@
blr_timestamp, // dtype_timestamp
blr_blob, // dtype_blob // ASF: CAST use blr_blob2 because blr_blob doesn't fit in UCHAR
blr_short, // dtype_array
- blr_int64 // dtype_int64
+ blr_int64, // dtype_int64
+ 0, // DB_KEY
+ blr_bool // dtype_boolean
};
void DDL_execute(Jrd::dsql_req*);
Modified: firebird/trunk/src/dsql/dsql.cpp
===================================================================
--- firebird/trunk/src/dsql/dsql.cpp 2010-12-17 22:32:35 UTC (rev 52053)
+++ firebird/trunk/src/dsql/dsql.cpp 2010-12-18 02:17:06 UTC (rev 52054)
@@ -2405,6 +2405,11 @@
}
break;
+ case blr_bool:
+ desc.dsc_dtype = dtype_boolean;
+ desc.dsc_length = sizeof(UCHAR);
+ break;
+
default:
ERRD_post(Arg::Gds(isc_sqlerr) << Arg::Num(-804) <<
Arg::Gds(isc_dsql_sqlda_err));
@@ -3320,6 +3325,10 @@
sql_scale = param->par_desc.dsc_scale;
break;
+ case dtype_boolean:
+ sql_type = SQL_BOOLEAN;
+ break;
+
default:
ERRD_post(Arg::Gds(isc_sqlerr) << Arg::Num(-804) <<
Arg::Gds(isc_dsql_datatype_err));
Modified: firebird/trunk/src/dsql/gen.cpp
===================================================================
--- firebird/trunk/src/dsql/gen.cpp 2010-12-17 22:32:35 UTC (rev 52053)
+++ firebird/trunk/src/dsql/gen.cpp 2010-12-18 02:17:06 UTC (rev 52054)
@@ -1082,6 +1082,10 @@
dsqlScratch->appendUShort(desc->getTextType());
break;
+ case dtype_boolean:
+ dsqlScratch->appendUChar(blr_bool);
+ break;
+
default:
// don't understand dtype
ERRD_post(Arg::Gds(isc_sqlerr) << Arg::Num(-804) <<
Modified: firebird/trunk/src/dsql/make.cpp
===================================================================
--- firebird/trunk/src/dsql/make.cpp 2010-12-17 22:32:35 UTC (rev 52053)
+++ firebird/trunk/src/dsql/make.cpp 2010-12-18 02:17:06 UTC (rev 52054)
@@ -266,6 +266,13 @@
break;
}
+ case CONSTANT_BOOLEAN:
+ DEV_BLKCHK(constant, dsql_type_str);
+
+ literal->litDesc.makeBoolean((UCHAR*) constant->str_data);
+ literal->dsqlStr = constant;
+ break;
+
default:
fb_assert(numeric_flag == CONSTANT_STRING);
DEV_BLKCHK(constant, dsql_type_str);
@@ -368,7 +375,8 @@
case nod_class_exprnode:
{
ValueExprNode* exprNode = reinterpret_cast<ValueExprNode*>(node->nod_arg[0]);
- exprNode->make(dsqlScratch, desc);
+ if (exprNode->kind == DmlNode::KIND_VALUE)
+ exprNode->make(dsqlScratch, desc);
}
return;
@@ -873,7 +881,11 @@
switch (item->nod_type)
{
case nod_class_exprnode:
- reinterpret_cast<ValueExprNode*>(item->nod_arg[0])->setParameterName(parameter);
+ {
+ ValueExprNode* exprNode = reinterpret_cast<ValueExprNode*>(item->nod_arg[0]);
+ if (exprNode->kind == DmlNode::KIND_VALUE)
+ exprNode->setParameterName(parameter);
+ }
break;
case nod_field:
field = (dsql_fld*) item->nod_arg[e_fld_field];
Modified: firebird/trunk/src/dsql/make_proto.h
===================================================================
--- firebird/trunk/src/dsql/make_proto.h 2010-12-17 22:32:35 UTC (rev 52053)
+++ firebird/trunk/src/dsql/make_proto.h 2010-12-18 02:17:06 UTC (rev 52054)
@@ -43,7 +43,8 @@
CONSTANT_DATE = 2, // stored as a SLONG
CONSTANT_TIME = 3, // stored as a ULONG
CONSTANT_TIMESTAMP = 4, // stored as a QUAD
- CONSTANT_SINT64 = 5 // stored as a SINT64
+ CONSTANT_SINT64 = 5, // stored as a SINT64
+ CONSTANT_BOOLEAN = 6, // stored as a UCHAR
};
// Parameters to MAKE_variable
Modified: firebird/trunk/src/dsql/parse.y
===================================================================
--- firebird/trunk/src/dsql/parse.y 2010-12-17 22:32:35 UTC (rev 52053)
+++ firebird/trunk/src/dsql/parse.y 2010-12-18 02:17:06 UTC (rev 52054)
@@ -581,12 +581,17 @@
%token <legacyNode> ROW_NUMBER
%token <legacyNode> SQLSTATE
+%token <legacyNode> KW_BOOLEAN
+%token <legacyNode> KW_FALSE
+%token <legacyNode> KW_TRUE
+%token <legacyNode> UNKNOWN
+
// precedence declarations for expression evaluation
%left OR
%left AND
%left NOT
-%left '=' '<' '>' LIKE EQL NEQ GTR LSS GEQ LEQ NOT_GTR NOT_LSS
+%left '=' '<' '>' LIKE CONTAINING STARTING SIMILAR KW_IN EQL NEQ GTR LSS GEQ LEQ NOT_GTR NOT_LSS
%left '+' '-'
%left '*' '/'
%left UMINUS UPLUS
@@ -805,7 +810,7 @@
%type <legacyNode> update_searched user_grantee user_grantee_list
%type <int32Val> unsigned_short_integer
-%type <legacyNode> valid_symbol_name value value_list value_list_opt var_decl_opt var_declaration_item
+%type <legacyNode> valid_symbol_name value common_value common_value_list common_value_list_opt value_list value_list_opt var_decl_opt var_declaration_item
%type <legacyNode> variable variable_list varying_keyword version_mode
%type <createAlterViewNode> view_clause
@@ -816,6 +821,8 @@
%type <legacyField> alter_col_name column_def_name data_type_descriptor init_data_type simple_column_def_name
+%type <legacyNode> boolean_literal
+
// New nodes
%type <intVal> ddl_type0 ddl_type1 ddl_type2
@@ -877,13 +884,12 @@
// Predicates
%type <boolExprNode> between_predicate comparison_predicate distinct_predicate
%type <boolExprNode> exists_predicate in_predicate binary_pattern_predicate
-%type <boolExprNode> null_predicate predicate quantified_predicate search_condition_impl
-%type <boolExprNode> singular_predicate ternary_pattern_predicate trigger_action_predicate
+%type <boolExprNode> null_predicate predicate quantified_predicate boolean_value_expression
+%type <boolExprNode> singular_predicate ternary_pattern_predicate
%type <blrOp> binary_pattern_operator ternary_pattern_operator comparison_operator
%type <cmpBoolFlag> quantified_flag
%type <legacyNode> escape_opt
-%type <intVal> trigger_action_code
%%
@@ -3625,6 +3631,11 @@
lex.g_field->fld_dtype = dtype_timestamp;
lex.g_field->fld_length = sizeof (GDS_TIMESTAMP);
}
+ | KW_BOOLEAN
+ {
+ lex.g_field->fld_dtype = dtype_boolean;
+ lex.g_field->fld_length = sizeof(UCHAR);
+ }
;
integer_keyword : INTEGER
@@ -4876,11 +4887,22 @@
// boolean expressions
search_condition
- : search_condition_impl
- { $$ = makeClassNode($1); }
+ : value
+ {
+ BoolAsValueNode* node = ExprNode::as<BoolAsValueNode>($1);
+ if (node)
+ $$ = node->dsqlBoolean;
+ else
+ {
+ ComparativeBoolNode* cmpNode = newNode<ComparativeBoolNode>(
+ blr_eql, $1, MAKE_constant(MAKE_string("1", 1), CONSTANT_BOOLEAN));
+ cmpNode->dsqlWasValue = true;
+ $$ = makeClassNode(cmpNode);
+ }
+ }
;
-search_condition_impl
+boolean_value_expression
: predicate
| search_condition OR search_condition
{ $$ = newNode<BinaryBoolNode>(blr_or, $1, $3); }
@@ -4888,6 +4910,8 @@
{ $$ = newNode<BinaryBoolNode>(blr_and, $1, $3); }
| NOT search_condition
{ $$ = newNode<NotBoolNode>($2); }
+ | '(' boolean_value_expression ')'
+ { $$ = $2; }
;
predicate
@@ -4901,16 +4925,20 @@
| quantified_predicate
| exists_predicate
| singular_predicate
- | trigger_action_predicate
- | '(' search_condition_impl ')'
- { $$ = $2; }
+ | common_value IS boolean_literal
+ { $$ = newNode<ComparativeBoolNode>(blr_equiv, $1, $3); }
+ | common_value IS NOT boolean_literal
+ {
+ ComparativeBoolNode* node = newNode<ComparativeBoolNode>(blr_equiv, $1, $4);
+ $$ = newNode<NotBoolNode>(makeClassNode(node));
+ }
;
// comparisons
comparison_predicate
- : value comparison_operator value
+ : common_value comparison_operator common_value
{ $$ = newNode<ComparativeBoolNode>($2, $1, $3); }
;
@@ -4927,7 +4955,7 @@
// quantified comparisons
quantified_predicate
- : value comparison_operator quantified_flag '(' column_select ')'
+ : common_value comparison_operator quantified_flag '(' column_select ')'
{
ComparativeBoolNode* node = newNode<ComparativeBoolNode>($2, $1, $5);
node->dsqlFlag = $3;
@@ -4945,19 +4973,19 @@
// other predicates
distinct_predicate
- : value IS DISTINCT FROM value
+ : common_value IS DISTINCT FROM common_value
{
ComparativeBoolNode* node = newNode<ComparativeBoolNode>(blr_equiv, $1, $5);
$$ = newNode<NotBoolNode>(makeClassNode(node));
}
- | value IS NOT DISTINCT FROM value
+ | common_value IS NOT DISTINCT FROM common_value
{ $$ = newNode<ComparativeBoolNode>(blr_equiv, $1, $6); }
;
between_predicate
- : value BETWEEN value AND value
+ : common_value BETWEEN common_value AND common_value
{ $$ = newNode<ComparativeBoolNode>(blr_between, $1, $3, $5); }
- | value NOT BETWEEN value AND value
+ | common_value NOT BETWEEN common_value AND common_value
{
ComparativeBoolNode* node = newNode<ComparativeBoolNode>(blr_between, $1, $4, $6);
$$ = newNode<NotBoolNode>(makeClassNode(node));
@@ -4965,12 +4993,12 @@
;
binary_pattern_predicate
- : value binary_pattern_operator value
+ : common_value binary_pattern_operator common_value
{ $$ = newNode<ComparativeBoolNode>($2, $1, $3); }
- | value NOT binary_pattern_operator value
+ | common_value NOT binary_pattern_operator common_value
{
- ComparativeBoolNode* containingNode = newNode<ComparativeBoolNode>($3, $1, $4);
- $$ = newNode<NotBoolNode>(makeClassNode(containingNode));
+ ComparativeBoolNode* cmpNode = newNode<ComparativeBoolNode>($3, $1, $4);
+ $$ = newNode<NotBoolNode>(makeClassNode(cmpNode));
}
;
@@ -4981,9 +5009,9 @@
;
ternary_pattern_predicate
- : value ternary_pattern_operator value escape_opt
+ : common_value ternary_pattern_operator common_value escape_opt
{ $$ = newNode<ComparativeBoolNode>($2, $1, $3, $4); }
- | value NOT ternary_pattern_operator value escape_opt
+ | common_value NOT ternary_pattern_operator common_value escape_opt
{
ComparativeBoolNode* likeNode = newNode<ComparativeBoolNode>($3, $1, $4, $5);
$$ = newNode<NotBoolNode>(makeClassNode(likeNode));
@@ -4997,17 +5025,17 @@
escape_opt
: { $$ = NULL; }
- | ESCAPE value { $$ = $2; }
+ | ESCAPE common_value { $$ = $2; }
;
in_predicate
- : value KW_IN in_predicate_value
+ : common_value KW_IN in_predicate_value
{
ComparativeBoolNode* node = newNode<ComparativeBoolNode>(blr_eql, $1, $3);
node->ds...
[truncated message content] |