mirror of
https://git.kore.io/kore.git
synced 2024-11-11 04:39:00 +01:00
3b09683f5c
This function uses PQsendQueryParams() instead of the normal PQsendQuery() allowing you to pass binary data in a cleaner fashion. A basic call would look something like: char *mydata = "Hello"; size_t mydata_len = strlen(mydata); kore_pgsql_query_params(&pgsql, req, "INSERT INTO foo VALUES($1::text)", KORE_PGSQL_FORMAT_TEXT, 1 mydata, mydata_len, KORE_PGSQL_FORMAT_TEXT); kore_pgsql_query_params() is variadic, allowing you to pass any count of parameters where each parameter has the following: data pointer, data length, type of parameter. |
||
---|---|---|
.. | ||
conf | ||
src | ||
.gitignore | ||
README.md |
Kore pgsql example.
This example demonstrates how one can use Kore state machines and the pgsql api to make fully asynchronous SQL queries.
Asynchronous in this case meaning, without interrupting a Kore worker its other clients their I/O or http requests.
Tons of comments inside on how everything works.
Run:
# kore run