1.. _gammu-smsd-dbi: 2 3DBI Backend 4=========== 5 6Description 7----------- 8 9DBI backend stores all data in any database supported by `libdbi`_, which 10parameters are defined by configuration (see :ref:`gammu-smsdrc` for description of 11configuration options). 12 13For tables description see :ref:`gammu-smsd-tables`. 14 15This backend is based on :ref:`gammu-smsd-sql`. 16 17.. note:: 18 19 The DBI driver is currently not supported on Windows because libdbi 20 library does not support this platform. 21 22 23Configuration 24------------- 25 26Before running :ref:`gammu-smsd` you need to create necessary tables in the 27database. You can use examples given in database specific backends parts of 28this manual to do that. 29 30The configuration file then can look like: 31 32.. code-block:: ini 33 34 [smsd] 35 service = sql 36 driver = DBI_DRIVER 37 host = localhost 38 39.. seealso:: :ref:`gammu-smsdrc` 40 41Supported drivers 42----------------- 43 44For complete list of drivers for `libdbi`_ see `libdbi-drivers`_ project. The 45drivers for example include: 46 47* ``sqlite3`` - for SQLite 3 48* ``mysql`` - for MySQL 49* ``pgsql`` - for PostgeSQL 50* ``freetds`` - for MS SQL Server or Sybase 51 52.. _libdbi: http://libdbi.sourceforge.net/ 53.. _libdbi-drivers: http://libdbi-drivers.sourceforge.net/ 54 55.. _sqlite-create: 56 57Creating tables for SQLite 58-------------------------- 59 60SQL script for creating tables in SQLite database: 61 62.. literalinclude:: ../../sql/sqlite.sql 63 :language: sql 64 65.. note:: 66 67 You can find the script in :file:`docs/sql/sqlite.sql` as well. There are 68 also scripts for other databases in same folder. 69 70Upgrading tables 71---------------- 72 73The easiest way to upgrade database structure is to backup old one and start 74with creating new one based on example above. 75 76For upgrading existing database, you can use changes described in 77:ref:`smsd-tables-history` and then manually update ``Version`` field in 78``gammu`` table. 79