mirror of
https://github.com/logos-storage/nim-datastore.git
synced 2026-01-30 03:13:08 +00:00
improve error message for mismatch between index and column metadata
This commit is contained in:
parent
ca8ab350c4
commit
9131323747
@ -105,9 +105,12 @@ proc idCol*(
|
||||
i = index.cint
|
||||
colName = sqlite3_column_origin_name(s, i)
|
||||
|
||||
if colName.isNil or $colName != idColName:
|
||||
if colName.isNil:
|
||||
raise (ref Defect)(msg: "no column exists for index " & $index)
|
||||
|
||||
if $colName != idColName:
|
||||
raise (ref Defect)(msg: "original column name for index " & $index &
|
||||
" was not \"" & idColName & "\"")
|
||||
" was \"" & $colName & "\" but expected \"" & idColName & "\"")
|
||||
|
||||
return proc (): string =
|
||||
let
|
||||
@ -135,9 +138,12 @@ proc dataCol*(
|
||||
i = index.cint
|
||||
colName = sqlite3_column_origin_name(s, i)
|
||||
|
||||
if colName.isNil or $colName != dataColName:
|
||||
if colName.isNil:
|
||||
raise (ref Defect)(msg: "no column exists for index " & $index)
|
||||
|
||||
if $colName != dataColName:
|
||||
raise (ref Defect)(msg: "original column name for index " & $index &
|
||||
" was not \"" & dataColName & "\"")
|
||||
" was \"" & $colName & "\" but expected \"" & dataColName & "\"")
|
||||
|
||||
return proc (): seq[byte] =
|
||||
let
|
||||
@ -181,9 +187,12 @@ proc timestampCol*(
|
||||
i = index.cint
|
||||
colName = sqlite3_column_origin_name(s, i)
|
||||
|
||||
if colName.isNil or $colName != timestampColName:
|
||||
if colName.isNil:
|
||||
raise (ref Defect)(msg: "no column exists for index " & $index)
|
||||
|
||||
if $colName != timestampColName:
|
||||
raise (ref Defect)(msg: "original column name for index " & $index &
|
||||
" was not \"" & timestampColName & "\"")
|
||||
" was \"" & $colName & "\" but expected \"" & timestampColName & "\"")
|
||||
|
||||
return proc (): int64 =
|
||||
sqlite3_column_int64(s, i)
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user