summaryrefslogtreecommitdiff
path: root/gentoobrowse-api/service/utils/dbUtils.h
blob: bce7f380fbe61934140aedd970ae976a8eb7858d (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
#ifndef GENTOOBROWSE_API_SERVICE_DBUTILS_H
#define GENTOOBROWSE_API_SERVICE_DBUTILS_H

#include <command.h>
#include <modifycommand.h>
#include <connection.h>
#include <IceUtil/Exception.h>
#include <IceUtil/Optional.h>

namespace Gentoo {
	namespace Utils {
		namespace Database {
			bool bindOptionalsS(DB::Command * db, unsigned int c, const std::vector<boost::optional<Glib::ustring> > & vs);
			void bindOptionalS(DB::Command * db, unsigned int c, const IceUtil::Optional<std::string> & v);
			void bindOptionalS(DB::Command * db, unsigned int c, const char * v);

			std::string createTempWith(DB::Connection *, const std::string &, const std::set<std::string> & keys = std::set<std::string>());
			std::string emptyClone(DB::Connection *, const std::string &);
			std::pair<std::string, DB::ModifyCommandPtr> customTemp(DB::Connection *, const std::map<std::string, const std::string> & cols);
			std::pair<std::string, DB::ModifyCommandPtr> namedTemp(DB::Connection *, const std::string &, const std::map<std::string, const std::string> & cols);
			void drop(DB::Connection *, const std::string &);
			DB::ModifyCommandPtr tablePatchInserter(DB::Connection *, const DB::TablePatch &);
			DB::ModifyCommandPtr tablePatchInserter(DB::Connection *, const std::string &, const std::set<std::string> &);
		}
	}
}

#endif