![]() |
![]() |
![]() |
GNOME Data Access 4.0 manual | ![]() |
---|---|---|---|---|
const gchar* gda_g_type_to_string (GType type); GType gda_g_type_from_string (const gchar *str); gchar* gda_default_escape_string (const gchar *string); gchar* gda_default_unescape_string (const gchar *string); guint gda_identifier_hash (const gchar *id); gboolean gda_identifier_equal (const gchar *id1, const gchar *id2); gchar** gda_completion_list_get (GdaConnection *cnc, const gchar *text, gint start, gint end); gchar* gda_rfc1738_encode (const gchar *string); gboolean gda_rfc1738_decode (gchar *string); void gda_dsn_split (const gchar *string, gchar **out_dsn, gchar **out_username, gchar **out_password); void gda_connection_string_split (const gchar *string, gchar **out_cnc_params, gchar **out_provider, gchar **out_username, gchar **out_password); gboolean gda_parse_iso8601_date (GDate *gdate, const gchar *value); gboolean gda_parse_iso8601_time (GdaTime *timegda, const gchar *value); gboolean gda_parse_iso8601_timestamp (GdaTimestamp *timestamp, const gchar *value);
const gchar* gda_g_type_to_string (GType type);
type : | Type to convert from. |
Returns : | the string representing the given GType. |
GType gda_g_type_from_string (const gchar *str);
str : | the name of a GType, as returned by gda_g_type_to_string(). |
Returns : | the GType represented by the given str. |
gchar* gda_default_escape_string (const gchar *string);
Escapes string to make it understandable by a DBMS. The escape method is very common and replaces any occurence of "'" with "''" and "\" with "\\"
string : | string to escape |
Returns : |
gchar* gda_default_unescape_string (const gchar *string);
Do the reverse of gda_default_escape_string(): transforms any "\'" into "'" and any "\\" into "\".
string : | string to unescape |
Returns : | a new unescaped string, or NULL in an error was found in string |
guint gda_identifier_hash (const gchar *id);
computes a hash string from id, to be used in hash tables as a GHashFunc
id : | an identifier string |
Returns : | a new hash |
gboolean gda_identifier_equal (const gchar *id1, const gchar *id2);
Does the same as strcmp(id1, id2), but handles the case where id1 and/or id2 are enclosed in double quotes. can also be used in hash tables as a GEqualFunc.
id1 : | an identifier string |
id2 : | an identifier string |
Returns : | TRUE if id1 and id2 are equal. |
gchar** gda_completion_list_get (GdaConnection *cnc, const gchar *text, gint start, gint end);
Creates an array of strings (terminated by a NULL) corresponding to possible completions. If no completion is available, then the returned array contains just one NULL entry, and if it was not possible to try to compute a completions list, then NULL is returned.
cnc : | a GdaConnection object |
text : | |
start : | starting position within sql of the "token" to complete (starts at 0) |
end : | ending position within sql of the "token" to complete |
Returns : | a new array of strings, or NULL (use g_strfreev() to free the returned array) |
gchar* gda_rfc1738_encode (const gchar *string);
Encodes string using the RFC 1738 recommendations: the <>"#%{}|\^~[]'`;/?:@=& and space characters are replaced by "%ab" where ab is the hexadecimal number corresponding to the character.
string : | a string to encode |
Returns : | a new string |
gboolean gda_rfc1738_decode (gchar *string);
Decodes string using the RFC 1738 recommendations: the <>"#%{}|\^~[]'`;/?:@=& and space characters are replaced by "%ab" where ab is the hexadecimal number corresponding to the character.
string should respect the RFC 1738 encoding. If this is not the case (for example if there is a "2z" because 2z is not an hexadecimal value), then the part with the problem is not decoded, and the function returns FALSE.
string is decoded in place, no new string gets created.
string : | a string to encode |
Returns : | TRUE if no error occurred. |
void gda_dsn_split (const gchar *string, gchar **out_dsn, gchar **out_username, gchar **out_password);
Extract the DSN, username and password from string. in string, the various parts are strings which are expected to be encoded using an RFC 1738 compliant encoding. If they are specified, the returned username and password strings are correclty decoded.
out_username and out_password may be set to NULL depending on string's format.
string : | a string in the "[<username>[:<password>]@]<DSN>" form |
out_dsn : | a place to store the new string containing the <DSN> part |
out_username : | a place to store the new string containing the <username> part |
out_password : | a place to store the new string containing the <password> part |
void gda_connection_string_split (const gchar *string, gchar **out_cnc_params, gchar **out_provider, gchar **out_username, gchar **out_password);
Extract the provider, connection parameters, username and password from string. in string, the various parts are strings which are expected to be encoded using an RFC 1738 compliant encoding. If they are specified, the returned provider, username and password strings are correclty decoded.
string : | a string in the "[<provider>://][<username>[:<password>]@]<connection_params>" form |
out_cnc_params : | a place to store the new string containing the <connection_params> part |
out_provider : | a place to store the new string containing the <provider> part |
out_username : | a place to store the new string containing the <username> part |
out_password : | a place to store the new string containing the <password> part |
gboolean gda_parse_iso8601_date (GDate *gdate, const gchar *value);
Extracts date parts from value, and sets gdate's contents
Accepted date format is "YYYY-MM-DD".
gdate : | a pointer to a GDate structure which will be filled |
value : | a string |
Returns : | TRUE if no error occurred |
gboolean gda_parse_iso8601_time (GdaTime *timegda, const gchar *value);
Extracts time parts from value, and sets timegda's contents
Accepted date format is "HH:MM:SS[.ms][TZ]" where TZ is +hour or -hour
timegda : | a pointer to a GdaTime structure which will be filled |
value : | a string |
Returns : | TRUE if no error occurred |
gboolean gda_parse_iso8601_timestamp (GdaTimestamp *timestamp, const gchar *value);
Extracts date and time parts from value, and sets timestamp's contents
Accepted date format is "YYYY-MM-DD HH:MM:SS[.ms][TZ]" where TZ is +hour or -hour
timestamp : | a pointer to a GdaTimeStamp structure which will be filled |
value : | a string |
Returns : | TRUE if no error occurred |