OpenMS  2.5.0
Functions
OpenMS::Internal::SqliteHelper Namespace Reference

Functions

template<typename ValueType >
bool extractValue (ValueType *, sqlite3_stmt *, int)
 Extracts a specific value from an SQL column. More...
 
template<>
bool extractValue< double > (double *dst, sqlite3_stmt *stmt, int pos)
 
template<>
bool extractValue< int > (int *dst, sqlite3_stmt *stmt, int pos)
 
template<>
bool extractValue< String > (String *dst, sqlite3_stmt *stmt, int pos)
 
template<>
bool extractValue< std::string > (std::string *dst, sqlite3_stmt *stmt, int pos)
 
bool extractValueIntStr (String *dst, sqlite3_stmt *stmt, int pos)
 Special case where an integer should be stored in a String field. More...
 

Function Documentation

◆ extractValue()

bool OpenMS::Internal::SqliteHelper::extractValue ( ValueType *  ,
sqlite3_stmt *  ,
int   
)

Extracts a specific value from an SQL column.

dst Destination (where to store the value) stmt Sqlite statement object pos Column position

For example, to extract a specific integer from column 5 of an SQL statement, one can use:

sqlite3_stmt* stmt; sqlite3* db; SqliteConnector::prepareStatement(db, &stmt, select_sql); sqlite3_step(stmt);

double target; while (sqlite3_column_type(stmt, 0) != SQLITE_NULL) { extractValue<double>(&target, stmt, 5); sqlite3_step( stmt ); } sqlite3_finalize(stmt);

◆ extractValue< double >()

bool OpenMS::Internal::SqliteHelper::extractValue< double > ( double dst,
sqlite3_stmt *  stmt,
int  pos 
)

◆ extractValue< int >()

bool OpenMS::Internal::SqliteHelper::extractValue< int > ( int dst,
sqlite3_stmt *  stmt,
int  pos 
)

◆ extractValue< std::string >()

bool OpenMS::Internal::SqliteHelper::extractValue< std::string > ( std::string *  dst,
sqlite3_stmt *  stmt,
int  pos 
)

◆ extractValue< String >()

bool OpenMS::Internal::SqliteHelper::extractValue< String > ( String dst,
sqlite3_stmt *  stmt,
int  pos 
)

◆ extractValueIntStr()

bool OpenMS::Internal::SqliteHelper::extractValueIntStr ( String dst,
sqlite3_stmt *  stmt,
int  pos 
)

Special case where an integer should be stored in a String field.