aboutsummaryrefslogtreecommitdiff
path: root/odb/sqlite
diff options
context:
space:
mode:
Diffstat (limited to 'odb/sqlite')
-rw-r--r--odb/sqlite/details/config.h.in14
-rw-r--r--odb/sqlite/details/config.hxx20
-rw-r--r--odb/sqlite/details/export.hxx41
-rw-r--r--odb/sqlite/details/options.cli48
-rw-r--r--odb/sqlite/forward.hxx37
-rw-r--r--odb/sqlite/makefile124
-rw-r--r--odb/sqlite/version.hxx44
7 files changed, 328 insertions, 0 deletions
diff --git a/odb/sqlite/details/config.h.in b/odb/sqlite/details/config.h.in
new file mode 100644
index 0000000..ff8c029
--- /dev/null
+++ b/odb/sqlite/details/config.h.in
@@ -0,0 +1,14 @@
+/* file : odb/sqlite/details/config.h.in
+ * author : Boris Kolpackov <boris@codesynthesis.com>
+ * copyright : Copyright (c) 2009-2011 Code Synthesis Tools CC
+ * license : GNU GPL v2; see accompanying LICENSE file
+ */
+
+/* This file is automatically processed by configure. */
+
+#ifndef ODB_SQLITE_DETAILS_CONFIG_H
+#define ODB_SQLITE_DETAILS_CONFIG_H
+
+#undef LIBODB_SQLITE_STATIC_LIB
+
+#endif /* ODB_SQLITE_DETAILS_CONFIG_H */
diff --git a/odb/sqlite/details/config.hxx b/odb/sqlite/details/config.hxx
new file mode 100644
index 0000000..26aeaf3
--- /dev/null
+++ b/odb/sqlite/details/config.hxx
@@ -0,0 +1,20 @@
+// file : odb/sqlite/details/config.hxx
+// author : Boris Kolpackov <boris@codesynthesis.com>
+// copyright : Copyright (c) 2005-2011 Code Synthesis Tools CC
+// license : GNU GPL v2; see accompanying LICENSE file
+
+#ifndef ODB_SQLITE_DETAILS_CONFIG_HXX
+#define ODB_SQLITE_DETAILS_CONFIG_HXX
+
+// no pre
+
+#ifdef _MSC_VER
+#elif defined(ODB_COMPILER)
+# error libodb-sqlite header included in odb-compiled header
+#else
+# include <odb/sqlite/details/config.h>
+#endif
+
+// no post
+
+#endif // ODB_SQLITE_DETAILS_CONFIG_HXX
diff --git a/odb/sqlite/details/export.hxx b/odb/sqlite/details/export.hxx
new file mode 100644
index 0000000..dd17e33
--- /dev/null
+++ b/odb/sqlite/details/export.hxx
@@ -0,0 +1,41 @@
+// file : odb/sqlite/details/export.hxx
+// author : Boris Kolpackov <boris@codesynthesis.com>
+// copyright : Copyright (c) 2005-2011 Code Synthesis Tools CC
+// license : GNU GPL v2; see accompanying LICENSE file
+
+#ifndef ODB_SQLITE_DETAILS_EXPORT_HXX
+#define ODB_SQLITE_DETAILS_EXPORT_HXX
+
+#include <odb/pre.hxx>
+
+#include <odb/sqlite/details/config.hxx>
+
+#ifdef LIBODB_SQLITE_STATIC_LIB
+# define LIBODB_SQLITE_EXPORT
+#else
+# ifdef _WIN32
+# ifdef _MSC_VER
+# ifdef LIBODB_SQLITE_DYNAMIC_LIB
+# define LIBODB_SQLITE_EXPORT __declspec(dllexport)
+# else
+# define LIBODB_SQLITE_EXPORT __declspec(dllimport)
+# endif
+# else
+# ifdef LIBODB_SQLITE_DYNAMIC_LIB
+# ifdef DLL_EXPORT
+# define LIBODB_SQLITE_EXPORT __declspec(dllexport)
+# else
+# define LIBODB_SQLITE_EXPORT
+# endif
+# else
+# define LIBODB_SQLITE_EXPORT __declspec(dllimport)
+# endif
+# endif
+# else
+# define LIBODB_SQLITE_EXPORT
+# endif
+#endif
+
+#include <odb/post.hxx>
+
+#endif // ODB_SQLITE_DETAILS_EXPORT_HXX
diff --git a/odb/sqlite/details/options.cli b/odb/sqlite/details/options.cli
new file mode 100644
index 0000000..a0af101
--- /dev/null
+++ b/odb/sqlite/details/options.cli
@@ -0,0 +1,48 @@
+// file : odb/sqlite/details/options.cli
+// author : Boris Kolpackov <boris@codesynthesis.com>
+// copyright : Copyright (c) 2009-2011 Code Synthesis Tools CC
+// license : GNU GPL v2; see accompanying LICENSE file
+
+include <string>;
+
+namespace odb
+{
+ namespace sqlite
+ {
+ namespace details
+ {
+ class options
+ {
+ std::string --database
+ {
+ "<filename>",
+ "SQLite database file name. If the database file is not specified
+ then a private, temporary on-disk database will be created. Use
+ the \cb{:memory:} special name to create a private, temporary
+ in-memory database."
+ };
+
+ bool --database-create
+ {
+ "Create the SQLite database if it does not already exist. By default
+ opening the database fails if it does not already exist."
+ };
+
+ bool --database-readonly
+ {
+ "Open the SQLite database in read-only mode. By default the database
+ is opened for reading and writing if possible, or reading only if
+ the file is write-protected by the operating system."
+ };
+
+ std::string --options-file
+ {
+ "<file>",
+ "Read additional options from <file>. Each option appearing on a
+ separate line optionally followed by space and an option value.
+ Empty lines and lines starting with \cb{#} are ignored."
+ };
+ };
+ }
+ }
+}
diff --git a/odb/sqlite/forward.hxx b/odb/sqlite/forward.hxx
new file mode 100644
index 0000000..d141534
--- /dev/null
+++ b/odb/sqlite/forward.hxx
@@ -0,0 +1,37 @@
+// file : odb/sqlite/forward.hxx
+// author : Boris Kolpackov <boris@codesynthesis.com>
+// copyright : Copyright (c) 2005-2011 Code Synthesis Tools CC
+// license : GNU GPL v2; see accompanying LICENSE file
+
+#ifndef ODB_SQLITE_FORWARD_HXX
+#define ODB_SQLITE_FORWARD_HXX
+
+#include <odb/pre.hxx>
+
+namespace odb
+{
+ namespace sqlite
+ {
+ // @@ Any garbage here?
+ //
+ class database;
+ class connection;
+ class connection_factory;
+ class transaction;
+ class query;
+
+ // Implementation details.
+ //
+ class select_statement;
+
+ template <typename T>
+ class object_statements;
+
+ template <typename T>
+ class container_statements;
+ }
+}
+
+#include <odb/post.hxx>
+
+#endif // ODB_SQLITE_FORWARD_HXX
diff --git a/odb/sqlite/makefile b/odb/sqlite/makefile
new file mode 100644
index 0000000..4a25dee
--- /dev/null
+++ b/odb/sqlite/makefile
@@ -0,0 +1,124 @@
+# file : odb/sqlite/makefile
+# author : Boris Kolpackov <boris@codesynthesis.com>
+# copyright : Copyright (c) 2009-2011 Code Synthesis Tools CC
+# license : GNU GPL v2; see accompanying LICENSE file
+
+include $(dir $(lastword $(MAKEFILE_LIST)))../../build/bootstrap.make
+
+cxx := \
+
+cli_tun := details/options.cli
+cxx_tun := $(cxx)
+cxx_obj := $(addprefix $(out_base)/,$(cxx_tun:.cxx=.o) $(cli_tun:.cli=.o))
+cxx_od := $(cxx_obj:.o=.o.d)
+
+odb_sqlite.l := $(out_base)/odb-sqlite.l
+odb_sqlite.l.cpp-options := $(out_base)/odb-sqlite.l.cpp-options
+
+default := $(out_base)/
+dist := $(out_base)/.dist
+clean := $(out_base)/.clean
+
+# Import.
+#
+$(call import,\
+ $(scf_root)/import/cli/stub.make,\
+ cli: cli,cli-rules: cli_rules)
+
+$(call import,\
+ $(scf_root)/import/libodb/stub.make,\
+ l: odb.l,cpp-options: odb.l.cpp-options)
+
+#$(call import,\
+# $(scf_root)/import/libsqlite/stub.make,\
+# l: sqlite.l,cpp-options: sqlite.l.cpp-options)
+
+# Build.
+#
+$(odb_sqlite.l): $(cxx_obj) $(odb.l) $(sqlite.l)
+$(odb_sqlite.l.cpp-options): value := -I$(out_root) -I$(src_root)
+$(odb_sqlite.l.cpp-options): $(odb.l.cpp-options) $(sqlite.l.cpp-options)
+
+$(cxx_obj) $(cxx_od): $(odb_sqlite.l.cpp-options) $(out_base)/details/config.h
+
+genf := $(cli_tun:.cli=.hxx) $(cli_tun:.cli=.ixx) $(cli_tun:.cli=.cxx)
+gen := $(addprefix $(out_base)/,$(genf))
+
+$(gen): $(cli)
+$(gen): cli := $(cli)
+$(gen): cli_options += \
+--long-usage \
+--generate-file-scanner \
+--cli-namespace odb::sqlite::details::cli \
+--guard-prefix LIBODB_SQLITE_DETAILS
+
+$(out_base)/details/config.h:
+ @echo '/* file : odb/sqlite/details/config.h' >$@
+ @echo ' * author : automatically generated' >>$@
+ @echo ' */' >>$@
+ @echo '' >>$@
+ @echo '#ifndef ODB_SQLITE_DETAILS_CONFIG_H' >>$@
+ @echo '#define ODB_SQLITE_DETAILS_CONFIG_H' >>$@
+ @echo '' >>$@
+ @echo '' >>$@
+ @echo '#endif /* ODB_SQLITE_DETAILS_CONFIG_H */' >>$@
+
+$(call include-dep,$(cxx_od),$(cxx_obj),$(gen) $(out_base)/details/config.h)
+
+# Convenience alias for default target.
+#
+$(out_base)/: $(odb_sqlite.l)
+
+# Dist.
+#
+$(dist): sources_dist := $(cxx)
+$(dist): export sources := $(sources_dist) $(cli_tun:.cli=.cxx)
+$(dist): headers_dist = $(subst $(src_base)/,,$(shell find $(src_base) \
+-name '*.hxx' -o -name '*.ixx' -o -name '*.txx'))
+$(dist): gen_headers := $(cli_tun:.cli=.hxx) $(cli_tun:.cli=.ixx)
+$(dist): export headers = $(sort $(headers_dist) $(gen_headers))
+$(dist): gen_dist := $(gen)
+$(dist): data_dist := $(cli_tun) details/config.h.in
+$(dist): export extra_dist := $(data_dist) libodb-sqlite-vc9.vcproj \
+libodb-sqlite-vc10.vcxproj libodb-sqlite-vc10.vcxproj.filters
+$(dist): export interface_version = $(shell sed -e \
+'s/^\([0-9]*\.[0-9]*\).*/\1/' $(src_root)/version)
+
+$(dist): $(gen)
+ $(call dist-data,$(sources_dist) $(headers_dist) $(data_dist))
+ $(call dist-data,$(gen_dist),$(dist_prefix)/odb/sqlite/details)
+ $(call meta-vc9proj,$(src_base)/libodb-sqlite-vc9.vcproj)
+ $(call meta-vc10proj,$(src_base)/libodb-sqlite-vc10.vcxproj)
+ $(call meta-automake)
+
+# Clean.
+#
+$(clean): $(odb_sqlite.l).o.clean \
+ $(odb_sqlite.l.cpp-options).clean \
+ $(addsuffix .cxx.clean,$(cxx_obj)) \
+ $(addsuffix .cxx.clean,$(cxx_od)) \
+ $(addprefix $(out_base)/,$(cli_tun:.cli=.cxx.cli.clean))
+ $(call message,rm $$1,rm -f $$1,$(out_base)/details/config.h)
+
+# Generated .gitignore.
+#
+ifeq ($(out_base),$(src_base))
+$(odb_sqlite.l): | $(out_base)/.gitignore
+
+$(out_base)/.gitignore: files := details/config.h $(genf)
+$(clean): $(out_base)/.gitignore.clean
+
+$(call include,$(bld_root)/git/gitignore.make)
+endif
+
+# How to.
+#
+$(call include,$(bld_root)/dist.make)
+$(call include,$(bld_root)/meta/vc9proj.make)
+$(call include,$(bld_root)/meta/vc10proj.make)
+$(call include,$(bld_root)/meta/automake.make)
+
+$(call include,$(cli_rules))
+$(call include,$(bld_root)/cxx/o-l.make)
+$(call include,$(bld_root)/cxx/cxx-o.make)
+$(call include,$(bld_root)/cxx/cxx-d.make)
diff --git a/odb/sqlite/version.hxx b/odb/sqlite/version.hxx
new file mode 100644
index 0000000..4759d6d
--- /dev/null
+++ b/odb/sqlite/version.hxx
@@ -0,0 +1,44 @@
+// file : odb/sqlite/version.hxx
+// author : Boris Kolpackov <boris@codesynthesis.com>
+// copyright : Copyright (c) 2005-2011 Code Synthesis Tools CC
+// license : GNU GPL v2; see accompanying LICENSE file
+
+#ifndef ODB_SQLITE_VERSION_HXX
+#define ODB_SQLITE_VERSION_HXX
+
+#include <odb/pre.hxx>
+
+#include <odb/version.hxx>
+
+// Version format is AABBCCDD where
+//
+// AA - major version number
+// BB - minor version number
+// CC - bugfix version number
+// DD - alpha / beta (DD + 50) version number
+//
+// When DD is not 00, 1 is subtracted from AABBCC. For example:
+//
+// Version AABBCCDD
+// 2.0.0 02000000
+// 2.1.0 02010000
+// 2.1.1 02010100
+// 2.2.0.a1 02019901
+// 3.0.0.b2 02999952
+//
+
+// Check that we have compatible ODB version.
+//
+#if ODB_VERSION != 10100
+# error incompatible odb interface version detected
+#endif
+
+// libodb-sqlite version: odb interface version plus the bugfix
+// version.
+//
+#define LIBODB_SQLITE_VERSION 1010000
+#define LIBODB_SQLITE_VERSION_STR "1.1.0"
+
+#include <odb/post.hxx>
+
+#endif // ODB_SQLITE_VERSION_HXX