-
Notifications
You must be signed in to change notification settings - Fork 5
/
Copy pathdebug.v
51 lines (43 loc) · 946 Bytes
/
debug.v
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
module vsql
// print sql string for debug
pub fn (mut db DB) print_sql() &DB {
s := db.gen_sql()
println(s)
return db
}
// print sql to object struct for debug
pub fn (mut db DB) print_obj() &DB {
println(db.stmt)
return db
}
// generate sql string for debug
// do not use together with end()
pub fn (mut db DB) to_sql() string {
s := db.gen_sql()
// after to_sql clear the db.stmt,that do not impact next sql
db.stmt = Stmt{}
return s
}
// ----------
// create table print sql string for debug
pub fn (t &Table) print_sql() &Table {
s := t.gen_table_sql()
println(s)
return t
}
// create table print sql to object struct for debug
pub fn (t &Table) print_obj() &Table {
println(t)
return t
}
// create table generate sql string for debug
pub fn (t &Table) to_sql() string {
s := t.gen_table_sql()
return s
}
// debug mode
pub fn (mut db DB) debug() {
}
// timeout,only mysql pg
pub fn (mut db DB) timeout(during int) {
}