/************************* * * * * * * * * * * * * *************************** Copyright (c) 1999-2005 Ryan Bobko ryan@ostrich-emulators.com This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. ************************** * * * * * * * * * * * * **************************/ #include "lfsqliteplugin.h" #include "localfileplugin.h" #include "qhacctable.h" #include "qhaccutils.h" #include "qhacc.h" #include #include #include // "factory" function calls extern "C" { QHaccPlugin * create(){ return new LFSQLiteDBPlugin; } void destroy( LFSQLiteDBPlugin * p ){ delete p; } } const LFSQLiteInfo LFSQLiteDBPlugin::pinfo; /* * This class is sort of a hybrid of LocalFilesDBPlugin and SQLiteDBPlugin * That is, it reads and writes data to the filesystem just like a LFDB, but * operates on an in-memory SQLite database. */ LFSQLiteDBPlugin::LFSQLiteDBPlugin() : SQLiteDBPlugin(){ conn=0; } LFSQLiteDBPlugin::~LFSQLiteDBPlugin(){ if( conn ) #ifdef SQLITE3 sqlite3_close( conn ); #else sqlite_close( conn ); #endif } const PluginInfo& LFSQLiteDBPlugin::info() const { return pinfo; } bool LFSQLiteDBPlugin::save( QString& err ){ bool ret=true; for( int i=0; i rslt=getWhere( ( Table )i, TableSelect(), rr ); QHaccTable tbl( *rslt ); tbl.setName( QString( "t_" )+QC::TABLENAMES[i] ); ret=( ret && LocalFileDBPlugin::savet( tbl, home+"/"+QC::TABLENAMES[i], !engine->getBP( "KEEPFILEPERMS" ), err ) ); } if( ret ) needsave=!ret; return ret; } bool LFSQLiteDBPlugin::load( QString& err ){ bool ret=true; for( int i=0; i tp=LocalFileDBPlugin::pinfo.prefs(); piprefs=tp; }