Skip to content

Commit

Permalink
Cosmetics
Browse files Browse the repository at this point in the history
  • Loading branch information
sake92 committed Jan 9, 2024
1 parent aa101f7 commit 222960d
Show file tree
Hide file tree
Showing 7 changed files with 10 additions and 30 deletions.
4 changes: 3 additions & 1 deletion DEV.md
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
./mill examples.runMain bla

# for local dev/test
./mill squery.publishM2Local
./mill squery.publishLocal

git diff
git commit -am "msg"
Expand All @@ -36,3 +36,5 @@ git push --atomic origin main $VERSION
- neo4j
- cassandra
- sql parser reorders OFFSET LIMIT ???
- generate (id, name) + corresponding insert (?, ?)
depending on autoincrement/serial stuff
9 changes: 5 additions & 4 deletions docs/src/files/tutorials/GettingStarted.scala
Original file line number Diff line number Diff line change
Expand Up @@ -21,10 +21,11 @@ object GettingStarted extends TutorialPage {
```scala
import ba.sake.squery.{*, given}
// import one of these if needed:
// import ba.sake.squery.postgres.*
// import ba.sake.squery.mysql.*
// import ba.sake.squery.mariadb.*
// import ba.sake.squery.oracle.*
// import ba.sake.squery.postgres.{*, given}
// import ba.sake.squery.mysql.{*, given}
// import ba.sake.squery.mariadb.{*, given}
// import ba.sake.squery.oracle.{*, given}
// import ba.sake.squery.h2.{*, given}
val ds = com.zaxxer.hikari.HikariDataSource()
ds.setJdbcUrl(..)
Expand Down
2 changes: 0 additions & 2 deletions squery/src/ba/sake/squery/query.scala
Original file line number Diff line number Diff line change
Expand Up @@ -29,8 +29,6 @@ case class Query(
colNames: Seq[String] = Seq.empty
): jsql.PreparedStatement = {
val enrichedQueryString = Query.enrichSqlQuery(sqlString)
// TODO reorder enriched issue..
// println("enriched: " + enrichedQueryString)
logger.debug(s"Executing statement: $enrichedQueryString")
val stat =
if retGenKeys then
Expand Down
4 changes: 0 additions & 4 deletions squery/src/ba/sake/squery/sql.scala
Original file line number Diff line number Diff line change
Expand Up @@ -6,10 +6,6 @@ import scala.collection.mutable.ListBuffer
import ba.sake.squery.write.*
import ba.sake.squery.Query

// TODO make derived SqlArgument[CaseClass]
// and insert (?, ?) automatically ??
// or autogenerate it with scalafix, easier

case class LiteralString(value: String)

case class DynamicArg[T](value: T)(using val sqlWrite: SqlWrite[T])
Expand Down
1 change: 0 additions & 1 deletion squery/src/ba/sake/squery/squery.scala
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,6 @@ extension (query: Query) {
throw SqueryException("No value returned from query")
)

// TODO same for UPDATE RETURNING.. ?
def insertReturningRows[A]()(using
c: SqueryConnection,
r: SqlReadRow[A]
Expand Down
15 changes: 0 additions & 15 deletions squery/test/src/ba/sake/squery/oracle/OracleSuite.scala
Original file line number Diff line number Diff line change
Expand Up @@ -240,21 +240,6 @@ class OracleSuite extends munit.FunSuite {
}
}

// TODO seems like this only works with PL/SQL ...
/*
test("INSERT returning columns") {
val ctx = initDb()
ctx.run {
val customer = sql"""
INSERT INTO customers(name)
VALUES ('bla')
RETURNING id, name, street
INTO id, name, street
""".insertReturningRow[Customer]()
assertEquals(customer.name, "bla")
}
}
*/
test("UPDATE should return number of affected rows") {
val ctx = initDb()
ctx.run {
Expand Down
5 changes: 2 additions & 3 deletions squery/test/src/ba/sake/squery/postgres/PostgresSuite.scala
Original file line number Diff line number Diff line change
Expand Up @@ -359,15 +359,14 @@ class PostgresSuite extends munit.FunSuite {
ctx.run {
// custom squery warnings
// no WHERE clause
// TODO how to test these..?
// TODO how to test logging statements ??
sql"UPDATE customers SET name='bla'".update()

intercept[Exception] {
sql"DELETE FROM customers".update()
}

// JDBC warning
// TODO not triggering...
// TODO not triggering JDBC warning...
sql"""
CREATE OR REPLACE FUNCTION test_fun_warn() RETURNS integer AS $$$$
BEGIN
Expand Down

0 comments on commit 222960d

Please sign in to comment.