refactor dbFormat (#19746)

* refactor dbFormat

* add simple tests
This commit is contained in:
ringabout
2022-09-29 18:16:42 +08:00
committed by GitHub
parent 77a65d3c33
commit f56085f21e
5 changed files with 34 additions and 34 deletions

25
tests/stdlib/tdb.nim Normal file
View File

@@ -0,0 +1,25 @@
discard """
action: "compile"
"""
import db_mysql, db_odbc, db_postgres
import os
from stdtest/specialpaths import buildDir
block:
block:
const dbName = buildDir / "db.sqlite3"
var db = db_mysql.open(dbName, "", "", "")
discard tryInsertId(db, sql"INSERT INTO myTestTbl (name,i,f) VALUES (?,?,?)", "t")
block:
const dbName = buildDir / "db.odbc"
var db = db_odbc.open(dbName, "", "", "")
discard tryInsertId(db, sql"INSERT INTO myTestTbl (name,i,f) VALUES (?,?,?)", "t")
block:
const dbName = buildDir / "db.postgres"
var db = db_postgres.open(dbName, "", "", "")
discard tryInsertId(db, sql"INSERT INTO myTestTbl (name,i,f) VALUES (?,?,?)", "t")

1
tests/stdlib/tdb.nims Normal file
View File

@@ -0,0 +1 @@
--styleCheck:off