- Timestamp:
- 01/21/10 14:24:08 (13 years ago)
- Branches:
- master, qt5
- Children:
- 06570e9
- Parents:
- d8d5bd2
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
src/sql/sqlengine.cpp
rd8d5bd2 r7d7659d 105 105 /*qDebug() << QString("DEBUG: Track %1 added to DB").arg(name);*/ 106 106 } 107 // The items of the Event are divided into the two tables EVENT and VIRTUAL_EVENT108 // VIRTUAL_EVENT is for Full-Text-Serach Support109 107 QDateTime startDateTime = QDateTime(QDate::fromString(aEvent["date"],DATE_FORMAT),QTime::fromString(aEvent["start"],TIME_FORMAT)); 110 QString values = QString("'%1', '%2', '%3', '%4', '%5', '%6', '%7', '%8', '%9'") \108 QString values = QString("'%1', '%2', '%3', '%4', '%5', '%6', '%7', ? , ? , ? , ? , ? , '%8', '%9'") \ 111 109 .arg(aEvent["conference_id"]) \ 112 110 .arg(aEvent["id"]) \ … … 119 117 .arg("0"); 120 118 121 QString query = QString("INSERT INTO EVENT (xid_conference, id, start, duration, xid_track, type, language, favourite, alarm) VALUES (%1)").arg(values); 122 QSqlQuery result (query, db); 123 //LOG_AUTOTEST(query); 124 125 // add some(text related) Event's items to VIRTUAL_EVENT table 126 QString values2 = QString("'%1', '%2', '%3', ? , ? , ? , ? ") \ 127 .arg(aEvent["conference_id"]) \ 128 .arg(aEvent["id"]) \ 129 .arg(aEvent["tag"]); 130 131 QString query2 = QString("INSERT INTO VIRTUAL_EVENT (xid_conference, id, tag, title, subtitle, abstract, description) VALUES (%1)").arg(values2); 132 133 QSqlQuery result2; 134 result2.prepare(query2); 135 result2.bindValue(0,aEvent["title"]); 136 result2.bindValue(1,aEvent["subtitle"]); 137 result2.bindValue(2,aEvent["abstract"]); 138 result2.bindValue(3,aEvent["description"]); 139 result2.exec(); 140 //LOG_AUTOTEST(query2); 119 QString query = 120 QString("INSERT INTO EVENT (xid_conference, id, start, duration, xid_track, type, language, tag, title, subtitle, abstract, description, favourite, alarm) VALUES (%1)") 121 .arg(values); 122 123 QSqlQuery result; 124 result.prepare(query); 125 result.bindValue(0,aEvent["tag"]); 126 result.bindValue(1,aEvent["title"]); 127 result.bindValue(2,aEvent["subtitle"]); 128 result.bindValue(3,aEvent["abstract"]); 129 result.bindValue(4,aEvent["description"]); 130 qDebug() << result.lastQuery(); 131 result.exec(); 141 132 } 142 133 } … … 250 241 type VARCHAR, \ 251 242 language VARCHAR, \ 243 tag VARCHAR,title VARCHAR NOT NULL , \ 244 subtitle VARCHAR, \ 245 abstract VARCHAR, \ 246 description VARCHAR, \ 252 247 favourite INTEGER DEFAULT 0, \ 253 248 alarm INTEGER DEFAULT 0, \ … … 255 250 FOREIGN KEY(xid_conference) REFERENCES CONFERENCE(id) \ 256 251 FOREIGN KEY(xid_track) REFERENCES TRACK(id))"); 257 258 #ifdef MAEMO259 // TBD: MAEMO Virtual tables compatibility (waiting for Marek).260 // MAEMO sqlite Qt driver doesn't provide FTS support by default - use the following HACK261 query.exec("CREATE TABLE VIRTUAL_EVENT ( \262 xid_conference INTEGER NOT NULL, \263 id INTEGER NOT NULL , \264 tag VARCHAR,title VARCHAR NOT NULL , \265 subtitle VARCHAR, \266 abstract VARCHAR, \267 description VARCHAR, \268 PRIMARY KEY (xid_conference,id))");269 #else270 query.exec("CREATE VIRTUAL TABLE VIRTUAL_EVENT using fts3 ( \271 xid_conference INTEGER NOT NULL, \272 id INTEGER NOT NULL , \273 tag VARCHAR,title VARCHAR NOT NULL , \274 subtitle VARCHAR, \275 abstract VARCHAR, \276 description VARCHAR, \277 PRIMARY KEY (xid_conference,id))");278 #endif279 252 280 253 query.exec("CREATE TABLE EVENT_PERSON ( \
Note: See TracChangeset
for help on using the changeset viewer.