GSP
Quick Navigator

Search Site

Unix VPS
A - Starter
B - Basic
C - Preferred
D - Commercial
MPS - Dedicated
Previous VPSs
* Sign Up! *

Support
Contact Us
Online Help
Handbooks
Domain Status
Man Pages

FAQ
Virtual Servers
Pricing
Billing
Technical

Network
Facilities
Connectivity
Topology Map

Miscellaneous
Server Agreement
Year 2038
Credits
 

USA Flag

 

 

Man Pages


Manual Reference Pages  -  GAMMU-SMSD-DBI (7)

NAME

gammu-smsd-dbi - gammu-smsd(1) backend using DBI abstraction layer to use any supported database as a message storage \$1 \n[an-margin] level \n[rst2man-indent-level] level margin: \n[rst2man-indent\n[rst2man-indent-level]] - \n[rst2man-indent0] \n[rst2man-indent1] \n[rst2man-indent2]

CONTENTS

Description
Configuration
Supported Drivers
Creating Tables
Upgrading Tables
Author
Copyright

DESCRIPTION

DBI backend stores all data in any database supported by  libdbi, which parameters are defined by configuration (see gammu-smsdrc for description of configuration options).

For tables description see gammu-smsd-tables.

This backend is based on gammu-smsd-sql.

NOTE: The DBI driver is currently not supported on Windows because libdbi library does not support this platform.

CONFIGURATION

Before running gammu-smsd you need to create necessary tables in the database. You can use examples given in database specific backends parts of this manual to do that.

The configuration file then can look like:


[smsd]
service = sql
driver = DBI_DRIVER
host = localhost


SEE ALSO: gammu-smsdrc

SUPPORTED DRIVERS

For complete list of drivers for  libdbi see  libdbi-drivers project. The drivers for example include:
o sqlite3 - for SQLite 3
o mysql - for MySQL
o pgsql - for PostgeSQL
o freetds - for MS SQL Server or Sybase

CREATING TABLES

SQL script for creating tables in SQLite database:


CREATE TABLE daemons (
  Start TEXT NOT NULL,
  Info TEXT NOT NULL
);

