Add binary copy, prepared statements, and handling for JSON, JSONB an…#13
Open
smari wants to merge 1 commit intorluba:masterfrom
Open
Add binary copy, prepared statements, and handling for JSON, JSONB an…#13smari wants to merge 1 commit intorluba:masterfrom
smari wants to merge 1 commit intorluba:masterfrom
Conversation
rluba
requested changes
Jun 24, 2025
Owner
rluba
left a comment
There was a problem hiding this comment.
Could you extend examples/example.jai to show how to use all the new functions (Prepared statements, binary copy, etc.) and add the new types as well (as a regression test)?
| memcpy(be_value, *be_val, arg.type.runtime_size); | ||
| } | ||
| param_values[index] = be_value; | ||
| param_values[index] = be_value; |
Owner
There was a problem hiding this comment.
Please don’t reformat existing code without a good reason.
| // } | ||
| if (result != newResult) { | ||
| // print("Connecting… %\n", result); | ||
| } |
| info := cast(*Type_Info_Integer) arg.type; | ||
| // @ToDo: implement unsigned ints | ||
| assert(info.signed, "Unsigned not yet supported"); | ||
| //assert(info.signed, "Unsigned not yet supported"); |
| bool_as_num := ifx arg.value_pointer.(*bool).* then cast(u8) 1 else cast(u8) 0; | ||
| be_value := alloc(1).(*u8); | ||
| network_val := hton(bool_as_num); | ||
| memcpy(be_value, *network_val, 1); |
Owner
There was a problem hiding this comment.
Why did you replace "pointer to constant" with "allocation for every bool"?
|
|
||
| write_integer :: (col: int, name: string, info: *Type_Info, pointer: *void, col_type: Pq_Type, value: s64) -> bool { | ||
| if info.type != Type_Info_Tag.INTEGER { | ||
| if info.type != Type_Info_Tag.INTEGER && info.type != Type_Info_Tag.ENUM { |
Owner
There was a problem hiding this comment.
This is not correct! info gets cast to Type_Info_Integer below, which is not OK if it is actually a Type_Info_Enum. This would re-interpret the name pointer as the signed property!
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Add binary copy, prepared statements, and handling for JSON, JSONB and ENUM types.