Diff for /mqtt/src/Attic/dbmqtt.c between versions 1.1 and 1.1.2.2

version 1.1, 2011/11/22 20:22:57 version 1.1.2.2, 2011/11/23 00:42:16
Line 0 Line 1
   #include "global.h"
   #include "dbmqtt.h"
   
   
   /* ------------------------------------------------------------------- */
   
   /*
    * mqtt_db_open() Open database connection
    *
    * @csCfgName = config filename
    * @modtype = RTL module type, 0== mqtt_acc or !=0 mqtt_pub
    * return: NULL error or SQL handle
    */
   sqlite3 *
   mqtt_db_open(sl_config *cfg, int modtype)
   {
           sqlite3 *sql = NULL;
           char *str;
   
           if (!cfg)
                   return NULL;
   
           str = CFG(cfg_GetAttribute(cfg, CFG(modtype ? "mqtt_pub" : "mqtt_acc"), CFG("name")));
           if (!str) {
                   mqtt_db_log("Error:: Unknown database name ...\n");
                   return NULL;
           }
   
           if (sqlite3_open_v2(str, &sql, modtype ? SQLITE_OPEN_READWRITE : SQLITE_OPEN_READONLY, NULL)) {
                   MQTT_DB_LOG(sql);
                   sqlite3_close(sql);
                   return NULL;
           }
   
           return sql;
   }
   
   /*
    * mqtt_db_close() Close database connection
    *
    * @sql = SQL handle
    * return: none
    */
   void
   mqtt_db_close(sqlite3 *sql)
   {
           sqlite3_close(sql);
   }
   
   /*
    * mqtt_db_log() Log database connection message
    *
    * @fmt = format string
    * @... = argument list
    * return: none
    */
   void
   mqtt_db_log(const char *fmt, ...)
   {
           va_list lst;
   
           va_start(lst, fmt);
           vsyslog(LOG_ERR, fmt, lst);
           va_end(lst);
   }

Removed from v.1.1  
changed lines
  Added in v.1.1.2.2


FreeBSD-CVSweb <freebsd-cvsweb@FreeBSD.org>