helper functions for Sqlite3 DB interactions More...
Go to the source code of this file.
Data Structures | |
| struct | GNUNET_SQ_QueryParam |
| Description of a DB query parameter. More... | |
| struct | GNUNET_SQ_ResultSpec |
| Description of a DB result cell. More... | |
| struct | GNUNET_SQ_PrepareStatement |
| Information needed to run a list of SQL statements using GNUNET_SQ_exec_statements(). More... | |
| struct | GNUNET_SQ_ExecuteStatement |
| Information needed to run a list of SQL statements using GNUNET_SQ_exec_statements(). More... | |
Macros | |
| #define | GNUNET_SQ_query_param_end { NULL, NULL, NULL, 0, 0 } |
| End of query parameter specification. | |
| #define | GNUNET_SQ_query_param_auto_from_type(x) GNUNET_SQ_query_param_fixed_size ((x), sizeof(*(x))) |
| Generate fixed-size query parameter with size determined by variable type. | |
| #define | GNUNET_SQ_result_spec_end { NULL, NULL, NULL, NULL, 0, NULL, 0 } |
| End of result parameter specification. | |
| #define | GNUNET_SQ_result_spec_auto_from_type(dst) GNUNET_SQ_result_spec_fixed_size ((dst), sizeof(*(dst))) |
We expect a fixed-size result, with size determined by the type of * dst | |
| #define | GNUNET_SQ_PREPARE_END { NULL, NULL } |
| Terminator for executable statement list. | |
| #define | GNUNET_SQ_EXECUTE_STATEMENT_END { NULL, GNUNET_SYSERR } |
| Terminator for executable statement list. | |
Typedefs | |
| typedef enum GNUNET_GenericReturnValue(* | GNUNET_SQ_QueryConverter) (void *cls, const void *data, size_t data_len, sqlite3_stmt *stmt, unsigned int off) |
| Function called to convert input argument into SQL parameters. | |
| typedef enum GNUNET_GenericReturnValue(* | GNUNET_SQ_ResultConverter) (void *cls, sqlite3_stmt *result, unsigned int column, size_t *dst_size, void *dst) |
| Extract data from a Postgres database result at row row. | |
| typedef void(* | GNUNET_SQ_ResultCleanup) (void *cls) |
| Function called to clean up memory allocated by a GNUNET_SQ_ResultConverter. | |
Functions | |
| struct GNUNET_SQ_QueryParam | GNUNET_SQ_query_param_fixed_size (const void *ptr, size_t ptr_size) |
| Generate query parameter for a buffer ptr of ptr_size bytes. | |
| struct GNUNET_SQ_QueryParam | GNUNET_SQ_query_param_string (const char *ptr) |
| Generate query parameter for a string. | |
| struct GNUNET_SQ_QueryParam | GNUNET_SQ_query_param_rsa_public_key (const struct GNUNET_CRYPTO_RsaPublicKey *x) |
| Generate query parameter for an RSA public key. | |
| struct GNUNET_SQ_QueryParam | GNUNET_SQ_query_param_rsa_signature (const struct GNUNET_CRYPTO_RsaSignature *x) |
| Generate query parameter for an RSA signature. | |
| struct GNUNET_SQ_QueryParam | GNUNET_SQ_query_param_absolute_time (const struct GNUNET_TIME_Absolute *x) |
| Generate query parameter for an absolute time value. | |
| struct GNUNET_SQ_QueryParam | GNUNET_SQ_query_param_absolute_time_nbo (const struct GNUNET_TIME_AbsoluteNBO *x) |
| Generate query parameter for an absolute time value. | |
| struct GNUNET_SQ_QueryParam | GNUNET_SQ_query_param_uint16 (const uint16_t *x) |
| Generate query parameter for an uint16_t in host byte order. | |
| struct GNUNET_SQ_QueryParam | GNUNET_SQ_query_param_uint32 (const uint32_t *x) |
| Generate query parameter for an uint32_t in host byte order. | |
| struct GNUNET_SQ_QueryParam | GNUNET_SQ_query_param_uint64 (const uint64_t *x) |
| Generate query parameter for an uint16_t in host byte order. | |
| enum GNUNET_GenericReturnValue | GNUNET_SQ_bind (sqlite3_stmt *stmt, const struct GNUNET_SQ_QueryParam *params) |
| Execute binding operations for a prepared statement. | |
| void | GNUNET_SQ_reset (sqlite3 *dbh, sqlite3_stmt *stmt) |
| Reset stmt and log error. | |
| struct GNUNET_SQ_ResultSpec | GNUNET_SQ_result_spec_variable_size (void **dst, size_t *sptr) |
| Variable-size result expected. | |
| struct GNUNET_SQ_ResultSpec | GNUNET_SQ_result_spec_fixed_size (void *dst, size_t dst_size) |
| Fixed-size result expected. | |
| struct GNUNET_SQ_ResultSpec | GNUNET_SQ_result_spec_string (char **dst) |
| 0-terminated string expected. | |
| struct GNUNET_SQ_ResultSpec | GNUNET_SQ_result_spec_rsa_public_key (struct GNUNET_CRYPTO_RsaPublicKey **rsa) |
| RSA public key expected. | |
| struct GNUNET_SQ_ResultSpec | GNUNET_SQ_result_spec_rsa_signature (struct GNUNET_CRYPTO_RsaSignature **sig) |
| RSA signature expected. | |
| struct GNUNET_SQ_ResultSpec | GNUNET_SQ_result_spec_absolute_time (struct GNUNET_TIME_Absolute *at) |
| Absolute time expected. | |
| struct GNUNET_SQ_ResultSpec | GNUNET_SQ_result_spec_absolute_time_nbo (struct GNUNET_TIME_AbsoluteNBO *at) |
| Absolute time expected. | |
| struct GNUNET_SQ_ResultSpec | GNUNET_SQ_result_spec_uint16 (uint16_t *u16) |
| uint16_t expected. | |
| struct GNUNET_SQ_ResultSpec | GNUNET_SQ_result_spec_uint32 (uint32_t *u32) |
| uint32_t expected. | |
| struct GNUNET_SQ_ResultSpec | GNUNET_SQ_result_spec_uint64 (uint64_t *u64) |
| uint64_t expected. | |
| enum GNUNET_GenericReturnValue | GNUNET_SQ_extract_result (sqlite3_stmt *result, struct GNUNET_SQ_ResultSpec *rs) |
| Extract results from a query result according to the given specification. | |
| void | GNUNET_SQ_cleanup_result (struct GNUNET_SQ_ResultSpec *rs) |
| Free all memory that was allocated in rs during GNUNET_SQ_extract_result(). | |
| struct GNUNET_SQ_PrepareStatement | GNUNET_SQ_make_prepare (const char *sql, sqlite3_stmt **pstmt) |
Create a struct GNUNET_SQ_PrepareStatement | |
| enum GNUNET_GenericReturnValue | GNUNET_SQ_prepare (sqlite3 *dbh, const struct GNUNET_SQ_PrepareStatement *ps) |
| Prepare all statements given in the (NULL,NULL)-terminated array at ps. | |
| struct GNUNET_SQ_ExecuteStatement | GNUNET_SQ_make_execute (const char *sql) |
Create a struct GNUNET_SQ_ExecuteStatement where errors are fatal. | |
| struct GNUNET_SQ_ExecuteStatement | GNUNET_SQ_make_try_execute (const char *sql) |
Create a struct GNUNET_SQ_ExecuteStatement where errors should be tolerated. | |
| enum GNUNET_GenericReturnValue | GNUNET_SQ_exec_statements (sqlite3 *dbh, const struct GNUNET_SQ_ExecuteStatement *es) |
| Request execution of an array of statements es from Postgres. | |
helper functions for Sqlite3 DB interactions
Definition in file gnunet_sq_lib.h.
| #define GNUNET_SQ_query_param_end { NULL, NULL, NULL, 0, 0 } |
End of query parameter specification.
Definition at line 87 of file gnunet_sq_lib.h.
| #define GNUNET_SQ_query_param_auto_from_type | ( | x | ) | GNUNET_SQ_query_param_fixed_size ((x), sizeof(*(x))) |
Generate fixed-size query parameter with size determined by variable type.
| x | pointer to the query parameter to pass. |
Definition at line 117 of file gnunet_sq_lib.h.
| #define GNUNET_SQ_result_spec_end { NULL, NULL, NULL, NULL, 0, NULL, 0 } |
End of result parameter specification.
Definition at line 302 of file gnunet_sq_lib.h.
| #define GNUNET_SQ_result_spec_auto_from_type | ( | dst | ) | GNUNET_SQ_result_spec_fixed_size ((dst), sizeof(*(dst))) |
We expect a fixed-size result, with size determined by the type of * dst
| dst | point to where to store the result, type fits expected result size |
Definition at line 335 of file gnunet_sq_lib.h.
| #define GNUNET_SQ_PREPARE_END { NULL, NULL } |
Terminator for executable statement list.
Definition at line 479 of file gnunet_sq_lib.h.
| #define GNUNET_SQ_EXECUTE_STATEMENT_END { NULL, GNUNET_SYSERR } |
Terminator for executable statement list.
Definition at line 531 of file gnunet_sq_lib.h.
| typedef enum GNUNET_GenericReturnValue(* GNUNET_SQ_QueryConverter) (void *cls, const void *data, size_t data_len, sqlite3_stmt *stmt, unsigned int off) |
Function called to convert input argument into SQL parameters.
| cls | closure |
| data | pointer to input argument |
| data_len | number of bytes in data (if applicable) |
| stmt | sqlite statement to bind parameters for |
| off | offset of the argument to bind in stmt, numbered from 1, so immediately suitable for passing to sqlite3_bind-functions. |
Definition at line 1 of file gnunet_sq_lib.h.
| typedef enum GNUNET_GenericReturnValue(* GNUNET_SQ_ResultConverter) (void *cls, sqlite3_stmt *result, unsigned int column, size_t *dst_size, void *dst) |
Extract data from a Postgres database result at row row.
| cls | closure | |
| result | where to extract data from | |
| column | column to extract data from | |
| [in,out] | dst_size | where to store size of result, may be NULL |
| [out] | dst | where to store the result |
Definition at line 210 of file gnunet_sq_lib.h.
| typedef void(* GNUNET_SQ_ResultCleanup) (void *cls) |
Function called to clean up memory allocated by a GNUNET_SQ_ResultConverter.
| cls | closure |
Definition at line 246 of file gnunet_sq_lib.h.
| struct GNUNET_SQ_QueryParam GNUNET_SQ_query_param_fixed_size | ( | const void * | ptr, |
| size_t | ptr_size | ||
| ) |
Generate query parameter for a buffer ptr of ptr_size bytes.
| ptr | pointer to the query parameter to pass |
| ptr_size | number of bytes in ptr |
Definition at line 66 of file sq_query_helper.c.
References bind_fixed_blob(), GNUNET_SQ_QueryParam::conv, and GNUNET_SQ_QueryParam::size.
Referenced by namecache_sqlite_cache_block(), namestore_sqlite_store_records(), peerstore_sqlite_store_record(), sqlite_plugin_put(), sqlite_plugin_put(), and sqlite_plugin_remove_key().
| struct GNUNET_SQ_QueryParam GNUNET_SQ_query_param_string | ( | const char * | ptr | ) |
Generate query parameter for a string.
| ptr | pointer to the string query parameter to pass |
Definition at line 123 of file sq_query_helper.c.
References bind_string(), GNUNET_SQ_QueryParam::conv, and GNUNET_SQ_QueryParam::num_params.
Referenced by lookup_records(), namestore_sqlite_editor_hint_clear(), namestore_sqlite_store_records(), peerstore_sqlite_delete_records(), peerstore_sqlite_iterate_records(), and peerstore_sqlite_store_record().
| struct GNUNET_SQ_QueryParam GNUNET_SQ_query_param_rsa_public_key | ( | const struct GNUNET_CRYPTO_RsaPublicKey * | x | ) |
Generate query parameter for an RSA public key.
The database must contain a BLOB type in the respective position.
| x | the query parameter to pass. |
Definition at line 182 of file sq_query_helper.c.
References bind_rsa_pub(), and GNUNET_SQ_QueryParam::conv.
| struct GNUNET_SQ_QueryParam GNUNET_SQ_query_param_rsa_signature | ( | const struct GNUNET_CRYPTO_RsaSignature * | x | ) |
Generate query parameter for an RSA signature.
The database must contain a BLOB type in the respective position.
| x | the query parameter to pass |
Definition at line 242 of file sq_query_helper.c.
References bind_rsa_sig(), and GNUNET_SQ_QueryParam::conv.
| struct GNUNET_SQ_QueryParam GNUNET_SQ_query_param_absolute_time | ( | const struct GNUNET_TIME_Absolute * | x | ) |
Generate query parameter for an absolute time value.
The database must store a 64-bit integer.
| x | pointer to the query parameter to pass |
Definition at line 295 of file sq_query_helper.c.
References bind_abstime(), and GNUNET_SQ_QueryParam::conv.
Referenced by get_any(), get_typed(), namecache_sqlite_cache_block(), namecache_sqlite_expire_blocks(), peerstore_sqlite_expire_records(), peerstore_sqlite_store_record(), sqlite_plugin_del(), sqlite_plugin_get_closest(), sqlite_plugin_get_expiration(), sqlite_plugin_put(), and sqlite_plugin_put().
| struct GNUNET_SQ_QueryParam GNUNET_SQ_query_param_absolute_time_nbo | ( | const struct GNUNET_TIME_AbsoluteNBO * | x | ) |
Generate query parameter for an absolute time value.
The database must store a 64-bit integer.
| x | pointer to the query parameter to pass |
Definition at line 349 of file sq_query_helper.c.
References bind_nbotime(), and GNUNET_SQ_QueryParam::conv.
| struct GNUNET_SQ_QueryParam GNUNET_SQ_query_param_uint16 | ( | const uint16_t * | x | ) |
Generate query parameter for an uint16_t in host byte order.
| x | pointer to the query parameter to pass |
Definition at line 399 of file sq_query_helper.c.
References bind_u16(), GNUNET_SQ_QueryParam::conv, and GNUNET_SQ_QueryParam::num_params.
| struct GNUNET_SQ_QueryParam GNUNET_SQ_query_param_uint32 | ( | const uint32_t * | x | ) |
Generate query parameter for an uint32_t in host byte order.
| x | pointer to the query parameter to pass |
Definition at line 448 of file sq_query_helper.c.
References bind_u32(), GNUNET_SQ_QueryParam::conv, and GNUNET_SQ_QueryParam::num_params.
Referenced by get_any(), get_typed(), namestore_sqlite_store_records(), sqlite_plugin_get_closest(), sqlite_plugin_get_key(), sqlite_plugin_get_replication(), sqlite_plugin_get_zero_anonymity(), sqlite_plugin_put(), and sqlite_plugin_put().
| struct GNUNET_SQ_QueryParam GNUNET_SQ_query_param_uint64 | ( | const uint64_t * | x | ) |
Generate query parameter for an uint16_t in host byte order.
| x | pointer to the query parameter to pass |
Definition at line 497 of file sq_query_helper.c.
References bind_u64(), GNUNET_SQ_QueryParam::conv, and GNUNET_SQ_QueryParam::num_params.
Referenced by delete_by_rowid(), namestore_sqlite_iterate_records(), namestore_sqlite_store_records(), peerstore_sqlite_iterate_records(), sqlite_plugin_del(), sqlite_plugin_get_key(), sqlite_plugin_get_replication(), sqlite_plugin_get_zero_anonymity(), and sqlite_plugin_put().
| enum GNUNET_GenericReturnValue GNUNET_SQ_bind | ( | sqlite3_stmt * | stmt, |
| const struct GNUNET_SQ_QueryParam * | params | ||
| ) |
Execute binding operations for a prepared statement.
| db_conn | database connection |
| params | parameters to the statement |
Definition at line 30 of file sq.c.
References _, conv, GNUNET_SQ_QueryParam::conv, data, GNUNET_assert, GNUNET_ERROR_TYPE_WARNING, GNUNET_log_from, GNUNET_OK, GNUNET_SYSERR, GNUNET_SQ_QueryParam::num_params, and size.
Referenced by delete_by_rowid(), get_any(), get_typed(), lookup_records(), namecache_sqlite_cache_block(), namecache_sqlite_expire_blocks(), namecache_sqlite_lookup_block(), namestore_sqlite_editor_hint_clear(), namestore_sqlite_iterate_records(), namestore_sqlite_store_records(), namestore_sqlite_zone_to_name(), peerstore_sqlite_delete_records(), peerstore_sqlite_expire_records(), peerstore_sqlite_iterate_records(), peerstore_sqlite_store_record(), sqlite_plugin_del(), sqlite_plugin_get_closest(), sqlite_plugin_get_expiration(), sqlite_plugin_get_key(), sqlite_plugin_get_replication(), sqlite_plugin_get_zero_anonymity(), sqlite_plugin_put(), sqlite_plugin_put(), and sqlite_plugin_remove_key().
| void GNUNET_SQ_reset | ( | sqlite3 * | dbh, |
| sqlite3_stmt * | stmt | ||
| ) |
Reset stmt and log error.
| dbh | database handle |
| stmt | statement to reset |
Definition at line 119 of file sq.c.
References _, GNUNET_ERROR_TYPE_BULK, GNUNET_ERROR_TYPE_ERROR, and GNUNET_log_from.
Referenced by delete_by_rowid(), execute_get(), get_any(), get_records_and_call_iterator(), get_typed(), lookup_records(), namecache_sqlite_cache_block(), namecache_sqlite_expire_blocks(), namecache_sqlite_lookup_block(), namestore_sqlite_editor_hint_clear(), namestore_sqlite_iterate_records(), namestore_sqlite_store_records(), namestore_sqlite_zone_to_name(), peerstore_sqlite_delete_records(), peerstore_sqlite_expire_records(), peerstore_sqlite_iterate_records(), peerstore_sqlite_store_record(), sqlite_plugin_del(), sqlite_plugin_get_closest(), sqlite_plugin_get_replication(), sqlite_plugin_put(), sqlite_plugin_put(), and sqlite_plugin_remove_key().
| struct GNUNET_SQ_ResultSpec GNUNET_SQ_result_spec_variable_size | ( | void ** | dst, |
| size_t * | sptr | ||
| ) |
Variable-size result expected.
| [out] | dst | where to store the result, allocated |
| [out] | sptr | where to store the size of dst |
Definition at line 119 of file sq_result_helper.c.
References clean_var_blob(), GNUNET_SQ_ResultSpec::conv, GNUNET_SQ_ResultSpec::dst, and extract_var_blob().
Referenced by execute_get(), get_any(), get_records_and_call_iterator(), get_typed(), namecache_sqlite_lookup_block(), peerstore_sqlite_iterate_records(), sqlite_plugin_del(), and sqlite_plugin_get_closest().
| struct GNUNET_SQ_ResultSpec GNUNET_SQ_result_spec_fixed_size | ( | void * | dst, |
| size_t | dst_size | ||
| ) |
Fixed-size result expected.
| [out] | dst | where to store the result |
| dst_size | number of bytes in dst |
Definition at line 198 of file sq_result_helper.c.
References GNUNET_SQ_ResultSpec::conv, GNUNET_SQ_ResultSpec::dst, GNUNET_SQ_ResultSpec::dst_size, and extract_fixed_blob().
| struct GNUNET_SQ_ResultSpec GNUNET_SQ_result_spec_string | ( | char ** | dst | ) |
0-terminated string expected.
| [out] | dst | where to store the result, allocated |
Definition at line 288 of file sq_result_helper.c.
References clean_utf8_string(), GNUNET_SQ_ResultSpec::conv, GNUNET_SQ_ResultSpec::dst, and extract_utf8_string().
Referenced by get_records_and_call_iterator(), and peerstore_sqlite_iterate_records().
| struct GNUNET_SQ_ResultSpec GNUNET_SQ_result_spec_rsa_public_key | ( | struct GNUNET_CRYPTO_RsaPublicKey ** | rsa | ) |
RSA public key expected.
| [out] | rsa | where to store the result |
Definition at line 381 of file sq_result_helper.c.
References clean_rsa_pub(), GNUNET_SQ_ResultSpec::conv, and extract_rsa_pub().
| struct GNUNET_SQ_ResultSpec GNUNET_SQ_result_spec_rsa_signature | ( | struct GNUNET_CRYPTO_RsaSignature ** | sig | ) |
RSA signature expected.
| [out] | sig | where to store the result; |
Definition at line 474 of file sq_result_helper.c.
References clean_rsa_sig(), GNUNET_SQ_ResultSpec::conv, and extract_rsa_sig().
| struct GNUNET_SQ_ResultSpec GNUNET_SQ_result_spec_absolute_time | ( | struct GNUNET_TIME_Absolute * | at | ) |
Absolute time expected.
| [out] | at | where to store the result |
Definition at line 534 of file sq_result_helper.c.
References GNUNET_SQ_ResultSpec::conv, and extract_abs_time().
Referenced by execute_get(), get_any(), get_typed(), peerstore_sqlite_iterate_records(), and sqlite_plugin_get_closest().
| struct GNUNET_SQ_ResultSpec GNUNET_SQ_result_spec_absolute_time_nbo | ( | struct GNUNET_TIME_AbsoluteNBO * | at | ) |
Absolute time expected.
| [out] | at | where to store the result |
Definition at line 593 of file sq_result_helper.c.
References GNUNET_SQ_ResultSpec::conv, and extract_abs_time_nbo().
| struct GNUNET_SQ_ResultSpec GNUNET_SQ_result_spec_uint16 | ( | uint16_t * | u16 | ) |
uint16_t expected.
| [out] | u16 | where to store the result |
Definition at line 655 of file sq_result_helper.c.
References GNUNET_SQ_ResultSpec::conv, extract_uint16(), and GNUNET_SQ_ResultSpec::num_params.
| struct GNUNET_SQ_ResultSpec GNUNET_SQ_result_spec_uint32 | ( | uint32_t * | u32 | ) |
uint32_t expected.
| [out] | u32 | where to store the result |
Definition at line 717 of file sq_result_helper.c.
References GNUNET_SQ_ResultSpec::conv, extract_uint32(), and GNUNET_SQ_ResultSpec::num_params.
Referenced by execute_get(), get_any(), get_records_and_call_iterator(), get_typed(), and sqlite_plugin_get_closest().
| struct GNUNET_SQ_ResultSpec GNUNET_SQ_result_spec_uint64 | ( | uint64_t * | u64 | ) |
uint64_t expected.
| [out] | u64 | where to store the result |
Definition at line 772 of file sq_result_helper.c.
References GNUNET_SQ_ResultSpec::conv, extract_uint64(), and GNUNET_SQ_ResultSpec::num_params.
Referenced by execute_get(), get_records_and_call_iterator(), peerstore_sqlite_iterate_records(), and sqlite_plugin_del().
| enum GNUNET_GenericReturnValue GNUNET_SQ_extract_result | ( | sqlite3_stmt * | result, |
| struct GNUNET_SQ_ResultSpec * | rs | ||
| ) |
Extract results from a query result according to the given specification.
| result | result to process | |
| [in,out] | rs | result specification to extract for |
Definition at line 75 of file sq.c.
References GNUNET_SQ_ResultSpec::cleaner, conv, GNUNET_SQ_ResultSpec::conv, GNUNET_SQ_ResultSpec::dst_size, GNUNET_assert, GNUNET_OK, GNUNET_SYSERR, GNUNET_SQ_ResultSpec::num_params, result, and GNUNET_SQ_ResultSpec::result_size.
Referenced by execute_get(), get_any(), get_records_and_call_iterator(), get_typed(), namecache_sqlite_lookup_block(), peerstore_sqlite_iterate_records(), sqlite_plugin_del(), sqlite_plugin_get_closest(), and sqlite_plugin_get_keys().
| void GNUNET_SQ_cleanup_result | ( | struct GNUNET_SQ_ResultSpec * | rs | ) |
Free all memory that was allocated in rs during GNUNET_SQ_extract_result().
| rs | result specification to clean up |
Definition at line 104 of file sq.c.
References GNUNET_SQ_ResultSpec::cleaner, and GNUNET_SQ_ResultSpec::conv.
Referenced by execute_get(), get_any(), get_records_and_call_iterator(), get_typed(), namecache_sqlite_lookup_block(), peerstore_sqlite_iterate_records(), sqlite_plugin_del(), and sqlite_plugin_get_closest().
| struct GNUNET_SQ_PrepareStatement GNUNET_SQ_make_prepare | ( | const char * | sql, |
| sqlite3_stmt ** | pstmt | ||
| ) |
Create a struct GNUNET_SQ_PrepareStatement
| sql | actual SQL statement |
| pstmt | where to store the handle |
Definition at line 37 of file sq_prepare.c.
References ps, GNUNET_SQ_PrepareStatement::pstmt, and GNUNET_SQ_PrepareStatement::sql.
Referenced by database_prepare(), and database_setup().
| enum GNUNET_GenericReturnValue GNUNET_SQ_prepare | ( | sqlite3 * | dbh, |
| const struct GNUNET_SQ_PrepareStatement * | ps | ||
| ) |
Prepare all statements given in the (NULL,NULL)-terminated array at ps.
| dbh | database handle |
| ps | array of statements to prepare |
Definition at line 50 of file sq_prepare.c.
References GNUNET_ERROR_TYPE_ERROR, GNUNET_log, GNUNET_OK, GNUNET_SYSERR, ps, GNUNET_SQ_PrepareStatement::pstmt, ret, and GNUNET_SQ_PrepareStatement::sql.
Referenced by database_prepare(), and database_setup().
| struct GNUNET_SQ_ExecuteStatement GNUNET_SQ_make_execute | ( | const char * | sql | ) |
Create a struct GNUNET_SQ_ExecuteStatement where errors are fatal.
| sql | actual SQL statement |
Definition at line 36 of file sq_exec.c.
References GNUNET_NO, and GNUNET_SQ_ExecuteStatement::sql.
Referenced by database_setup(), namestore_sqlite_begin_tx(), namestore_sqlite_commit_tx(), namestore_sqlite_create_tables(), namestore_sqlite_drop_tables(), and namestore_sqlite_rollback_tx().
| struct GNUNET_SQ_ExecuteStatement GNUNET_SQ_make_try_execute | ( | const char * | sql | ) |
Create a struct GNUNET_SQ_ExecuteStatement where errors should be tolerated.
| sql | actual SQL statement |
Definition at line 55 of file sq_exec.c.
References GNUNET_YES, and GNUNET_SQ_ExecuteStatement::sql.
Referenced by database_prepare(), database_setup(), and namestore_sqlite_create_tables().
| enum GNUNET_GenericReturnValue GNUNET_SQ_exec_statements | ( | sqlite3 * | dbh, |
| const struct GNUNET_SQ_ExecuteStatement * | es | ||
| ) |
Request execution of an array of statements es from Postgres.
| dbh | database to execute the statements over |
| es | GNUNET_PQ_PREPARED_STATEMENT_END-terminated array of prepared statements. |
Definition at line 76 of file sq_exec.c.
References GNUNET_ERROR_TYPE_DEBUG, GNUNET_ERROR_TYPE_ERROR, GNUNET_log, GNUNET_OK, GNUNET_SYSERR, GNUNET_SQ_ExecuteStatement::ignore_errors, and GNUNET_SQ_ExecuteStatement::sql.
Referenced by database_prepare(), database_setup(), namestore_sqlite_begin_tx(), namestore_sqlite_commit_tx(), namestore_sqlite_create_tables(), namestore_sqlite_drop_tables(), and namestore_sqlite_rollback_tx().