Main Page | Class Hierarchy | Class List | File List | Class Members | File Members

reindex.ui.h

Go to the documentation of this file.
00001 /***************************************************************************
00002  *                                                                         *
00003  *   reindex.ui.h                                                                  *
00004  *                                                                         *
00005  *   This program is free software; you can redistribute it and/or modify  *
00006  *   it under the terms of the GNU General Public License as published by  *
00007  *   the Free Software Foundation; either version 2 of the License, or     *
00008  *   (at your option) any later version.                                   *
00009  *                                                                         *
00010  *   Read the file COPYING for details.                                    *
00011  *                                                                         *
00012  *   copyright: (C) 2003 by Jan Mueller                                    *
00013  *   email: janmueller7@hotmail.com                                        *
00014  *                                                                         *
00015  ***************************************************************************/
00016 
00017 /****************************************************************************
00018  ** ui.h extension file, included from the uic-generated form implementation.
00019  **
00020  ** If you wish to add, delete or rename functions or slots use
00021  ** Qt Designer which will update this file, preserving your code. Create an
00022  ** init() function in place of a constructor, and a destroy() function in
00023  ** place of a destructor.
00024  *****************************************************************************/
00025 
00026 void ReIndex::start() {
00027   debug("Reindex::start()");
00028   int i=0;
00029   QSqlQuery q("select count(*) from partdata");
00030   int count=q.value(0).toInt();
00031   progress->setTotalSteps(count);
00032     
00033   q.exec("select no, filename from partdata");// where no=15528");
00034   while(q.next()) {
00035     i++;
00036     filename->setText(q.value(1).toString());
00037     
00038     QString file="/tmp/test_reindex";
00039     QFile f(file);
00040     f.open(IO_WriteOnly | IO_Truncate);
00041     
00042     QSqlQuery p("select no from file where partdata_no="+q.value(0).toString()+" order by chunk_no");
00043     int j=0;
00044     while(p.next()) {
00045       qApp->processEvents();
00046       QSqlQuery r("select chunk from file where no="+p.value(0).toString());
00047       r.first();
00048       QByteArray buf;
00049       KCodecs::base64Decode(r.value(0).asCString(), buf);
00050       //      buf.resize(buf.count()-2);
00051       f.writeBlock(qUncompress(buf));
00052       j++;
00053       QFile d("/tmp/block"+QString().setNum(j));
00054       d.open(IO_WriteOnly);
00055       d.writeBlock(qUncompress(buf));
00056       d.close();
00057     }
00058     f.close();
00059       
00060     Convert2Text conv;
00061     QString text;
00062     debug("Reindex::start()");
00063     try {
00064       if(conv.mime2text("/tmp/test_reindex", text)) {
00065         QSqlQuery r;
00066         r.exec("update partdata set astext='' where no="+q.value(0). toString());
00067         r.prepare("update partdata set astext=? where no="+q.value(0).toString());
00068         r.bindValue(0, text.simplifyWhiteSpace());
00069         r.exec();
00070       }
00071     } catch(...) {
00072     }
00073     progress->setProgress(i);
00074     qApp->processEvents();    
00075   }
00076   progress->setProgress(count);
00077 }

Generated on Sat Mar 27 19:20:44 2004 for Literature by doxygen 1.3.6-20040222