CREATE TABLE gammu ( Version INTEGER NOT NULL DEFAULT \(aq0\(aq );

INSERT INTO gammu (Version) VALUES (15);

CREATE TABLE inbox ( UpdatedInDB NUMERIC NOT NULL DEFAULT (datetime(\(aqnow\(aq)), ReceivingDateTime NUMERIC NOT NULL DEFAULT (datetime(\(aqnow\(aq)), Text TEXT NOT NULL, SenderNumber TEXT NOT NULL DEFAULT \(aq\(aq, Coding TEXT NOT NULL DEFAULT \(aqDefault_No_Compression\(aq, UDH TEXT NOT NULL, SMSCNumber TEXT NOT NULL DEFAULT \(aq\(aq, Class INTEGER NOT NULL DEFAULT \(aq-1\(aq, TextDecoded TEXT NOT NULL DEFAULT \(aq\(aq, ID INTEGER PRIMARY KEY AUTOINCREMENT, RecipientID TEXT NOT NULL, Processed TEXT NOT NULL DEFAULT \(aqfalse\(aq, CHECK (Coding IN (\(aqDefault_No_Compression\(aq,\(aqUnicode_No_Compression\(aq,\(aq8bit\(aq,\(aqDefault_Compression\(aq,\(aqUnicode_Compression\(aq)) );

CREATE TRIGGER update_inbox_time UPDATE ON inbox BEGIN UPDATE inbox SET UpdatedInDB = datetime(\(aqnow\(aq) WHERE ID = old.ID; END;

CREATE TABLE outbox ( UpdatedInDB NUMERIC NOT NULL DEFAULT (datetime(\(aqnow\(aq)), InsertIntoDB NUMERIC NOT NULL DEFAULT (datetime(\(aqnow\(aq)), SendingDateTime NUMERIC NOT NULL DEFAULT (datetime(\(aqnow\(aq)), SendBefore time NOT NULL DEFAULT \(aq23:59:59\(aq, SendAfter time NOT NULL DEFAULT \(aq00:00:00\(aq, Text TEXT, DestinationNumber TEXT NOT NULL DEFAULT \(aq\(aq, Coding TEXT NOT NULL DEFAULT \(aqDefault_No_Compression\(aq, UDH TEXT, Class INTEGER DEFAULT \(aq-1\(aq, TextDecoded TEXT NOT NULL DEFAULT \(aq\(aq, ID INTEGER PRIMARY KEY AUTOINCREMENT, MultiPart TEXT NOT NULL DEFAULT \(aqfalse\(aq, RelativeValidity INTEGER DEFAULT \(aq-1\(aq, SenderID TEXT, SendingTimeOut NUMERIC NOT NULL DEFAULT (datetime(\(aqnow\(aq)), DeliveryReport TEXT DEFAULT \(aqdefault\(aq, CreatorID TEXT NOT NULL, Retries INTEGER DEFAULT \(aq0\(aq, CHECK (Coding IN (\(aqDefault_No_Compression\(aq,\(aqUnicode_No_Compression\(aq,\(aq8bit\(aq,\(aqDefault_Compression\(aq,\(aqUnicode_Compression\(aq)), CHECK (DeliveryReport IN (\(aqdefault\(aq,\(aqyes\(aq,\(aqno\(aq)) );

CREATE INDEX outbox_date ON outbox(SendingDateTime, SendingTimeOut); CREATE INDEX outbox_sender ON outbox(SenderID);

CREATE TRIGGER update_outbox_time UPDATE ON outbox BEGIN UPDATE outbox SET UpdatedInDB = datetime(\(aqnow\(aq) WHERE ID = old.ID; END;

CREATE TABLE outbox_multipart ( Text TEXT, Coding TEXT NOT NULL DEFAULT \(aqDefault_No_Compression\(aq, UDH TEXT, Class INTEGER DEFAULT \(aq-1\(aq, TextDecoded TEXT DEFAULT NULL, ID INTEGER, SequencePosition INTEGER NOT NULL DEFAULT \(aq1\(aq, CHECK (Coding IN (\(aqDefault_No_Compression\(aq,\(aqUnicode_No_Compression\(aq,\(aq8bit\(aq,\(aqDefault_Compression\(aq,\(aqUnicode_Compression\(aq)), PRIMARY KEY (ID, SequencePosition) );

CREATE TABLE pbk ( ID INTEGER PRIMARY KEY AUTOINCREMENT, GroupID INTEGER NOT NULL DEFAULT \(aq-1\(aq, Name TEXT NOT NULL, Number TEXT NOT NULL );

CREATE TABLE pbk_groups ( Name TEXT NOT NULL, ID INTEGER PRIMARY KEY AUTOINCREMENT );

CREATE TABLE phones ( ID TEXT NOT NULL, UpdatedInDB NUMERIC NOT NULL DEFAULT (datetime(\(aqnow\(aq)), InsertIntoDB NUMERIC NOT NULL DEFAULT (datetime(\(aqnow\(aq)), TimeOut NUMERIC NOT NULL DEFAULT (datetime(\(aqnow\(aq)), Send TEXT NOT NULL DEFAULT \(aqno\(aq, Receive TEXT NOT NULL DEFAULT \(aqno\(aq, IMEI TEXT PRIMARY KEY NOT NULL, NetCode TEXT DEFAULT \(aqERROR\(aq, NetName TEXT DEFAULT \(aqERROR\(aq, Client TEXT NOT NULL, Battery INTEGER NOT NULL DEFAULT -1, Signal INTEGER NOT NULL DEFAULT -1, Sent INTEGER NOT NULL DEFAULT 0, Received INTEGER NOT NULL DEFAULT 0 );

CREATE TRIGGER update_phones_time UPDATE ON phones BEGIN UPDATE phones SET UpdatedInDB = datetime(\(aqnow\(aq) WHERE IMEI = old.IMEI; END;

CREATE TABLE sentitems ( UpdatedInDB NUMERIC NOT NULL DEFAULT (datetime(\(aqnow\(aq)), InsertIntoDB NUMERIC NOT NULL DEFAULT (datetime(\(aqnow\(aq)), SendingDateTime NUMERIC NOT NULL DEFAULT (datetime(\(aqnow\(aq)), DeliveryDateTime NUMERIC NULL, Text TEXT NOT NULL, DestinationNumber TEXT NOT NULL DEFAULT \(aq\(aq, Coding TEXT NOT NULL DEFAULT \(aqDefault_No_Compression\(aq, UDH TEXT NOT NULL, SMSCNumber TEXT NOT NULL DEFAULT \(aq\(aq, Class INTEGER NOT NULL DEFAULT \(aq-1\(aq, TextDecoded TEXT NOT NULL DEFAULT \(aq\(aq, ID INTEGER, SenderID TEXT NOT NULL, SequencePosition INTEGER NOT NULL DEFAULT \(aq1\(aq, Status TEXT NOT NULL DEFAULT \(aqSendingOK\(aq, StatusError INTEGER NOT NULL DEFAULT \(aq-1\(aq, TPMR INTEGER NOT NULL DEFAULT \(aq-1\(aq, RelativeValidity INTEGER NOT NULL DEFAULT \(aq-1\(aq, CreatorID TEXT NOT NULL, CHECK (Status IN (\(aqSendingOK\(aq,\(aqSendingOKNoReport\(aq,\(aqSendingError\(aq,\(aqDeliveryOK\(aq,\(aqDeliveryFailed\(aq,\(aqDeliveryPending\(aq, \(aqDeliveryUnknown\(aq,\(aqError\(aq)), CHECK (Coding IN (\(aqDefault_No_Compression\(aq,\(aqUnicode_No_Compression\(aq,\(aq8bit\(aq,\(aqDefault_Compression\(aq,\(aqUnicode_Compression\(aq)) , PRIMARY KEY (ID, SequencePosition) );

CREATE INDEX sentitems_date ON sentitems(DeliveryDateTime); CREATE INDEX sentitems_tpmr ON sentitems(TPMR); CREATE INDEX sentitems_dest ON sentitems(DestinationNumber); CREATE INDEX sentitems_sender ON sentitems(SenderID);

CREATE TRIGGER update_sentitems_time UPDATE ON sentitems BEGIN UPDATE sentitems SET UpdatedInDB = datetime(\(aqnow\(aq) WHERE ID = old.ID; END;

NOTE: You can find the script in docs/sql/sqlite.sql as well. There are also scripts for other databases in same folder.

UPGRADING TABLES

The easiest way to upgrade database structure is to backup old one and start with creating new one based on example above.

For upgrading existing database, you can use changes described in smsd-tables-history and then manually update Version field in gammu table.

AUTHOR

Michal Čihař <michal@cihar.com>

COPYRIGHT

2009-2015, Michal Čihař <michal@cihar.com>
Search for    or go to Top of page |  Section 7 |  Main Index


1.37.0 GAMMU-SMSD-DBI (7) February 03, 2016

Powered by GSP Visit the GSP FreeBSD Man Page Interface.
Output converted with manServer 1.07.