aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Data/SQLite/SQLiteInventoryStore.cs
diff options
context:
space:
mode:
Diffstat (limited to 'OpenSim/Data/SQLite/SQLiteInventoryStore.cs')
-rw-r--r--OpenSim/Data/SQLite/SQLiteInventoryStore.cs63
1 files changed, 35 insertions, 28 deletions
diff --git a/OpenSim/Data/SQLite/SQLiteInventoryStore.cs b/OpenSim/Data/SQLite/SQLiteInventoryStore.cs
index 64591fd..a5e0517 100644
--- a/OpenSim/Data/SQLite/SQLiteInventoryStore.cs
+++ b/OpenSim/Data/SQLite/SQLiteInventoryStore.cs
@@ -46,10 +46,12 @@ namespace OpenSim.Data.SQLite
46 private const string invItemsSelect = "select * from inventoryitems"; 46 private const string invItemsSelect = "select * from inventoryitems";
47 private const string invFoldersSelect = "select * from inventoryfolders"; 47 private const string invFoldersSelect = "select * from inventoryfolders";
48 48
49 private SqliteConnection conn; 49 private static SqliteConnection conn;
50 private DataSet ds; 50 private static DataSet ds;
51 private SqliteDataAdapter invItemsDa; 51 private static SqliteDataAdapter invItemsDa;
52 private SqliteDataAdapter invFoldersDa; 52 private static SqliteDataAdapter invFoldersDa;
53
54 private static bool m_Initialized = false;
53 55
54 public void Initialise() 56 public void Initialise()
55 { 57 {
@@ -67,39 +69,44 @@ namespace OpenSim.Data.SQLite
67 /// <param name="dbconnect">connect string</param> 69 /// <param name="dbconnect">connect string</param>
68 public void Initialise(string dbconnect) 70 public void Initialise(string dbconnect)
69 { 71 {
70 if (dbconnect == string.Empty) 72 if (!m_Initialized)
71 { 73 {
72 dbconnect = "URI=file:inventoryStore.db,version=3"; 74 m_Initialized = true;
73 } 75
74 m_log.Info("[INVENTORY DB]: Sqlite - connecting: " + dbconnect); 76 if (dbconnect == string.Empty)
75 conn = new SqliteConnection(dbconnect); 77 {
78 dbconnect = "URI=file:inventoryStore.db,version=3";
79 }
80 m_log.Info("[INVENTORY DB]: Sqlite - connecting: " + dbconnect);
81 conn = new SqliteConnection(dbconnect);
76 82
77 conn.Open(); 83 conn.Open();
78 84
79 Assembly assem = GetType().Assembly; 85 Assembly assem = GetType().Assembly;
80 Migration m = new Migration(conn, assem, "InventoryStore"); 86 Migration m = new Migration(conn, assem, "InventoryStore");
81 m.Update(); 87 m.Update();
82 88
83 SqliteCommand itemsSelectCmd = new SqliteCommand(invItemsSelect, conn); 89 SqliteCommand itemsSelectCmd = new SqliteCommand(invItemsSelect, conn);
84 invItemsDa = new SqliteDataAdapter(itemsSelectCmd); 90 invItemsDa = new SqliteDataAdapter(itemsSelectCmd);
85 // SqliteCommandBuilder primCb = new SqliteCommandBuilder(primDa); 91 // SqliteCommandBuilder primCb = new SqliteCommandBuilder(primDa);
86 92
87 SqliteCommand foldersSelectCmd = new SqliteCommand(invFoldersSelect, conn); 93 SqliteCommand foldersSelectCmd = new SqliteCommand(invFoldersSelect, conn);
88 invFoldersDa = new SqliteDataAdapter(foldersSelectCmd); 94 invFoldersDa = new SqliteDataAdapter(foldersSelectCmd);
89 95
90 ds = new DataSet(); 96 ds = new DataSet();
91 97
92 ds.Tables.Add(createInventoryFoldersTable()); 98 ds.Tables.Add(createInventoryFoldersTable());
93 invFoldersDa.Fill(ds.Tables["inventoryfolders"]); 99 invFoldersDa.Fill(ds.Tables["inventoryfolders"]);
94 setupFoldersCommands(invFoldersDa, conn); 100 setupFoldersCommands(invFoldersDa, conn);
95 m_log.Info("[INVENTORY DB]: Populated Inventory Folders Definitions"); 101 m_log.Info("[INVENTORY DB]: Populated Inventory Folders Definitions");
96 102
97 ds.Tables.Add(createInventoryItemsTable()); 103 ds.Tables.Add(createInventoryItemsTable());
98 invItemsDa.Fill(ds.Tables["inventoryitems"]); 104 invItemsDa.Fill(ds.Tables["inventoryitems"]);
99 setupItemsCommands(invItemsDa, conn); 105 setupItemsCommands(invItemsDa, conn);
100 m_log.Info("[INVENTORY DB]: Populated Inventory Items Definitions"); 106 m_log.Info("[INVENTORY DB]: Populated Inventory Items Definitions");
101 107
102 ds.AcceptChanges(); 108 ds.AcceptChanges();
109 }
103 } 110 }
104 111
105 /// <summary> 112 /// <summary>