![]() |
![]() |
![]() |
GNOME Data Access 4 manual | ![]() |
---|---|---|---|---|
Top | Description |
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 *sql, 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);
Converts a GType to its string representation (use gda_g_type_from_string()
for the
operation in the other direction).
This function wraps g_type_name()
but for common types it provides an easier to
understand and remember name. For Example the G_TYPE_STRING is converted to "string"
whereas g_type_name()
converts it to "gchararray".
|
Type to convert from. |
Returns : |
the GDA's string representing the given GType or the name returned by g_type_name. |
GType gda_g_type_from_string (const gchar *str);
Converts a named type to ts GType type (also see the gda_g_type_to_string()
function).
This function is a wrapper around the g_type_from_name()
function, but also recognizes
some type synonyms such as:
"int" for G_TYPE_INT
"string" for G_TYPE_STRING
"date" for G_TYPE_DATE
"time" for GDA_TYPE_TIME
"timestamp" for GDA_TYPE_TIMESTAMP
"boolean" for G_TYPE_BOOLEAN
"blob" for GDA_TYPE_BLOB
"binary" for GDA_TYPE_BINARY
"null" for GDA_TYPE_NULL
|
the name of a GType, as returned by gda_g_type_to_string() .
|
Returns : |
the GType represented by the given str , or G_TYPE_INVALID if not found
|
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
occurrence of "'" with "''" and "\" with "\\"
|
string to escape |
Returns : |
a new string |
gchar * gda_default_unescape_string (const gchar *string);
Do the reverse of gda_default_escape_string()
: transforms any "\'" into "'" and any
"\\" into "\".
|
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
|
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.
|
an identifier string |
|
an identifier string |
Returns : |
TRUE if id1 and id2 are equal.
|
gchar ** gda_completion_list_get (GdaConnection *cnc, const gchar *sql, 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.
|
a GdaConnection object |
|
a partial SQL statement which is the context of the completion proposal |
|
starting position within sql of the "token" to complete (starts at 0)
|
|
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
"%
where
ab
"ab
is the hexadecimal number corresponding to the character.
|
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
"%
where
ab
"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.
|
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 correctly decoded.
out_username
and out_password
may be set to NULL
depending on string
's format.
|
a string in the "[<username>[:<password>]@]<DSN>" form |
|
a place to store the new string containing the <DSN> part |
|
a place to store the new string containing the <username> part |
|
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 correctly decoded.
|
a string in the "[<provider>://][<username>[:<password>]@]<connection_params>" form |
|
a place to store the new string containing the <connection_params> part |
|
a place to store the new string containing the <provider> part |
|
a place to store the new string containing the <username> part |
|
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".
|
a pointer to a GDate structure which will be filled |
|
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
|
a pointer to a GdaTime structure which will be filled |
|
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
|
a pointer to a GdaTimeStamp structure which will be filled |
|
a string |
Returns : |
TRUE if no error occurred |