Changeset be9b645
- Timestamp:
- 04/15/10 13:48:14 (13 years ago)
- Branches:
- master, qt5
- Children:
- d06ae27
- Parents:
- a0b8978
- Location:
- src
- Files:
-
- 4 edited
Legend:
- Unmodified
- Added
- Removed
-
src/gui/importschedulewidget.cpp
ra0b8978 rbe9b645 48 48 49 49 cancel->hide(); 50 importAction->hide();51 50 connect(online, SIGNAL(clicked()), SLOT(downloadSchedule())); 52 51 -
src/gui/importschedulewidget.ui
ra0b8978 rbe9b645 34 34 <string>Import schedule: </string> 35 35 </property> 36 </widget>37 </item>38 <item>39 <widget class="QGroupBox" name="importAction">40 <property name="title">41 <string/>42 </property>43 <layout class="QHBoxLayout" name="horizontalLayout">44 <item>45 <widget class="QRadioButton" name="update">46 <property name="text">47 <string>Update</string>48 </property>49 <property name="checked">50 <bool>true</bool>51 </property>52 </widget>53 </item>54 <item>55 <widget class="QRadioButton" name="replace">56 <property name="text">57 <string>Replace</string>58 </property>59 </widget>60 </item>61 </layout>62 36 </widget> 63 37 </item> -
src/sql/sqlengine.cpp
ra0b8978 rbe9b645 51 51 if(!QFile::exists(aDatabaseName)) // the DB (tables) doesn't exists, and so we have to create one 52 52 { 53 /*54 // creating empty DB + tables55 // ??? what is the best way of creating new empty DB ???56 // we can either:57 // - create new DB + tables by issuing corresponding queries (used solution)58 // - create new DB from resource, which contains empty DB with tables59 result = createTables(database);60 */61 62 53 // copy conference Db from resource, instead of creating 63 54 // empty tables and then parsing the schedule … … 278 269 } 279 270 280 bool SqlEngine::createTables(QSqlDatabase &aDatabase)281 {282 bool result = aDatabase.open();283 284 if (aDatabase.isValid() && aDatabase.isOpen())285 {286 QSqlQuery query(aDatabase);287 288 query.exec("CREATE TABLE CONFERENCE ( "289 "id INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL, "290 "title VARCHAR UNIQUE NOT NULL, "291 "subtitle VARCHAR, "292 "venue VARCHAR, "293 "city VARCHAR NOT NULL, "294 "start INTEGER NOT NULL, "295 "end INTEGER NOT NULL, "296 "days INTEGER, "297 "day_change INTEGER, "298 "timeslot_duration INTEGER, "299 "active INTEGER DEFAULT 0);");300 301 query.exec("CREATE TABLE TRACK ( "302 "id INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL, "303 "name VARCHAR UNIQUE NOT NULL );");304 305 query.exec("CREATE TABLE ROOM ( "306 "id INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL, "307 "name VARCHAR UNIQUE NOT NULL, "308 "picture VARCHAR NOT NULL);");309 310 query.exec("CREATE TABLE PERSON ( "311 "id INTEGER PRIMARY KEY NOT NULL, "312 "name VARCHAR UNIQUE NOT NULL);");313 314 query.exec("CREATE TABLE EVENT ( "315 "xid_conference INTEGER NOT NULL, "316 "id INTEGER NOT NULL, "317 "start INTEGER NOT NULL, "318 "duration INTEGER NOT NULL, "319 "xid_track INTEGER NOT NULL REFERENCES TRACK(id), "320 "type VARCHAR, "321 "language VARCHAR, "322 "tag VARCHAR,title VARCHAR NOT NULL, "323 "subtitle VARCHAR, "324 "abstract VARCHAR, "325 "description VARCHAR, "326 "favourite INTEGER DEFAULT 0, "327 "alarm INTEGER DEFAULT 0, "328 "PRIMARY KEY (xid_conference,id), "329 "FOREIGN KEY(xid_conference) REFERENCES CONFERENCE(id), "330 "FOREIGN KEY(xid_track) REFERENCES TRACK(id));");331 332 query.exec("CREATE TABLE EVENT_PERSON ( "333 "xid_conference INTEGER NOT NULL, "334 "xid_event INTEGER NOT NULL, "335 "xid_person INTEGER NOT NULL, "336 "UNIQUE ( xid_conference, xid_event, xid_person ) ON CONFLICT REPLACE, "337 "FOREIGN KEY(xid_conference) REFERENCES CONFERENCE(id), "338 "FOREIGN KEY(xid_event) REFERENCES EVENT(id), "339 "FOREIGN KEY(xid_person) REFERENCES PERSON(id));");340 341 query.exec("CREATE TABLE EVENT_ROOM ( "342 "xid_conference INTEGER NOT NULL, "343 "xid_event INTEGER NOT NULL, "344 "xid_room INTEGER NOT NULL, "345 "UNIQUE ( xid_conference, xid_event, xid_room ) ON CONFLICT REPLACE, "346 "FOREIGN KEY(xid_conference) REFERENCES CONFERENCE(id), "347 "FOREIGN KEY(xid_event) REFERENCES EVENT(id), "348 "FOREIGN KEY(xid_room) REFERENCES ROOM(id));");349 350 query.exec("CREATE TABLE LINK ( "351 "id INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL, "352 "xid_conference INTEGER NOT NULL, "353 "xid_event INTEGER NOT NULL, "354 "name VARCHAR, "355 "url VARCHAR NOT NULL, "356 "UNIQUE ( xid_conference, xid_event, url ) ON CONFLICT REPLACE, "357 "FOREIGN KEY(xid_conference) REFERENCES CONFERENCE(id), "358 "FOREIGN KEY(xid_event) REFERENCES EVENT(id));");359 }360 else361 {362 //LOG_WARNING("Database is not opened");363 }364 365 return result;366 }367 368 271 int SqlEngine::searchEvent(int aConferenceId, const QHash<QString,QString> &aColumns, const QString &aKeyword) 369 272 { -
src/sql/sqlengine.h
ra0b8978 rbe9b645 45 45 private: 46 46 static QString login(const QString &aDatabaseType, const QString &aDatabaseName); 47 static bool createTables(QSqlDatabase &aDatabase);48 47 static bool execQuery(QSqlDatabase &aDatabase, const QString &aQuery); 49 48 };
Note: See TracChangeset
for help on using the changeset viewer.