gda.global

Global functions for gda5 library

Functions 43

fnstring escapeString(string string_)Escapes string to make it understandable by a DBMS. The escape method is very common and replaces any occurrence of "'" with "''" and "\" with "\\"
fnstring unescapeString(string string_)Do the reverse of [gda.global.defaultEscapeString]: transforms any "''" into "'", any "\\" into "\" and any "\'" into "'".
fnstring alphanumToText(string text)Does the opposite of [gda.global.textToAlphanum], in the same string
fnstring[] completionListGet(gda.connection.Connection cnc, string sql, int start, int 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 poss...
fnbool computeDmlStatements(gda.connection.Connection cnc, gda.statement.Statement selectStmt, bool requirePk, gda.statement.Statement insertStmt = null, gda.statement.Statement updateStmt = null, gda.statement.Statement deleteStmt = null)Creates an INSERT, an UPDATE and a DELETE statement from a SELECT statement using the database metadata available in cnc's meta store. Each statements are computed only if the corresponding place t...
fnvoid dsnSplit(string string_, out string outDsn, out string outUsername, out string outPassword)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 return...
fngobject.types.GType gTypeFromString(string str)Converts a named type to ts GType type (also see the [gda.global.gTypeToString] function).
fnstring gTypeToString(gobject.types.GType type)Converts a GType to its string representation (use [gda.global.gTypeFromString] for the operation in the other direction).
fnstring getApplicationExecPath(string appName)Find the path to the application identified by app_name. For example if the application is "gda-sql", then calling this function will return "/your/prefix/bin/gda-sql-5.0" if Libgda is installed in...
fnbool identifierEqual(string id1, string 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.
fnuint identifierHash(string id)computes a hash string from id, to be used in hash tables as a #GHashFunc
fnvoid init_()Initializes the GDA library, must be called prior to any Libgda usage.
fnvoid localeChanged()Call this function whenever the setlocale() function has been called to change the current locale; this function is first called by [gda.global.init] so you don't need to call it if you have set th...
fnvoid logDisable()Disables GDA logs.
fnvoid logEnable()Enables GDA logs.
fnbool logIsEnabled()
fnbool parseFormattedDate(glib.date.Date gdate, string value, glib.types.DateDMY first, glib.types.DateDMY second, glib.types.DateDMY third, char sep)This function is similar to [gda.global.parseIso8601Date] (with first being GDATEYEAR, second being GDATEMONTH, third being GDATEDAY and sep being '-') but allows one to specify the expected date f...
fnbool parseFormattedTime(gda.time.Time timegda, string value, char sep)
fnbool parseFormattedTimestamp(gda.timestamp.Timestamp timestamp, string value, glib.types.DateDMY first, glib.types.DateDMY second, glib.types.DateDMY third, char sep)This function is similar to [gda.global.parseIso8601Timestamp] (with first being GDATEYEAR, second being GDATEMONTH, third being GDATEDAY and sep being '-') but allows one to specify the expected d...
fnbool parseIso8601Date(glib.date.Date gdate, string value)Extracts date parts from value, and sets gdate's contents
fnbool parseIso8601Time(gda.time.Time timegda, string value)Extracts time parts from value, and sets timegda's contents
fnbool parseIso8601Timestamp(gda.timestamp.Timestamp timestamp, string value)Extracts date and time parts from value, and sets timestamp's contents
fnbool rewriteStatementForNullParameters(gda.statement.Statement stmt, gda.set.Set params, gda.statement.Statement outStmt = null)Modifies stmt to take into account any parameter which might be null: if stmt contains the equivalent of "xxx = <parameter definition>" and if that parameter is in params and its value is of ...
fnbool rfc1738Decode(string string_)Decodes string using the RFC 1738 recommendations: the <constant><>"#%{}|\^~[]'`;/?:@=&</constant> and space characters are replaced by <constant>"%`ab`"</constant> wh...
fnstring rfc1738Encode(string string_)Encodes string using the RFC 1738 recommendations: the <constant><>"#%{}|\^~[]'`;/?:@=&</constant> and space characters are replaced by <constant>"%`ab`"</constant> wh...
fngda.statement.Statement selectAlterSelectForEmpty(gda.statement.Statement stmt)Creates a new #GdaStatement, selecting the same data as stmt, but which always returns an empty (no row) data model. This is use dy database providers' implementations.
fnstring sqlIdentifierForceQuotes(string str)Add double quotes around the str identifier. This function is normally used only by database provider's implementation. Any double quote character is replaced by two double quote characters.
fnstring sqlIdentifierPrepareForCompare(string str)Prepares str to be compared: <itemizedlist> <listitem><para>if surrounded by double quotes or single quotes, then just remove the quotes</para></listitem> <listitem><para>otherwise convert to lower...
fnstring sqlIdentifierQuote(string id, gda.connection.Connection cnc, gda.server_provider.ServerProvider prov, bool metaStoreConvention, bool forceQuotes)Use this function for any SQL identifier to make sure that: <itemizedlist> <listitem> <para>it is correctly formatted to be used with cnc (if cnc is null, then some default SQL quoting rules will b...
fnstring[] sqlIdentifierSplit(string id)Splits id into an array of it sub parts. id's format has to be "<part>[.<part>[...]]" where each part is either a text surrounded by double quotes which can contain upper and lower case...
fnstring sqlValueStringify(gobject.value.Value value)Simplified version of [gda.global.valueStringify].
fngda.binary.Binary stringToBinary(string str = null)Performs the reverse of [gda.binary.Binary.toString_] (note that for any "\xyz" succession of 4 characters where "xyz" represents a valid octal value, the resulting read value will be modulo 256).
fngda.blob.Blob stringToBlob(string str)Performs the reverse of [gda.blob.Blob.toString_].
fnstring textToAlphanum(string text)The "encoding" consists in replacing non alphanumeric character with the string "__gdaXX" where XX is the hex. representation of the non alphanumeric char.
fnbool utilityCheckDataModel(gda.data_model.DataModel model, gobject.types.GType[] types)Check the column types of a GdaDataModel.
fnbool utilityDataModelDumpDataToXml(gda.data_model.DataModel model, libxml2.types.NodePtr parent, int[] cols, int[] rows, bool useColIds)Dump the data in a #GdaDataModel into a xmlNodePtr (as used in libxml).
fnstring utilityDataModelFindColumnDescription(gda.data_select.DataSelect model, string fieldName)Finds the description of a field into Metadata from a #GdaDataModel.
fnbool utilityHolderLoadAttributes(gda.holder.Holder holder, libxml2.types.NodePtr node, gda.data_model.DataModel[] sources)Note: this method may set the "source" custom string property
fnint valueCompare(gobject.value.Value value1, gobject.value.Value value2)Compares two values of the same type, with the exception that a value of any type can be compared to a GDATYPENULL value, specifically: <itemizedlist> <listitem><para>if value1 and value2 are both ...
fnint valueDiffer(gobject.value.Value value1, gobject.value.Value value2)Tells if two values are equal or not, by comparing memory representations. Unlike [gda.global.valueCompare], the returned value is boolean, and gives no idea about ordering.
fnbool valueIsNull(gobject.value.Value value)Tests if a given value is of type #GDATYPENULL.
fnstring valueStringify(gobject.value.Value value)Converts a GValue to its string representation which is a human readable value. Note that the returned string does not take into account the current locale of the user (on the contrary to the #GdaD...