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

Fixed CORE-1528 - Functions DATEDIFF, ABS(integer const) does not work in dialect 1

This commit is contained in:
asfernandes 2007-10-25 14:31:17 +00:00
parent b71d62c51d
commit c7440554de
6 changed files with 17 additions and 3 deletions

View File

@ -672,7 +672,7 @@ static ISC_STATUS dsql8_execute_immediate_common(ISC_STATUS* user_status,
* be a way to send the parser version to DSQL so that the parser can compare the keyword
* version to the parser version. To accomplish this, the parser version is combined with
* the client dialect and sent across that way. In dsql8_execute_immediate, the parser version
* and client dialect are separated and passed on to their final desintations. The information
* and client dialect are separated and passed on to their final destinations. The information
* is combined as follows:
* Dialect * 10 + parser_version
*

View File

@ -1056,4 +1056,9 @@ UCHAR DSqlDataTypeUtil::maxBytesPerChar(UCHAR charSet)
return METD_get_charset_bpc(request, charSet);
}
USHORT DSqlDataTypeUtil::getDialect()
{
return request->req_client_dialect;
}
#endif

View File

@ -56,6 +56,7 @@ public:
public:
virtual UCHAR maxBytesPerChar(UCHAR charSet);
virtual USHORT getDialect();
private:
dsql_req* request;

View File

@ -535,11 +535,14 @@ void DataTypeUtilBase::makeSysFunction(dsc* result, const char* name, int argsCo
namespace Jrd {
UCHAR DataTypeUtil::maxBytesPerChar(UCHAR charSet)
{
return INTL_charset_lookup(tdbb, charSet)->maxBytesPerChar();
}
USHORT DataTypeUtil::getDialect()
{
return (tdbb->tdbb_database->dbb_flags & DBB_DB_SQL_dialect_3) ? 3 : 1;
}
} // namespace Jrd

View File

@ -50,6 +50,7 @@ public:
public:
virtual UCHAR maxBytesPerChar(UCHAR charSet) = 0;
virtual USHORT getDialect() = 0;
};
@ -67,6 +68,7 @@ public:
public:
virtual UCHAR maxBytesPerChar(UCHAR charSet);
virtual USHORT getDialect(); // returns client dialect in DSQL and database dialect in JRD
private:
thread_db* tdbb;

View File

@ -351,6 +351,9 @@ static void makeFromListResult(DataTypeUtilBase* dataTypeUtil, const SysFunction
static void makeInt64Result(DataTypeUtilBase* dataTypeUtil, const SysFunction* function, dsc* result, int argsCount, const dsc** args)
{
if (dataTypeUtil->getDialect() == 1)
result->makeDouble();
else
result->makeInt64(0);
bool isNullable;