Beispiel #1
0
void compile_mime_regex() {
 char sB[]="(=\\?([0-9a-z-]*)\\?B\\?([0-9a-z+/=]*)\\?=)";
 char sQ[]="(=\\?([0-9a-z-]*)\\?Q\\?(([!-<]|[>-~]|=[0-9a-f]{2}|\\0x9| |_)*)\\?=)";
 char sH[]="(=[0-9a-z]{2})";

 if (regcomp(&r_base64, sB, REG_EXTENDED | REG_ICASE) > 0) myWarn("Error compiling regex!","(mime_base64)",5);
 if (regcomp(&r_qp    , sQ, REG_EXTENDED | REG_ICASE) > 0) myWarn("Error compiling regex!","(mime_qp)",5);
 if (regcomp(&r_hex   , sH, REG_EXTENDED | REG_ICASE) > 0) myWarn("Error compiling regex!","(mime_hex)",5);
}
Beispiel #2
0
void SQLiteWrapper::init()
{
    myOut() << "SQLite init use db:" << filename;
    db = QSqlDatabase::addDatabase("QSQLITE");
    db.setDatabaseName(filename);

    open();

    QStringList tableList = db.tables(QSql::Tables);
    if( tableList.size() == 0 )
    {
        myWarn() << "Warning empty db";

        QSqlQuery query;
        //mqtt topic, unix timestamp
        if( !query.exec("CREATE TABLE IF NOT EXISTS data \
                    ( \
                      id    INTEGER PRIMARY KEY AUTOINCREMENT, \
                      topic VARCHAR(256), \
                      time  INTEGER, \
                      alarm INTEGER DEFAULT 0 \
                    )")
          )
        {
            qFatal("Failed to create table!");
        }