Implementation of SQLite database support in program gama-local


  • Václav Petráš Department of Mapping and Cartography, Faculty of Civil Engineering, Czech Technical University in Prague



GNU Gama, adjustment of geodetic networks, programming, C, C , databases, SQLite, callback functions


The program gama-local is a part of GNU Gama project and allows adjustment of local geodetic networks. Before realization of this project the program gama-local supported only XML as an input. I designed and implemented support for the SQLite database and thanks to this extension gama-local can read input data from the SQLite database. This article is focused on the specifics of the use of callback functions in C++ using the native SQLite C/C++ Application Programming Interface. The article provides solution to safe calling of callback functions written in C++. Callback functions are called from C library and C library itself is used by C++ program. Provided solution combines several programing techniques which are described in detail, so this article can serve as a cookbook even for beginner programmers.  This project was accomplished within my bachelor thesis.


ČEPEK, Aleš. GNU Gama manual [online]. 2011-08-16.

ČEPEK, Aleš; PYTEL, Jan. A Note on Numerical Solutions of Least Squares Adjustment in GNU Project Gama In: Interfacing Geostatistics and GIS. Berlin: SpringerVerlag, 2009, p. 179. ISBN 978-3-540-33235-0.

SQLite [program]. Version 3. 2004-2011.

PETRÁŠ, Václav. Podpora databáze SQLite pro program gama-local. Praha 2011. 75 s. Bakalářská práce. ČVUT v Praze, Fakulta stavební

NOVÁK, Jiří. Object – oriented GUI for GNU Gama. Prague, 2010. 63 p. Bachelor thesis. CTU in Prague, Faculty of Civil Engineering.

GNU FTP server mirrors. GNU Gama release 1.11

GNU Gama Git source code repository

The C language interface to SQLite Version 2 [online]. Modified 2011-09-21.

C/C++ Interface For SQLite Version 3 [online]. Modified 2011-09-21.

STROUSTRUP, Bjarne. The C++ Programming Language. Special Edition. AT&T Labs, Florham Park, New Jersey. United States of America: Addison-Wesley, 2000. 1020 p. ISBN 0-201-70073-5.

ISO/IEC 14882. INTERNATIONAL STANDARD: Programming languages — C++. 11 West 42nd Street, New York, New York 10036: American National Standards Institute, First edition, 1998-09-01. 748 p.

Free Software Foundation, Inc. GCC, the GNU Compiler Collection [program]. Version 4.4.3, Copyright 2009 Free Software Foundation, Inc.

GCC Bugzilla: Bug 2316

SUTTER, Herb; ALEXANDRESCU, Andrei. C++ Coding Standards: 101 Rules, Guidelines, and Best Practices. 1st edition. Addison-Wesley Professional, 2004. 240 p. ISBN 0321113586.

GNU Gama Git source code repository: gama-local directory. Files: sqlitereader.h and sqlitereader.cpp.