gda-util

Name

gda-util -- Utility functions

Synopsis



const gchar* gda_type_to_string             (GdaValueType type);
GdaValueType gda_type_from_string           (const gchar *str);
GList*      gda_string_hash_to_list         (GHashTable *hash_table);
gchar*      gda_sql_replace_placeholders    (const gchar *sql,
                                             GdaParameterList *params);
gchar*      gda_file_load                   (const gchar *filename);
gboolean    gda_file_save                   (const gchar *filename,
                                             const gchar *buffer,
                                             gint len);

Description

Details

gda_type_to_string ()

const gchar* gda_type_to_string             (GdaValueType type);

Return the string representing the given GdaType.

type : Type to convert from.
Returns : the name of the type.


gda_type_from_string ()

GdaValueType gda_type_from_string           (const gchar *str);

str : 
Returns : 


gda_string_hash_to_list ()

GList*      gda_string_hash_to_list         (GHashTable *hash_table);

hash_table : 
Returns : 


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.

sql : A SQL command containing placeholders for values.
params : 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.

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.

filename : path for the file to be saved.
buffer : contents of the file.
len : size of buffer.
Returns : TRUE if successful, FALSE on error.