Warning: file_get_contents(/data/phpspider/zhask/data//catemap/7/sqlite/3.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
在scalaquery中为SQLite生成了不受支持的length()函数_Scala_Scalaquery_Slick - Fatal编程技术网

在scalaquery中为SQLite生成了不受支持的length()函数

在scalaquery中为SQLite生成了不受支持的length()函数,scala,scalaquery,slick,Scala,Scalaquery,Slick,尝试使用scalaquery检索SQLite数据库中文本列的长度时,会生成错误的SQL。 我明白了: SELECT "t1"."title" FROM "GoodPages" "t1" WHERE ({fn length("t1"."title")} > 65) 当查询真的应该 SELECT "t1"."title" FROM "GoodPages" "t1" WHERE length("t1"."title") > 65 用于获取此查询的组件的为 for (f <- Fo

尝试使用scalaquery检索SQLite数据库中文本列的长度时,会生成错误的SQL。 我明白了:

SELECT "t1"."title" FROM "GoodPages" "t1" WHERE ({fn length("t1"."title")} > 65)
当查询真的应该

SELECT "t1"."title" FROM "GoodPages" "t1" WHERE length("t1"."title") > 65
用于获取此查询的
组件的

for (f <- Foo if f.title.length > 65) yield f.title

scalaquery似乎只是生成了错误的
length()
函数,但我在代码中找不到发生这种情况的地方,也没有在Internet上找到任何与此相关的信息。

您看到的生成的SQL更准确地使用了。JDBC驱动程序可以使用这种语法,但不幸的是,SQLite驱动程序不支持这种语法

Slick 1.0.0知道这一点,正如
SQLiteDriver
中的以下代码片段所示

case Apply(j: Library.JdbcFunction, ch) if j != Library.Concat =>
  /* The SQLite JDBC driver does not support ODBC {fn ...} escapes, so we try
   * unescaped function calls by default */
  b"${j.name}("
  b.sep(ch, ",")(expr(_, true))
  b")"
case s: SimpleFunction if s.scalar =>
  /* The SQLite JDBC driver does not support ODBC {fn ...} escapes, so we try
   * unescaped function calls by default */
  b"${s.name}("
  b.sep(s.nodeChildren, ",")(expr(_, true))
  b")"
如果Slick 1.0.0不适合您,我们可能会找到另一个解决方案。让我知道

case Apply(j: Library.JdbcFunction, ch) if j != Library.Concat =>
  /* The SQLite JDBC driver does not support ODBC {fn ...} escapes, so we try
   * unescaped function calls by default */
  b"${j.name}("
  b.sep(ch, ",")(expr(_, true))
  b")"
case s: SimpleFunction if s.scalar =>
  /* The SQLite JDBC driver does not support ODBC {fn ...} escapes, so we try
   * unescaped function calls by default */
  b"${s.name}("
  b.sep(s.nodeChildren, ",")(expr(_, true))
  b")"