Hoel
C Database abstraction library with json based language
Data Structures | Macros | Functions
hoel.h File Reference

Hoel database abstraction library. More...

#include "hoel-cfg.h"
#include <jansson.h>
#include <time.h>
#include <pthread.h>
#include <yder.h>
#include <orcania.h>

Go to the source code of this file.

Data Structures

struct  _h_connection
 
struct  _h_type_int
 
struct  _h_type_double
 
struct  _h_type_datetime
 
struct  _h_type_text
 
struct  _h_type_blob
 
struct  _h_data
 
struct  _h_result
 

Macros

#define __USE_XOPEN
 
#define HOEL_DB_TYPE_SQLITE   0
 
#define HOEL_DB_TYPE_MARIADB   1
 
#define HOEL_DB_TYPE_PGSQL   2
 
#define HOEL_COL_TYPE_INT   0
 
#define HOEL_COL_TYPE_DOUBLE   1
 
#define HOEL_COL_TYPE_TEXT   2
 
#define HOEL_COL_TYPE_DATE   3
 
#define HOEL_COL_TYPE_BLOB   4
 
#define HOEL_COL_TYPE_BOOL   5
 
#define HOEL_COL_TYPE_NULL   5
 
#define H_OK   0 /* No error */
 
#define H_ERROR   1 /* Generic error */
 
#define H_ERROR_PARAMS   2 /* Error in input parameters */
 
#define H_ERROR_CONNECTION   3 /* Error in database connection */
 
#define H_ERROR_QUERY   4 /* Error executing query */
 
#define H_ERROR_MEMORY   99 /* Error allocating memory */
 
#define H_OPTION_NONE   0x0000 /* Nothing whatsoever */
 
#define H_OPTION_SELECT   0x0001 /* Execute a SELECT statement */
 
#define H_OPTION_EXEC   0x0010 /* Execute an INSERT, UPDATE or DELETE statement */
 

Functions

int h_close_db (struct _h_connection *conn)
 
void h_free (void *data)
 
char * h_escape_string (const struct _h_connection *conn, const char *unsafe)
 
char * h_escape_string_with_quotes (const struct _h_connection *conn, const char *unsafe)
 
int h_execute_query (const struct _h_connection *conn, const char *query, struct _h_result *result, int options)
 
int h_query_insert (const struct _h_connection *conn, const char *query)
 
struct _h_datah_query_last_insert_id (const struct _h_connection *conn)
 
int h_query_update (const struct _h_connection *conn, const char *query)
 
int h_query_delete (const struct _h_connection *conn, const char *query)
 
int h_query_select (const struct _h_connection *conn, const char *query, struct _h_result *result)
 
int h_execute_query_json (const struct _h_connection *conn, const char *query, json_t **j_result)
 
int h_query_select_json (const struct _h_connection *conn, const char *query, json_t **j_result)
 
int h_select (const struct _h_connection *conn, const json_t *j_query, json_t **j_result, char **generated_query)
 
int h_insert (const struct _h_connection *conn, const json_t *j_query, char **generated_query)
 
json_t * h_last_insert_id (const struct _h_connection *conn)
 
int h_update (const struct _h_connection *conn, const json_t *j_query, char **generated_query)
 
int h_delete (const struct _h_connection *conn, const json_t *j_query, char **generated_query)
 
char * h_build_where_clause (const struct _h_connection *conn, const char *pattern,...)
 
int h_clean_result (struct _h_result *result)
 
int h_clean_data (struct _h_data *data)
 
int h_clean_data_full (struct _h_data *data)
 
int h_clean_connection (struct _h_connection *conn)
 
struct _h_connectionh_connect_sqlite (const char *db_path)
 
void h_close_sqlite (struct _h_connection *conn)
 
char * h_escape_string_sqlite (const struct _h_connection *conn, const char *unsafe)
 
char * h_escape_string_with_quotes_sqlite (const struct _h_connection *conn, const char *unsafe)
 
long long int h_last_insert_id_sqlite (const struct _h_connection *conn)
 
int h_exec_query_sqlite (const struct _h_connection *conn, const char *query)
 
int h_execute_query_sqlite (const struct _h_connection *conn, const char *query)
 
int h_execute_query_json_sqlite (const struct _h_connection *conn, const char *query, json_t **j_result)
 
int h_select_query_sqlite (const struct _h_connection *conn, const char *query, struct _h_result *result)
 
struct _h_connectionh_connect_mariadb (const char *host, const char *user, const char *passwd, const char *db, const unsigned int port, const char *unix_socket)
 
void h_close_mariadb (struct _h_connection *conn)
 
char * h_escape_string_mariadb (const struct _h_connection *conn, const char *unsafe)
 
char * h_escape_string_with_quotes_mariadb (const struct _h_connection *conn, const char *unsafe)
 
long long int h_last_insert_id_mariadb (const struct _h_connection *conn)
 
int h_execute_query_json_mariadb (const struct _h_connection *conn, const char *query, json_t **j_result)
 
int h_execute_query_mariadb (const struct _h_connection *conn, const char *query, struct _h_result *result)
 
struct _h_datah_get_mariadb_value (const char *value, const unsigned long length, const int m_type)
 
struct _h_connectionh_connect_pgsql (const char *conninfo)
 
void h_close_pgsql (struct _h_connection *conn)
 
char * h_escape_string_pgsql (const struct _h_connection *conn, const char *unsafe)
 
char * h_escape_string_with_quotes_pgsql (const struct _h_connection *conn, const char *unsafe)
 
int h_execute_query_json_pgsql (const struct _h_connection *conn, const char *query, json_t **j_result)
 
long long int h_last_insert_id_pgsql (const struct _h_connection *conn)
 
int h_execute_query_pgsql (const struct _h_connection *conn, const char *query, struct _h_result *result)
 

Detailed Description

Hoel database abstraction library.

hoel.h: structures and functions declarations

Copyright 2015-2020 Nicolas Mora mail@.nosp@m.babe.nosp@m.loues.nosp@m.t.or.nosp@m.g

This program is free software; you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software Foundation; version 2.1 of the License.

This library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU GENERAL PUBLIC LICENSE for more details.

You should have received a copy of the GNU General Public License along with this library. If not, see http://www.gnu.org/licenses/.

Macro Definition Documentation

◆ __USE_XOPEN

#define __USE_XOPEN