gda-util

gda-util — Utility functions

Functions

Description

Functions

gda_type_to_string ()

const gchar *
gda_type_to_string (GdaValueType type);

Parameters

type

Type to convert from.

 

Returns

the string representing the given GdaValueType. This is not necessarily the same string used to describe the column type in a SQL statement. Use gda_connection_get_schema() with GDA_CONNECTION_SCHEMA_TYPES to get the actual types supported by the provider.


gda_type_from_string ()

GdaValueType
gda_type_from_string (const gchar *str);

Parameters

str

the name of a GdaValueType, as returned by gda_type_to_string().

 

Returns

the GdaValueType represented by the given str .


gda_string_hash_to_list ()

GList *
gda_string_hash_to_list (GHashTable *hash_table);

Creates a new list of strings, which contains all keys of a given hash table. After using it, you should free this list by calling g_list_free.

Parameters

hash_table

a hash table.

 

Returns

a new GList.


gda_sql_replace_placeholders ()

gchar *
gda_sql_replace_placeholders (const gchar *sql,
                              GdaParameterList *params);

Replaces the placeholders (:name) in the given SQL command with the values from the GdaParameterList specified as the params argument.

Parameters

sql

a SQL command containing placeholders for values.

 

params

a list of values for the placeholders.

 

Returns

the SQL string with all placeholders replaced, or NULL on error. On success, the returned string must be freed by the caller when no longer needed.


gda_file_load ()

gchar *
gda_file_load (const gchar *filename);

Loads a file, specified by the given uri , and returns the file contents as a string.

It is the caller's responsibility to free the returned value.

Parameters

filename

path for the file to be loaded.

 

Returns

the file contents as a newly-allocated string, or NULL if there is an error.


gda_file_save ()

gboolean
gda_file_save (const gchar *filename,
               const gchar *buffer,
               gint len);

Saves a chunk of data into a file.

Parameters

filename

path for the file to be saved.

 

buffer

contents of the file.

 

len

size of buffer .

 

Returns

TRUE if successful, FALSE on error.

Types and Values