aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Grid/AssetInventoryServer/Extensions/DBConnString.cs
diff options
context:
space:
mode:
authorMike Mazur2009-02-16 02:25:44 +0000
committerMike Mazur2009-02-16 02:25:44 +0000
commit16fa7f516a484e9f21fac34262214b3d9d761823 (patch)
tree925c10831c04d053b707857ffa785482316d4dcb /OpenSim/Grid/AssetInventoryServer/Extensions/DBConnString.cs
parentAdded OpenSim asset frontend plugin. (diff)
downloadopensim-SC_OLD-16fa7f516a484e9f21fac34262214b3d9d761823.zip
opensim-SC_OLD-16fa7f516a484e9f21fac34262214b3d9d761823.tar.gz
opensim-SC_OLD-16fa7f516a484e9f21fac34262214b3d9d761823.tar.bz2
opensim-SC_OLD-16fa7f516a484e9f21fac34262214b3d9d761823.tar.xz
Converted to Linux newlines.
Diffstat (limited to '')
-rw-r--r--OpenSim/Grid/AssetInventoryServer/Extensions/DBConnString.cs156
1 files changed, 78 insertions, 78 deletions
diff --git a/OpenSim/Grid/AssetInventoryServer/Extensions/DBConnString.cs b/OpenSim/Grid/AssetInventoryServer/Extensions/DBConnString.cs
index 58054d6..78761be 100644
--- a/OpenSim/Grid/AssetInventoryServer/Extensions/DBConnString.cs
+++ b/OpenSim/Grid/AssetInventoryServer/Extensions/DBConnString.cs
@@ -1,78 +1,78 @@
1/* 1/*
2 * Copyright (c) 2008 Intel Corporation 2 * Copyright (c) 2008 Intel Corporation
3 * All rights reserved. 3 * All rights reserved.
4 * Redistribution and use in source and binary forms, with or without 4 * Redistribution and use in source and binary forms, with or without
5 * modification, are permitted provided that the following conditions 5 * modification, are permitted provided that the following conditions
6 * are met: 6 * are met:
7 * 7 *
8 * -- Redistributions of source code must retain the above copyright 8 * -- Redistributions of source code must retain the above copyright
9 * notice, this list of conditions and the following disclaimer. 9 * notice, this list of conditions and the following disclaimer.
10 * -- Redistributions in binary form must reproduce the above copyright 10 * -- Redistributions in binary form must reproduce the above copyright
11 * notice, this list of conditions and the following disclaimer in the 11 * notice, this list of conditions and the following disclaimer in the
12 * documentation and/or other materials provided with the distribution. 12 * documentation and/or other materials provided with the distribution.
13 * -- Neither the name of the Intel Corporation nor the names of its 13 * -- Neither the name of the Intel Corporation nor the names of its
14 * contributors may be used to endorse or promote products derived from 14 * contributors may be used to endorse or promote products derived from
15 * this software without specific prior written permission. 15 * this software without specific prior written permission.
16 * 16 *
17 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 17 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
18 * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 18 * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
19 * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A 19 * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A
20 * PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE INTEL OR ITS 20 * PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE INTEL OR ITS
21 * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, 21 * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
22 * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, 22 * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
23 * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR 23 * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
24 * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF 24 * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
25 * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING 25 * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
26 * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS 26 * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
27 * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 27 * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
28 */ 28 */
29 29
30using System; 30using System;
31using System.Xml; 31using System.Xml;
32using ExtensionLoader.Config; 32using ExtensionLoader.Config;
33using MySql.Data.MySqlClient; 33using MySql.Data.MySqlClient;
34 34
35namespace OpenSim.Grid.AssetInventoryServer.Extensions 35namespace OpenSim.Grid.AssetInventoryServer.Extensions
36{ 36{
37 public static class DBConnString 37 public static class DBConnString
38 { 38 {
39 private static string connectionString; 39 private static string connectionString;
40 40
41 /// <summary> 41 /// <summary>
42 /// Parses the MySQL connection string out of either the asset server 42 /// Parses the MySQL connection string out of either the asset server
43 /// .ini or a OpenSim-style .xml file and caches the result for future 43 /// .ini or a OpenSim-style .xml file and caches the result for future
44 /// requests 44 /// requests
45 /// </summary> 45 /// </summary>
46 public static string GetConnectionString(IniConfigSource configFile) 46 public static string GetConnectionString(IniConfigSource configFile)
47 { 47 {
48 if (connectionString == null) 48 if (connectionString == null)
49 { 49 {
50 // Try parsing from the ini file 50 // Try parsing from the ini file
51 try 51 try
52 { 52 {
53 // Load the extension list (and ordering) from our config file 53 // Load the extension list (and ordering) from our config file
54 IConfig extensionConfig = configFile.Configs["MySQL"]; 54 IConfig extensionConfig = configFile.Configs["MySQL"];
55 connectionString = extensionConfig.GetString("database_connect", null); 55 connectionString = extensionConfig.GetString("database_connect", null);
56 } 56 }
57 catch (Exception) { } 57 catch (Exception) { }
58 58
59 if (connectionString != null) 59 if (connectionString != null)
60 { 60 {
61 // Force MySQL's broken connection pooling off 61 // Force MySQL's broken connection pooling off
62 MySqlConnectionStringBuilder builder = new MySqlConnectionStringBuilder(connectionString); 62 MySqlConnectionStringBuilder builder = new MySqlConnectionStringBuilder(connectionString);
63 builder.Pooling = false; 63 builder.Pooling = false;
64 if (String.IsNullOrEmpty(builder.Database)) 64 if (String.IsNullOrEmpty(builder.Database))
65 Logger.Log.Error("No database selected in the connectionString: " + connectionString); 65 Logger.Log.Error("No database selected in the connectionString: " + connectionString);
66 connectionString = builder.ToString(); 66 connectionString = builder.ToString();
67 } 67 }
68 else 68 else
69 { 69 {
70 Logger.Log.Error("Database connection string is missing, check that the database_connect line is " + 70 Logger.Log.Error("Database connection string is missing, check that the database_connect line is " +
71 "correct and uncommented in AssetInventoryServer.ini"); 71 "correct and uncommented in AssetInventoryServer.ini");
72 } 72 }
73 } 73 }
74 74
75 return connectionString; 75 return connectionString;
76 } 76 }
77 } 77 }
78} 78}