- public string? alphanum_to_text (string text)
- public string[]? completion_list_get (Connection cnc, string sql, int start, int end)
Creates an array of strings (terminated by a null
) corresponding to possible completions.
- public bool compute_dml_statements (Connection cnc, Statement select_stmt, bool require_pk, out Statement? insert_stmt, out Statement? update_stmt, out Statement? delete_stmt) throws Error
Creates an INSERT, an UPDATE and a DELETE statement from a SELECT statement
using the database metadata available in cnc
's meta store.
- public SqlStatement? compute_select_statement_from_update (Statement update_stmt) throws Error
Computes a SELECT statement which selects all the rows the update_stmt
would update.
- public SqlExpr? compute_unique_table_row_condition (SqlStatementSelect stsel, MetaTable mtable, bool require_pk) throws Error
Computes a SqlExpr
expression which can be used in the WHERE clause of an UPDATE or DELETE statement when a row from the result of the stsel
statement has to be modified.
- public SqlExpr? compute_unique_table_row_condition_with_cnc (Connection? cnc, SqlStatementSelect stsel, MetaTable mtable, bool require_pk) throws Error
Computes a SqlExpr
expression which can be used in the WHERE clause of an UPDATE or DELETE statement when a row from the result of the stsel
statement has to be modified.
- public DataHandler data_handler_get_default (Type for_type)
- public DateTime date_time_copy (DateTime ts)
- public string? default_escape_string (string string)
Escapes string
to make it understandable by a DBMS.
- public string? default_unescape_string (string string)
Do the reverse of
default_escape_string: transforms any "''" into "'", any "\\" into
"\" and any "\'" into "'".
- public void dsn_split (string string, string out_dsn, string out_username, string out_password)
Extract the DSN, username and password from string
.
- public Type g_type_from_string (string str)
Converts a named type to ts GType type (also see the
g_type_to_string function).
- public unowned string g_type_to_string (Type type)
Converts a GType to its string representation (use
g_type_from_string for the operation in the other direction).
- public bool identifier_equal (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.
- public uint identifier_hash (string id)
computes a hash string from id
, to be used in hash tables as a
HashFunc
- public void log_disable ()
Disables GDA logs.
- public void log_enable ()
Enables GDA logs.
- public bool log_is_enabled ()
- public bool parse_formatted_date (Date gdate, string value, DateDMY first, DateDMY second, DateDMY third, char sep)
This function is similar to
parse_iso8601_date (with first
being G_DATE_YEAR
, second
being G_DATE_MONTH
, third
being G_DATE_DAY
and sep
being
'-') but allows one to specify the expected date format.
- public Time parse_formatted_time (string value, char sep)
- public DateTime? parse_formatted_timestamp (string value, DateDMY first, DateDMY second, DateDMY third, char sep)
This function is similar to
DateTime.from_iso8601 (with first
being G_DATE_YEAR
, second
being G_DATE_MONTH
, third
being G_DATE_DAY
and
sep
being '-') but allows one to specify the expected date format.
- public bool parse_iso8601_date (Date gdate, string value)
Extracts date parts from value
, and sets gdate
's
contents
- public Time parse_iso8601_time (string value)
Extracts time parts from value
, and sets timegda
's
contents
- public SqlStatement? rewrite_sql_statement_for_null_parameters (owned SqlStatement sqlst, Set @params, out bool out_modified) throws Error
Modifies sqlst
to take into account any parameter which might
be null: if sqlst
contains the equivalent of "xxx = <parameter definition>" and
if that parameter is in params
and its value is of type GDA_TYPE_NUL, then that part is replaced with "xxx IS NULL".
- public bool rewrite_statement_for_null_parameters (Statement stmt, Set @params, out Statement? out_stmt) throws Error
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 type GDA_TYPE_NUL, then that part is replaced with "xxx IS NULL".
- public bool rfc1738_decode (string string)
Decodes string
using the RFC 1738 recommendations: the <
constant><>"#%{}|\^~[]'`;/?:@=&</constant> and space characters are replaced by <
constant>"%ab"</constant> where <constant>ab</constant> is the
hexadecimal number corresponding to the character.
- public string? rfc1738_encode (string string)
Encodes string
using the RFC 1738 recommendations: the <
constant><>"#%{}|\^~[]'`;/?:@=&</constant> and space characters are replaced by <
constant>"%ab"</constant> where <constant>ab</constant> is the
hexadecimal number corresponding to the character.
- public Statement select_alter_select_for_empty (Statement stmt) throws Error
Creates a new
Statement, selecting the same data as stmt
, but which always returns an empty (no row) data model.
- public string sql_identifier_force_quotes (string str)
Add double quotes around the str
identifier.
- public string sql_identifier_prepare_for_compare (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 case</para></listitem> </itemizedlist>
- public string? sql_identifier_quote (string id, Connection? cnc, ServerProvider? prov, bool meta_store_convention, bool force_quotes)
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 be applied, similar to PostgreSQL's way) if
for_meta_store
is false; </para> </listitem> <listitem> <para>it is
correctly formatted to be used with the MetaStore's object associated to
cnc
is for_meta_store
is true.
- public string[]? sql_identifier_split (string id)
Splits id
into an array of it sub parts.
- public SqlOperatorType sql_operation_operator_from_string (string op)
- public unowned string sql_operation_operator_to_string (SqlOperatorType op)
Returns a constant string representing a operator name.
- public SqlStatementType sql_statement_string_to_type (string type)
- public string sql_value_stringify (Value value)
- public Binary string_to_binary (string? str)
Performs the reverse of
to_string (note that for any "\xyz" succession of 4 characters where
"xyz" represents a valid octal value, the resulting read value will be modulo 256).
- public Blob string_to_blob (string str)
- public string text_to_alphanum (string text)
The "encoding" consists in replacing non alphanumeric character with the
string "__gdaXX" where XX is the hex.
- public bool utility_check_data_model_v (DataModel model, Type[] types)
Check the column types of a GdaDataModel.
- public bool utility_data_model_dump_data_to_xml (DataModel model, unowned Node* parent, int[]? cols, int[]? rows, bool use_col_ids)
Dump the data in a
DataModel into a xmlNodePtr (as used in libxml).
- public unowned string? utility_data_model_find_column_description (DataSelect model, string field_name)
Finds the description of a field into Metadata from a
DataModel.
- public bool utility_holder_load_attributes (Holder holder, unowned Node* node, SList<DataModel>? sources) throws Error
Note: this method may set the "source" custom string property
- public int value_compare (Value value1, Value value2)
Compares two values of the same type, with the exception that a value of any
type can be compared to a GDA_TYPE_NULL value, specifically: <itemizedlist> <listitem><para>if value1
and
value2
are both GDA_TYPE_NULL values then the returned value is 0</para></listitem> <listitem><para>if
value1
is a GDA_TYPE_NULL value and value2
is of another type then the returned value is -1</para><
/listitem> <listitem><para>if value1
is of another type and value2
is a GDA_TYPE_NULL value then
the returned value is 1</para></listitem> <listitem><para>in all other cases, value1
and value2
must be of the same type and their values are compared</para></listitem> </itemizedlist>
- public Value? value_copy (Value value)
Creates a new Value
from an existing one.
- public int value_differ (Value value1, Value value2)
Tells if two values are equal or not, by comparing memory representations.
- public void value_free (owned Value? value)
Deallocates all memory associated to a
Value.
- public unowned Binary value_get_binary (Value value)
- public unowned Blob value_get_blob (Value value)
- public unowned GeometricPoint value_get_geometric_point (Value value)
- public unowned MetaStoreChange value_get_meta_store_change (Value value)
- public unowned Numeric value_get_numeric (Value value)
- public short value_get_short (Value value)
- public unowned Time value_get_time (Value value)
- public ushort value_get_ushort (Value value)
- public bool value_is_null (Value value)
Tests if a given value
is of type GDA_TYPE_NULL
.
- public bool value_is_number (Value value)
Gets whether the value stored in the given
Value is of numeric type or not.
- public Value? value_new (Type type)
Creates a new Value
of type type
, left in the same state as when Value
is called.
- public Value? value_new_binary (owned uint8 val, long size)
Makes a new Value
of type GDA_TYPE_BINARY
with value val
.
- public Value? value_new_blob (uint8 val, long size)
Makes a new Value
of type GDA_TYPE_BLOB
with the data contained by val
.
- public Value? value_new_blob_from_file (string filename)
Makes a new Value
of type GDA_TYPE_BLOB
interfacing with the contents of the file named filename
- public Value? value_new_date_time_from_timet (long val)
Makes a new Value
of type typeof (DateTime)
with value
val
(of type time_t).
- public Value? value_new_default (string? default_val)
Creates a new default value.
- public Value? value_new_from_string (string as_string, Type type)
Makes a new Value
of type type
from its string representation.
- public Value? value_new_from_xml (Node node)
Creates a GValue from an XML representation of it.
- public Value? value_new_null ()
Creates a new Value
initiated to a Null structure with a GDA_TYPE_NULL
, to represent a
NULL in the database.
- public Value? value_new_time_from_timet (long val)
Makes a new Value
of type GDA_TYPE_TIME
with value val
(of type time_t).
- public void value_reset_with_type (Value value, Type type)
- public void value_set_binary (Value value, Binary binary)
Stores val
into value
.
- public void value_set_blob (Value value, Blob blob)
Stores val
into value
.
- public bool value_set_from_string (Value value, string as_string, Type type)
Stores the value data from its string representation as type
.
- public bool value_set_from_value (Value value, Value from)
- public void value_set_geometric_point (Value value, GeometricPoint val)
Stores val
into value
.
- public void value_set_meta_store_change (Value value, MetaStoreChange change)
- public void value_set_null (Value value)
Sets the type of value
to GDA_TYPE_NULL
.
- public void value_set_numeric (Value value, Numeric val)
Stores val
into value
.
- public void value_set_short (Value value, short val)
Stores val
into value
.
- public void value_set_time (Value value, Time val)
Stores val
into value
.
- public void value_set_ushort (Value value, ushort val)
Stores val
into value
.
- public string value_stringify (Value value)
Converts a GValue to its string representation which is a human readable
value.
- public void value_take_binary (Value value, owned Binary binary)
Stores val
into value
, but on the contrary to
value_set_binary, the binary
argument is not copied, but
used as-is and it should be considered owned by value
.
- public void value_take_blob (Value value, owned Blob blob)
Stores val
into value
, but on the contrary to
value_set_blob, the blob
argument is not copied, but used
as-is and it should be considered owned by value
.
- public string value_to_xml_string (Value value)
This methods creates an XML string representation of a
Value
- public Worker worker_new_unique (Worker location, bool allow_destroy)
This function creates a new
Worker, or reuses the one at location
.