mirror of
https://github.com/vlang/v.git
synced 2025-09-15 07:22:27 +03:00
fmt: fix alignment of struct init fields (#22025)
This commit is contained in:
parent
99da5726db
commit
c51d30bf53
671 changed files with 18817 additions and 18787 deletions
|
@ -74,7 +74,7 @@ pub fn (mut conn Connection) query(q string) !Result {
|
|||
raw_rows := hstmt.read_rows()!
|
||||
|
||||
mut res := Result{
|
||||
rows: []Row{}
|
||||
rows: []Row{}
|
||||
num_rows_affected: affected
|
||||
}
|
||||
|
||||
|
|
|
@ -24,7 +24,7 @@ fn new_hstmt(hdbc C.SQLHDBC) !HStmt {
|
|||
check_error(retcode, 'SQLAllocHandle(SQL_HANDLE_STMT)', C.SQLHANDLE(hstmt), C.SQLSMALLINT(C.SQL_HANDLE_STMT))!
|
||||
|
||||
return HStmt{
|
||||
hdbc: hdbc
|
||||
hdbc: hdbc
|
||||
hstmt: hstmt
|
||||
}
|
||||
}
|
||||
|
|
|
@ -43,7 +43,7 @@ import db.mysql
|
|||
// Create connection
|
||||
mut connection := mysql.Connection{
|
||||
username: 'root'
|
||||
dbname: 'mysql'
|
||||
dbname: 'mysql'
|
||||
}
|
||||
// Connect to server
|
||||
connection.connect()?
|
||||
|
@ -60,4 +60,4 @@ for user in get_users_query_result.maps() {
|
|||
get_users_query_result.free()
|
||||
// Close the connection if needed
|
||||
connection.close()
|
||||
```
|
||||
```
|
|
@ -384,7 +384,7 @@ pub fn (db &DB) prepare(query string) !StmtHandle {
|
|||
|
||||
return StmtHandle{
|
||||
stmt: stmt
|
||||
db: DB{
|
||||
db: DB{
|
||||
conn: db.conn
|
||||
}
|
||||
}
|
||||
|
@ -398,10 +398,10 @@ pub fn (stmt &StmtHandle) execute(params []string) ![]Row {
|
|||
mut bind_params := []C.MYSQL_BIND{}
|
||||
for param in params {
|
||||
bind := C.MYSQL_BIND{
|
||||
buffer_type: mysql_type_string
|
||||
buffer: param.str
|
||||
buffer_type: mysql_type_string
|
||||
buffer: param.str
|
||||
buffer_length: u32(param.len)
|
||||
length: 0
|
||||
length: 0
|
||||
}
|
||||
bind_params << bind
|
||||
}
|
||||
|
@ -428,10 +428,10 @@ pub fn (stmt &StmtHandle) execute(params []string) ![]Row {
|
|||
mut binds := []C.MYSQL_BIND{}
|
||||
for i in 0 .. num_cols {
|
||||
bind := C.MYSQL_BIND{
|
||||
buffer_type: mysql_type_string
|
||||
buffer: 0
|
||||
buffer_type: mysql_type_string
|
||||
buffer: 0
|
||||
buffer_length: 0
|
||||
length: unsafe { &length[i] }
|
||||
length: unsafe { &length[i] }
|
||||
}
|
||||
binds << bind
|
||||
}
|
||||
|
|
|
@ -42,58 +42,58 @@ fn test_mysql_orm() {
|
|||
return
|
||||
}
|
||||
mut db := mysql.connect(
|
||||
host: '127.0.0.1'
|
||||
port: 3306
|
||||
host: '127.0.0.1'
|
||||
port: 3306
|
||||
username: 'root'
|
||||
password: ''
|
||||
dbname: 'mysql'
|
||||
dbname: 'mysql'
|
||||
)!
|
||||
defer {
|
||||
db.close()
|
||||
}
|
||||
db.create('Test', [
|
||||
orm.TableField{
|
||||
name: 'id'
|
||||
typ: typeof[int]().idx
|
||||
name: 'id'
|
||||
typ: typeof[int]().idx
|
||||
attrs: [
|
||||
VAttribute{
|
||||
name: 'primary'
|
||||
},
|
||||
VAttribute{
|
||||
name: 'sql'
|
||||
name: 'sql'
|
||||
has_arg: true
|
||||
kind: .plain
|
||||
arg: 'serial'
|
||||
kind: .plain
|
||||
arg: 'serial'
|
||||
},
|
||||
]
|
||||
},
|
||||
orm.TableField{
|
||||
name: 'name'
|
||||
typ: typeof[string]().idx
|
||||
name: 'name'
|
||||
typ: typeof[string]().idx
|
||||
attrs: []
|
||||
},
|
||||
orm.TableField{
|
||||
name: 'age'
|
||||
typ: typeof[int]().idx
|
||||
typ: typeof[int]().idx
|
||||
},
|
||||
]) or { panic(err) }
|
||||
|
||||
db.insert('Test', orm.QueryData{
|
||||
fields: ['name', 'age']
|
||||
data: [orm.string_to_primitive('Louis'), orm.int_to_primitive(101)]
|
||||
data: [orm.string_to_primitive('Louis'), orm.int_to_primitive(101)]
|
||||
}) or { panic(err) }
|
||||
|
||||
res := db.@select(orm.SelectConfig{
|
||||
table: 'Test'
|
||||
table: 'Test'
|
||||
has_where: true
|
||||
fields: ['id', 'name', 'age']
|
||||
types: [typeof[int]().idx, typeof[string]().idx, typeof[i64]().idx]
|
||||
fields: ['id', 'name', 'age']
|
||||
types: [typeof[int]().idx, typeof[string]().idx, typeof[i64]().idx]
|
||||
}, orm.QueryData{}, orm.QueryData{
|
||||
fields: ['name', 'age']
|
||||
data: [orm.Primitive('Louis'), i64(101)]
|
||||
types: [typeof[string]().idx, typeof[i64]().idx]
|
||||
data: [orm.Primitive('Louis'), i64(101)]
|
||||
types: [typeof[string]().idx, typeof[i64]().idx]
|
||||
is_and: [true, true]
|
||||
kinds: [.eq, .eq]
|
||||
kinds: [.eq, .eq]
|
||||
}) or { panic(err) }
|
||||
|
||||
id := res[0][0]
|
||||
|
@ -179,7 +179,7 @@ fn test_mysql_orm() {
|
|||
}
|
||||
|
||||
model := TestTimeType{
|
||||
username: 'hitalo'
|
||||
username: 'hitalo'
|
||||
created_at: today
|
||||
updated_at: today.str()
|
||||
deleted_at: today
|
||||
|
|
|
@ -7,11 +7,11 @@ fn test_mysql() {
|
|||
return
|
||||
}
|
||||
config := mysql.Config{
|
||||
host: '127.0.0.1'
|
||||
port: 3306
|
||||
host: '127.0.0.1'
|
||||
port: 3306
|
||||
username: 'root'
|
||||
password: ''
|
||||
dbname: 'mysql'
|
||||
dbname: 'mysql'
|
||||
}
|
||||
|
||||
db := mysql.connect(config)!
|
||||
|
|
|
@ -133,9 +133,9 @@ pub fn (db DB) insert(table string, data orm.QueryData) ! {
|
|||
|
||||
converted_primitive_data := orm.QueryData{
|
||||
fields: data.fields
|
||||
data: converted_primitive_array
|
||||
types: []
|
||||
kinds: []
|
||||
data: converted_primitive_array
|
||||
types: []
|
||||
kinds: []
|
||||
is_and: []
|
||||
}
|
||||
|
||||
|
|
|
@ -7,11 +7,11 @@ fn test_prep() {
|
|||
return
|
||||
}
|
||||
config := mysql.Config{
|
||||
host: '127.0.0.1'
|
||||
port: 3306
|
||||
host: '127.0.0.1'
|
||||
port: 3306
|
||||
username: 'root'
|
||||
password: ''
|
||||
dbname: 'mysql'
|
||||
dbname: 'mysql'
|
||||
}
|
||||
|
||||
db := mysql.connect(config)!
|
||||
|
|
|
@ -93,26 +93,26 @@ pub fn (r Result) fields() []Field {
|
|||
for i in 0 .. nr_cols {
|
||||
unsafe {
|
||||
fields << Field{
|
||||
name: mystring(orig_fields[i].name)
|
||||
org_name: mystring(orig_fields[i].org_name)
|
||||
table: mystring(orig_fields[i].table)
|
||||
org_table: mystring(orig_fields[i].org_table)
|
||||
db: mystring(orig_fields[i].db)
|
||||
catalog: mystring(orig_fields[i].catalog)
|
||||
def: resolve_nil_str(orig_fields[i].def)
|
||||
length: orig_fields.length
|
||||
max_length: orig_fields.max_length
|
||||
name_length: orig_fields.name_length
|
||||
org_name_length: orig_fields.org_name_length
|
||||
table_length: orig_fields.table_length
|
||||
name: mystring(orig_fields[i].name)
|
||||
org_name: mystring(orig_fields[i].org_name)
|
||||
table: mystring(orig_fields[i].table)
|
||||
org_table: mystring(orig_fields[i].org_table)
|
||||
db: mystring(orig_fields[i].db)
|
||||
catalog: mystring(orig_fields[i].catalog)
|
||||
def: resolve_nil_str(orig_fields[i].def)
|
||||
length: orig_fields.length
|
||||
max_length: orig_fields.max_length
|
||||
name_length: orig_fields.name_length
|
||||
org_name_length: orig_fields.org_name_length
|
||||
table_length: orig_fields.table_length
|
||||
org_table_length: orig_fields.org_table_length
|
||||
db_length: orig_fields.db_length
|
||||
catalog_length: orig_fields.catalog_length
|
||||
def_length: orig_fields.def_length
|
||||
flags: orig_fields.flags
|
||||
decimals: orig_fields.decimals
|
||||
charsetnr: orig_fields.charsetnr
|
||||
type_: FieldType(orig_fields.@type)
|
||||
db_length: orig_fields.db_length
|
||||
catalog_length: orig_fields.catalog_length
|
||||
def_length: orig_fields.def_length
|
||||
flags: orig_fields.flags
|
||||
decimals: orig_fields.decimals
|
||||
charsetnr: orig_fields.charsetnr
|
||||
type_: FieldType(orig_fields.@type)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -77,7 +77,7 @@ pub fn (s &Stmt) str() string {
|
|||
// init_stmt creates a new statement, given the `query`.
|
||||
pub fn (db DB) init_stmt(query string) Stmt {
|
||||
return Stmt{
|
||||
stmt: C.mysql_stmt_init(db.conn)
|
||||
stmt: C.mysql_stmt_init(db.conn)
|
||||
query: query
|
||||
binds: []C.MYSQL_BIND{}
|
||||
}
|
||||
|
@ -171,7 +171,7 @@ pub fn (stmt Stmt) error(code int) IError {
|
|||
msg := stmt.get_error_msg()
|
||||
|
||||
return &SQLError{
|
||||
msg: '${msg} (${code}) (${stmt.query})'
|
||||
msg: '${msg} (${code}) (${stmt.query})'
|
||||
code: code
|
||||
}
|
||||
}
|
||||
|
@ -249,7 +249,7 @@ pub fn (mut stmt Stmt) bind_text(b string) {
|
|||
pub fn (mut stmt Stmt) bind_null() {
|
||||
stmt.binds << C.MYSQL_BIND{
|
||||
buffer_type: mysql.mysql_type_null
|
||||
length: 0
|
||||
length: 0
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -257,10 +257,10 @@ pub fn (mut stmt Stmt) bind_null() {
|
|||
// Note: it is more convenient to use one of the other bind_XYZ methods.
|
||||
pub fn (mut stmt Stmt) bind(typ int, buffer voidptr, buf_len u32) {
|
||||
stmt.binds << C.MYSQL_BIND{
|
||||
buffer_type: typ
|
||||
buffer: buffer
|
||||
buffer_type: typ
|
||||
buffer: buffer
|
||||
buffer_length: buf_len
|
||||
length: 0
|
||||
length: 0
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -269,8 +269,8 @@ pub fn (mut stmt Stmt) bind_res(fields &C.MYSQL_FIELD, dataptr []&u8, lengths []
|
|||
for i in 0 .. num_fields {
|
||||
stmt.res << C.MYSQL_BIND{
|
||||
buffer_type: unsafe { fields[i].@type }
|
||||
buffer: dataptr[i]
|
||||
length: &lengths[i]
|
||||
buffer: dataptr[i]
|
||||
length: &lengths[i]
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -42,10 +42,10 @@ fn test_pg_orm() {
|
|||
return
|
||||
}
|
||||
mut db := pg.connect(
|
||||
host: 'localhost'
|
||||
user: 'postgres'
|
||||
host: 'localhost'
|
||||
user: 'postgres'
|
||||
password: 'password'
|
||||
dbname: 'postgres'
|
||||
dbname: 'postgres'
|
||||
) or { panic(err) }
|
||||
|
||||
defer {
|
||||
|
@ -55,65 +55,65 @@ fn test_pg_orm() {
|
|||
db.create('Test', [
|
||||
orm.TableField{
|
||||
name: 'id'
|
||||
typ: typeof[string]().idx
|
||||
typ: typeof[string]().idx
|
||||
// is_time: false
|
||||
default_val: ''
|
||||
is_arr: false
|
||||
attrs: [
|
||||
is_arr: false
|
||||
attrs: [
|
||||
VAttribute{
|
||||
name: 'primary'
|
||||
name: 'primary'
|
||||
has_arg: false
|
||||
arg: ''
|
||||
kind: .plain
|
||||
arg: ''
|
||||
kind: .plain
|
||||
},
|
||||
VAttribute{
|
||||
name: 'sql'
|
||||
name: 'sql'
|
||||
has_arg: true
|
||||
arg: 'serial'
|
||||
kind: .plain
|
||||
arg: 'serial'
|
||||
kind: .plain
|
||||
},
|
||||
]
|
||||
},
|
||||
orm.TableField{
|
||||
name: 'name'
|
||||
typ: typeof[string]().idx
|
||||
typ: typeof[string]().idx
|
||||
// is_time: false
|
||||
default_val: ''
|
||||
is_arr: false
|
||||
attrs: []
|
||||
is_arr: false
|
||||
attrs: []
|
||||
},
|
||||
orm.TableField{
|
||||
name: 'age'
|
||||
typ: typeof[i64]().idx
|
||||
typ: typeof[i64]().idx
|
||||
// is_time: false
|
||||
default_val: ''
|
||||
is_arr: false
|
||||
attrs: []
|
||||
is_arr: false
|
||||
attrs: []
|
||||
},
|
||||
]) or { panic(err) }
|
||||
|
||||
db.insert('Test', orm.QueryData{
|
||||
fields: ['name', 'age']
|
||||
data: [orm.string_to_primitive('Louis'), orm.int_to_primitive(101)]
|
||||
data: [orm.string_to_primitive('Louis'), orm.int_to_primitive(101)]
|
||||
}) or { panic(err) }
|
||||
|
||||
res := db.@select(orm.SelectConfig{
|
||||
table: 'Test'
|
||||
is_count: false
|
||||
has_where: true
|
||||
has_order: false
|
||||
order: ''
|
||||
table: 'Test'
|
||||
is_count: false
|
||||
has_where: true
|
||||
has_order: false
|
||||
order: ''
|
||||
order_type: .asc
|
||||
has_limit: false
|
||||
primary: 'id'
|
||||
has_limit: false
|
||||
primary: 'id'
|
||||
has_offset: false
|
||||
fields: ['id', 'name', 'age']
|
||||
types: [typeof[int]().idx, typeof[string]().idx, typeof[i64]().idx]
|
||||
fields: ['id', 'name', 'age']
|
||||
types: [typeof[int]().idx, typeof[string]().idx, typeof[i64]().idx]
|
||||
}, orm.QueryData{}, orm.QueryData{
|
||||
fields: ['name', 'age']
|
||||
data: [orm.Primitive('Louis'), orm.Primitive(101)]
|
||||
types: []
|
||||
kinds: [.eq, .eq]
|
||||
data: [orm.Primitive('Louis'), orm.Primitive(101)]
|
||||
types: []
|
||||
kinds: [.eq, .eq]
|
||||
is_and: [true]
|
||||
}) or { panic(err) }
|
||||
|
||||
|
@ -178,7 +178,7 @@ fn test_pg_orm() {
|
|||
}
|
||||
|
||||
model := TestTimeType{
|
||||
username: 'hitalo'
|
||||
username: 'hitalo'
|
||||
created_at: today
|
||||
updated_at: today.str()
|
||||
deleted_at: today
|
||||
|
|
|
@ -29,7 +29,7 @@ fn test_main() {
|
|||
} or { panic(err) }
|
||||
|
||||
new_parent := Parent{
|
||||
name: 'first parent'
|
||||
name: 'first parent'
|
||||
children: [
|
||||
Child{
|
||||
name: 'first child'
|
||||
|
@ -46,23 +46,23 @@ fn test_main() {
|
|||
|
||||
babies := [
|
||||
Baby{
|
||||
name: 'first baby'
|
||||
name: 'first baby'
|
||||
child_id: 1
|
||||
},
|
||||
Baby{
|
||||
name: 'second baby'
|
||||
name: 'second baby'
|
||||
child_id: 1
|
||||
},
|
||||
Baby{
|
||||
name: 'third baby'
|
||||
name: 'third baby'
|
||||
child_id: 2
|
||||
},
|
||||
Baby{
|
||||
name: 'fourth baby'
|
||||
name: 'fourth baby'
|
||||
child_id: 2
|
||||
},
|
||||
Baby{
|
||||
name: 'fifth baby'
|
||||
name: 'fifth baby'
|
||||
child_id: 2
|
||||
},
|
||||
]
|
||||
|
|
|
@ -131,12 +131,12 @@ pub fn connect(path string) !DB {
|
|||
code := C.sqlite3_open(&char(path.str), &db)
|
||||
if code != 0 {
|
||||
return &SQLError{
|
||||
msg: unsafe { cstring_to_vstring(&char(C.sqlite3_errmsg(db))) }
|
||||
msg: unsafe { cstring_to_vstring(&char(C.sqlite3_errmsg(db))) }
|
||||
code: code
|
||||
}
|
||||
}
|
||||
return DB{
|
||||
conn: db
|
||||
conn: db
|
||||
is_open: true
|
||||
}
|
||||
}
|
||||
|
@ -150,7 +150,7 @@ pub fn (mut db DB) close() !bool {
|
|||
db.is_open = false
|
||||
} else {
|
||||
return &SQLError{
|
||||
msg: unsafe { cstring_to_vstring(&char(C.sqlite3_errmsg(db.conn))) }
|
||||
msg: unsafe { cstring_to_vstring(&char(C.sqlite3_errmsg(db.conn))) }
|
||||
code: code
|
||||
}
|
||||
}
|
||||
|
@ -258,7 +258,7 @@ pub fn (db &DB) exec_one(query string) !Row {
|
|||
}
|
||||
if rows.len == 0 {
|
||||
return &SQLError{
|
||||
msg: 'No rows'
|
||||
msg: 'No rows'
|
||||
code: sqlite.sqlite_done
|
||||
}
|
||||
}
|
||||
|
@ -273,7 +273,7 @@ pub fn (db &DB) error_message(code int, query string) IError {
|
|||
msg := '${errmsg} (${code}) (${query})'
|
||||
unsafe { errmsg.free() }
|
||||
return SQLError{
|
||||
msg: msg
|
||||
msg: msg
|
||||
code: code
|
||||
}
|
||||
}
|
||||
|
|
|
@ -33,47 +33,47 @@ fn test_sqlite_orm() {
|
|||
}
|
||||
db.create('Test', [
|
||||
orm.TableField{
|
||||
name: 'id'
|
||||
typ: typeof[int]().idx
|
||||
name: 'id'
|
||||
typ: typeof[int]().idx
|
||||
attrs: [
|
||||
VAttribute{
|
||||
name: 'primary'
|
||||
},
|
||||
VAttribute{
|
||||
name: 'sql'
|
||||
name: 'sql'
|
||||
has_arg: true
|
||||
kind: .plain
|
||||
arg: 'serial'
|
||||
kind: .plain
|
||||
arg: 'serial'
|
||||
},
|
||||
]
|
||||
},
|
||||
orm.TableField{
|
||||
name: 'name'
|
||||
typ: typeof[string]().idx
|
||||
name: 'name'
|
||||
typ: typeof[string]().idx
|
||||
attrs: []
|
||||
},
|
||||
orm.TableField{
|
||||
name: 'age'
|
||||
typ: typeof[i64]().idx
|
||||
typ: typeof[i64]().idx
|
||||
},
|
||||
]) or { panic(err) }
|
||||
|
||||
db.insert('Test', orm.QueryData{
|
||||
fields: ['name', 'age']
|
||||
data: [orm.string_to_primitive('Louis'), orm.i64_to_primitive(100)]
|
||||
data: [orm.string_to_primitive('Louis'), orm.i64_to_primitive(100)]
|
||||
}) or { panic(err) }
|
||||
|
||||
res := db.@select(orm.SelectConfig{
|
||||
table: 'Test'
|
||||
table: 'Test'
|
||||
has_where: true
|
||||
fields: ['id', 'name', 'age']
|
||||
types: [typeof[int]().idx, typeof[string]().idx, typeof[i64]().idx]
|
||||
fields: ['id', 'name', 'age']
|
||||
types: [typeof[int]().idx, typeof[string]().idx, typeof[i64]().idx]
|
||||
}, orm.QueryData{}, orm.QueryData{
|
||||
fields: ['name', 'age']
|
||||
data: [orm.Primitive('Louis'), i64(100)]
|
||||
types: [typeof[string]().idx, typeof[i64]().idx]
|
||||
data: [orm.Primitive('Louis'), i64(100)]
|
||||
types: [typeof[string]().idx, typeof[i64]().idx]
|
||||
is_and: [true, true]
|
||||
kinds: [.eq, .eq]
|
||||
kinds: [.eq, .eq]
|
||||
}) or { panic(err) }
|
||||
|
||||
id := res[0][0]
|
||||
|
@ -177,7 +177,7 @@ fn test_get_affected_rows_count() {
|
|||
);')!
|
||||
|
||||
fst := EntityToTest{
|
||||
id: 1
|
||||
id: 1
|
||||
smth: '1'
|
||||
}
|
||||
|
||||
|
@ -188,7 +188,7 @@ fn test_get_affected_rows_count() {
|
|||
assert db.get_affected_rows_count() == 1
|
||||
|
||||
snd := EntityToTest{
|
||||
id: 1
|
||||
id: 1
|
||||
smth: '2'
|
||||
}
|
||||
|
||||
|
|
|
@ -10,7 +10,7 @@ fn test_vfs_register() {
|
|||
|
||||
vfs_name := 'sometest'
|
||||
mut vfs_descr := &sqlite.Sqlite3_vfs{
|
||||
zName: vfs_name.str
|
||||
zName: vfs_name.str
|
||||
iVersion: 2
|
||||
}
|
||||
|
||||
|
@ -42,23 +42,23 @@ fn test_verify_vfs_is_actually_used() {
|
|||
log: []string{cap: 100}
|
||||
}
|
||||
mut vfs_descr := &sqlite.Sqlite3_vfs{
|
||||
iVersion: 2
|
||||
szOsFile: int(sizeof(ExampleVfsOpenedFile))
|
||||
mxPathname: max_file_name_len
|
||||
zName: vfs_name.str
|
||||
pAppData: vfs_state
|
||||
xOpen: example_vfs_open
|
||||
xDelete: example_vfs_delete
|
||||
xAccess: example_vfs_access
|
||||
xFullPathname: example_vfs_fullpathname
|
||||
xDlOpen: wrapped.xDlOpen
|
||||
xDlError: wrapped.xDlError
|
||||
xDlSym: wrapped.xDlSym
|
||||
xDlClose: wrapped.xDlClose
|
||||
xRandomness: wrapped.xRandomness
|
||||
xSleep: wrapped.xSleep
|
||||
xCurrentTime: wrapped.xCurrentTime
|
||||
xGetLastError: example_vfs_getlasterror
|
||||
iVersion: 2
|
||||
szOsFile: int(sizeof(ExampleVfsOpenedFile))
|
||||
mxPathname: max_file_name_len
|
||||
zName: vfs_name.str
|
||||
pAppData: vfs_state
|
||||
xOpen: example_vfs_open
|
||||
xDelete: example_vfs_delete
|
||||
xAccess: example_vfs_access
|
||||
xFullPathname: example_vfs_fullpathname
|
||||
xDlOpen: wrapped.xDlOpen
|
||||
xDlError: wrapped.xDlError
|
||||
xDlSym: wrapped.xDlSym
|
||||
xDlClose: wrapped.xDlClose
|
||||
xRandomness: wrapped.xRandomness
|
||||
xSleep: wrapped.xSleep
|
||||
xCurrentTime: wrapped.xCurrentTime
|
||||
xGetLastError: example_vfs_getlasterror
|
||||
xCurrentTimeInt64: wrapped.xCurrentTimeInt64
|
||||
}
|
||||
|
||||
|
@ -155,18 +155,18 @@ fn example_vfs_open(vfs &sqlite.Sqlite3_vfs, file_name_or_null_for_tempfile &cha
|
|||
unsafe {
|
||||
mut outp := to_vfsopenedfile(vfs_opened_file)
|
||||
outp.base.pMethods = &sqlite.Sqlite3_io_methods{
|
||||
iVersion: 1
|
||||
xClose: example_vfsfile_close
|
||||
xRead: example_vfsfile_read
|
||||
xWrite: example_vfsfile_write
|
||||
xTruncate: example_vfsfile_truncate
|
||||
xSync: example_vfsfile_sync
|
||||
xFileSize: example_vfsfile_size
|
||||
xLock: example_vfsfile_lock
|
||||
xUnlock: example_vfsfile_unlock
|
||||
xCheckReservedLock: example_vfsfile_checkreservedlock
|
||||
xFileControl: example_vfsfile_filecontrol
|
||||
xSectorSize: example_vfsfile_sectorsize
|
||||
iVersion: 1
|
||||
xClose: example_vfsfile_close
|
||||
xRead: example_vfsfile_read
|
||||
xWrite: example_vfsfile_write
|
||||
xTruncate: example_vfsfile_truncate
|
||||
xSync: example_vfsfile_sync
|
||||
xFileSize: example_vfsfile_size
|
||||
xLock: example_vfsfile_lock
|
||||
xUnlock: example_vfsfile_unlock
|
||||
xCheckReservedLock: example_vfsfile_checkreservedlock
|
||||
xFileControl: example_vfsfile_filecontrol
|
||||
xSectorSize: example_vfsfile_sectorsize
|
||||
xDeviceCharacteristics: example_vfsfile_devicecharacteristics
|
||||
}
|
||||
|
||||
|
|
|
@ -155,12 +155,12 @@ pub fn connect_full(path string, mode_flags []OpenModeFlag, vfs_name string) !DB
|
|||
code := C.sqlite3_open_v2(&char(path.str), &db, flags, vfs_name.str)
|
||||
if code != 0 {
|
||||
return &SQLError{
|
||||
msg: unsafe { cstring_to_vstring(&char(C.sqlite3_errstr(code))) }
|
||||
msg: unsafe { cstring_to_vstring(&char(C.sqlite3_errstr(code))) }
|
||||
code: code
|
||||
}
|
||||
}
|
||||
return DB{
|
||||
conn: db
|
||||
conn: db
|
||||
is_open: true
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue