equal
deleted
inserted
replaced
60 { |
60 { |
61 IRQChannelItem* insertItem = aChannelList->at(i); |
61 IRQChannelItem* insertItem = aChannelList->at(i); |
62 QString name = insertItem->channelName; |
62 QString name = insertItem->channelName; |
63 int channelID = insertItem->channelID; |
63 int channelID = insertItem->channelID; |
64 QString imageURL = insertItem->imageURL; |
64 QString imageURL = insertItem->imageURL; |
65 QString description = insertItem->shortDescription; |
65 QString description = insertItem->shortDescription; |
|
66 |
|
67 //if some data overflows, we just skip it.note that |
|
68 //the VARCHAR is word-based, so here we use the real size |
|
69 if( name.size()>= 256 || imageURL.size() >= 256 || description.size() >= 256 ) |
|
70 { |
|
71 continue; |
|
72 } |
66 |
73 |
67 QSqlQuery query; |
74 QSqlQuery query; |
68 bool result; |
75 bool result; |
69 |
76 |
70 result = query.prepare("INSERT INTO searchresult (name, channelID, imageURL, description) " |
77 result = query.prepare("INSERT INTO searchresult (name, channelID, imageURL, description) " |
154 |
161 |
155 if (!created) |
162 if (!created) |
156 { |
163 { |
157 bool dbResult = false; |
164 bool dbResult = false; |
158 QSqlQuery query; |
165 QSqlQuery query; |
|
166 //note: the VARCHAR is word-based but not byte-based. and 255 |
|
167 //means 255 unicode words. |
159 dbResult = query.exec("CREATE TABLE searchresult (" |
168 dbResult = query.exec("CREATE TABLE searchresult (" |
160 "id INTEGER PRIMARY KEY AUTOINCREMENT, " |
169 "id INTEGER PRIMARY KEY AUTOINCREMENT, " |
161 "name VARCHAR(255) NOT NULL, " |
170 "name VARCHAR(255) NOT NULL, " |
162 "channelID INTEGER, " |
171 "channelID INTEGER, " |
163 "imageURL VARCHAR(255), " |
172 "imageURL VARCHAR(255), " |