/[svn]/linuxsampler/trunk/src/network/lscpserver.cpp
ViewVC logotype

Diff of /linuxsampler/trunk/src/network/lscpserver.cpp

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 392 by schoenebeck, Sat Feb 19 02:40:24 2005 UTC revision 397 by senkov, Mon Feb 21 04:28:50 2005 UTC
# Line 24  Line 24 
24  #include "lscpserver.h"  #include "lscpserver.h"
25  #include "lscpresultset.h"  #include "lscpresultset.h"
26  #include "lscpevent.h"  #include "lscpevent.h"
27    //#include "../common/global.h"
28    
29    #ifdef HAVE_SQLITE3
30    #include "sqlite3.h"
31    #endif
32    
33  #include "../engines/gig/Engine.h"  #include "../engines/gig/Engine.h"
34  #include "../drivers/audio/AudioOutputDeviceFactory.h"  #include "../drivers/audio/AudioOutputDeviceFactory.h"
# Line 1393  String LSCPServer::UnsubscribeNotificati Line 1398  String LSCPServer::UnsubscribeNotificati
1398      return result.Produce();      return result.Produce();
1399  }  }
1400    
1401    static int select_callback(void * lscpResultSet, int argc,
1402                            char **argv, char **azColName)
1403    {
1404        LSCPResultSet* resultSet = (LSCPResultSet*) lscpResultSet;
1405        resultSet->Add(argc, argv);
1406        return 0;
1407    }
1408    
1409    String LSCPServer::QueryDatabase(String query) {
1410        LSCPResultSet result;
1411    #ifdef HAVE_SQLITE3
1412        char* zErrMsg = NULL;
1413        sqlite3 *db;
1414        String selectStr = "SELECT " + query;
1415    
1416        int rc = sqlite3_open("linuxsampler.db", &db);
1417        if (rc == SQLITE_OK)
1418        {
1419                rc = sqlite3_exec(db, selectStr.c_str(), select_callback, &result, &zErrMsg);
1420        }
1421        if ( rc != SQLITE_OK )
1422        {
1423                //result.Error(String(zErrMsg), rc);
1424                result.Error(selectStr, 666);
1425        }
1426        sqlite3_close(db);
1427    #else
1428        result.Error(String("SQLITE3 was not installed when linuxsampler was built. SELECT statement is not available."), 0);
1429    #endif
1430        return result.Produce();
1431    }
1432    
1433  /**  /**
1434   * Will be called by the parser to enable or disable echo mode; if echo   * Will be called by the parser to enable or disable echo mode; if echo
1435   * mode is enabled, all commands from the client will (immediately) be   * mode is enabled, all commands from the client will (immediately) be

Legend:
Removed from v.392  
changed lines
  Added in v.397

  ViewVC Help
Powered by ViewVC