diff options
Diffstat (limited to 'OpenSim/Data/SQLite/SQLiteUserData.cs')
-rw-r--r-- | OpenSim/Data/SQLite/SQLiteUserData.cs | 52 |
1 files changed, 33 insertions, 19 deletions
diff --git a/OpenSim/Data/SQLite/SQLiteUserData.cs b/OpenSim/Data/SQLite/SQLiteUserData.cs index c9ef3c2..36ec9ea 100644 --- a/OpenSim/Data/SQLite/SQLiteUserData.cs +++ b/OpenSim/Data/SQLite/SQLiteUserData.cs | |||
@@ -72,12 +72,20 @@ namespace OpenSim.Data.SQLite | |||
72 | connect = "URI=file:userprofiles.db,version=3"; | 72 | connect = "URI=file:userprofiles.db,version=3"; |
73 | 73 | ||
74 | SqliteConnection conn = new SqliteConnection(connect); | 74 | SqliteConnection conn = new SqliteConnection(connect); |
75 | TestTables(conn); | ||
76 | 75 | ||
77 | // This sucks, but It doesn't seem to work with the dataset Syncing :P | 76 | // This sucks, but It doesn't seem to work with the dataset Syncing :P |
78 | g_conn = conn; | 77 | g_conn = conn; |
79 | g_conn.Open(); | 78 | g_conn.Open(); |
80 | 79 | ||
80 | Assembly assem = GetType().Assembly; | ||
81 | Migration m = new Migration(g_conn, assem, "UserStore"); | ||
82 | |||
83 | // TODO: remove this after rev 6000 | ||
84 | TestTables(conn, m); | ||
85 | |||
86 | m.Update(); | ||
87 | |||
88 | |||
81 | ds = new DataSet(); | 89 | ds = new DataSet(); |
82 | da = new SqliteDataAdapter(new SqliteCommand(userSelect, conn)); | 90 | da = new SqliteDataAdapter(new SqliteCommand(userSelect, conn)); |
83 | daf = new SqliteDataAdapter(new SqliteCommand(userFriendsSelect, conn)); | 91 | daf = new SqliteDataAdapter(new SqliteCommand(userFriendsSelect, conn)); |
@@ -824,7 +832,7 @@ namespace OpenSim.Data.SQLite | |||
824 | conn.Close(); | 832 | conn.Close(); |
825 | } | 833 | } |
826 | 834 | ||
827 | private static bool TestTables(SqliteConnection conn) | 835 | private static bool TestTables(SqliteConnection conn, Migration m) |
828 | { | 836 | { |
829 | SqliteCommand cmd = new SqliteCommand(userSelect, conn); | 837 | SqliteCommand cmd = new SqliteCommand(userSelect, conn); |
830 | SqliteCommand fcmd = new SqliteCommand(userFriendsSelect, conn); | 838 | SqliteCommand fcmd = new SqliteCommand(userFriendsSelect, conn); |
@@ -842,26 +850,32 @@ namespace OpenSim.Data.SQLite | |||
842 | catch (SqliteSyntaxException) | 850 | catch (SqliteSyntaxException) |
843 | { | 851 | { |
844 | m_log.Info("[USER DB]: SQLite Database doesn't exist... creating"); | 852 | m_log.Info("[USER DB]: SQLite Database doesn't exist... creating"); |
845 | InitDB(conn); | 853 | return false; |
846 | } | ||
847 | conn.Open(); | ||
848 | try | ||
849 | { | ||
850 | cmd = new SqliteCommand("select webLoginKey from users limit 1;", conn); | ||
851 | cmd.ExecuteNonQuery(); | ||
852 | } | ||
853 | catch (SqliteSyntaxException) | ||
854 | { | ||
855 | cmd = new SqliteCommand("alter table users add column webLoginKey text default '00000000-0000-0000-0000-000000000000';", conn); | ||
856 | cmd.ExecuteNonQuery(); | ||
857 | pDa.Fill(tmpDS, "users"); | ||
858 | } | ||
859 | finally | ||
860 | { | ||
861 | conn.Close(); | ||
862 | } | 854 | } |
863 | 855 | ||
856 | if (m.Version == 0) | ||
857 | m.Version = 1; | ||
858 | |||
864 | return true; | 859 | return true; |
860 | |||
861 | // conn.Open(); | ||
862 | // try | ||
863 | // { | ||
864 | // cmd = new SqliteCommand("select webLoginKey from users limit 1;", conn); | ||
865 | // cmd.ExecuteNonQuery(); | ||
866 | // } | ||
867 | // catch (SqliteSyntaxException) | ||
868 | // { | ||
869 | // cmd = new SqliteCommand("alter table users add column webLoginKey text default '00000000-0000-0000-0000-000000000000';", conn); | ||
870 | // cmd.ExecuteNonQuery(); | ||
871 | // pDa.Fill(tmpDS, "users"); | ||
872 | // } | ||
873 | // finally | ||
874 | // { | ||
875 | // conn.Close(); | ||
876 | // } | ||
877 | |||
878 | // return true; | ||
865 | } | 879 | } |
866 | } | 880 | } |
867 | } | 881 | } |