Results 1 to 1 of 1

Thread: Recursion Problem

  1. #1
    Join Date
    Jan 2010
    Posts
    12
    Qt products
    Qt4
    Platforms
    Unix/X11

    Default Recursion Problem

    Hey there,

    for some Reason this recursion never ends.
    What is wrong?
    Little Explanation: The Query is sent to a PHP Backend that does the SQL Query and prints the Data.

    Oh, and In my Db There are only 3 entries, which all have the pId 0. But for some reason The pId 1 also gives 3 entries??

    Qt Code:
    1. void DirParser::getSubDirs(Dir* dir) {
    2. buffer->seek(0);
    3. QString query = "SELECT%20*%20FROM%20dirs%20WHERE%20pId="+QString().setNum(dir->getId());
    4. //http->post("/backend.php", ("pw="+backendPw+"&query="+query).toAscii(), buffer);
    5. http->syncGet("/backend.php?pw="+backendPw+"&query="+query, buffer);
    6. box.setText(QString(buffer->data().data()));
    7. box.exec();
    8. QList<QByteArray> lines = buffer->data().split('\n');
    9. foreach(QByteArray line, lines) {
    10. QString values;
    11. for(int i=0;i<line.size();i++)
    12. values += line[i];
    13. QStringList attr = values.split('\t');
    14. if(attr.count() == 5)
    15. dir->children.append(new Dir(dir, attr[0].toInt(), attr[2], attr[3]));
    16. }
    17. }
    18.  
    19. void DirParser::parseDirStructure(Dir* dir) {
    20. getSubDirs(dir);
    21. foreach(Dir* child, dir->children)
    22. parseDirStructure(child);
    23. }
    To copy to clipboard, switch view to plain text mode 


    JUST SOLVED IT !!!
    I have to delete the buffer everytime, because, else there is the old data still in it.
    Last edited by kingfinn; 23rd January 2010 at 22:32.

Similar Threads

  1. endless recursion with QDir
    By roxton in forum Qt Programming
    Replies: 2
    Last Post: 17th January 2009, 00:04
  2. Replies: 5
    Last Post: 20th November 2007, 13:19
  3. Singleton pattern - end in recursion
    By probine in forum General Programming
    Replies: 6
    Last Post: 29th March 2006, 14:08

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Digia, Qt and their respective logos are trademarks of Digia Plc in Finland and/or other countries worldwide.