Skip to content

Commit

Permalink
refs #4538 many fixes and tests for advanced search operators
Browse files Browse the repository at this point in the history
refs #4548 fixed the prepend and append operators for freetds / ms sql server and mysql / mariadb
  • Loading branch information
davidnich committed Jun 26, 2022
1 parent 04cbbba commit 5403069
Show file tree
Hide file tree
Showing 12 changed files with 740 additions and 70 deletions.
4 changes: 4 additions & 0 deletions doxygen/lang/900_release_notes.dox.tmpl
Original file line number Diff line number Diff line change
Expand Up @@ -9,10 +9,14 @@

@subsection qore_1_9_0_bug_fixes Bug Fixes in Qore
- <a href="../../modules/FreetdsSqlUtil/html/index.html">FreetdsSqlUtil</a> module
- fixed the prepend and append column operators
(<a href="https://github.com/qorelanguage/qore/issues/4548">issue 4548</a>)
- implemented support for generating queries based on generic expressions using the DataProvider module's
generic expression support
(<a href="https://github.com/qorelanguage/qore/issues/4538">issue 4538</a>)
- <a href="../../modules/MysqlSqlUtil/html/index.html">MysqlSqlUtil</a> module
- fixed the prepend and append column operators
(<a href="https://github.com/qorelanguage/qore/issues/4548">issue 4548</a>)
- implemented support for generating queries based on generic expressions using the DataProvider module's
generic expression support
(<a href="https://github.com/qorelanguage/qore/issues/4538">issue 4538</a>)
Expand Down
12 changes: 6 additions & 6 deletions examples/test/qlib/SqlUtil/BulkFreetdsSqlUtil.qtest
Original file line number Diff line number Diff line change
Expand Up @@ -8,13 +8,13 @@

%requires ../../../../qlib/Util.qm
%requires ../../../../qlib/QUnit.qm
%requires ../../../../qlib/DataProvider
%requires ../../../../qlib/SqlUtil
%requires ../../../../qlib/BulkSqlUtil
%requires ../../../../qlib/FreetdsSqlUtil.qm
%requires ../../../../qlib/Schema.qm

%requires ./BulkSqlUtilTestBase.qm
#/;

%exec-class FreetdsTest

Expand All @@ -27,7 +27,7 @@ class FreetdsTestSchema inherits SqlUtilTestSchema {
private {
const GenericOptions = (
"replace": True,
);
);

const IndexOptions = {};

Expand All @@ -40,11 +40,11 @@ class FreetdsTestSchema inherits SqlUtilTestSchema {
"null_f": c_varchar(69),
),
"primary_key": ("name": "pk_sqlutil_test", "columns": ("id")),
);
);

const Tables = (
"sqlutil_test": T_SqlUtilTest,
);
);
}

