1
0
mirror of https://git.kore.io/kore.git synced 2024-11-11 04:39:00 +01:00
kore/examples/pgsql
Joris Vink 3b09683f5c Add kore_pgsql_query_params().
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.
2014-09-28 21:39:16 +02:00
..
conf Remove the pgsql simple layer again. 2014-09-19 15:53:22 +02:00
src Add kore_pgsql_query_params(). 2014-09-28 21:39:16 +02:00
.gitignore add a .gitignore here 2014-09-19 14:51:14 +02:00
README.md Major pgsql rework. 2014-08-14 14:34:23 +02:00

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