Exemplo n.º 1
0
static void
ephy_sqlite_statement_get_property (GObject *object, guint property_id, GValue *value, GParamSpec *pspec)
{
  EphySQLiteStatement *self = EPHY_SQLITE_STATEMENT (object);

  switch (property_id) {
    case PROP_PREPARED_STATEMENT:
      g_value_set_pointer (value, self->priv->prepared_statement);
      break;
    case PROP_CONNECTION:
      g_value_set_object (value, self->priv->connection);
      break;
    default:
      G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec);
      break;
  }
}
Exemplo n.º 2
0
static void
ephy_sqlite_statement_finalize (GObject *self)
{
  EphySQLiteStatementPrivate *priv = EPHY_SQLITE_STATEMENT (self)->priv;

  if (priv->prepared_statement) {
    sqlite3_finalize (priv->prepared_statement);
    priv->prepared_statement = NULL;
  }

  if (priv->connection) {
    g_object_unref (priv->connection);
    priv->connection = NULL;
  }

  G_OBJECT_CLASS (ephy_sqlite_statement_parent_class)->dispose (self);
}
Exemplo n.º 3
0
static void
ephy_sqlite_statement_finalize (GObject *object)
{
  EphySQLiteStatement *self = EPHY_SQLITE_STATEMENT (object);

  if (self->prepared_statement) {
    sqlite3_finalize (self->prepared_statement);
    self->prepared_statement = NULL;
  }

  if (self->connection) {
    g_object_unref (self->connection);
    self->connection = NULL;
  }

  G_OBJECT_CLASS (ephy_sqlite_statement_parent_class)->finalize (object);
}
Exemplo n.º 4
0
EphySQLiteStatement *
ephy_sqlite_connection_create_statement (EphySQLiteConnection *self, const char *sql, GError **error)
{
  sqlite3_stmt *prepared_statement;

  if (self->database == NULL) {
    set_error_from_string ("Connection not open.", error);
    return NULL;
  }

  if (sqlite3_prepare_v2 (self->database, sql, -1, &prepared_statement, NULL) != SQLITE_OK) {
    ephy_sqlite_connection_get_error (self, error);
    return NULL;
  }

  return EPHY_SQLITE_STATEMENT (g_object_new (EPHY_TYPE_SQLITE_STATEMENT,
                                              "prepared-statement", prepared_statement,
                                              "connection", self,
                                              NULL));
}