-
Notifications
You must be signed in to change notification settings - Fork 27
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
SQL Version 3 #65
Open
biscuitWizard
wants to merge
23
commits into
lisdude:master
Choose a base branch
from
SindomeCorp:sqlv3
base: master
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
SQL Version 3 #65
Conversation
This file contains 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
…ool when an error occurred.
…id of an ugly while wait loop.
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.
This patch adds:
The method signatures of the new built ins are:
sql_open(STR sql_url[, INT options]) => INT connection handle id.
This uses database://[user:password@][host][:port]/database[?name=value][&name=value]... format as described on https://www.tildeslash.com/libzdb/#api
Requests to open the same URL will result in it returning the existing handle_id for that URL, instead of creating a new connection pool.
Will return a string if an error has occurred.
Is capable of throwing E_INVARGs if invalid input is provided, or a general error occurs.
sql_close(INT handle_id) => INT true/false success.
Closes a connection at handle_id. If unable to for some reason, will return a string with the error.
sql_connections() => MAP of connection handles and urls
Returns a map of handle_id -> STR URL of active pools.
sql_query(INT handle_id, STR query[, LIST parameters]) => LIST of results
Queries handle_id (connection_pool) on another thread with query. ? marks are replaced by elements in the list of parameters in order that they are defined.
Results are a list of rows, with each row itself also being a list. {{row1_col1_value, row1_col2_value}, {row2_col1_value, row2_col2_value}, ...}
Will return a string if there is a SQL error. Is capable of throwing E_INVARGs if the parameters are invalid type. Only has support for primitive types (integer, string, floats).
Results will always be strings, regardless of what the database has the datatype defined as.
sql_info(INT handle_id) => MAP of settings
This is exactly like sqlite_info, just also returning the size of the connection pools.
The big difference between this and version 2 is that I rewrote it entirely to remove libzdb as a requirement, figuring I could do better. And I believe I did better, and removed one whole requirement. I've also written and added a lot of documentation, and removed sqlite formally which makes this a ....
BREAKING CHANGE