test: fix sqlite_test.v
parent
e8f8defc3e
commit
9d6b402df0
|
@ -4,7 +4,7 @@ fn test_sqlite() {
|
||||||
$if !linux {
|
$if !linux {
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
db := sqlite.connect(':memory:')
|
db := sqlite.connect(':memory:') or { panic(err) }
|
||||||
db.exec("drop table if exists users")
|
db.exec("drop table if exists users")
|
||||||
db.exec("create table users (id integer primary key, name text default '');")
|
db.exec("create table users (id integer primary key, name text default '');")
|
||||||
|
|
||||||
|
|
|
@ -509,7 +509,6 @@ pub fn (mut f Fmt) struct_field_expr(fexpr ast.Expr) {
|
||||||
|
|
||||||
fn (f &Fmt) type_to_str(t table.Type) string {
|
fn (f &Fmt) type_to_str(t table.Type) string {
|
||||||
mut res := f.table.type_to_str(t)
|
mut res := f.table.type_to_str(t)
|
||||||
|
|
||||||
for res.ends_with('_ptr') {
|
for res.ends_with('_ptr') {
|
||||||
// type_ptr => &type
|
// type_ptr => &type
|
||||||
res = res[0..res.len - 4]
|
res = res[0..res.len - 4]
|
||||||
|
@ -703,6 +702,7 @@ pub fn (mut f Fmt) expr(node ast.Expr) {
|
||||||
}
|
}
|
||||||
f.write(')')
|
f.write(')')
|
||||||
}
|
}
|
||||||
|
ast.SqlExpr {}
|
||||||
ast.StringLiteral {
|
ast.StringLiteral {
|
||||||
if it.is_raw {
|
if it.is_raw {
|
||||||
f.write('r')
|
f.write('r')
|
||||||
|
@ -721,7 +721,8 @@ pub fn (mut f Fmt) expr(node ast.Expr) {
|
||||||
continue
|
continue
|
||||||
}
|
}
|
||||||
f.write('$')
|
f.write('$')
|
||||||
needs_fspec := it.need_fmts[i] || it.pluss[i] || (it.fills[i] && it.fwidths[i] >= 0) || it.fwidths[i] != 0 || it.precisions[i] != 0
|
needs_fspec := it.need_fmts[i] || it.pluss[i] || (it.fills[i] && it.fwidths[i] >=
|
||||||
|
0) || it.fwidths[i] != 0 || it.precisions[i] != 0
|
||||||
if needs_fspec || (it.exprs[i] !is ast.Ident && it.exprs[i] !is ast.SelectorExpr) {
|
if needs_fspec || (it.exprs[i] !is ast.Ident && it.exprs[i] !is ast.SelectorExpr) {
|
||||||
f.write('{')
|
f.write('{')
|
||||||
f.expr(it.exprs[i])
|
f.expr(it.exprs[i])
|
||||||
|
|
Loading…
Reference in New Issue