pg: minor fixes

pull/2856/head
Alexander Medvednikov 2019-11-23 19:45:35 +03:00
parent e724792a67
commit 0fb0c43c0a
4 changed files with 28 additions and 25 deletions

View File

@ -41,5 +41,6 @@
+ fast.vlang.io + fast.vlang.io
+ bare metal support + bare metal support
+ inline assembly + inline assembly
+ x64 machine code generation (ELF)

View File

@ -1625,7 +1625,9 @@ fn (p mut Parser) var_expr(v Var) string {
p.next() p.next()
return p.select_query(fn_ph) return p.select_query(fn_ph)
} }
if typ == 'pg__DB' && !p.fileis('pg.v') && p.peek() == .name { if typ == 'pg__DB' && !p.fileis('pg.v') && p.peek() == .name &&
!p.tokens[p.token_idx].lit.contains('exec')
{
p.next() p.next()
p.insert_query(fn_ph) p.insert_query(fn_ph)
return 'void' return 'void'

View File

@ -5,19 +5,19 @@ module pg
#flag darwin -I/opt/local/include/postgresql11 #flag darwin -I/opt/local/include/postgresql11
#include <libpq-fe.h> #include <libpq-fe.h>
struct DB { pub struct DB {
mut: mut:
conn &C.PGconn conn &C.PGconn
} }
struct Row { pub struct Row {
pub mut: pub mut:
vals []string vals []string
} }
struct C.PGResult { } struct C.PGResult { }
struct Config { pub struct Config {
pub: pub:
host string host string
user string user string