diff options
author | Diva Canto | 2010-02-14 16:57:02 -0800 |
---|---|---|
committer | Diva Canto | 2010-02-14 16:57:02 -0800 |
commit | dc197856727c06b0b06488ab839409831af84865 (patch) | |
tree | 52db90cc6ae1ad2abcb6103fca0129a69bea4716 /OpenSim/Data/SQLite | |
parent | Implement the methods needed for the login service to populate the friendslist (diff) | |
download | opensim-SC_OLD-dc197856727c06b0b06488ab839409831af84865.zip opensim-SC_OLD-dc197856727c06b0b06488ab839409831af84865.tar.gz opensim-SC_OLD-dc197856727c06b0b06488ab839409831af84865.tar.bz2 opensim-SC_OLD-dc197856727c06b0b06488ab839409831af84865.tar.xz |
Added UserAccount, Avatar and Authentication to Data.Null, so that OpenSim can run out-of-the-box. #WaitingForSQLite
Diffstat (limited to 'OpenSim/Data/SQLite')
-rw-r--r-- | OpenSim/Data/SQLite/SQLiteInventoryStore.cs | 67 |
1 files changed, 39 insertions, 28 deletions
diff --git a/OpenSim/Data/SQLite/SQLiteInventoryStore.cs b/OpenSim/Data/SQLite/SQLiteInventoryStore.cs index 64591fd..c058bc7 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> |
@@ -384,7 +391,9 @@ namespace OpenSim.Data.SQLite | |||
384 | List<InventoryFolderBase> folders = new List<InventoryFolderBase>(); | 391 | List<InventoryFolderBase> folders = new List<InventoryFolderBase>(); |
385 | DataTable inventoryFolderTable = ds.Tables["inventoryfolders"]; | 392 | DataTable inventoryFolderTable = ds.Tables["inventoryfolders"]; |
386 | string selectExp = "agentID = '" + user + "' AND parentID = '" + UUID.Zero + "'"; | 393 | string selectExp = "agentID = '" + user + "' AND parentID = '" + UUID.Zero + "'"; |
394 | m_log.DebugFormat("XXX selectExp = {0}", selectExp); | ||
387 | DataRow[] rows = inventoryFolderTable.Select(selectExp); | 395 | DataRow[] rows = inventoryFolderTable.Select(selectExp); |
396 | m_log.DebugFormat("XXX rows: {0}", rows.Length); | ||
388 | foreach (DataRow row in rows) | 397 | foreach (DataRow row in rows) |
389 | { | 398 | { |
390 | folders.Add(buildFolder(row)); | 399 | folders.Add(buildFolder(row)); |
@@ -397,9 +406,11 @@ namespace OpenSim.Data.SQLite | |||
397 | // suitably refactor. | 406 | // suitably refactor. |
398 | if (folders.Count > 0) | 407 | if (folders.Count > 0) |
399 | { | 408 | { |
409 | m_log.DebugFormat("XXX Found root folder"); | ||
400 | return folders[0]; | 410 | return folders[0]; |
401 | } | 411 | } |
402 | 412 | ||
413 | m_log.DebugFormat("XXX Root folder for {0} not found", user); | ||
403 | return null; | 414 | return null; |
404 | } | 415 | } |
405 | } | 416 | } |