![]() | ![]() | ![]() | GNOME Data Access manual | ![]() |
---|
gda-util — Utility functions
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);
const gchar* gda_type_to_string (GdaValueType type);
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.
|
GdaValueType gda_type_from_string (const gchar *str);
str : | the name of a GdaValueType, as returned by gda_type_to_string() .
|
Returns : | the GdaValueType represented by the given str .
|
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.
hash_table : | a hash table. |
Returns : | a new GList. |
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 : | 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.
|
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.
|
<< GdaTransaction | gda-value >> |