Multiple changes.

- Minor README updates.
- Create LICENSE and History files.
- Use 'func' instead of 'proc' where applicable.
- Add some destructor debug.
- Rename primary exceptions to 'X-error'.
- Bind to proper object types in prepared statement parameters.
- Retain the found 'type' in the KuzuValue object.

FossilOrigin-Name: db59c0b901b1715170e0d269fc2bf00477ac48af4d10a747eb5a749adbf6268e
This commit is contained in:
mahlon 2025-03-29 23:17:10 +00:00
parent 421cb87e57
commit db85c36d70
22 changed files with 284 additions and 162 deletions

View file

@ -3,22 +3,25 @@
proc `=destroy`*( tpl: KuzuFlatTupleObj ) =
## Graceful cleanup for out of scope tuples.
if tpl.valid:
when defined( debug ): echo &"Destroying tuple: {tpl}"
kuzu_flat_tuple_destroy( addr tpl.handle )
proc `$`*( tpl: KuzuFlatTuple ): string =
func `$`*( tpl: KuzuFlatTuple ): string =
## Stringify a tuple.
result = $kuzu_flat_tuple_to_string( addr tpl.handle )
result.removeSuffix( "\n" )
proc `[]`*( tpl: KuzuFlatTuple, idx: int ): KuzuValue =
## Returns a KuzuValue at the given +idx+.
func `[]`*( tpl: KuzuFlatTuple, idx: int ): KuzuValue =
## Returns a KuzuValue at the given *idx*.
result = new KuzuValue
if kuzu_flat_tuple_get_value( addr tpl.handle, idx.uint64, addr result.handle ) == KuzuSuccess:
result.valid = true
result.getType()
else:
raise newException( KuzuIndexException,
raise newException( KuzuIndexError,
&"Unable to fetch tuple value at idx {idx}. ({tpl.num_columns} column(s).)" )