MPD  0.20.18
Functions
Util.hxx File Reference
#include "Error.hxx"
#include <sqlite3.h>
#include <assert.h>
Include dependency graph for Util.hxx:

Go to the source code of this file.

Functions

static void Bind (sqlite3_stmt *stmt, unsigned i, const char *value)
 Throws SqliteError on error. More...
 
template<typename... Args>
static void BindAll2 (gcc_unused sqlite3_stmt *stmt, gcc_unused unsigned i)
 
template<typename... Args>
static void BindAll2 (sqlite3_stmt *stmt, unsigned i, const char *value, Args &&... args)
 
template<typename... Args>
static void BindAll (sqlite3_stmt *stmt, Args &&... args)
 Throws SqliteError on error. More...
 
static int ExecuteBusy (sqlite3_stmt *stmt)
 Call sqlite3_stmt() repepatedly until something other than SQLITE_BUSY is returned. More...
 
static bool ExecuteRow (sqlite3_stmt *stmt)
 Wrapper for ExecuteBusy() that returns true on SQLITE_ROW. More...
 
static void ExecuteCommand (sqlite3_stmt *stmt)
 Wrapper for ExecuteBusy() that interprets everything other than SQLITE_DONE as error. More...
 
static unsigned ExecuteChanges (sqlite3_stmt *stmt)
 Wrapper for ExecuteCommand() that returns the number of rows modified via sqlite3_changes(). More...
 
static bool ExecuteModified (sqlite3_stmt *stmt)
 Wrapper for ExecuteChanges() that returns true if at least one row was modified. More...
 
template<typename F >
static void ExecuteForEach (sqlite3_stmt *stmt, F &&f)
 

Function Documentation

◆ Bind()

static void Bind ( sqlite3_stmt *  stmt,
unsigned  i,
const char *  value 
)
static

Throws SqliteError on error.

Definition at line 33 of file Util.hxx.

◆ BindAll()

template<typename... Args>
static void BindAll ( sqlite3_stmt *  stmt,
Args &&...  args 
)
static

Throws SqliteError on error.

Definition at line 61 of file Util.hxx.

◆ BindAll2() [1/2]

template<typename... Args>
static void BindAll2 ( gcc_unused sqlite3_stmt *  stmt,
gcc_unused unsigned  i 
)
static

Definition at line 42 of file Util.hxx.

◆ BindAll2() [2/2]

template<typename... Args>
static void BindAll2 ( sqlite3_stmt *  stmt,
unsigned  i,
const char *  value,
Args &&...  args 
)
static

Definition at line 49 of file Util.hxx.

◆ ExecuteBusy()

static int ExecuteBusy ( sqlite3_stmt *  stmt)
static

Call sqlite3_stmt() repepatedly until something other than SQLITE_BUSY is returned.

Definition at line 73 of file Util.hxx.

◆ ExecuteChanges()

static unsigned ExecuteChanges ( sqlite3_stmt *  stmt)
inlinestatic

Wrapper for ExecuteCommand() that returns the number of rows modified via sqlite3_changes().

Throws SqliteError on error.

Definition at line 122 of file Util.hxx.

◆ ExecuteCommand()

static void ExecuteCommand ( sqlite3_stmt *  stmt)
static

Wrapper for ExecuteBusy() that interprets everything other than SQLITE_DONE as error.

Throws SqliteError on error.

Definition at line 108 of file Util.hxx.

◆ ExecuteForEach()

template<typename F >
static void ExecuteForEach ( sqlite3_stmt *  stmt,
F &&  f 
)
inlinestatic

Definition at line 143 of file Util.hxx.

◆ ExecuteModified()

static bool ExecuteModified ( sqlite3_stmt *  stmt)
inlinestatic

Wrapper for ExecuteChanges() that returns true if at least one row was modified.

Returns false if nothing was modified.

Throws SqliteError on error.

Definition at line 136 of file Util.hxx.

◆ ExecuteRow()

static bool ExecuteRow ( sqlite3_stmt *  stmt)
static

Wrapper for ExecuteBusy() that returns true on SQLITE_ROW.

Throws SqliteError on error.

Definition at line 89 of file Util.hxx.