JULEA
Functions | Variables
sql-generic-common.c File Reference
#include <julea-config.h>
#include "sql-generic-internal.h"

Functions

 G_LOCK_DEFINE (sql_backend_lock)
 
gboolean sql_generic_init (JSQLSpecifics *specifics)
 
void sql_generic_fini (void)
 
void thread_variables_fini (void *ptr)
 Free function for JThreadVariables. More...
 
JThreadVariablesthread_variables_get (gpointer backend_data, GError **error)
 Retrieve the thread-private JThreadVariables. More...
 
JSqlStatementj_sql_statement_new (gchar const *query, GArray *types_in, GArray *types_out, GHashTable *out_variables_index, GHashTable *variable_types, GError **error)
 Construct a JSqlStatement struct from the necessary information. More...
 
void j_sql_statement_free (JSqlStatement *ptr)
 Destructor for a JSqlStatement. More...
 
GString * j_sql_get_full_field_name (const gchar *namespace, const gchar *table, const gchar *field)
 Get the full field name from the different parts. More...
 

Variables

GPrivate thread_variables_global = G_PRIVATE_INIT(thread_variables_fini)
 Holds a thread-private pointer to JThreadVariables. More...
 
JSQLSpecificsspecs
 Contains the specific string constants and functions for a DB backend. More...
 

Function Documentation

◆ G_LOCK_DEFINE()

G_LOCK_DEFINE ( sql_backend_lock  )

◆ j_sql_get_full_field_name()

GString* j_sql_get_full_field_name ( const gchar *  namespace,
const gchar *  table,
const gchar *  field 
)

Get the full field name from the different parts.

The name is correctly quoted and suitable as key in schema hash tables and as name in queries.

Parameters
namespaceThe namespace of the operation.
tableThe name of the table.
fieldThe name of a column in the table.
Returns
GString*

◆ j_sql_statement_free()

void j_sql_statement_free ( JSqlStatement ptr)

Destructor for a JSqlStatement.

Parameters
ptrPointer to the Statement.

◆ j_sql_statement_new()

JSqlStatement* j_sql_statement_new ( gchar const *  query,
GArray *  types_in,
GArray *  types_out,
GHashTable *  out_variables_index,
GHashTable *  variable_types,
GError **  error 
)

Construct a JSqlStatement struct from the necessary information.

Parameters
queryA SQL query string.
types_inThe types of input variables in correct order. Needed by some DB backends for statement compilation.
types_outThe types of output variables in correct order. Needed by some DB backends for statement compilation.
out_variables_indexA map from output variable names to their position. See JSqlStatement for details.
variable_typesType information for the query. See JSqlStatement for details.
[out]errorAn uninitialized GError* for error code passing.
Returns
JSqlStatement* The constructed statement or NULL on error.
Attention
If the function returns a valid pointer in_variables_index and out_variables_index are now owned by the new struct and the original pointers are set to NULL.

◆ sql_generic_fini()

void sql_generic_fini ( void  )

◆ sql_generic_init()

gboolean sql_generic_init ( JSQLSpecifics specifics)
Todo:
figure out whether we should add an index instead

◆ thread_variables_fini()

void thread_variables_fini ( void *  ptr)

Free function for JThreadVariables.

Parameters
ptrPointer to an allocated JThreadVariables struct.

◆ thread_variables_get()

JThreadVariables* thread_variables_get ( gpointer  backend_data,
GError **  error 
)

Retrieve the thread-private JThreadVariables.

The struct will be initialized if this function is called by a new thread for the first time.

Parameters
backend_dataThe backend-specific information to open a connection.
[out]errorAn uninitialized GError* for error code passing.
Returns
JThreadVariables* An initilized pointer to the thred-pribvate variables. The returned data schould NOT be freed.

Variable Documentation

◆ specs

JSQLSpecifics* specs

Contains the specific string constants and functions for a DB backend.

◆ thread_variables_global

GPrivate thread_variables_global = G_PRIVATE_INIT(thread_variables_fini)

Holds a thread-private pointer to JThreadVariables.