This tutorial demonstrates the use of upscaledb. It will show how to create or open a Database, insert items, look them up and delete them. It will also demonstrate the use of Database Cursors to enumerate all items and to insert or delete items using Cursors. But before upscaledb can be used, it has to be configured, compiled and installed. These steps are also described in this chapter.
upscaledb uses the GNU autotools for the build process, therefore compiling and installing is as simple as it can get. After downloading the sources, unpack them with the following command:
$ tar -zxvf upscaledb-v.v.v.tar.gz
This command creates a subdirectory upscaledb-v.v.v with all sources. Change to this directory:
$ cd upscaledb-v.v.v
Now run ./configure, make and make install to build and install the libraries and header files. Please note that you usually need root privileges to install the header files and libraries. Also note that you can change the compiler settings by adding flags to ./configure; run ./configure —help for a list of all available options.
$ ./configure
$ make
Now change user to root and install in a system-wide directory:
$ sudo make install
The upscaledb package includes Solution files for Microsoft Visual Studio 2013 and 2015. A free Express Edition with limited functionality can be downloaded from Microsoft’s website. See http://msdn.microsoft.com/vstudio/express/visualc/download.
Additionally, you can download prebuilt libraries for Win32 from http://upscaledb.com/download.
To compile upscaledb, unpack the sources and open the Solution file in Visual Studio. It can be found in the subdirectory win32. Several projects are included: the samples, the dll project (to build a dynamic library) and the lib project (to build a static library). Build one (or both) of those projects to create your own upscaledb library. upscaledb has several dependencies which you need for compilation (BuildDependencies). You can download precompiled dependencies for Win32 on http://upscaledb.com/download.
Compiling upscaledb without the provided autoconf or Visual Studio files is easy. There are a few preprocessor macros which are mandatory, and some others which are optional. They are described in the README file of the upscaledb source distribution.
If you want to port upscaledb to another operating system or hardware platform, you will most likely have to make a few minor modifications. All operating system-specific functions are declared in src/os.h and defined in either src/oswin32.cc_ or src/osposix.cc_. Please get in touch with the author of upscaledb to get help with these topics.