22 #ifndef DBALLE_DB_INTERNALS_H
23 #define DBALLE_DB_INTERNALS_H
25 #include <wreport/error.h>
39 #define TRACE(...) fprintf(stderr, __VA_ARGS__)
40 #define IFTRACE if (1)
43 #define TRACE(...) do { } while (0)
45 #define IFTRACE if (0)
85 const std::string& get_url()
const {
return url; }
93 virtual std::unique_ptr<Transaction>
transaction() = 0;
96 virtual bool has_table(
const std::string& name) = 0;
103 virtual std::string
get_setting(
const std::string& key) = 0;
110 virtual void set_setting(
const std::string& key,
const std::string& value) = 0;
122 static std::unique_ptr<Connection>
create_from_url(
const std::string& url);
140 virtual void commit() = 0;
147 virtual void lock_table(
const char* name) = 0;
virtual void commit()=0
Commit this transaction.
virtual void rollback()=0
Roll back this transaction.
Copyright (C) 2008–2010 ARPA-SIM urpsim@smr.arpa.emr.it
Definition: cmdline.h:17
String buffer for composing database queries.
Definition: querybuf.h:37
virtual std::string get_setting(const std::string &key)=0
Get a value from the settings table.
virtual void drop_settings()=0
Drop the settings table.
virtual bool has_table(const std::string &name)=0
Check if the database contains a table.
ServerType server_type
Type of SQL server we are connected to.
Definition: sql.h:81
A RAII transaction interface.
Definition: sql.h:134
virtual void set_setting(const std::string &key, const std::string &value)=0
Set a value in the settings table.
virtual void add_datetime(Querybuf &qb, const Datetime &dt) const
Format a datetime and add it to the querybuf.
static std::unique_ptr< Connection > create_from_url(const char *url)
Create a new connection from a URL.
Date and time.
Definition: types.h:147
virtual void lock_table(const char *name)=0
Get an exclusive lock on the given table until the end of the transaction.
virtual std::unique_ptr< Transaction > transaction()=0
Begin a transaction.