Files
fluxengine/lib/sql.h
David Given fc2655ecd6 Rework the bytecode format to use a much simplified setup: a six-bit timer with
the top two bits reserved for pulse and index state. This is actually smaller,
bandwidth-wise, than the old version, and may be smaller than the crunched
version.
2020-03-14 18:58:43 +00:00

36 lines
1.2 KiB
C++

#ifndef SQL_H
#define SQL_H
#include <sqlite3.h>
class Fluxmap;
enum
{
FLUX_VERSION_0, /* without properties table */
FLUX_VERSION_1,
FLUX_VERSION_2, /* new bytecode with index marks */
FLUX_VERSION_3, /* simplified bytecode with six-bit timer */
FLUX_VERSION_CURRENT = FLUX_VERSION_3,
};
extern void sqlCheck(sqlite3* db, int i);
extern sqlite3* sqlOpen(const std::string filename, int flags);
extern void sqlClose(sqlite3* db);
extern void sqlStmt(sqlite3* db, const char* sql);
extern int sqlGetVersion(sqlite3* db);
extern void sqlPrepareFlux(sqlite3* db);
extern void sqlWriteFlux(sqlite3* db, int track, int side, const Fluxmap& fluxmap);
extern std::unique_ptr<Fluxmap> sqlReadFlux(sqlite3* db, int track, int side);
extern std::vector<std::pair<unsigned, unsigned>> sqlFindFlux(sqlite3* db);
extern void sqlWriteStringProperty(sqlite3* db, const std::string& name, const std::string& value);
extern std::string sqlReadStringProperty(sqlite3* db, const std::string& name);
extern void sqlWriteIntProperty(sqlite3* db, const std::string& name, long value);
extern long sqlReadIntProperty(sqlite3* db, const std::string& name);
#endif