Skip to content

Commit

Permalink
toSqlStr -> renderSql
Browse files Browse the repository at this point in the history
  • Loading branch information
lihaoyi committed Dec 11, 2023
1 parent a884f02 commit 82c2e91
Show file tree
Hide file tree
Showing 4 changed files with 5 additions and 5 deletions.
2 changes: 1 addition & 1 deletion docs/design.md
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ The rough dataflow of how ScalaSql works is given by the following diagram:
Q | | R
| |
v |
Queryable#{toSqlStr,walkSqlExprs} Queryable#construct
Queryable#{renderSql,walkExprs} Queryable#construct
| ^
| |
SqlStr | | ResultSet
Expand Down
2 changes: 1 addition & 1 deletion scalasql/core/src/DbApi.scala
Original file line number Diff line number Diff line change
Expand Up @@ -109,7 +109,7 @@ object DbApi {

def unpackQueryable[R, Q](query: Q, qr: Queryable[Q, R], config: Config) = {
val ctx = Context.Impl(Map(), Map(), config)
val flattened = SqlStr.flatten(qr.toSqlStr(query, ctx))
val flattened = SqlStr.flatten(qr.renderSql(query, ctx))
flattened
}

Expand Down
4 changes: 2 additions & 2 deletions scalasql/core/src/Queryable.scala
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ trait Queryable[-Q, R] {
* Converts the given queryable value into a [[SqlStr]], that can then be executed
* by the underlying SQL JDBC interface
*/
def toSqlStr(q: Q, ctx: Context): SqlStr
def renderSql(q: Q, ctx: Context): SqlStr

/**
* Construct a Scala return value from the [[Queryable.ResultSetIterator]] representing
Expand Down Expand Up @@ -87,7 +87,7 @@ object Queryable {
def walkLabels(): Seq[List[String]]
def walkLabels(q: Q): Seq[List[String]] = walkLabels()

def toSqlStr(q: Q, ctx: Context): SqlStr = {
def renderSql(q: Q, ctx: Context): SqlStr = {
ExprsToSql.apply(this.walkLabelsAndExprs(q), ctx, sql"SELECT ")
}

Expand Down
2 changes: 1 addition & 1 deletion scalasql/query/src/Query.scala
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,7 @@ object Query {
override def walkExprs(q: Q) = q.queryWalkExprs()
override def isSingleRow(q: Q) = q.queryIsSingleRow

def toSqlStr(q: Q, ctx: Context): SqlStr = q.renderSql(ctx)
def renderSql(q: Q, ctx: Context): SqlStr = q.renderSql(ctx)

override def construct(q: Q, args: Queryable.ResultSetIterator): R = q.queryConstruct(args)
}
Expand Down

0 comments on commit 82c2e91

Please sign in to comment.