Diff for /mqtt/src/pubmqtt.c between versions 1.2.2.11 and 1.2.2.12

version 1.2.2.11, 2012/06/26 08:05:58 version 1.2.2.12, 2012/06/26 13:43:59
Line 247  mqtt_rtlm_chk_session(cfg_root_t *cfg, sqlite3 *sql, c Line 247  mqtt_rtlm_chk_session(cfg_root_t *cfg, sqlite3 *sql, c
  * @txtlen = text length   * @txtlen = text length
  * @user = username   * @user = username
  * @host = hostname   * @host = hostname
    * @qos = QoS
  * @retain = !=0 retain message to database   * @retain = !=0 retain message to database
  * return: -1 error, 0 no publish or >0 published ok   * return: -1 error, 0 no publish or >0 published ok
  */   */
 int  int
 mqtt_rtlm_write_topic(cfg_root_t *cfg, sqlite3 *sql, const char *connid, u_short msgid,   mqtt_rtlm_write_topic(cfg_root_t *cfg, sqlite3 *sql, const char *connid, u_short msgid, 
                const char *topic, void *txt, int txtlen, const char *user, const char *host, char retain)                const char *topic, void *txt, int txtlen, const char *user, 
                 const char *host, char qos, char retain)
 {  {
         int ret = 0;          int ret = 0;
         char *str, *psStmt;          char *str, *psStmt;
Line 266  mqtt_rtlm_write_topic(cfg_root_t *cfg, sqlite3 *sql, c Line 268  mqtt_rtlm_write_topic(cfg_root_t *cfg, sqlite3 *sql, c
                 mqtt_rtlm_log("Error:: not found topics table name");                  mqtt_rtlm_log("Error:: not found topics table name");
                 return -1;                  return -1;
         }          }
        psStmt = sqlite3_mprintf("INSERT INTO %s (Retain, ConnID, MsgID, Topic, Value, PubUser, "        psStmt = sqlite3_mprintf("INSERT INTO %s (QoS, Retain, ConnID, MsgID, Topic, Value, PubUser, "
                        "PubDate, PubHost) VALUES (%d, '%q', %u, '%q', ?1, '%q', "                        "PubDate, PubHost) VALUES (%d, %d, '%q', %u, '%q', ?1, '%q', "
                         "datetime('now', 'localtime'), '%q');",                           "datetime('now', 'localtime'), '%q');", 
                        str, retain, connid, msgid, topic, txt, user, host);                        str, qos, retain, connid, msgid, topic, user, host);
   
        if (sqlite3_prepare_v2(sql, psStmt, strlen(psStmt), &stmt, NULL)) {        if (sqlite3_prepare_v2(sql, psStmt, strlen(psStmt), &stmt, NULL) || !stmt) {
                 MQTT_RTLM_LOG(sql);                  MQTT_RTLM_LOG(sql);
                 sqlite3_free(psStmt);                  sqlite3_free(psStmt);
                 return -1;                  return -1;

Removed from v.1.2.2.11  
changed lines
  Added in v.1.2.2.12


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