From: <nor...@us...> - 2007-06-25 20:33:53
|
Revision: 630 http://mp-plugins.svn.sourceforge.net/mp-plugins/?rev=630&view=rev Author: northern_sky Date: 2007-06-25 13:33:27 -0700 (Mon, 25 Jun 2007) Log Message: ----------- dbsettings merged in dbhandler Modified Paths: -------------- trunk/plugins/myGUIProgramsAlt/GUIProgramsAlt/GUIProgramsAlt.csproj Removed Paths: ------------- trunk/plugins/myGUIProgramsAlt/GUIProgramsAlt/Database/DatabaseSettings.cs Deleted: trunk/plugins/myGUIProgramsAlt/GUIProgramsAlt/Database/DatabaseSettings.cs =================================================================== --- trunk/plugins/myGUIProgramsAlt/GUIProgramsAlt/Database/DatabaseSettings.cs 2007-06-25 20:28:17 UTC (rev 629) +++ trunk/plugins/myGUIProgramsAlt/GUIProgramsAlt/Database/DatabaseSettings.cs 2007-06-25 20:33:27 UTC (rev 630) @@ -1,126 +0,0 @@ -#region Copyright (C) 2005-2007 Team MediaPortal - -/* - * Copyright (C) 2005-2007 Team MediaPortal - * http://www.team-mediaportal.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, 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 GNU Make; see the file COPYING. If not, write to - * the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA. - * http://www.gnu.org/copyleft/gpl.html - * - */ - -#endregion - -using System; -using System.Collections; -using SQLite.NET; - - -namespace GUIPrograms.Database -{ - /// <summary> - /// Summary description for DatabaseSettings. - /// </summary> - public class DatabaseSettings - { - static public SQLiteClient sqlDB = null; - static public ProgramViewHandler viewHandler = null; - - // singleton. Dont allow any instance of this class - private DatabaseSettings() { } - - static DatabaseSettings() { } - - static public string ReadSetting(string Key) - { - SQLiteResultSet results; - string res = null; - string SQL = @" - SELECT - value - - FROM - tblSetting - - WHERE - key ='" + Key + "'"; - - results = sqlDB.Execute(SQL); - - if (results != null && results.Rows.Count > 0) - { - SQLiteResultSet.Row arr = results.Rows[0]; - res = arr.fields[0]; - } - //Log.Info("dw read setting key:{0}\nvalue:{1}", Key, applicationItem); - return res; - } - - static int CountKey(string Key) - { - SQLiteResultSet results; - int res = 0; - results = sqlDB.Execute(@" - SELECT - COUNT(*) - - FROM - tblSetting - - WHERE key ='" + Key + "'"); - - if (results != null && results.Rows.Count > 0) - { - SQLiteResultSet.Row arr = results.Rows[0]; - res = Int32.Parse(arr.fields[0]); - } - return res; - } - - static public bool KeyExists(string Key) - { - return (CountKey(Key) > 0); - } - - static public void WriteSetting(string Key, string Value) - { - if (KeyExists(Key)) - { - sqlDB.Execute(@" - UPDATE - tblSetting - - SET - value = '" + Value + @"' - - WHERE - key = '" + Key + "'"); - } - else - { - sqlDB.Execute(@" - INSERT INTO - tblSetting (key, value) - - VALUES('" + Key + "', '" + Value + "')"); - } - } - - static public void DeleteSetting(string Key) - { - sqlDB.Execute("DELETE FROM tblSetting WHERE key = '" + Key + "'"); - } - } -} Modified: trunk/plugins/myGUIProgramsAlt/GUIProgramsAlt/GUIProgramsAlt.csproj =================================================================== --- trunk/plugins/myGUIProgramsAlt/GUIProgramsAlt/GUIProgramsAlt.csproj 2007-06-25 20:28:17 UTC (rev 629) +++ trunk/plugins/myGUIProgramsAlt/GUIProgramsAlt/GUIProgramsAlt.csproj 2007-06-25 20:33:27 UTC (rev 630) @@ -62,7 +62,6 @@ <Compile Include="ApplicationItems\ApplicationItemList.cs" /> <Compile Include="ApplicationItems\ApplicationItemMame.cs" /> <Compile Include="Database\DatabaseHandler.cs" /> - <Compile Include="Database\DatabaseSettings.cs" /> <Compile Include="Database\DatabaseSorter.cs" /> <Compile Include="Design\AppFilesImportProgress.cs"> <SubType>UserControl</SubType> This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |