mirror of
https://github.com/vlang/v.git
synced 2025-09-15 15:32:27 +03:00
all: remove unnecessary IError() casts
This commit is contained in:
parent
daa2f90023
commit
c6158e4519
28 changed files with 86 additions and 88 deletions
|
@ -110,10 +110,10 @@ pub fn connect(path string) !DB {
|
|||
db := &C.sqlite3(0)
|
||||
code := C.sqlite3_open(&char(path.str), &db)
|
||||
if code != 0 {
|
||||
return IError(&SQLError{
|
||||
return &SQLError{
|
||||
msg: unsafe { cstring_to_vstring(&char(C.sqlite3_errstr(code))) }
|
||||
code: code
|
||||
})
|
||||
}
|
||||
}
|
||||
return DB{
|
||||
conn: db
|
||||
|
@ -129,10 +129,10 @@ pub fn (mut db DB) close() !bool {
|
|||
if code == 0 {
|
||||
db.is_open = false
|
||||
} else {
|
||||
return IError(&SQLError{
|
||||
return &SQLError{
|
||||
msg: unsafe { cstring_to_vstring(&char(C.sqlite3_errstr(code))) }
|
||||
code: code
|
||||
})
|
||||
}
|
||||
}
|
||||
return true // successfully closed
|
||||
}
|
||||
|
@ -223,15 +223,15 @@ pub fn (db &DB) exec_one(query string) !Row {
|
|||
unsafe { rows.free() }
|
||||
}
|
||||
if rows.len == 0 {
|
||||
return IError(&SQLError{
|
||||
return &SQLError{
|
||||
msg: 'No rows'
|
||||
code: code
|
||||
})
|
||||
}
|
||||
} else if code != 101 {
|
||||
return IError(&SQLError{
|
||||
return &SQLError{
|
||||
msg: unsafe { cstring_to_vstring(&char(C.sqlite3_errstr(code))) }
|
||||
code: code
|
||||
})
|
||||
}
|
||||
}
|
||||
res := rows[0]
|
||||
return res
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue