summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorStewart Smith <stewart@linux.vnet.ibm.com>2015-12-15 16:02:35 +1100
committerStewart Smith <stewart@linux.vnet.ibm.com>2015-12-15 16:48:06 +1100
commit4672f1232399d844eb18c7dbe9b8c5c2a2a6c726 (patch)
tree4bb910525bca49ce0ccb22e573671d83ecef9cc1
parentb22aff3ebc8c21915c39030bf6024bcb4372d495 (diff)
downloadffs-4672f1232399d844eb18c7dbe9b8c5c2a2a6c726.zip
ffs-4672f1232399d844eb18c7dbe9b8c5c2a2a6c726.tar.gz
remove unused db.c/db.h
Signed-off-by: Stewart Smith <stewart@linux.vnet.ibm.com>
-rw-r--r--clib/Rules.mk3
-rw-r--r--clib/db.h449
-rw-r--r--clib/src/db.c407
3 files changed, 0 insertions, 859 deletions
diff --git a/clib/Rules.mk b/clib/Rules.mk
index 4f9516f..fc3c7f8 100644
--- a/clib/Rules.mk
+++ b/clib/Rules.mk
@@ -50,9 +50,6 @@ libclib.so: $(OBJS)
libclib.a: $(OBJS)
$(AR) -r $@ $^
-db.o: db.c db.h
- $(CC) $(CFLAGS) -DSQLITE3 -c $^
-
crc32: crc32.c crc32_main.c
$(CC) $(CFLAGS) -o $@ $^
diff --git a/clib/db.h b/clib/db.h
deleted file mode 100644
index 184fb99..0000000
--- a/clib/db.h
+++ /dev/null
@@ -1,449 +0,0 @@
-/* IBM_PROLOG_BEGIN_TAG */
-/* This is an automatically generated prolog. */
-/* */
-/* $Source: clib/db.h $ */
-/* */
-/* OpenPOWER FFS Project */
-/* */
-/* Contributors Listed Below - COPYRIGHT 2014,2015 */
-/* [+] International Business Machines Corp. */
-/* */
-/* */
-/* Licensed under the Apache License, Version 2.0 (the "License"); */
-/* you may not use this file except in compliance with the License. */
-/* You may obtain a copy of the License at */
-/* */
-/* http://www.apache.org/licenses/LICENSE-2.0 */
-/* */
-/* Unless required by applicable law or agreed to in writing, software */
-/* distributed under the License is distributed on an "AS IS" BASIS, */
-/* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or */
-/* implied. See the License for the specific language governing */
-/* permissions and limitations under the License. */
-/* */
-/* IBM_PROLOG_END_TAG */
-
-/*!
- * @file db.h
- * @brief Database client
- * @details Embedded database API wrapper
- * @author Shaun Wetzstein <shaun@us.ibm.com>
- * @date 2010-2011
- */
-
-#ifndef __DB_H__
-#define __DB_H__
-
-#include <stdbool.h>
-#include <stdint.h>
-#include <sqlite3.h>
-
-#include "exception.h"
-
-/* ======================================================================= */
-
-#define DB_ROW SQLITE_ROW //!< Statement contains another row @hideinitializer
-#define DB_DONE SQLITE_DONE //!< Statement contains no more rows @hideinitializer
-#define DB_OK SQLITE_OK //!< Database command ok @hideinitializer
-
-#define DB 4 //!< Database exception class
-#define SQL 5 //!< Statement exception class
-
-typedef struct db db_t; //!< Alias for the @em db class
-typedef struct statement statement_t; //!< Alias for the @em statement class
-
-/*!
- * @brief Database access class
- */
-struct db {
-#ifdef SQLITE3
- const char *path; //!< @private
- sqlite3 *db; //!< @private
-#endif
-};
-
-typedef enum transaction_type transaction_type_t; //!< Alias for the @em transaction_type enum
-
-/*!
- * @brief Transaction types
- */
-enum transaction_type {
- tt_ERROR = -1, //!< Invalid / unknown transaction
- tt_DEFERRED, //!< Defferred locking transaction
- tt_IMMEDIATE, //!< Immediate locking transaction
- tt_EXCLUSIVE, //!< Exclusive locking transaction
-};
-
-#ifdef SQLITE3
-typedef sqlite3_context db_context_t; //!< User-defined database context
-typedef sqlite3_value db_value_t; //!< User-defined value
-#else
-#error MUST define db_context_t and db_value_t
-#endif
-
-/*!
- * @brief User-defined function
- */
-typedef void (*db_f) (db_context_t *, int, db_value_t **);
-
-/*!
- * @brief Statement class
- */
-struct statement {
- db_t *db; //!< Database object
-#ifdef SQLITE3
- sqlite3_stmt *stmt; //!< @private
-#endif
-};
-
-/* ======================================================================= */
-
-#if 0
-extern db_t *db_new(const char *) __nonnull((1));
-#endif
-
-/*!
- * @brief Constructs a @em db object
- * @memberof db
- * @param self [in] db object @em self pointer
- * @param path [in] db file name
- * @return None
- * @throws UNEXPECTED if @em self pointer is NULL
- */
-extern int db_init(db_t * self, const char *path)
-/*! @cond */
-__nonnull((1, 2)) /*! @endcond */ ;
-
-/*!
- * @brief Destructs a @em db object
- * @memberof db
- * @param self [in] db object @em self pointer
- * @return None
- * @throws UNEXPECTED if @em self pointer is NULL
- */
-extern int db_delete(db_t * self)
-/*! @cond */
-__nonnull((1)) /*! @endcond */ ;
-
-/*!
- * @brief Execute a SQL txt statement
- * @memberof db
- * @param self [in] db object @em self pointer
- * @param fmt [in] printf-like format string
- * @param ... [in] printf-like arguments
- * @return None
- * @throws UNEXPECTED if @em self pointer is NULL
- */
-extern int db_execute(db_t * self, const char *fmt, ...)
-/*! @cond */
-__nonnull((1, 2)) /*! @endcond */ ;
-
-/*!
- * @brief Open a @em db object
- * @memberof db
- * @param self [in] db object @em self pointer
- * @param flags [in] Open flagsprintf-like format string
- * @return 0 on success, non-0 otherwise
- * @throws UNEXPECTED if @em self pointer is NULL
- */
-extern int db_open(db_t * self, int flags)
-/*! @cond */
-__nonnull((1)) /*! @endcond */ ;
-
-/*!
- * @brief Close a @em db object
- * @memberof db
- * @param self [in] db object @em self pointer
- * @return 0 on success, non-0 otherwise
- * @throws UNEXPECTED if @em self pointer is NULL
- */
-extern int db_close(db_t * self)
-/*! @cond */
-__nonnull((1)) /*! @endcond */ ;
-
-/*!
- * @brief Register a user-defined function on a @em db object
- * @memberof db
- * @param self [in] db object @em self pointer
- * @param name [in] db function name
- * @param argc [in] Function argument count
- * @param func [in] User-defined function
- * @param data [in] User-defined data passed to @em finc
- * @return 0 on siccess, non-0 otherwise
- * @throws UNEXPECTED if @em self pointer is NULL
- */
-extern int db_register_function(db_t * self, const char *name, int argc,
- db_f func, void *data)
-/*! @cond */
-__nonnull((1, 2)) /*! @endcond */ ;
-
-/*!
- * @brief Start a database transaction
- * @memberof db
- * @param self [in] db object @em self pointer
- * @param type [in] Transaction type
- * @return None
- * @throws UNEXPECTED if @em self pointer is NULL
- */
-extern int db_begin(db_t * self, transaction_type_t type)
-/*! @cond */
-__nonnull((1)) /*! @endcond */ ;
-
-/*!
- * @brief Commit a database transaction
- * @memberof db
- * @param self [in] db object @em self pointer
- * @return None
- * @throws UNEXPECTED if @em self pointer is NULL
- */
-extern int db_commit(db_t * self)
-/*! @cond */
-__nonnull((1)) /*! @endcond */ ;
-
-/*!
- * @brief Rollback a database transaction
- * @memberof db
- * @param self [in] db object @em self pointer
- * @return None
- * @throws UNEXPECTED if @em self pointer is NULL
- */
-extern int db_rollback(db_t * self)
-/*! @cond */
-__nonnull((1)) /*! @endcond */ ;
-
-/* ======================================================================= */
-
-#if 0
-extern statement_t *statement_new(db_t *) __nonnull((1));
-#endif
-
-/*!
- * @brief Constructs a @em statement object
- * @memberof statement
- * @param self [in] statement object @em self pointer
- * @param db [in] Pointer to owning database object
- * @return None
- * @throws UNEXPECTED if @em self pointer is NULL
- */
-extern int statement_init(statement_t * self, db_t * db)
-/*! @cond */
-__nonnull((1, 2)) /*! @endcond */ ;
-
-/*!
- * @brief Destructs a @em statement object
- * @memberof statement
- * @param self [in] statement object @em self pointer
- * @return None
- * @throws UNEXPECTED if @em self pointer is NULL
- */
-extern int statement_delete(statement_t * self)
-/*! @cond */
-__nonnull((1)) /*! @endcond */ ;
-
-/*!
- * @brief Prepare a @em statement object for execution
- * @memberof statement
- * @param self [in] statement object @em self pointer
- * @return DB_ROW when a row is available, DB_DONE when no more rows left
- * @throws UNEXPECTED if @em self pointer is NULL
- */
-extern int statement_prepare(statement_t * self, const char *sql)
-/*! @cond */
-__nonnull((1, 2)) /*! @endcond */ ;
-
-/*!
- * @brief Execute the next step of @em statement object
- * @memberof statement
- * @param self [in] statement object @em self pointer
- * @return DB_OK on success, non-0 otherwise
- * @throws UNEXPECTED if @em self pointer is NULL
- */
-extern int statement_step(statement_t * self)
-/*! @cond */
-__nonnull((1)) /*! @endcond */ ;
-
-/*!
- * @brief Reset a @em statement object
- * @memberof statement
- * @param self [in] statement object @em self pointer
- * @return DB_OK on success, non-0 otherwise
- * @throws UNEXPECTED if @em self pointer is NULL
- */
-extern int statement_reset(statement_t * self)
-/*! @cond */
-__nonnull((1)) /*! @endcond */ ;
-
-/*!
- * @brief Finalize a @em statement object
- * @memberof statement
- * @param self [in] statement object @em self pointer
- * @return DB_OK on success, non-0 otherwise
- * @throws UNEXPECTED if @em self pointer is NULL
- */
-extern int statement_finalize(statement_t * self)
-/*! @cond */
-__nonnull((1)) /*! @endcond */ ;
-
-/*!
- * @brief Binds an integer to a bound variable of a @em statement object
- * @memberof statement
- * @param self [in] statement object @em self pointer
- * @param pos [in] Bound varialble position number
- * @param val [in] Integer value
- * @return DB_OK on success, non-0 otherwise
- * @throws UNEXPECTED if @em self pointer is NULL
- */
-extern int statement_bind_int(statement_t * self, int pos, int val)
-/*! @cond */
-__nonnull((1)) /*! @endcond */ ;
-
-/*!
- * @brief Binds a long long integer to a bound variable of a @em statement object
- * @memberof statement
- * @param self [in] statement object @em self pointer
- * @param pos [in] Bound varialble position number
- * @param val [in] Long Long Integer value
- * @return DB_OK on success, non-0 otherwise
- * @throws UNEXPECTED if @em self pointer is NULL
- */
-extern int statement_bind_int64(statement_t * self, int pos, int64_t val)
-/*! @cond */
-__nonnull((1)) /*! @endcond */ ;
-
-/*!
- * @brief Binds a text string to a bound variable of a @em statement object
- * @memberof statement
- * @param self [in] statement object @em self pointer
- * @param pos [in] Bound varialble position number
- * @param val [in] Text string value
- * @return DB_OK on success, non-0 otherwise
- * @throws UNEXPECTED if @em self pointer is NULL
- */
-extern int statement_bind_text(statement_t * self, int pos, const char *val)
-/*! @cond */
-__nonnull((1, 3)) /*! @endcond */ ;
-
-/*!
- * @brief Binds a blob to a bound variable of a @em statement object
- * @memberof statement
- * @param self [in] statement object @em self pointer
- * @param pos [in] Bound varialble position number
- * @param val [in] Blob value
- * @param len [in] Lengh of blob value (in bytes)
- * @return DB_OK on success, non-0 otherwise
- * @throws UNEXPECTED if @em self pointer is NULL
- */
-extern int statement_bind_blob(statement_t * self, int pos, const void *val,
- int len)
-/*! @cond */
-__nonnull((1, 3)) /*! @endcond */ ;
-
-/*!
- * @brief Return an integer from the result set of a @em statement object
- * @memberof statement
- * @param self [in] statement object @em self pointer
- * @param pos [in] Column position number
- * @return DB_OK on success, non-0 otherwise
- * @throws UNEXPECTED if @em self pointer is NULL
- */
-extern int statement_column_int(statement_t * self, int pos)
-/*! @cond */
-__nonnull((1)) /*! @endcond */ ;
-
-/*!
- * @brief Return an long long integer from the result set of a @em statement object
- * @memberof statement
- * @param self [in] statement object @em self pointer
- * @param pos [in] Column position number
- * @return DB_OK on success, non-0 otherwise
- * @throws UNEXPECTED if @em self pointer is NULL
- */
-extern int64_t statement_column_int64(statement_t * self, int pos)
-/*! @cond */
-__nonnull((1)) /*! @endcond */ ;
-
-/*!
- * @brief Return the length of a column from the result set of a @em statement object
- * @memberof statement
- * @param self [in] statement object @em self pointer
- * @param pos [in] Column position number
- * @return DB_OK on success, non-0 otherwise
- * @throws UNEXPECTED if @em self pointer is NULL
- */
-extern int statement_column_bytes(statement_t * self, int pos)
-/*! @cond */
-__nonnull((1)) /*! @endcond */ ;
-
-/*!
- * @brief Return a text string from the result set of a @em statement object
- * @memberof statement
- * @param self [in] statement object @em self pointer
- * @param pos [in] Column position number
- * @return DB_OK on success, non-0 otherwise
- * @throws UNEXPECTED if @em self pointer is NULL
- */
-extern const unsigned char *statement_column_text(statement_t * self, int pos)
-/*! @cond */
-__nonnull((1)) /*! @endcond */ ;
-
-/*!
- * @brief Return a blob from the result set of a @em statement object
- * @memberof statement
- * @param self [in] statement object @em self pointer
- * @param pos [in] Column position number
- * @return DB_OK on success, non-0 otherwise
- * @throws UNEXPECTED if @em self pointer is NULL
- */
-extern const void *statement_column_blob(statement_t * self, int pos)
-/*! @cond */
-__nonnull((1)) /*! @endcond */ ;
-
-#ifdef SQLITE3
-#define DBERR(d) ({ \
- err_t * _e = (err_t *)malloc(sizeof(*_e) + ERR_DATA_SIZE); \
- memset(_e, 0, sizeof(*_e) + ERR_DATA_SIZE); \
- _e->size = snprintf(_e->data, ERR_DATA_SIZE, "%s (code=%d)", \
- sqlite3_errmsg(d), sqlite3_errcode(d)); \
- _e->magic = ERR_MAGIC, _e->type = DB, _e->code = sqlite3_errcode(d); \
- _e->file = __FILE__, _e->line = __LINE__; \
- err_put(_e); \
- })
-
-#define SQLERR(d,s) ({ \
- err_t * _e = (err_t *)malloc(sizeof(*_e) + ERR_DATA_SIZE); \
- memset(_e, 0, sizeof(*_e) + ERR_DATA_SIZE); \
- _e->size = snprintf(_e->data, ERR_DATA_SIZE, "'%s' => %s (code=%d)", \
- sqlite3_sql(s), sqlite3_errmsg(d), \
- sqlite3_errcode(d)); \
- _e->magic = ERR_MAGIC, _e->type = SQL, _e->code = sqlite3_errcode(d); \
- _e->file = __FILE__, _e->line = __LINE__; \
- err_put(_e); \
- })
-#if 0
-#define throw_db(x) ({ \
- char __e[strlen(sqlite3_errmsg((x))) + 32]; \
- __exc_throw(DB,((void*)__e), \
- sprintf(__e, "(%d) %s", \
- sqlite3_errcode((x)), \
- sqlite3_errmsg((x))), \
- __FILE__, __LINE__); \
- })
-
-#define throw_statement(x,s) ({ \
- char __e[strlen(sqlite3_errmsg((x))) + \
- strlen(sqlite3_sql((s))) + 32]; \
- __exc_throw(STATEMENT,((void*)__e), \
- sprintf(__e, "(%d) %s\n%s", \
- sqlite3_errcode((x)), \
- sqlite3_errmsg((x)), \
- sqlite3_sql((s))), \
- __FILE__, __LINE__); \
- })
-#endif
-#else
-#error FIX ME
-#endif
-
-/* ======================================================================= */
-
-#endif /* __DB_H__ */
diff --git a/clib/src/db.c b/clib/src/db.c
deleted file mode 100644
index 0f3c930..0000000
--- a/clib/src/db.c
+++ /dev/null
@@ -1,407 +0,0 @@
-/* IBM_PROLOG_BEGIN_TAG */
-/* This is an automatically generated prolog. */
-/* */
-/* $Source: clib/src/db.c $ */
-/* */
-/* OpenPOWER FFS Project */
-/* */
-/* Contributors Listed Below - COPYRIGHT 2014,2015 */
-/* [+] International Business Machines Corp. */
-/* */
-/* */
-/* Licensed under the Apache License, Version 2.0 (the "License"); */
-/* you may not use this file except in compliance with the License. */
-/* You may obtain a copy of the License at */
-/* */
-/* http://www.apache.org/licenses/LICENSE-2.0 */
-/* */
-/* Unless required by applicable law or agreed to in writing, software */
-/* distributed under the License is distributed on an "AS IS" BASIS, */
-/* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or */
-/* implied. See the License for the specific language governing */
-/* permissions and limitations under the License. */
-/* */
-/* IBM_PROLOG_END_TAG */
-
-/*
- * File: db.c
- * Author: Shaun Wetzstein <shaun@us.ibm.com>
- * Descr: SQlite wrapper
- * Note:
- * Date: 02/25/11
- */
-
-#include <stdio.h>
-#include <unistd.h>
-#include <stdarg.h>
-#include <stdlib.h>
-#include <malloc.h>
-#include <sqlite3.h>
-#include <stdint.h>
-#include <string.h>
-#include <errno.h>
-#include <limits.h>
-
-#include "assert.h"
-#include "err.h"
-
-#include "db.h"
-
-/* =======================================================================*/
-
-int db_init(db_t * self, const char *path)
-{
- assert(self != NULL);
-
- self->path = strdup(path);
- if (self->path == NULL) {
- ERRNO(errno);
- return -1;
- }
-
- self->db = NULL;
-
- return 0;
-}
-
-int db_delete(db_t * self)
-{
- if (self != NULL) {
- db_close(self);
- if (self->path != NULL)
- free((char *)self->path);
- memset(self, 0, sizeof(*self));
- }
-
- return 0;
-}
-
-int db_execute(db_t * self, const char *fmt, ...)
-{
- assert(self != NULL);
-
- va_list ap;
- va_start(ap, fmt);
- char *sql = NULL;
- vasprintf(&sql, fmt, ap);
-
- assert(sql != NULL);
-
- int rc = sqlite3_exec(self->db, sql, NULL, NULL, NULL);
- if (sql != NULL)
- free(sql);
-
- if (rc != DB_OK) {
- DBERR(self->db);
- return -1;
- }
-
- return 0;
-}
-
-int db_open(db_t * self, int flags)
-{
- assert(self != NULL);
-
- int rc = DB_OK;
-
- if (self->db != NULL)
- db_close(self);
-
- rc = sqlite3_open_v2(self->path, &self->db, flags, NULL);
- if (rc != DB_OK) {
- DBERR(self->db);
- return -1;
- }
-
- return rc;
-}
-
-int db_close(db_t * self)
-{
- assert(self != NULL);
-
- int rc = DB_OK;
-
- if (self->db != NULL) {
- /* finalize statements */
- rc = sqlite3_close(self->db);
- }
-
- return rc;
-}
-
-int db_register_function(db_t * self, const char *name, int argc, db_f func,
- void *data)
-{
- assert(self != NULL);
-
- int rc = DB_OK;
-
- rc = sqlite3_create_function(self->db, name, argc, SQLITE_ANY, data,
- func, NULL, NULL);
- if (rc != 0) {
- DBERR(self->db);
- return -1;
- }
-
- return rc;
-}
-
-int db_begin(db_t * self, transaction_type_t type)
-{
- assert(self != NULL);
-
- const char *tran_type = NULL;
-
- switch (type) {
- case tt_DEFERRED:
- tran_type = "DEFERRED";
- break;
- case tt_IMMEDIATE:
- tran_type = "IMMEDIATE";
- break;
- case tt_EXCLUSIVE:
- tran_type = "EXCLUSIVE";
- break;
- default:
- UNEXPECTED("'%d' invalid transaction type", type);
- return -1;
- }
-
- return db_execute(self, "BEGIN %s TRANSACTION", tran_type);
-}
-
-int db_commit(db_t * self)
-{
- assert(self != NULL);
- return db_execute(self, "COMMIT TRANSACTION");
-}
-
-int db_rollback(db_t * self)
-{
- assert(self != NULL);
- return db_execute(self, "ROLLBACK TRANSACTION");
-}
-
-/* =======================================================================*/
-
-int statement_init(statement_t * self, db_t * db)
-{
- assert(self != NULL);
- assert(db != NULL);
-
- self->db = db;
- self->stmt = NULL;
-
- return 0;
-}
-
-int statement_delete(statement_t * self)
-{
- assert(self != NULL);
-
- if (self->stmt != NULL) {
- statement_finalize(self);
- self->stmt = NULL;
- }
-
- self->db = NULL;
- free(self);
-
- return 0;
-}
-
-int statement_prepare(statement_t * self, const char *sql)
-{
- assert(self != NULL);
- assert(sql != NULL);
-
- int rc = DB_OK;
-
- if (self->stmt != NULL) {
- rc = sqlite3_finalize(self->stmt);
- if (rc != DB_OK) {
- SQLERR(self->db->db, self->stmt);
- return -1;
- }
- }
-
- rc = sqlite3_prepare_v2(self->db->db, sql, -1, &self->stmt, NULL);
- if (rc != DB_OK) {
- SQLERR(self->db->db, self->stmt);
- return -1;
- }
-
- return rc;
-}
-
-int statement_step(statement_t * self)
-{
- assert(self != NULL);
-
- int rc = DB_OK;
-
- if (self->stmt != NULL) {
- rc = sqlite3_step(self->stmt);
-
- switch (rc) {
- case DB_DONE:
- case DB_ROW:
- break;
- default:
- SQLERR(self->db->db, self->stmt);
- return -1;
- }
- }
-
- return rc;
-}
-
-int statement_reset(statement_t * self)
-{
- self = NULL;
- return 0;
-}
-
-int statement_finalize(statement_t * self)
-{
- assert(self != NULL);
-
- int rc = DB_OK;
-
- if (self->stmt != NULL) {
- rc = sqlite3_finalize(self->stmt);
- if (rc != DB_OK) {
- SQLERR(self->db->db, self->stmt);
- return -1;
- }
- self->stmt = NULL;
- }
-
- return rc;
-}
-
-int statement_bind_int(statement_t * self, int pos, int val)
-{
- assert(self != NULL);
-
- int rc = DB_OK;
-
- if (self->stmt != NULL) {
- rc = sqlite3_bind_int(self->stmt, pos, val);
- if (rc != DB_OK) {
- SQLERR(self->db->db, self->stmt);
- return -1;
- }
- }
-
- return rc;
-}
-
-int statement_bind_int64(statement_t * self, int pos, int64_t val)
-{
- assert(self != NULL);
-
- int rc = DB_OK;
-
- if (self->stmt != NULL) {
- rc = sqlite3_bind_int64(self->stmt, pos, val);
- if (rc != DB_OK) {
- SQLERR(self->db->db, self->stmt);
- return -1;
- }
- }
-
- return rc;
-}
-
-int statement_bind_text(statement_t * self, int pos, const char *val)
-{
- assert(self != NULL);
-
- int rc = DB_OK;
-
- if (self->stmt != NULL) {
- rc = sqlite3_bind_text(self->stmt, pos, val, -1,
- SQLITE_TRANSIENT);
- if (rc != DB_OK) {
- SQLERR(self->db->db, self->stmt);
- return -1;
- }
- }
-
- return rc;
-}
-
-int statement_bind_blob(statement_t * self, int pos, const void *val, int size)
-{
- assert(self != NULL);
-
- int rc = DB_OK;
-
- if (self->stmt != NULL) {
- rc = sqlite3_bind_blob(self->stmt, pos, val, size,
- SQLITE_TRANSIENT);
- if (rc != DB_OK) {
- SQLERR(self->db->db, self->stmt);
- return -1;
- }
- }
-
- return rc;
-}
-
-int statement_column_int(statement_t * self, int pos)
-{
- assert(self != NULL);
- return sqlite3_column_int(self->stmt, pos);
-}
-
-int64_t statement_column_int64(statement_t * self, int pos)
-{
- assert(self != NULL);
- return sqlite3_column_int64(self->stmt, pos);
-}
-
-int statement_column_bytes(statement_t * self, int pos)
-{
- assert(self != NULL);
- return sqlite3_column_bytes(self->stmt, pos);
-}
-
-const unsigned char *statement_column_text(statement_t * self, int pos)
-{
- assert(self != NULL);
-
- const unsigned char *rc = NULL;
-
- if (self->stmt != NULL) {
- rc = sqlite3_column_text(self->stmt, pos);
- if (rc == NULL) {
- SQLERR(self->db->db, self->stmt);
- return NULL;
- }
- }
-
- return rc;
-}
-
-const void *statement_column_blob(statement_t * self, int pos)
-{
- assert(self != NULL);
-
- const void *rc = NULL;
-
- if (self->stmt != NULL) {
- rc = sqlite3_column_blob(self->stmt, pos);
- if (rc == NULL) {
- SQLERR(self->db->db, self->stmt);
- return NULL;
- }
- }
-
- return rc;
-}
-
-/* =======================================================================*/
OpenPOWER on IntegriCloud