-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
52c61d6
commit df43363
Showing
5 changed files
with
124 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,40 @@ | ||
# Copyright Thomas T. Jarløv (TTJ) | ||
|
||
when NimMajor >= 2: | ||
import db_connector/db_common | ||
else: | ||
import std/db_common | ||
|
||
import | ||
std/strutils, | ||
std/unittest | ||
|
||
import | ||
src/sqlbuilderpkg/utils_private | ||
|
||
import | ||
./test_sql_import_with_deletemarkers | ||
|
||
|
||
suite "delete marker - package import": | ||
|
||
test "useDeleteMarker = default": | ||
var test: SqlQuery | ||
|
||
test = sqlSelect( | ||
table = "tasks", | ||
select = @["id", "name", "description", "created", "updated", "completed"], | ||
where = @["id ="], | ||
) | ||
check querycompare(test, sql("SELECT id, name, description, created, updated, completed FROM tasks WHERE id = ? AND tasks.is_deleted IS NULL ")) | ||
|
||
test "useDeleteMarker = default": | ||
var test: SqlQuery | ||
|
||
test = sqlSelectConst( | ||
table = "tasks", | ||
select = @["id", "name", "description", "created", "updated", "completed"], | ||
where = @["id ="], | ||
joinargs = [] | ||
) | ||
check querycompare(test, sql("SELECT id, name, description, created, updated, completed FROM tasks WHERE id = ? AND tasks.is_deleted IS NULL ")) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,66 @@ | ||
# Copyright Thomas T. Jarløv (TTJ) | ||
|
||
when NimMajor >= 2: | ||
import db_connector/db_common | ||
else: | ||
import std/db_common | ||
|
||
import | ||
std/strutils, | ||
std/unittest | ||
|
||
import | ||
src/sqlbuilderpkg/utils_private | ||
|
||
import | ||
./test_sql_import_with_deletemarkers as sqlUno, | ||
./test_sql_import_with_deletemarkers2 as sqlDos | ||
|
||
|
||
suite "delete marker - package import - first import sqlUno": | ||
|
||
test "useDeleteMarker = tasks": | ||
var test: SqlQuery | ||
|
||
test = sqlUno.sqlSelect( | ||
table = "tasks", | ||
select = @["id", "name", "description", "created", "updated", "completed"], | ||
where = @["id ="], | ||
) | ||
check querycompare(test, sql("SELECT id, name, description, created, updated, completed FROM tasks WHERE id = ? AND tasks.is_deleted IS NULL ")) | ||
|
||
test "useDeleteMarker = tasks (const)": | ||
var test: SqlQuery | ||
|
||
test = sqlUno.sqlSelectConst( | ||
table = "tasks", | ||
select = @["id", "name", "description", "created", "updated", "completed"], | ||
where = @["id ="], | ||
joinargs = [] | ||
) | ||
check querycompare(test, sql("SELECT id, name, description, created, updated, completed FROM tasks WHERE id = ? AND tasks.is_deleted IS NULL ")) | ||
|
||
|
||
suite "delete marker - package import - second import sqlDos": | ||
|
||
test "useDeleteMarker = project": | ||
var test: SqlQuery | ||
|
||
test = sqlDos.sqlSelect( | ||
table = "project", | ||
select = @["id", "name", "description", "created", "updated", "completed"], | ||
where = @["id ="], | ||
) | ||
check querycompare(test, sql("SELECT id, name, description, created, updated, completed FROM project WHERE id = ? AND project.is_deleted IS NULL ")) | ||
|
||
test "useDeleteMarker = project (const)": | ||
var test: SqlQuery | ||
|
||
test = sqlDos.sqlSelectConst( | ||
table = "project", | ||
select = @["id", "name", "description", "created", "updated", "completed"], | ||
where = @["id ="], | ||
joinargs = [] | ||
) | ||
check querycompare(test, sql("SELECT id, name, description, created, updated, completed FROM project WHERE id = ? AND project.is_deleted IS NULL ")) | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
|
||
const tablesWithDeleteMarkerInit = ["tasks"] | ||
|
||
include src/sqlbuilder_include |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
|
||
const tablesWithDeleteMarkerInit = ["project"] | ||
|
||
include src/sqlbuilder_include |