Exemple #1
0
/**
 * Binds values to the prepared statement
 * @param db is the concerned database where to save meta data
 * @param stmt is the prepared statement where we want to bind values
 * @param url is the url corresponding to the request to be saved
 * @param buffer is the buffer to be saved
 */
static void bind_values_to_save_buffer(sqlite3 *db, sqlite3_stmt *stmt, gchar *url, gchar *buffer)
{
    if (stmt != NULL && db != NULL)
        {
            bind_text_value(db, stmt, ":url", url);
            bind_text_value(db, stmt, ":data", buffer);
        }
}
Exemple #2
0
/**
 * Binds values to the prepared statement
 * @param db is the concerned database where to save meta data
 * @param stmt is the prepared statement where we want to bind values
 * @param meta is the meta_data_t structure containing all meta data
 *        for one file. We want to bind those values into the prepared
 *        statement
 * @param only_meta : a gboolean that when set to TRUE only meta_data will
 *        be saved and hashs data will not ! FALSE means that something
 *        went wrong with server and that all data will be cached localy.
 * @param cache_time is the time (calculatde from epoch) when the cache
 *        has been created.
 */
static void bind_values_to_save_meta_data(sqlite3 *db, sqlite3_stmt *stmt, meta_data_t *meta, gboolean only_meta, guint64 cache_time)
{
    bind_guint64_value(db, stmt, ":cache_time", cache_time);
    bind_guint_value(db, stmt, ":type", meta->file_type);
    bind_guint64_value(db, stmt, ":inode", meta->inode);
    bind_text_value(db, stmt, ":file_user", meta->owner);
    bind_text_value(db, stmt, ":file_group", meta->group);
    bind_guint_value(db, stmt, ":uid", meta->uid);
    bind_guint_value(db, stmt, ":gid", meta->gid);
    bind_guint64_value(db, stmt, ":atime", meta->atime);
    bind_guint64_value(db, stmt, ":ctime", meta->ctime);
    bind_guint64_value(db, stmt, ":mtime", meta->mtime);
    bind_guint_value(db, stmt, ":mode", meta->mode);
    bind_guint64_value(db, stmt, ":size", meta->size);
    bind_text_value(db, stmt, ":name", meta->name);
    bind_guint_value(db, stmt, ":transmited", (guint) only_meta);
    bind_text_value(db, stmt, ":link", meta->link);
}
Exemple #3
0
/**
 * Binds values to the prepared statement
 * @param db is the concerned database where to save meta data
 * @param stmt is the prepared statement where we want to bind values
 * @param meta is the meta_data_t structure containing all meta data
 *        for one file. We want to bind some of those values into the
 *        prepared statement
 */
static void bind_values_to_get_file_id(sqlite3 *db, sqlite3_stmt *stmt, meta_data_t *meta)
{
    bind_guint64_value(db, stmt, ":inode", meta->inode);
    bind_text_value(db, stmt, ":name", meta->name);
    bind_guint_value(db, stmt, ":file_type", meta->file_type);
    bind_guint_value(db, stmt, ":uid", meta->uid);
    bind_guint_value(db, stmt, ":gid", meta->gid);
    bind_guint64_value(db, stmt, ":ctime", meta->ctime);
    bind_guint64_value(db, stmt, ":mtime", meta->mtime);
    bind_guint_value(db, stmt, ":mode", meta->mode);
    bind_guint64_value(db, stmt, ":size", meta->size);
}