mirror of
https://github.com/ncruces/go-sqlite3.git
synced 2026-01-12 05:59:14 +00:00
Optimize errors a bit.
This commit is contained in:
@@ -75,7 +75,7 @@ func ErrorCodeString(rc uint32) string {
|
||||
return "sqlite3: unable to open database file"
|
||||
case PROTOCOL:
|
||||
return "sqlite3: locking protocol"
|
||||
case FORMAT:
|
||||
case EMPTY:
|
||||
break
|
||||
case SCHEMA:
|
||||
return "sqlite3: database schema has changed"
|
||||
@@ -91,7 +91,7 @@ func ErrorCodeString(rc uint32) string {
|
||||
break
|
||||
case AUTH:
|
||||
return "sqlite3: authorization denied"
|
||||
case EMPTY:
|
||||
case FORMAT:
|
||||
break
|
||||
case RANGE:
|
||||
return "sqlite3: column index out of range"
|
||||
|
||||
@@ -135,11 +135,10 @@ func ReadString(mod api.Module, ptr Ptr_t, maxlen int64) string {
|
||||
panic(RangeErr)
|
||||
}
|
||||
}
|
||||
if i := bytes.IndexByte(buf, 0); i < 0 {
|
||||
panic(NoNulErr)
|
||||
} else {
|
||||
if i := bytes.IndexByte(buf, 0); i >= 0 {
|
||||
return string(buf[:i])
|
||||
}
|
||||
panic(NoNulErr)
|
||||
}
|
||||
|
||||
func WriteBytes(mod api.Module, ptr Ptr_t, b []byte) {
|
||||
|
||||
Reference in New Issue
Block a user