Skip to content

Commit

Permalink
SQL - add support for decimal tds accessor
Browse files Browse the repository at this point in the history
  • Loading branch information
gs-jp1 committed Nov 1, 2023
1 parent 68b9a09 commit 74e33ff
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -841,7 +841,7 @@ function meta::relational::functions::pureToSqlQuery::processQualifiedPropertyFu

function meta::relational::functions::pureToSqlQuery::tdsQualifier(fe:FunctionExpression[1], operation:SelectWithCursor[1], vars:Map<VariableExpression, ValueSpecification>[1], state:State[1], extensions:Extension[*]):OperationWithParentPropertyMapping[1]
{
let tdsProperties = ['getNumber', 'getInteger', 'getString', 'getFloat', 'getDate', 'getBoolean', 'getEnum', 'getDateTime', 'getStrictDate', 'isNull', 'isNotNull'];
let tdsProperties = ['getNumber', 'getInteger', 'getString', 'getFloat', 'getDate', 'getDecimal', 'getBoolean', 'getEnum', 'getDateTime', 'getStrictDate', 'isNull', 'isNotNull'];

let funcName = $fe.func.functionName->toOne();
let valid = $tdsProperties->contains($funcName);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,13 @@ function <<test.Test>> meta::relational::tests::tds::tdsFilter::testFilterOnEnum
assertEquals('select "root".NAME as "name", "root".TYPE as "type" from addressTable as "root" where "root".TYPE = 1', $result->sqlRemoveFormatting());
}

function <<test.Test>> meta::relational::tests::tds::tdsFilter::testFilterOnDecimal():Boolean[1]
{
let result = execute(|Person.all()->project(col(p | 1.0d, 'decimal'))->filter({l|$l.getDecimal('decimal') == 2.0d}), simpleRelationalMapping, testRuntime(), meta::relational::extension::relationalExtensions());
assertSize($result.values.rows, 0);
assertEquals('select 1.0 as "decimal" from personTable as "root" where 1.0 = 2.0', $result->sqlRemoveFormatting());
}

function <<test.Test>> meta::relational::tests::tds::tdsFilter::testFilterTwoExpressions():Boolean[1]
{
let result = execute(|Person.all()->project([p | $p.firstName, p | $p.lastName], ['first', 'last'])->filter({r | $r.getString('first') == 'John' && $r.getString('last') == 'Johnson'}), simpleRelationalMapping, testRuntime(), meta::relational::extension::relationalExtensions());
Expand Down

0 comments on commit 74e33ff

Please sign in to comment.