#include <WriteStreamSQLite.h>
|
void | writeNextTuple (const RamDomain *tuple) override |
|
void | writeNullary () override |
|
void | outputADT (std::ostream &destination, const RamDomain value, const std::string &name) |
|
void | outputRecord (std::ostream &destination, const RamDomain value, const std::string &name) |
|
template<typename Tuple > |
void | writeNext (const Tuple tuple) |
|
virtual void | writeSize (std::size_t) |
|
| SerialisationStream (RO< SymbolTable > &symTab, RO< RecordTable > &recTab, const std::map< std::string, std::string > &rwOperation) |
|
| SerialisationStream (RO< SymbolTable > &symTab, RO< RecordTable > &recTab, Json types) |
|
| SerialisationStream (RO< SymbolTable > &symTab, RO< RecordTable > &recTab, Json types, std::vector< std::string > relTypes, size_t auxArity=0) |
|
|
static std::string | getFileName (const std::map< std::string, std::string > &rwOperation) |
| Return given filename or construct from relation name. More...
|
|
Definition at line 40 of file WriteStreamSQLite.h.
◆ WriteStreamSQLite()
souffle::WriteStreamSQLite::WriteStreamSQLite |
( |
const std::map< std::string, std::string > & |
rwOperation, |
|
|
const SymbolTable & |
symbolTable, |
|
|
const RecordTable & |
recordTable |
|
) |
| |
|
inline |
◆ ~WriteStreamSQLite()
souffle::WriteStreamSQLite::~WriteStreamSQLite |
( |
| ) |
|
|
inlineoverride |
◆ createRelationTable()
void souffle::WriteStreamSQLite::createRelationTable |
( |
| ) |
|
|
inlineprivate |
Definition at line 200 of file WriteStreamSQLite.h.
202 createTableText <<
",'" << std::to_string(
i) <<
"' ";
203 createTableText <<
"INTEGER";
206 createTableText <<
");";
213 std::stringstream createViewText;
References i.
◆ createRelationView()
void souffle::WriteStreamSQLite::createRelationView |
( |
| ) |
|
|
inlineprivate |
Definition at line 215 of file WriteStreamSQLite.h.
221 std::string columnName = std::to_string(
i);
223 projectionClause <<
",";
226 projectionClause <<
"'_symtab_" << columnName <<
"'.symbol AS '" << columnName <<
"'";
227 fromClause <<
",'" <<
symbolTableName <<
"' AS '_symtab_" << columnName <<
"'";
229 whereClause <<
" AND ";
233 whereClause <<
"'_" <<
relationName <<
"'.'" << columnName <<
"' = "
234 <<
"'_symtab_" << columnName <<
"'.id";
236 projectionClause <<
"'_" <<
relationName <<
"'.'" << columnName <<
"'";
239 createViewText <<
"SELECT " << projectionClause.str() <<
" FROM " << fromClause.str();
241 createViewText <<
" WHERE " << whereClause.str();
243 createViewText <<
";";
247 std::stringstream createTableText;
248 createTableText <<
"CREATE TABLE IF NOT EXISTS '" <<
symbolTableName <<
"' ";
249 createTableText <<
"(id INTEGER PRIMARY KEY, symbol TEXT UNIQUE);";
References i, relationName, symbolTableName, and souffle::SerialisationStream< true >::typeAttributes.
◆ createSymbolTable()
void souffle::WriteStreamSQLite::createSymbolTable |
( |
| ) |
|
|
inlineprivate |
◆ createTables()
void souffle::WriteStreamSQLite::createTables |
( |
| ) |
|
|
inlineprivate |
Definition at line 194 of file WriteStreamSQLite.h.
197 std::stringstream createTableText;
198 createTableText <<
"CREATE TABLE IF NOT EXISTS '_" <<
relationName <<
"' (";
◆ executeSQL()
void souffle::WriteStreamSQLite::executeSQL |
( |
const std::string & |
sql, |
|
|
sqlite3 * |
db |
|
) |
| |
|
inlineprivate |
Definition at line 87 of file WriteStreamSQLite.h.
90 std::stringstream error;
91 error <<
"SQLite error in sqlite3_exec: " << sqlite3_errmsg(
db) <<
"\n";
92 error <<
"SQL error: " << errorMessage <<
"\n";
93 error <<
"SQL: " << sql <<
"\n";
94 sqlite3_free(errorMessage);
95 throw std::invalid_argument(error.str());
100 std::stringstream error;
101 error << message << sqlite3_errmsg(
db) <<
"\n";
◆ getFileName()
static std::string souffle::WriteStreamSQLite::getFileName |
( |
const std::map< std::string, std::string > & |
rwOperation | ) |
|
|
inlinestaticprivate |
Return given filename or construct from relation name.
Default name is [configured path]/[relation name].sqlite
- Parameters
-
rwOperation | map of IO configuration options |
- Returns
- input filename
Definition at line 264 of file WriteStreamSQLite.h.
267 name =
getOr(rwOperation,
"output-dir",
".") +
"/" + name;
◆ getSymbolTableID()
uint64_t souffle::WriteStreamSQLite::getSymbolTableID |
( |
int |
index | ) |
|
|
inlineprivate |
◆ getSymbolTableIDFromDB()
uint64_t souffle::WriteStreamSQLite::getSymbolTableIDFromDB |
( |
int |
index | ) |
|
|
inlineprivate |
◆ openDB()
void souffle::WriteStreamSQLite::openDB |
( |
| ) |
|
|
inlineprivate |
◆ prepareInsertStatement()
void souffle::WriteStreamSQLite::prepareInsertStatement |
( |
| ) |
|
|
inlineprivate |
◆ prepareStatements()
void souffle::WriteStreamSQLite::prepareStatements |
( |
| ) |
|
|
inlineprivate |
Definition at line 155 of file WriteStreamSQLite.h.
157 std::stringstream insertSQL;
159 insertSQL <<
" VALUES(null,@V0);";
◆ prepareSymbolInsertStatement()
void souffle::WriteStreamSQLite::prepareSymbolInsertStatement |
( |
| ) |
|
|
inlineprivate |
◆ prepareSymbolSelectStatement()
void souffle::WriteStreamSQLite::prepareSymbolSelectStatement |
( |
| ) |
|
|
inlineprivate |
◆ throwError()
void souffle::WriteStreamSQLite::throwError |
( |
const std::string & |
message | ) |
|
|
inlineprivate |
◆ writeNextTuple()
void souffle::WriteStreamSQLite::writeNextTuple |
( |
const RamDomain * |
tuple | ) |
|
|
inlineoverrideprotectedvirtual |
◆ writeNullary()
void souffle::WriteStreamSQLite::writeNullary |
( |
| ) |
|
|
inlineoverrideprotectedvirtual |
◆ db
sqlite3* souffle::WriteStreamSQLite::db = nullptr |
|
private |
◆ dbFilename
const std::string souffle::WriteStreamSQLite::dbFilename |
|
private |
◆ dbSymbolTable
std::unordered_map<uint64_t, uint64_t> souffle::WriteStreamSQLite::dbSymbolTable |
|
private |
◆ insertStatement
sqlite3_stmt* souffle::WriteStreamSQLite::insertStatement = nullptr |
|
private |
◆ relationName
const std::string souffle::WriteStreamSQLite::relationName |
|
private |
◆ symbolInsertStatement
sqlite3_stmt* souffle::WriteStreamSQLite::symbolInsertStatement = nullptr |
|
private |
◆ symbolSelectStatement
sqlite3_stmt* souffle::WriteStreamSQLite::symbolSelectStatement = nullptr |
|
private |
◆ symbolTableName
const std::string souffle::WriteStreamSQLite::symbolTableName = "__SymbolTable" |
|
private |
The documentation for this class was generated from the following file:
C::mapped_type const & getOr(const C &container, typename C::key_type key, const typename C::mapped_type &defaultValue)
Get value for a given key; if not found, return default value.