/** * gda_pstmt_set_gda_statement: * @pstmt: a #GdaPStmt object * @stmt: (allow-none): a #GdaStatement object, or %NULL * * Informs @pstmt that it corresponds to the preparation of the @stmt statement */ void gda_pstmt_set_gda_statement (GdaPStmt *pstmt, GdaStatement *stmt) { g_return_if_fail (GDA_IS_PSTMT (pstmt)); g_return_if_fail (!stmt || GDA_IS_STATEMENT (stmt)); g_rec_mutex_lock (& pstmt->priv->mutex); GdaStatement *estmt; estmt = g_weak_ref_get (& pstmt->priv->gda_stmt_ref); if (estmt == stmt) { if (estmt) g_object_unref (estmt); g_rec_mutex_unlock (& pstmt->priv->mutex); return; } gda_stmt_reset_cb (NULL, pstmt); if (stmt) { g_object_ref (stmt); g_weak_ref_set (& pstmt->priv->gda_stmt_ref, stmt); g_signal_connect (G_OBJECT (stmt), "reset", G_CALLBACK (gda_stmt_reset_cb), pstmt); } g_rec_mutex_unlock (& pstmt->priv->mutex); }
static void gda_pstmt_dispose (GObject *object) { GdaPStmt *pstmt = (GdaPStmt *) object; GdaPStmtPrivate *priv = gda_pstmt_get_instance_private (pstmt); gda_stmt_reset_cb (NULL, pstmt); /* free memory */ g_rec_mutex_clear (& priv->mutex); g_weak_ref_clear (&priv->gda_stmt_ref); if (priv->sql != NULL) { g_free (priv->sql); priv->sql = NULL; } if (priv->param_ids != NULL) { g_slist_free_full (priv->param_ids, (GDestroyNotify) g_free); priv->param_ids = NULL; } if (priv->types != NULL) { g_free (priv->types); priv->types = NULL; } if (priv->tmpl_columns != NULL) { g_slist_free_full (priv->tmpl_columns, (GDestroyNotify) g_object_unref); priv->tmpl_columns = NULL; } /* chain to parent class */ G_OBJECT_CLASS (gda_pstmt_parent_class)->dispose (object); }
static void gda_pstmt_dispose (GObject *object) { GdaPStmt *pstmt = (GdaPStmt *) object; gda_stmt_reset_cb (NULL, pstmt); /* chain to parent class */ parent_class->dispose (object); }