Hoel
C Database abstraction library with json based language
Functions
hoel.c File Reference
#include <ctype.h>
#include <string.h>
#include "hoel.h"
#include "h-private.h"

Functions

void h_free (void *data)
 
int h_close_db (struct _h_connection *conn)
 
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_execute_query_json (const struct _h_connection *conn, const char *query, json_t **j_result)
 
int h_row_add_data (struct _h_data **row, struct _h_data *data, int cols)
 
int h_result_add_row (struct _h_result *result, struct _h_data *row, int rows)
 
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_query_select_json (const struct _h_connection *conn, const char *query, json_t **j_result)
 
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)
 
struct _h_datah_new_data_int (const long long int value)
 
struct _h_datah_new_data_double (const double value)
 
struct _h_datah_new_data_text (const char *value, const size_t length)
 
struct _h_datah_new_data_blob (const void *value, const size_t length)
 
struct _h_datah_new_data_null ()
 
struct _h_datah_new_data_datetime (const struct tm *datetime)
 
int h_clean_connection (struct _h_connection *conn)
 

Function Documentation

◆ h_new_data_blob()

struct _h_data* h_new_data_blob ( const void *  value,
const size_t  length 
)

Allocate memory for a new struct _h_data * containing a blob return pointer to the new structure return NULL on error

◆ h_new_data_datetime()

struct _h_data* h_new_data_datetime ( const struct tm *  datetime)

Allocate memory for a new struct _h_data * containing a date time structure return pointer to the new structure return NULL on error

◆ h_new_data_double()

struct _h_data* h_new_data_double ( const double  value)

Allocate memory for a new struct _h_data * containing a double return pointer to the new structure return NULL on error

◆ h_new_data_int()

struct _h_data* h_new_data_int ( const long long int  value)

Allocate memory for a new struct _h_data * containing an int return pointer to the new structure return NULL on error

◆ h_new_data_null()

struct _h_data* h_new_data_null ( )

Allocate memory for a new struct _h_data * containing a null value return pointer to the new structure return NULL on error

◆ h_new_data_text()

struct _h_data* h_new_data_text ( const char *  value,
const size_t  length 
)

Allocate memory for a new struct _h_data * containing a text return pointer to the new structure return NULL on error

◆ h_result_add_row()

int h_result_add_row ( struct _h_result result,
struct _h_data row,
int  rows 
)

Add a new row of struct _h_data * in a struct _h_result * return H_OK on success

◆ h_row_add_data()

int h_row_add_data ( struct _h_data **  row,
struct _h_data data,
int  cols 
)

Add a new struct _h_data * to an array of struct _h_data *, which already has cols columns return H_OK on success