constructor(AbstractDatasource ds, *string dts, *string its) : SqlUtilTestSchema(ds, dts, its) {
Expand Down Expand Up @@ -80,11 +80,11 @@ class FreetdsTest inherits SqlTestBase {
const CustomColumns = (
"varchar": (
"value": "hello",
"size": "20",
"size": 20,
),
"char": (
"value": "hello",
"size": "20",
"size": 20,
),
"decimal": (
"size": 15,
Expand Down
11 changes: 6 additions & 5 deletions examples/test/qlib/SqlUtil/BulkMysqlSqlUtil.qtest
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
%strict-args

%requires ../../../../qlib/QUnit.qm
%requires ../../../../qlib/DataProvider
%requires ../../../../qlib/SqlUtil
%requires ../../../../qlib/BulkSqlUtil
%requires ../../../../qlib/MysqlSqlUtil.qm
Expand All @@ -29,7 +30,7 @@ class MysqlTestSchema inherits SqlUtilTestSchema {
private {
const GenericOptions = (
"replace": True,
);
);

const IndexOptions = {};

Expand All @@ -42,11 +43,11 @@ class MysqlTestSchema inherits SqlUtilTestSchema {
"null_f": c_varchar(69),
),
"primary_key": ("name": "pk_mysql_test", "columns": ("id")),
);
);

const Tables = (
"mysql_test": T_MysqlTest,
);
);
}

constructor(AbstractDatasource ds, *string dts, *string its) : SqlUtilTestSchema(ds, dts, its) {
Expand Down Expand Up @@ -82,11 +83,11 @@ class MysqlTest inherits SqlTestBase {
const CustomColumns = (
"varchar": (
"value": "hello",
"size": "20",
"size": 20,
),
"char": (
"value": "hello",
"size": "20",
"size": 20,
),
"decimal": (
"size": 15,
Expand Down
17 changes: 9 additions & 8 deletions examples/test/qlib/SqlUtil/BulkOracleSqlUtil.qtest
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@

%requires ../../../../qlib/Util.qm
%requires ../../../../qlib/QUnit.qm
%requires ../../../../qlib/DataProvider
%requires ../../../../qlib/SqlUtil
%requires ../../../../qlib/BulkSqlUtil
%requires ../../../../qlib/OracleSqlUtil.qm
Expand All @@ -30,7 +31,7 @@ class OracleTestSchema inherits SqlUtilTestSchema {
private {
const GenericOptions = (
"replace": True,
);
);

const IndexOptions = {};

Expand All @@ -43,15 +44,15 @@ class OracleTestSchema inherits SqlUtilTestSchema {
"null_f": c_varchar(69),
),
"primary_key": ("name": "pk_oracle_test", "columns": ("id")),
);
);

const Tables = (
"oracle_test": T_OracleTest,
);
);

const Sequences = (
"oracle_test_seq": {},
);
);
}

constructor(AbstractDatasource ds, *string dts, *string its) : SqlUtilTestSchema(ds, dts, its) {
Expand Down Expand Up @@ -91,11 +92,11 @@ class OracleTest inherits SqlTestBase {
const CustomColumns = (
"varchar2": (
"value": "hello",
"size": "20",
"size": 20,
),
"char": (
"value": "hello",
"size": "20",
"size": 20,
"expect": rpad("hello", 20),
),
"number": (
Expand All @@ -121,15 +122,15 @@ class OracleTest inherits SqlTestBase {
#raw
#bfile
#long
);
);

const ConstColumns = (
"const_f": (
"type": "varchar2",
"value": "test",
"size": "20",
),
);
);
}

constructor() : SqlTestBase("OracleTest", "1.0", \ARGV, MyOpts) {
Expand Down
21 changes: 11 additions & 10 deletions examples/test/qlib/SqlUtil/BulkPgsqlSqlUtil.qtest
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
%strict-args

%requires ../../../../qlib/QUnit.qm
%requires ../../../../qlib/DataProvider
%requires ../../../../qlib/SqlUtil
%requires ../../../../qlib/BulkSqlUtil
%requires ../../../../qlib/PgsqlSqlUtil.qm
Expand All @@ -29,7 +30,7 @@ class PgsqlTestSchema inherits SqlUtilTestSchema {
private {
const GenericOptions = (
"replace": True,
);
);

const IndexOptions = {};

Expand All @@ -42,18 +43,19 @@ class PgsqlTestSchema inherits SqlUtilTestSchema {
"null_f": c_varchar(69),
),
"primary_key": ("name": "pk_pgsql_test", "columns": ("id")),
);
);

const Tables = (
"pgsql_test": T_PgsqlTest,
);
);

const Sequences = (
"pgsql_test_seq": {},
);
);
}

constructor(AbstractDatasource ds, *string dts, *string its) : SqlUtilTestSchema(ds, dts, its) {
constructor(AbstractDatasource ds, *string dts, *string its)
: SqlUtilTestSchema(ds, dts, its) {
}

private string getNameImpl() {
Expand Down Expand Up @@ -105,11 +107,11 @@ class PgsqlTest inherits SqlTestBase {
const CustomColumns = (
"varchar": (
"value": "hello",
"size": "20",
"size": 20,
),
"char": (
"value": "hello",
"size": "20",
"size": 20,
),
"numeric": (
"size": 15,
Expand Down Expand Up @@ -167,15 +169,14 @@ class PgsqlTest inherits SqlTestBase {
"inet": ("bind": pgsql_bind (PG_TYPE_INET, "192.168.11.1"), "expect": "192.168.11.1/32"),
"cidr": ("bind": pgsql_bind (PG_TYPE_CIDR, "192.168"), "expect": "192.168.0.0/24"),
%endif
);
);
}

constructor() : SqlTestBase("PgsqlTest", "1.0", \ARGV, MyOpts) {
Datasource ds;
try {
ds = getDatasource();
}
catch (hash ex) {
} catch (hash<ExceptionInfo> ex) {
if (m_options.verbose)
printf("%s: %s\n", ex.err, ex.desc);
# skip tests if we can't create the datasource
Expand Down
5 changes: 3 additions & 2 deletions examples/test/qlib/SqlUtil/BulkSqlUtilTestBase.qm
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ module BulkSqlUtilTestBase {
}

%requires ../../../../qlib/QUnit.qm
%requires ../../../../qlib/DataProvider
%requires ../../../../qlib/SqlUtil
%requires ../../../../qlib/BulkSqlUtil
%requires ../../../../qlib/Schema.qm
Expand All @@ -30,7 +31,7 @@ public class SqlUtilTestSchema inherits AbstractSchema {
hash ch = (
"native_type": type,
"notnull": True,
);
);
if (h.value.typeCode() == NT_HASH)
ch += (h.value - ("value", "bind", "expect", "type"));
tables{table}.columns{SqlTestBase::getColumnName(h.key)} = ch;
Expand Down Expand Up @@ -59,7 +60,7 @@ public class SqlTestBase inherits QUnit::Test {

const MyOpts = Opts + (
"connstr": "c,conn=s",
);
);

const OptionColumn = 22;

Expand Down

0 comments on commit 5403069

Please sign in to comment.