diff options
author | Adam Frisby | 2007-05-28 21:55:50 +0000 |
---|---|---|
committer | Adam Frisby | 2007-05-28 21:55:50 +0000 |
commit | 24f613d244f20a504bbff25815c93b7616366ea6 (patch) | |
tree | 737bb5a403e17b978f307c790f5141eb31191251 /OpenGridServices/OpenGrid.Framework.Data.MySQL | |
parent | * Added ILogData interface to Grid.Framework.Data - to be used for saving log... (diff) | |
download | opensim-SC-24f613d244f20a504bbff25815c93b7616366ea6.zip opensim-SC-24f613d244f20a504bbff25815c93b7616366ea6.tar.gz opensim-SC-24f613d244f20a504bbff25815c93b7616366ea6.tar.bz2 opensim-SC-24f613d244f20a504bbff25815c93b7616366ea6.tar.xz |
Zomg wtf bbq logdata!
Diffstat (limited to 'OpenGridServices/OpenGrid.Framework.Data.MySQL')
3 files changed, 95 insertions, 15 deletions
diff --git a/OpenGridServices/OpenGrid.Framework.Data.MySQL/MySQLLogData.cs b/OpenGridServices/OpenGrid.Framework.Data.MySQL/MySQLLogData.cs new file mode 100644 index 0000000..f1610ec --- /dev/null +++ b/OpenGridServices/OpenGrid.Framework.Data.MySQL/MySQLLogData.cs | |||
@@ -0,0 +1,39 @@ | |||
1 | using System; | ||
2 | using System.Collections.Generic; | ||
3 | using System.Text; | ||
4 | |||
5 | namespace OpenGrid.Framework.Data.MySQL | ||
6 | { | ||
7 | class MySQLLogData : ILogData | ||
8 | { | ||
9 | public MySQLManager database; | ||
10 | |||
11 | public void Initialise() | ||
12 | { | ||
13 | IniFile GridDataMySqlFile = new IniFile("mysql_connection.ini"); | ||
14 | string settingHostname = GridDataMySqlFile.ParseFileReadValue("hostname"); | ||
15 | string settingDatabase = GridDataMySqlFile.ParseFileReadValue("database"); | ||
16 | string settingUsername = GridDataMySqlFile.ParseFileReadValue("username"); | ||
17 | string settingPassword = GridDataMySqlFile.ParseFileReadValue("password"); | ||
18 | string settingPooling = GridDataMySqlFile.ParseFileReadValue("pooling"); | ||
19 | string settingPort = GridDataMySqlFile.ParseFileReadValue("port"); | ||
20 | |||
21 | database = new MySQLManager(settingHostname, settingDatabase, settingUsername, settingPassword, settingPooling, settingPort); | ||
22 | } | ||
23 | |||
24 | public void saveLog(string serverDaemon, string target, string methodCall, string arguments, int priority, string logMessage) | ||
25 | { | ||
26 | database.insertLogRow(serverDaemon, target, methodCall, arguments, priority, logMessage); | ||
27 | } | ||
28 | |||
29 | public string getName() | ||
30 | { | ||
31 | return "MySQL Logdata Interface"; | ||
32 | } | ||
33 | |||
34 | public string getVersion() | ||
35 | { | ||
36 | return "0.1"; | ||
37 | } | ||
38 | } | ||
39 | } | ||
diff --git a/OpenGridServices/OpenGrid.Framework.Data.MySQL/MySQLManager.cs b/OpenGridServices/OpenGrid.Framework.Data.MySQL/MySQLManager.cs index ea7e2ac..1f7413f 100644 --- a/OpenGridServices/OpenGrid.Framework.Data.MySQL/MySQLManager.cs +++ b/OpenGridServices/OpenGrid.Framework.Data.MySQL/MySQLManager.cs | |||
@@ -207,6 +207,39 @@ namespace OpenGrid.Framework.Data.MySQL | |||
207 | return retval; | 207 | return retval; |
208 | } | 208 | } |
209 | 209 | ||
210 | public bool insertLogRow(string serverDaemon, string target, string methodCall, string arguments, int priority, string logMessage) | ||
211 | { | ||
212 | string sql = "INSERT INTO logs (target, server, method, arguments, priority, message) VALUES ("; | ||
213 | sql += "(?target, ?server, ?method, ?arguments, ?priority, ?message)"; | ||
214 | |||
215 | Dictionary<string, string> parameters = new Dictionary<string, string>(); | ||
216 | parameters["?server"] = serverDaemon; | ||
217 | parameters["?target"] = target; | ||
218 | parameters["?method"] = methodCall; | ||
219 | parameters["?arguments"] = arguments; | ||
220 | parameters["?priority"] = priority.ToString(); | ||
221 | parameters["?message"] = logMessage; | ||
222 | |||
223 | bool returnval = false; | ||
224 | |||
225 | try | ||
226 | { | ||
227 | IDbCommand result = Query(sql, parameters); | ||
228 | |||
229 | if (result.ExecuteNonQuery() == 1) | ||
230 | returnval = true; | ||
231 | |||
232 | result.Dispose(); | ||
233 | } | ||
234 | catch (Exception e) | ||
235 | { | ||
236 | Console.WriteLine(e.ToString()); | ||
237 | return false; | ||
238 | } | ||
239 | |||
240 | return returnval; | ||
241 | } | ||
242 | |||
210 | public bool insertRow(SimProfileData profile) | 243 | public bool insertRow(SimProfileData profile) |
211 | { | 244 | { |
212 | string sql = "REPLACE INTO regions (regionHandle, regionName, uuid, regionRecvKey, regionSecret, regionSendKey, regionDataURI, "; | 245 | string sql = "REPLACE INTO regions (regionHandle, regionName, uuid, regionRecvKey, regionSecret, regionSendKey, regionDataURI, "; |
diff --git a/OpenGridServices/OpenGrid.Framework.Data.MySQL/OpenGrid.Framework.Data.MySQL.csproj b/OpenGridServices/OpenGrid.Framework.Data.MySQL/OpenGrid.Framework.Data.MySQL.csproj index 9a1703a..93f409e 100644 --- a/OpenGridServices/OpenGrid.Framework.Data.MySQL/OpenGrid.Framework.Data.MySQL.csproj +++ b/OpenGridServices/OpenGrid.Framework.Data.MySQL/OpenGrid.Framework.Data.MySQL.csproj | |||
@@ -1,4 +1,4 @@ | |||
1 | <Project DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003"> | 1 | <Project DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003"> |
2 | <PropertyGroup> | 2 | <PropertyGroup> |
3 | <ProjectType>Local</ProjectType> | 3 | <ProjectType>Local</ProjectType> |
4 | <ProductVersion>8.0.50727</ProductVersion> | 4 | <ProductVersion>8.0.50727</ProductVersion> |
@@ -6,7 +6,8 @@ | |||
6 | <ProjectGuid>{0F3C3AC1-0000-0000-0000-000000000000}</ProjectGuid> | 6 | <ProjectGuid>{0F3C3AC1-0000-0000-0000-000000000000}</ProjectGuid> |
7 | <Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration> | 7 | <Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration> |
8 | <Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform> | 8 | <Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform> |
9 | <ApplicationIcon></ApplicationIcon> | 9 | <ApplicationIcon> |
10 | </ApplicationIcon> | ||
10 | <AssemblyKeyContainerName> | 11 | <AssemblyKeyContainerName> |
11 | </AssemblyKeyContainerName> | 12 | </AssemblyKeyContainerName> |
12 | <AssemblyName>OpenGrid.Framework.Data.MySQL</AssemblyName> | 13 | <AssemblyName>OpenGrid.Framework.Data.MySQL</AssemblyName> |
@@ -15,9 +16,11 @@ | |||
15 | <DefaultTargetSchema>IE50</DefaultTargetSchema> | 16 | <DefaultTargetSchema>IE50</DefaultTargetSchema> |
16 | <DelaySign>false</DelaySign> | 17 | <DelaySign>false</DelaySign> |
17 | <OutputType>Library</OutputType> | 18 | <OutputType>Library</OutputType> |
18 | <AppDesignerFolder></AppDesignerFolder> | 19 | <AppDesignerFolder> |
20 | </AppDesignerFolder> | ||
19 | <RootNamespace>OpenGrid.Framework.Data.MySQL</RootNamespace> | 21 | <RootNamespace>OpenGrid.Framework.Data.MySQL</RootNamespace> |
20 | <StartupObject></StartupObject> | 22 | <StartupObject> |
23 | </StartupObject> | ||
21 | <FileUpgradeFlags> | 24 | <FileUpgradeFlags> |
22 | </FileUpgradeFlags> | 25 | </FileUpgradeFlags> |
23 | </PropertyGroup> | 26 | </PropertyGroup> |
@@ -28,7 +31,8 @@ | |||
28 | <ConfigurationOverrideFile> | 31 | <ConfigurationOverrideFile> |
29 | </ConfigurationOverrideFile> | 32 | </ConfigurationOverrideFile> |
30 | <DefineConstants>TRACE;DEBUG</DefineConstants> | 33 | <DefineConstants>TRACE;DEBUG</DefineConstants> |
31 | <DocumentationFile></DocumentationFile> | 34 | <DocumentationFile> |
35 | </DocumentationFile> | ||
32 | <DebugSymbols>True</DebugSymbols> | 36 | <DebugSymbols>True</DebugSymbols> |
33 | <FileAlignment>4096</FileAlignment> | 37 | <FileAlignment>4096</FileAlignment> |
34 | <Optimize>False</Optimize> | 38 | <Optimize>False</Optimize> |
@@ -37,7 +41,8 @@ | |||
37 | <RemoveIntegerChecks>False</RemoveIntegerChecks> | 41 | <RemoveIntegerChecks>False</RemoveIntegerChecks> |
38 | <TreatWarningsAsErrors>False</TreatWarningsAsErrors> | 42 | <TreatWarningsAsErrors>False</TreatWarningsAsErrors> |
39 | <WarningLevel>4</WarningLevel> | 43 | <WarningLevel>4</WarningLevel> |
40 | <NoWarn></NoWarn> | 44 | <NoWarn> |
45 | </NoWarn> | ||
41 | </PropertyGroup> | 46 | </PropertyGroup> |
42 | <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' "> | 47 | <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' "> |
43 | <AllowUnsafeBlocks>False</AllowUnsafeBlocks> | 48 | <AllowUnsafeBlocks>False</AllowUnsafeBlocks> |
@@ -46,7 +51,8 @@ | |||
46 | <ConfigurationOverrideFile> | 51 | <ConfigurationOverrideFile> |
47 | </ConfigurationOverrideFile> | 52 | </ConfigurationOverrideFile> |
48 | <DefineConstants>TRACE</DefineConstants> | 53 | <DefineConstants>TRACE</DefineConstants> |
49 | <DocumentationFile></DocumentationFile> | 54 | <DocumentationFile> |
55 | </DocumentationFile> | ||
50 | <DebugSymbols>False</DebugSymbols> | 56 | <DebugSymbols>False</DebugSymbols> |
51 | <FileAlignment>4096</FileAlignment> | 57 | <FileAlignment>4096</FileAlignment> |
52 | <Optimize>True</Optimize> | 58 | <Optimize>True</Optimize> |
@@ -55,26 +61,27 @@ | |||
55 | <RemoveIntegerChecks>False</RemoveIntegerChecks> | 61 | <RemoveIntegerChecks>False</RemoveIntegerChecks> |
56 | <TreatWarningsAsErrors>False</TreatWarningsAsErrors> | 62 | <TreatWarningsAsErrors>False</TreatWarningsAsErrors> |
57 | <WarningLevel>4</WarningLevel> | 63 | <WarningLevel>4</WarningLevel> |
58 | <NoWarn></NoWarn> | 64 | <NoWarn> |
65 | </NoWarn> | ||
59 | </PropertyGroup> | 66 | </PropertyGroup> |
60 | <ItemGroup> | 67 | <ItemGroup> |
61 | <Reference Include="System" > | 68 | <Reference Include="System"> |
62 | <HintPath>System.dll</HintPath> | 69 | <HintPath>System.dll</HintPath> |
63 | <Private>False</Private> | 70 | <Private>False</Private> |
64 | </Reference> | 71 | </Reference> |
65 | <Reference Include="System.Xml" > | 72 | <Reference Include="System.Xml"> |
66 | <HintPath>System.Xml.dll</HintPath> | 73 | <HintPath>System.Xml.dll</HintPath> |
67 | <Private>False</Private> | 74 | <Private>False</Private> |
68 | </Reference> | 75 | </Reference> |
69 | <Reference Include="System.Data" > | 76 | <Reference Include="System.Data"> |
70 | <HintPath>System.Data.dll</HintPath> | 77 | <HintPath>System.Data.dll</HintPath> |
71 | <Private>False</Private> | 78 | <Private>False</Private> |
72 | </Reference> | 79 | </Reference> |
73 | <Reference Include="libsecondlife.dll" > | 80 | <Reference Include="libsecondlife.dll"> |
74 | <HintPath>..\..\bin\libsecondlife.dll</HintPath> | 81 | <HintPath>..\..\bin\libsecondlife.dll</HintPath> |
75 | <Private>False</Private> | 82 | <Private>False</Private> |
76 | </Reference> | 83 | </Reference> |
77 | <Reference Include="MySql.Data.dll" > | 84 | <Reference Include="MySql.Data.dll"> |
78 | <HintPath>..\..\bin\MySql.Data.dll</HintPath> | 85 | <HintPath>..\..\bin\MySql.Data.dll</HintPath> |
79 | <Private>False</Private> | 86 | <Private>False</Private> |
80 | </Reference> | 87 | </Reference> |
@@ -84,13 +91,14 @@ | |||
84 | <Name>OpenGrid.Framework.Data</Name> | 91 | <Name>OpenGrid.Framework.Data</Name> |
85 | <Project>{62CDF671-0000-0000-0000-000000000000}</Project> | 92 | <Project>{62CDF671-0000-0000-0000-000000000000}</Project> |
86 | <Package>{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</Package> | 93 | <Package>{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</Package> |
87 | <Private>False</Private> | 94 | <Private>False</Private> |
88 | </ProjectReference> | 95 | </ProjectReference> |
89 | </ItemGroup> | 96 | </ItemGroup> |
90 | <ItemGroup> | 97 | <ItemGroup> |
91 | <Compile Include="MySQLGridData.cs"> | 98 | <Compile Include="MySQLGridData.cs"> |
92 | <SubType>Code</SubType> | 99 | <SubType>Code</SubType> |
93 | </Compile> | 100 | </Compile> |
101 | <Compile Include="MySQLLogData.cs" /> | ||
94 | <Compile Include="MySQLManager.cs"> | 102 | <Compile Include="MySQLManager.cs"> |
95 | <SubType>Code</SubType> | 103 | <SubType>Code</SubType> |
96 | </Compile> | 104 | </Compile> |
@@ -108,4 +116,4 @@ | |||
108 | <PostBuildEvent> | 116 | <PostBuildEvent> |
109 | </PostBuildEvent> | 117 | </PostBuildEvent> |
110 | </PropertyGroup> | 118 | </PropertyGroup> |
111 | </Project> | 119 | </Project> \ No newline at end of file |