dp->iDb->Connect(); } catch (IBPP::Exception& e) { if (db.indexOf(QRegExp(QLatin1String("[\\\\/]"))) != -1 && !QFile::exists(db)) { // possibly file path try { dp->iDb->Create(3); dp->iDb->Connect(); setOpen(true); return true; } catch (IBPP::Exception& e) { setOpenError(true); dp->setError("Unable to create and connect", e, QSqlError::ConnectionError); return false; } } setOpenError(true); dp->setError("Unable to connect", e, QSqlError::ConnectionError); return false; }
CREATE TABLE Journal( IDX INTEGER NOT NULL PRIMARY KEY, DTTM TIMESTAMP NOT NULL, WHOSEND VARCHAR(10) NOT NULL, NAME VARCHAR(50) NOT NULL, MESS VARCHAR(50) NOT NULL);
"INSERT INTO Journal (DTTM,WHOSEND,NAME,MESS) VALUES ('NOW',:WHOSEND,:NAME,:MESSAGE)"
"select DTTM, WHOSEND, NAME, MESS from JOURNAL ORDER BY IDX ASC"
query.value(0).toDateTime().toString("dd.MM.yy hh:mm:ss")