qtinternetradio/ui/src/irsearchresultdb.cpp
changeset 11 f683e24efca3
parent 8 3b03c28289e6
child 17 38bbf2dcd608
--- a/qtinternetradio/ui/src/irsearchresultdb.cpp	Fri Jun 11 13:30:40 2010 +0300
+++ b/qtinternetradio/ui/src/irsearchresultdb.cpp	Wed Jun 23 18:04:00 2010 +0300
@@ -62,7 +62,14 @@
             QString name = insertItem->channelName;
             int channelID = insertItem->channelID;
             QString imageURL = insertItem->imageURL;
-            QString description = insertItem->shortDescription;            
+            QString description = insertItem->shortDescription;
+            
+            //if some data overflows, we just skip it.note that
+            //the VARCHAR is word-based, so here we use the real size 
+            if( name.size()>= 256 || imageURL.size() >= 256 || description.size() >= 256 )
+            {
+                continue;
+            }            
             
             QSqlQuery query;
             bool result;
@@ -156,6 +163,8 @@
     {
         bool dbResult = false;
         QSqlQuery query;         
+        //note: the VARCHAR is word-based but not byte-based. and 255 
+        //means 255 unicode words.
         dbResult = query.exec("CREATE TABLE searchresult ("
             "id INTEGER PRIMARY KEY AUTOINCREMENT, "
             "name VARCHAR(255) NOT NULL, "