![]() |
![]() |
![]() |
GNOME Data Access 4 manual | ![]() |
---|---|---|---|---|
Top | Description |
GdaServerOperation * gda_server_operation_new (GdaServerOperationType op_type
,const gchar *xml_file
); GdaSqlParser * gda_server_provider_internal_get_parser (GdaServerProvider *prov
); gboolean gda_server_provider_perform_operation_default (GdaServerProvider *provider
,GdaConnection *cnc
,GdaServerOperation *op
,GError **error
); GdaDataHandler * gda_server_provider_get_data_handler_default (GdaServerProvider *provider
,GdaConnection *cnc
,GType type
,const gchar *dbms_type
); GdaDataHandler * gda_server_provider_handler_find (GdaServerProvider *prov
,GdaConnection *cnc
,GType g_type
,const gchar *dbms_type
); void gda_server_provider_handler_declare (GdaServerProvider *prov
,GdaDataHandler *dh
,GdaConnection *cnc
,GType g_type
,const gchar *dbms_type
); gchar * gda_server_provider_find_file (GdaServerProvider *prov
,const gchar *inst_dir
,const gchar *filename
); gchar * gda_server_provider_load_file_contents (const gchar *inst_dir
,const gchar *data_dir
,const gchar *filename
); void gda_connection_internal_set_provider_data (GdaConnection *cnc
,gpointer data
,GDestroyNotify destroy_func
); gpointer gda_connection_internal_get_provider_data (GdaConnection *cnc
); void gda_connection_add_event (GdaConnection *cnc
,GdaConnectionEvent *event
); GdaConnectionEvent * gda_connection_add_event_string (GdaConnection *cnc
,const gchar *str
,...
); void gda_connection_clear_events_list (GdaConnection *cnc
); GdaConnectionEvent * gda_connection_event_new (GdaConnectionEventType type
); void gda_connection_event_set_event_type (GdaConnectionEvent *event
,GdaConnectionEventType type
); void gda_connection_event_set_description (GdaConnectionEvent *event
,const gchar *description
); void gda_connection_event_set_code (GdaConnectionEvent *event
,glong code
); void gda_connection_event_set_gda_code (GdaConnectionEvent *event
,GdaConnectionEventCode code
); void gda_connection_event_set_source (GdaConnectionEvent *event
,const gchar *source
); void gda_connection_event_set_sqlstate (GdaConnectionEvent *event
,const gchar *sqlstate
); void gda_connection_add_prepared_statement (GdaConnection *cnc
,GdaStatement *gda_stmt
,GdaPStmt *prepared_stmt
); void gda_connection_del_prepared_statement (GdaConnection *cnc
,GdaStatement *gda_stmt
); GdaPStmt * gda_connection_get_prepared_statement (GdaConnection *cnc
,GdaStatement *gda_stmt
); void gda_connection_internal_transaction_started (GdaConnection *cnc
,const gchar *parent_trans
,const gchar *trans_name
,GdaTransactionIsolation isol_level
); void gda_connection_internal_transaction_rolledback (GdaConnection *cnc
,const gchar *trans_name
); void gda_connection_internal_transaction_committed (GdaConnection *cnc
,const gchar *trans_name
); void gda_connection_internal_statement_executed (GdaConnection *cnc
,GdaStatement *stmt
,GdaSet *params
,GdaConnectionEvent *error
); void gda_connection_internal_savepoint_added (GdaConnection *cnc
,const gchar *parent_trans
,const gchar *svp_name
); void gda_connection_internal_savepoint_rolledback (GdaConnection *cnc
,const gchar *svp_name
); void gda_connection_internal_savepoint_removed (GdaConnection *cnc
,const gchar *svp_name
); void gda_connection_internal_change_transaction_state (GdaConnection *cnc
,GdaTransactionStatusState newstate
); void gda_connection_internal_reset_transaction_status (GdaConnection *cnc
); GdaConnection * gda_connection_open_sqlite (const gchar *directory
,const gchar *filename
,gboolean auto_unlink
); gboolean gda_meta_store_modify (GdaMetaStore *store
,const gchar *table_name
,GdaDataModel *new_data
,const gchar *condition
,GError **error
,...
); gboolean gda_meta_store_modify_v (GdaMetaStore *store
,const gchar *table_name
,GdaDataModel *new_data
,const gchar *condition
,gint nvalues
,const gchar **value_names
,const GValue **values
,GError **error
); gboolean gda_meta_store_modify_with_context (GdaMetaStore *store
,GdaMetaContext *context
,GdaDataModel *new_data
,GError **error
); enum GdaSqlIdentifierStyle; void gda_meta_store_set_identifiers_style (GdaMetaStore *store
,GdaSqlIdentifierStyle style
); gboolean (*GdaSqlReservedKeywordsFunc) (const gchar *word
); void gda_meta_store_set_reserved_keywords_func (GdaMetaStore *store
,GdaSqlReservedKeywordsFunc func
); gboolean gda_compute_dml_statements (GdaConnection *cnc
,GdaStatement *select_stmt
,gboolean require_pk
,GdaStatement **insert_stmt
,GdaStatement **update_stmt
,GdaStatement **delete_stmt
,GError **error
); GdaSqlStatement * gda_compute_select_statement_from_update (GdaStatement *update_stmt
,GError **error
); GdaSqlStatement * gda_rewrite_sql_statement_for_null_parameters (GdaSqlStatement *sqlst
,GdaSet *params
,gboolean *out_modified
,GError **error
); gboolean gda_rewrite_statement_for_null_parameters (GdaStatement *stmt
,GdaSet *params
,GdaStatement **out_stmt
,GError **error
); GdaSqlExpr * gda_compute_unique_table_row_condition (GdaSqlStatementSelect *stsel
,GdaMetaTable *mtable
,gboolean require_pk
,GError **error
); GdaSqlExpr * gda_compute_unique_table_row_condition_with_cnc (GdaConnection *cnc
,GdaSqlStatementSelect *stsel
,GdaMetaTable *mtable
,gboolean require_pk
,GError **error
); gboolean gda_sql_any_part_check_structure (GdaSqlAnyPart *node
,GError **error
); GdaSqlStatement * gda_statement_rewrite_for_default_values (GdaStatement *stmt
,GdaSet *params
,gboolean remove
,GError **error
);
The methods mentioned in this section are reserved for database providers implementations and should not bu used by developers outside that scope.
GdaServerOperation * gda_server_operation_new (GdaServerOperationType op_type
,const gchar *xml_file
);
IMPORTANT NOTE: Using this funtion is not the recommended way of creating a GdaServerOperation object, the
correct way is to use gda_server_provider_create_operation()
; this method is reserved for the database provider's
implementation.
Creates a new GdaServerOperation object from the xml_file
specifications
The xml_file
must respect the DTD described in the "libgda-server-operation.dtd" file: its top
node must be a <serv_op> tag.
|
type of operation |
|
a file which has the specifications for the GdaServerOperation object to create |
Returns : |
a new GdaServerOperation object |
GdaSqlParser * gda_server_provider_internal_get_parser
(GdaServerProvider *prov
);
This is a factory method to get a unique instance of a GdaSqlParser object for each GdaServerProvider object Don't unref it.
|
a GdaServerProvider |
Returns : |
a GdaSqlParser. [transfer none] |
gboolean gda_server_provider_perform_operation_default (GdaServerProvider *provider
,GdaConnection *cnc
,GdaServerOperation *op
,GError **error
);
Performs the operation described by op
, using the SQL from the rendering of the operation
|
a GdaServerProvider object |
|
a GdaConnection object which will be used to perform an action, or NULL . [allow-none]
|
|
a GdaServerOperation object |
|
a place to store an error, or NULL
|
Returns : |
TRUE if no error occurred |
GdaDataHandler * gda_server_provider_get_data_handler_default (GdaServerProvider *provider
,GdaConnection *cnc
,GType type
,const gchar *dbms_type
);
Provides the implementation when the default Libgda's data handlers must be used
|
a server provider. |
|
a GdaConnection object, or NULL . [allow-none]
|
|
a GType |
|
a DBMS type definition |
Returns : |
a GdaDataHandler, or NULL . [transfer none]
|
GdaDataHandler * gda_server_provider_handler_find (GdaServerProvider *prov
,GdaConnection *cnc
,GType g_type
,const gchar *dbms_type
);
Returns : |
. [transfer none] |
void gda_server_provider_handler_declare (GdaServerProvider *prov
,GdaDataHandler *dh
,GdaConnection *cnc
,GType g_type
,const gchar *dbms_type
);
gchar * gda_server_provider_find_file (GdaServerProvider *prov
,const gchar *inst_dir
,const gchar *filename
);
Finds the location of a filename
. This function should only be used by database provider's
implementations
|
a GdaServerProvider |
|
directory where prov is installed |
|
name of the file to find |
Returns : |
the complete path to filename , or NULL if not found. [transfer full]
|
gchar * gda_server_provider_load_file_contents (const gchar *inst_dir
,const gchar *data_dir
,const gchar *filename
);
Loads and returns the contents of filename
, which is searched in several places
This function should only be used by database provider's
implementations
|
directory where the database provider has been installed |
|
DATA directory to look for ($prefix/share) |
|
name of the file to load |
Returns : |
a new string containing filename 's contents, or NULL if not found or if an error occurred. [transfer full]
|
void gda_connection_internal_set_provider_data (GdaConnection *cnc
,gpointer data
,GDestroyNotify destroy_func
);
Note: calling this function more than once will not make it call destroy_func
on any previously
set opaque data
, you'll have to do it yourself.
|
a GdaConnection object |
|
an opaque structure, known only to the provider for which cnc is opened |
|
function to call when the connection closes and data needs to be destroyed |
gpointer gda_connection_internal_get_provider_data
(GdaConnection *cnc
);
Get the opaque pointer previously set using gda_connection_internal_set_provider_data()
.
If it's not set, then add a connection event and returns NULL
|
a GdaConnection object |
Returns : |
the pointer to the opaque structure set using gda_connection_internal_set_provider_data() , or NULL . [allow-none]
|
void gda_connection_add_event (GdaConnection *cnc
,GdaConnectionEvent *event
);
Adds an event to the given connection. This function is usually called by providers, to inform clients of events that happened during some operation.
As soon as a provider (or a client, it does not matter) calls this
function with an event
object which is an error,
the connection object emits the "error" signal, to which clients can connect to be
informed of events.
WARNING: the reference to the event
object is stolen by this function!
|
a GdaConnection object. |
|
is stored internally, so you don't need to unref it. [transfer full] |
GdaConnectionEvent * gda_connection_add_event_string (GdaConnection *cnc
,const gchar *str
,...
);
Adds a new error to the given connection object. This is just a convenience function that simply creates a GdaConnectionEvent and then calls gda_server_connection_add_error.
|
a GdaConnection object. |
|
a format string (see the printf(3) documentation). |
|
the arguments to insert in the error message. |
Returns : |
a new GdaConnectionEvent object, however the caller does not hold a reference to the returned object, and if need be the caller must call g_object_ref() on it. [transfer none]
|
void gda_connection_clear_events_list (GdaConnection *cnc
);
This function lets you clear the list of GdaConnectionEvent's of the given connection.
|
a GdaConnection object. |
GdaConnectionEvent * gda_connection_event_new (GdaConnectionEventType type
);
gda_connection_event_new
has been deprecated since version 4.2 and should not be used in newly-written code. use gda_connection_point_available_event()
instead
Creates a new uninitialized event object. This class is used for communicating events from the different providers to the clients.
|
the type of event |
Returns : |
the event object. |
void gda_connection_event_set_event_type (GdaConnectionEvent *event
,GdaConnectionEventType type
);
Sets event
's severity (from a simple notice to a fatal event)
This function should not be called directly.
|
a GdaConnectionEvent object |
|
the severity of the event |
void gda_connection_event_set_description (GdaConnectionEvent *event
,const gchar *description
);
Sets event
's description
. This function should not be called directly.
|
a GdaConnectionEvent. |
|
a description. |
void gda_connection_event_set_code (GdaConnectionEvent *event
,glong code
);
Sets event
's code: the code is specific to the provider being used.
If you want to have a common understanding of the event codes, use
gda_connection_event_get_gda_code()
instead.
This function should not be called directly
|
a GdaConnectionEvent. |
|
a code. |
void gda_connection_event_set_gda_code (GdaConnectionEvent *event
,GdaConnectionEventCode code
);
Sets event
's gda code: that code is standardized by the libgda
library. If you want to specify the corresponding provider specific code,
use gda_connection_event_get_code()
or gda_connection_event_get_sqlstate()
instead.
This function should not be called directly
|
a GdaConnectionEvent |
|
a code |
void gda_connection_event_set_source (GdaConnectionEvent *event
,const gchar *source
);
Sets event
's source
; this function should not be called directly
|
a GdaConnectionEvent. |
|
a source. |
void gda_connection_event_set_sqlstate (GdaConnectionEvent *event
,const gchar *sqlstate
);
Changes the SQLSTATE code of event
, this function should not be called directly
Sets event
's SQL state.
|
a GdaConnectionEvent. |
|
SQL state. |
void gda_connection_add_prepared_statement (GdaConnection *cnc
,GdaStatement *gda_stmt
,GdaPStmt *prepared_stmt
);
Declares that prepared_stmt
is a prepared statement object associated to gda_stmt
within the connection
(meaning the connection increments the reference counter of prepared_stmt
).
If gda_stmt
changes or is destroyed, the the association will be lost and the connection will lose the
reference it has on prepared_stmt
.
|
a GdaConnection object |
|
a GdaStatement object |
|
a prepared statement object (as a GdaPStmt object, or more likely a descendant) |
void gda_connection_del_prepared_statement (GdaConnection *cnc
,GdaStatement *gda_stmt
);
Removes any prepared statement associated to gda_stmt
in cnc
: this undoes what
gda_connection_add_prepared_statement()
does.
|
a GdaConnection object |
|
a GdaStatement object |
GdaPStmt * gda_connection_get_prepared_statement (GdaConnection *cnc
,GdaStatement *gda_stmt
);
Retrieves a pointer to an object representing a prepared statement for gda_stmt
within cnc
. The
association must have been done using gda_connection_add_prepared_statement()
.
|
a GdaConnection object |
|
a GdaStatement object |
Returns : |
the prepared statement, or NULL if no association exists. [transfer none]
|
void gda_connection_internal_transaction_started (GdaConnection *cnc
,const gchar *parent_trans
,const gchar *trans_name
,GdaTransactionIsolation isol_level
);
Internal functions to be called by database providers when a transaction has been started to keep track of the transaction status of the connection.
Note: this function should not be called if gda_connection_internal_statement_executed()
has already been called because a statement's execution was necessary to perform
the action.
|
a GdaConnection |
|
name of the parent transaction, or NULL
|
|
transaction's name, or NULL
|
|
isolation level. |
void gda_connection_internal_transaction_rolledback (GdaConnection *cnc
,const gchar *trans_name
);
Internal functions to be called by database providers when a transaction has been rolled back to keep track of the transaction status of the connection
Note: this function should not be called if gda_connection_internal_statement_executed()
has already been called because a statement's execution was necessary to perform
the action.
|
a GdaConnection |
|
transaction's name, or NULL . [allow-none]
|
void gda_connection_internal_transaction_committed (GdaConnection *cnc
,const gchar *trans_name
);
Internal functions to be called by database providers when a transaction has been committed to keep track of the transaction status of the connection
Note: this function should not be called if gda_connection_internal_statement_executed()
has already been called because a statement's execution was necessary to perform
the action.
|
a GdaConnection |
|
transaction's name, or NULL . [allow-none]
|
void gda_connection_internal_statement_executed (GdaConnection *cnc
,GdaStatement *stmt
,GdaSet *params
,GdaConnectionEvent *error
);
Internal functions to be called by database providers when a statement has been executed to keep track of the transaction status of the connection
|
a GdaConnection |
|
a GdaStatement which has been executed |
|
execution's parameters |
|
a GdaConnectionEvent if the execution failed, or NULL
|
void gda_connection_internal_savepoint_added (GdaConnection *cnc
,const gchar *parent_trans
,const gchar *svp_name
);
Internal functions to be called by database providers when a savepoint has been added to keep track of the transaction status of the connection
Note: this function should not be called if gda_connection_internal_statement_executed()
has already been called because a statement's execution was necessary to perform
the action.
|
a GdaConnection |
|
name of the parent transaction, or NULL . [allow-none]
|
|
savepoint's name, or NULL . [allow-none]
|
void gda_connection_internal_savepoint_rolledback (GdaConnection *cnc
,const gchar *svp_name
);
Internal functions to be called by database providers when a savepoint has been rolled back to keep track of the transaction status of the connection
Note: this function should not be called if gda_connection_internal_statement_executed()
has already been called because a statement's execution was necessary to perform
the action.
|
a GdaConnection |
|
savepoint's name, or NULL . [allow-none]
|
void gda_connection_internal_savepoint_removed (GdaConnection *cnc
,const gchar *svp_name
);
Internal functions to be called by database providers when a savepoint has been removed to keep track of the transaction status of the connection
Note: this function should not be called if gda_connection_internal_statement_executed()
has already been called because a statement's execution was necessary to perform
the action.
|
a GdaConnection |
|
savepoint's name, or NULL . [allow-none]
|
void gda_connection_internal_change_transaction_state (GdaConnection *cnc
,GdaTransactionStatusState newstate
);
Internal function to be called by database providers to force a transaction status change.
|
a GdaConnection |
|
the new state |
void gda_connection_internal_reset_transaction_status
(GdaConnection *cnc
);
Internal function to be called by database providers to reset the transaction status.
|
a GdaConnection |
GdaConnection * gda_connection_open_sqlite (const gchar *directory
,const gchar *filename
,gboolean auto_unlink
);
Opens an SQLite connection even if the SQLite provider is not installed, to be used by database providers which need a temporary database to store some information.
|
the directory the database file will be in, or NULL for the default TMP directory. [allow-none]
|
|
the database file name |
|
if TRUE , then the database file will be removed afterwards |
Returns : |
a new GdaConnection, or NULL if an error occurred. [transfer full]
|
gboolean gda_meta_store_modify (GdaMetaStore *store
,const gchar *table_name
,GdaDataModel *new_data
,const gchar *condition
,GError **error
,...
);
Propagates an update to store
, the update's contents is represented by new_data
, this function is
primarily reserved to database providers.
For example tell store
to update its list of tables, new_data
should contain the same columns as the "_tables"
table of store
, and contain one row per table in the store; there should not be any more argument after the error
argument.
Now, to update only one table, the new_data
data model should have one row for the table to update (or no row
at all if the table does not exist anymore), and have values for the primary key of the "_tables" table of
store
, namely "table_catalog", "table_schema" and "table_name".
|
a GdaMetaStore object |
|
the name of the table to modify within store
|
|
a GdaDataModel containing the new data to set in table_name , or NULL (treated as a data model
with no row at all). [allow-none]
|
|
SQL expression (which may contain variables) defining the rows which are being obsoleted by new_data , or NULL . [allow-none]
|
|
a place to store errors, or NULL . [allow-none]
|
|
a list of (variable name (gchar *), GValue *value) terminated with NULL, representing values for all the
variables mentioned in condition . |
Returns : |
TRUE if no error occurred |
gboolean gda_meta_store_modify_v (GdaMetaStore *store
,const gchar *table_name
,GdaDataModel *new_data
,const gchar *condition
,gint nvalues
,const gchar **value_names
,const GValue **values
,GError **error
);
Propagates an update to store
, the update's contents is represented by new_data
, this function is
primarily reserved to database providers.
|
a GdaMetaStore object |
|
the name of the table to modify within store
|
|
a GdaDataModel containing the new data to set in table_name , or NULL (treated as a data model
with no row at all). [allow-none]
|
|
SQL expression (which may contain variables) defining the rows which are being obsoleted by new_data , or NULL . [allow-none]
|
|
number of values in value_names and values
|
|
names of values. [array length=nvalues] |
|
values. [array length=nvalues] |
|
a place to store errors, or NULL . [allow-none]
|
Returns : |
TRUE if no error occurred |
Since 4.2.6
gboolean gda_meta_store_modify_with_context (GdaMetaStore *store
,GdaMetaContext *context
,GdaDataModel *new_data
,GError **error
);
Propagates an update to store
, the update's contents is represented by new_data
, this function is
primarily reserved to database providers.
|
a GdaMetaStore object |
|
a GdaMetaContext context describing what to modify in store . [transfer none]
|
|
a GdaDataModel containing the new data to set in table_name , or NULL (treated as a data model
with no row at all). [transfer none][allow-none]
|
|
a place to store errors, or NULL
|
Returns : |
TRUE if no error occurred |
typedef enum { GDA_SQL_IDENTIFIERS_LOWER_CASE = 1 << 0, GDA_SQL_IDENTIFIERS_UPPER_CASE = 1 << 1 } GdaSqlIdentifierStyle;
Specifies how SQL identifiers are represented by a specific database.
case insensitive SQL identifiers are represented in lower case (meaning that any SQL identifier which has a non lower case character is case sensitive) | |
case insensitive SQL identifiers are represented in upper case (meaning that any SQL identifier which has a non upper case character is case sensitive) |
void gda_meta_store_set_identifiers_style (GdaMetaStore *store
,GdaSqlIdentifierStyle style
);
Specifies how store
must handle SQL identifiers it has to store. This method is mainly used by
database providers.
|
a GdaMetaStore object |
|
a style |
Since 4.2
void gda_meta_store_set_reserved_keywords_func (GdaMetaStore *store
,GdaSqlReservedKeywordsFunc func
);
Specifies a function which store
will use to determine if a keyword is an SQL reserved
keyword or not.
This method is mainly used by database providers.
|
a GdaMetaStore object |
|
a GdaSqlReservedKeywordsFunc function, or NULL . [allow-none][scope call]
|
Since 4.2
gboolean gda_compute_dml_statements (GdaConnection *cnc
,GdaStatement *select_stmt
,gboolean require_pk
,GdaStatement **insert_stmt
,GdaStatement **update_stmt
,GdaStatement **delete_stmt
,GError **error
);
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 to store the created statement is not NULL
.
|
a GdaConnection |
|
a SELECT GdaStatement (compound statements not handled) |
|
TRUE if the created statement have to use a primary key |
|
a place to store the created INSERT statement, or NULL . [allow-none][transfer full]
|
|
a place to store the created UPDATE statement, or NULL . [allow-none][transfer full]
|
|
a place to store the created DELETE statement, or NULL . [allow-none][transfer full]
|
|
a place to store errors, or NULL . [allow-none]
|
Returns : |
TRUE if no error occurred |
GdaSqlStatement * gda_compute_select_statement_from_update (GdaStatement *update_stmt
,GError **error
);
Computes a SELECT statement which selects all the rows the update_stmt
would update. Beware
however that this GdaSqlStatement does not select anything (ie it would be rendered as "SELECT FROM ... WHERE ...")
and before being usable, one needs to add some fields to actually select.
|
an UPDATE statement |
|
a place to store errors, or NULL
|
Returns : |
a new GdaStatement if no error occurred, or NULL otherwise |
GdaSqlStatement * gda_rewrite_sql_statement_for_null_parameters (GdaSqlStatement *sqlst
,GdaSet *params
,gboolean *out_modified
,GError **error
);
gboolean gda_rewrite_statement_for_null_parameters (GdaStatement *stmt
,GdaSet *params
,GdaStatement **out_stmt
,GError **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". It also
handles the "xxx IS NOT NULL" transformation.
For example the following SELECT:
SELECT * FROM data WHERE id = #id::int::null AND name = #name::string
in case the "id" parameter is set to NULL, is converted to:
SELECT * FROM data WHERE id IS NULL AND name = #name::string
if out_stmt
is not NULL
, then it will contain:
This function is used by provider's implementations to make sure one can use parameters with NULL values in statements without having to rewrite statements, as database usually don't consider that "xxx = NULL" is the same as "xxx IS NULL" when using parameters.
|
a GdaStatement. [transfer none] |
|
a GdaSet to be used as parameters when executing stmt
|
|
a place to store the new GdaStatement, or NULL . [transfer full][allow-none]
|
|
a place to store errors, or NULL
|
Returns : |
TRUE if stmt needs to be transformed to handle NULL parameters, and FALSE otherwise |
Since 4.2.9
GdaSqlExpr * gda_compute_unique_table_row_condition (GdaSqlStatementSelect *stsel
,GdaMetaTable *mtable
,gboolean require_pk
,GError **error
);
Computes a GdaSqlExpr 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.
|
a GdaSqlSelectStatement |
|
a GdaMetaTable |
|
set to TRUE if a primary key ir required |
|
a place to store errors, or NULL
|
Returns : |
a new GdaSqlExpr, or NULL if an error occurred. |
GdaSqlExpr * gda_compute_unique_table_row_condition_with_cnc (GdaConnection *cnc
,GdaSqlStatementSelect *stsel
,GdaMetaTable *mtable
,gboolean require_pk
,GError **error
);
Computes a GdaSqlExpr 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.
If require_pk
is TRUE
then this function will return a non NULL
GdaSqlExpr only if it can
use a primary key of mtable
. If require_pk
is FALSE
, then it will try to use a primary key of mtable
,
and if none is available, it will use all the columns of mtable
to compute a condition statement.
|
a GdaConnection, or NULL . [allow-none]
|
|
a GdaSqlSelectStatement |
|
a GdaMetaTable |
|
set to TRUE if a primary key is required |
|
a place to store errors, or NULL
|
Returns : |
a new GdaSqlExpr, or NULL if an error occurred. |
Since 4.0.3
gboolean gda_sql_any_part_check_structure (GdaSqlAnyPart *node
,GError **error
);
Checks for any error in node
's structure to make sure it is valid. This
is the same as gda_sql_statement_check_structure()
but for individual GdaSqlAnyPart
parts. This function is mainly for database provider's implementations
|
a GdaSqlAnyPart pointer |
|
a place to store errors, or NULL
|
Returns : |
TRUE if no error occurred |
GdaSqlStatement * gda_statement_rewrite_for_default_values (GdaStatement *stmt
,GdaSet *params
,gboolean remove
,GError **error
);
Rewrites stmt
and creates a new GdaSqlStatement where all the variables which are to a DEFAULT value
(as returned by gda_holder_value_is_default()
) are either removed from the statement (if remove
is TRUE
) or replaced by the "DEFAULT" keyword (if remove
is FALSE
).
This function is only useful for database providers' implementations which have to deal with default
values when executing statements, and is only relevant in the case of INSERT or UPDATE statements
(in the latter case an error is returned if remove
is TRUE
).
For example the
INSERT INTO mytable (id, name) VALUES (23, ##name::string)
is re-written into
INSERT INTO mytable (id, name) VALUES (23, DEFAULT)
if remove
is FALSE
and into
INSERT INTO mytable (id) VALUES (23)
if remove
is TRUE
.
|
a GdaStatement object |
|
a GdaSet containing the variable's values to be bound when executing stmt
|
|
set to TRUE if DEFAULT fields are removed, of FALSE if the "DEFAULT" keyword is used |
|
a place to store errors, or NULL
|
Returns : |
a new GdaSqlStatement, or NULL if an error occurred |
Since 4.2