-
Notifications
You must be signed in to change notification settings - Fork 7
Add binary copy, prepared statements, and handling for JSON, JSONB an… #13
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: master
Are you sure you want to change the base?
Conversation
rluba
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please don’t reformat existing code without a good reason.
| // } | ||
| if (result != newResult) { | ||
| // print("Connecting… %\n", result); | ||
| } |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
That change should be reverted.
| 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"); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why did you disable this?
| 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); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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 { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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!
Add binary copy, prepared statements, and handling for JSON, JSONB and ENUM types.