<?xml version="1.0" encoding="UTF-8"?><rss xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:atom="http://www.w3.org/2005/Atom" version="2.0"><channel><title><![CDATA[Select data from QSqlite in thread]]></title><description><![CDATA[<p dir="auto">I have used the thread to read data from QSqlite database</p>
<pre><code>void RandomWalk::run()
{
    qDebug("Thread id inside run %d", (int)QThread::currentThreadId());

    QSqlQuery  qry(db);
    qry.prepare( "SELECT * FROM  TEST  ");
      if( !qry.exec() )
        qDebug() &lt;&lt;"here"&lt;&lt; qry.lastError();
      else
      {
        qDebug( "Selected!" );

        QSqlRecord rec = qry.record();
       

       for( int r=0; qry.next(); r++ ){
          qDebug() &lt;&lt; QString( "Row %1, %2: %3" ).arg( r ).arg( rec.fieldName(0) ).arg( qry.value(0).toString() );

            qDebug() &lt;&lt; QString( "Row %1, %2: %3" ).arg( r ).arg( rec.fieldName(1) ).arg( qry.value(1).toString() );

          }
      }
}
</code></pre>
<p dir="auto">I don't use sleep in thread and it starts with : thread-&gt;start();<br />
the output like :</p>
<pre><code>"Row 0, Field1: 77"
"Row 0, Field2: 87"
"Row 1, Field1: 77"
"Row 1, Field2: 87"
"Row 2, Field1: 77"
"Row 2, Field2: 87"
"Row 3, Field1: 76"
"Row 3, Field2: 86"
"Row 4, Field1: 77"








"Row 4, Field2: 87"
"Row 5, Field1: 77"
"Row 5, Field2: 87"
"Row 6, Field1: 77"
"Row 6, Field2: 87"
"Row 7, Field1: 77"
"Row 7, Field2: 87"






....
</code></pre>
<p dir="auto">Why is space between output data?Why is not read data continuous?</p>
]]></description><link>https://forum.qt.io/topic/105350/select-data-from-qsqlite-in-thread</link><generator>RSS for Node</generator><lastBuildDate>Thu, 23 Apr 2026 23:35:45 GMT</lastBuildDate><atom:link href="https://forum.qt.io/topic/105350.rss" rel="self" type="application/rss+xml"/><pubDate>Thu, 25 Jul 2019 21:12:22 GMT</pubDate><ttl>60</ttl><item><title><![CDATA[Reply to Select data from QSqlite in thread on Fri, 26 Jul 2019 13:06:23 GMT]]></title><description><![CDATA[<p dir="auto"><a class="plugin-mentions-user plugin-mentions-a" href="/user/isan">@<bdi>isan</bdi></a><br />
As the others say, you might have non-printing bytes in the column in the database.  For your debug line try something like:</p>
<pre><code>qry.value(0).toString().toLatin1().toHex()
</code></pre>
<p dir="auto">in order to see what is actually in there.</p>
]]></description><link>https://forum.qt.io/post/543072</link><guid isPermaLink="true">https://forum.qt.io/post/543072</guid><dc:creator><![CDATA[JonB]]></dc:creator><pubDate>Fri, 26 Jul 2019 13:06:23 GMT</pubDate></item><item><title><![CDATA[Reply to Select data from QSqlite in thread on Fri, 26 Jul 2019 04:28:30 GMT]]></title><description><![CDATA[<p dir="auto"><a class="plugin-mentions-user plugin-mentions-a" href="/user/isan">@<bdi>isan</bdi></a> Maybe you have an entry in the database containing many newlines at the end?<br />
Use the debugger to see what data you get in each line.<br />
Also, these empty lines could be from another (main for example)  thread.</p>
]]></description><link>https://forum.qt.io/post/542992</link><guid isPermaLink="true">https://forum.qt.io/post/542992</guid><dc:creator><![CDATA[jsulm]]></dc:creator><pubDate>Fri, 26 Jul 2019 04:28:30 GMT</pubDate></item><item><title><![CDATA[Reply to Select data from QSqlite in thread on Thu, 25 Jul 2019 21:27:19 GMT]]></title><description><![CDATA[<p dir="auto">Each time you call qdebug, you get a new line printed on the console.</p>
]]></description><link>https://forum.qt.io/post/542981</link><guid isPermaLink="true">https://forum.qt.io/post/542981</guid><dc:creator><![CDATA[SGaist]]></dc:creator><pubDate>Thu, 25 Jul 2019 21:27:19 GMT</pubDate></item><item><title><![CDATA[Reply to Select data from QSqlite in thread on Thu, 25 Jul 2019 21:19:07 GMT]]></title><description><![CDATA[<p dir="auto"><a class="plugin-mentions-user plugin-mentions-a" href="/user/sgaist">@<bdi>SGaist</bdi></a> Hi , the space between Rows 4<br />
The output shouldn't continuous? like this:</p>
<pre><code>"Row 0, Field1: 77"
"Row 0, Field2: 87"
"Row 1, Field1: 77"
"Row 1, Field2: 87"
"Row 2, Field1: 77"
"Row 2, Field2: 87"
"Row 3, Field1: 76"
"Row 3, Field2: 86"
"Row 4, Field1: 77"
"Row 4, Field2: 87"
"Row 5, Field1: 77"
"Row 5, Field2: 87"
"Row 6, Field1: 77"
"Row 6, Field2: 87"
"Row 7, Field1: 77"
"Row 7, Field2: 87"
....
</code></pre>
]]></description><link>https://forum.qt.io/post/542978</link><guid isPermaLink="true">https://forum.qt.io/post/542978</guid><dc:creator><![CDATA[isan]]></dc:creator><pubDate>Thu, 25 Jul 2019 21:19:07 GMT</pubDate></item><item><title><![CDATA[Reply to Select data from QSqlite in thread on Thu, 25 Jul 2019 21:14:49 GMT]]></title><description><![CDATA[<p dir="auto">Hi,</p>
<p dir="auto">What do you mean by space ?<br />
What is the expected output ?</p>
]]></description><link>https://forum.qt.io/post/542976</link><guid isPermaLink="true">https://forum.qt.io/post/542976</guid><dc:creator><![CDATA[SGaist]]></dc:creator><pubDate>Thu, 25 Jul 2019 21:14:49 GMT</pubDate></item></channel></rss>