[libgda] sqlite: improved multi-thread performance
- From: Daniel Espinosa Ortiz <despinosa src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [libgda] sqlite: improved multi-thread performance
- Date: Tue, 9 Oct 2018 21:41:08 +0000 (UTC)
commit 7f501b70dd1cee12e81d1948825ab231be2c903c
Author: Daniel Espinosa <esodan gmail com>
Date: Mon Oct 8 23:49:10 2018 -0500
sqlite: improved multi-thread performance
libgda/gda-connection.c | 8 ++------
libgda/gda-data-select.c | 14 +++++---------
libgda/gda-server-provider.c | 3 ++-
libgda/sqlite/gda-sqlite-provider.c | 4 ++--
4 files changed, 11 insertions(+), 18 deletions(-)
---
diff --git a/libgda/gda-connection.c b/libgda/gda-connection.c
index 0600c194c..dece5200e 100644
--- a/libgda/gda-connection.c
+++ b/libgda/gda-connection.c
@@ -487,8 +487,6 @@ gda_connection_dispose (GObject *object)
/* get rid of prepared statements to avoid problems */
if (priv->prepared_stmts) {
- g_hash_table_foreach (priv->prepared_stmts,
- (GHFunc) prepared_stms_foreach_func, cnc);
g_hash_table_destroy (priv->prepared_stmts);
priv->prepared_stmts = NULL;
}
@@ -1540,8 +1538,6 @@ gda_connection_close (GdaConnection *cnc, GError **error)
/* get rid of prepared statements to avoid problems */
if (priv->prepared_stmts) {
- g_hash_table_foreach (priv->prepared_stmts,
- (GHFunc) prepared_stms_foreach_func, cnc);
g_hash_table_destroy (priv->prepared_stmts);
priv->prepared_stmts = NULL;
}
@@ -5994,10 +5990,10 @@ gda_connection_del_prepared_statement (GdaConnection *cnc, GdaStatement *gda_stm
g_return_if_fail (cnc != NULL);
gda_connection_lock ((GdaLockable*) cnc);
+ GdaConnectionPrivate *priv = gda_connection_get_instance_private (cnc);
g_return_if_fail (GDA_IS_CONNECTION (cnc));
g_object_ref (gda_stmt);
- if (gda_connection_get_prepared_statement (cnc, gda_stmt))
- prepared_stmts_stmt_reset_cb (gda_stmt, cnc);
+ g_hash_table_remove (priv->prepared_stmts, gda_stmt);
g_object_unref (gda_stmt);
gda_connection_unlock ((GdaLockable*) cnc);
}
diff --git a/libgda/gda-data-select.c b/libgda/gda-data-select.c
index 182bddcfa..cd6bfc1a8 100644
--- a/libgda/gda-data-select.c
+++ b/libgda/gda-data-select.c
@@ -533,8 +533,7 @@ free_private_shared_data (GdaDataSelect *model)
model->priv->sh->index = NULL;
}
if (model->priv->sh->columns) {
- g_slist_foreach (model->priv->sh->columns, (GFunc) g_object_unref, NULL);
- g_slist_free (model->priv->sh->columns);
+ g_slist_free_full (model->priv->sh->columns, (GDestroyNotify) g_object_unref);
model->priv->sh->columns = NULL;
}
@@ -722,8 +721,7 @@ create_columns (GdaDataSelect *model)
gint i;
ModType m;
if (model->priv->sh->columns) {
- g_slist_foreach (model->priv->sh->columns, (GFunc) g_object_unref, NULL);
- g_slist_free (model->priv->sh->columns);
+ g_slist_free_full (model->priv->sh->columns, (GDestroyNotify) g_object_unref);
model->priv->sh->columns = NULL;
}
for (m = FIRST_QUERY; m < NB_QUERIES; m++) {
@@ -734,8 +732,7 @@ create_columns (GdaDataSelect *model)
return;
if (model->prep_stmt->ncols < 0)
- g_error ("INTERNAL implementation error: unknown number of columns in GdaPStmt, \n"
- "set number of columns before using with GdaDataSelect");
+ g_error (_("INTERNAL implementation error: unknown number of columns in GdaPStmt, \nset
number of columns before using with GdaDataSelect"));
if (model->prep_stmt->tmpl_columns) {
/* copy template columns */
GSList *list;
@@ -1002,8 +999,7 @@ gda_data_select_set_columns (GdaDataSelect *model, GSList *columns)
g_return_if_fail (model->priv);
if (model->priv->sh->columns) {
- g_slist_foreach (model->priv->sh->columns, (GFunc) g_object_unref, NULL);
- g_slist_free (model->priv->sh->columns);
+ g_slist_free_full (model->priv->sh->columns, (GDestroyNotify) g_object_unref);
model->priv->sh->columns = NULL;
}
for (m = FIRST_QUERY; m < NB_QUERIES; m++) {
@@ -3623,7 +3619,7 @@ set_column_properties_from_select_stmt (GdaDataSelect *model, GdaConnection *cnc
columns = columns->next;
}
if (fields || columns)
- g_warning ("Internal error: GdaDataSelect has %d GdaColumns, and SELECT statement has %d
expressions",
+ g_warning (_("Internal error: GdaDataSelect has %d GdaColumns, and SELECT statement has %d
expressions"),
g_slist_length (model->priv->sh->columns), g_slist_length (select->expr_list));
out:
diff --git a/libgda/gda-server-provider.c b/libgda/gda-server-provider.c
index 30127ac8f..8b7079571 100644
--- a/libgda/gda-server-provider.c
+++ b/libgda/gda-server-provider.c
@@ -2282,8 +2282,9 @@ stage2_close_connection (GdaConnection *cnc, gpointer result)
if (cdata) {
gda_connection_internal_set_provider_data (cnc, NULL, NULL);
- if (cdata->provider_data_destroy_func)
+ if (cdata->provider_data_destroy_func) {
cdata->provider_data_destroy_func (cdata);
+ }
}
_gda_connection_set_status (cnc, GDA_CONNECTION_STATUS_CLOSED);
}
diff --git a/libgda/sqlite/gda-sqlite-provider.c b/libgda/sqlite/gda-sqlite-provider.c
index 2be076725..1e795ddd4 100644
--- a/libgda/sqlite/gda-sqlite-provider.c
+++ b/libgda/sqlite/gda-sqlite-provider.c
@@ -1124,7 +1124,7 @@ gda_sqlite_provider_open_connection (GdaServerProvider *provider, GdaConnection
if (filename)
cdata->file = filename;
- errmsg = SQLITE3_CALL (sqlite3_open) (filename, &cdata->connection);
+ errmsg = SQLITE3_CALL (sqlite3_open_v2) (filename, &cdata->connection, SQLITE_OPEN_FULLMUTEX |
SQLITE_OPEN_READWRITE | SQLITE_OPEN_CREATE, NULL);
if (errmsg != SQLITE_OK) {
gda_connection_add_event_string (cnc, SQLITE3_CALL (sqlite3_errmsg) (cdata->connection));
@@ -4197,7 +4197,7 @@ gda_sqlite_free_cnc_data (SqliteConnectionData *cdata)
if (cdata->gdacnc)
g_object_remove_weak_pointer (G_OBJECT (cdata->gdacnc), (gpointer*) &(cdata->gdacnc));
if (cdata->connection)
- SQLITE3_CALL (sqlite3_close) (cdata->connection);
+ SQLITE3_CALL (sqlite3_close_v2) (cdata->connection);
g_free (cdata->file);
if (cdata->types_hash)
g_hash_table_destroy (cdata->types_hash);
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]