OpenSWMM Engine  6.0.0-alpha.4
Data-oriented, plugin-extensible SWMM Engine (6.0.0-alpha.4)
Loading...
Searching...
No Matches
GpkgUtils.hpp File Reference

RAII wrappers and utilities for SQLite operations in GeoPackage I/O. More...

#include <sqlite3.h>
#include <string>
#include <stdexcept>
#include <memory>
#include <vector>
Include dependency graph for GpkgUtils.hpp:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Classes

class  openswmm::gpkg::GpkgError
 Runtime-error carrier for owned GeoPackage/SQLite diagnostic text. More...
 
struct  openswmm::gpkg::DbDeleter
 Unique-pointer deleter using SQLite deferred close semantics. More...
 
struct  openswmm::gpkg::StmtDeleter
 Unique-pointer deleter that finalizes prepared statements. More...
 
class  openswmm::gpkg::Transaction
 Noncopyable best-effort transaction guard borrowing one SQLite connection. More...
 

Namespaces

namespace  openswmm
 
namespace  openswmm::gpkg
 

Typedefs

using openswmm::gpkg::DbPtr = std::unique_ptr<sqlite3, DbDeleter>
 
using openswmm::gpkg::StmtPtr = std::unique_ptr<sqlite3_stmt, StmtDeleter>
 

Functions

DbPtr openswmm::gpkg::open_database (const std::string &path, int flags=SQLITE_OPEN_READWRITE|SQLITE_OPEN_CREATE)
 Open an owned connection and configure GeoPackage connection defaults.
 
StmtPtr openswmm::gpkg::prepare (sqlite3 *db, const std::string &sql)
 Prepare the first SQL statement without stepping it.
 
void openswmm::gpkg::exec (sqlite3 *db, const std::string &sql)
 Execute SQL text and discard all returned rows.
 
void openswmm::gpkg::bind_text (sqlite3_stmt *stmt, int col, const std::string &val)
 Bind a copied SQL text parameter, discarding SQLite status.
 
void openswmm::gpkg::bind_double (sqlite3_stmt *stmt, int col, double val)
 Bind a floating SQL parameter, discarding SQLite status.
 
void openswmm::gpkg::bind_int (sqlite3_stmt *stmt, int col, int val)
 Bind an int SQL parameter, discarding SQLite status.
 
void openswmm::gpkg::bind_null (sqlite3_stmt *stmt, int col)
 Bind SQL NULL, discarding SQLite status.
 
void openswmm::gpkg::bind_blob (sqlite3_stmt *stmt, int col, const void *data, int size)
 Bind copied binary bytes, discarding SQLite status.
 
std::string openswmm::gpkg::column_text (sqlite3_stmt *stmt, int col)
 Copy current-row text using NUL-terminated SQLite conversion.
 
double openswmm::gpkg::column_double (sqlite3_stmt *stmt, int col)
 Read current-row SQLite numeric conversion as double.
 
int openswmm::gpkg::column_int (sqlite3_stmt *stmt, int col)
 Read current-row SQLite numeric conversion as int.
 
bool openswmm::gpkg::column_is_null (sqlite3_stmt *stmt, int col)
 Test the current-row SQLite column type for NULL.
 
std::vector< uint8_t > openswmm::gpkg::column_blob (sqlite3_stmt *stmt, int col)
 Copy current-row blob bytes into owned storage.
 

Detailed Description

RAII wrappers and utilities for SQLite operations in GeoPackage I/O.

Author
Caleb Buahin caleb.nosp@m..bua.nosp@m.hin@g.nosp@m.mail.nosp@m..com
License
Apache-2.0