diff options
Diffstat (limited to 'OpenSim/Data/SQLite')
-rw-r--r-- | OpenSim/Data/SQLite/SQLiteRegionData.cs | 222 |
1 files changed, 0 insertions, 222 deletions
diff --git a/OpenSim/Data/SQLite/SQLiteRegionData.cs b/OpenSim/Data/SQLite/SQLiteRegionData.cs index a44b892..dd88751 100644 --- a/OpenSim/Data/SQLite/SQLiteRegionData.cs +++ b/OpenSim/Data/SQLite/SQLiteRegionData.cs | |||
@@ -118,11 +118,6 @@ namespace OpenSim.Data.SQLite | |||
118 | // This actually does the roll forward assembly stuff | 118 | // This actually does the roll forward assembly stuff |
119 | Assembly assem = GetType().Assembly; | 119 | Assembly assem = GetType().Assembly; |
120 | Migration m = new Migration(m_conn, assem, "RegionStore"); | 120 | Migration m = new Migration(m_conn, assem, "RegionStore"); |
121 | |||
122 | // TODO: After rev 6000, remove this. People should have | ||
123 | // been rolled onto the new migration code by then. | ||
124 | TestTables(m_conn, m); | ||
125 | |||
126 | m.Update(); | 121 | m.Update(); |
127 | 122 | ||
128 | lock (ds) | 123 | lock (ds) |
@@ -1723,191 +1718,6 @@ namespace OpenSim.Data.SQLite | |||
1723 | da.DeleteCommand = delete; | 1718 | da.DeleteCommand = delete; |
1724 | } | 1719 | } |
1725 | 1720 | ||
1726 | /// <summary> | ||
1727 | /// Create the necessary database tables. | ||
1728 | /// </summary> | ||
1729 | /// <param name="conn"></param> | ||
1730 | // private void InitDB(SqliteConnection conn) | ||
1731 | // { | ||
1732 | // string createPrims = defineTable(createPrimTable()); | ||
1733 | // string createShapes = defineTable(createShapeTable()); | ||
1734 | // string createItems = defineTable(createItemsTable()); | ||
1735 | // string createTerrain = defineTable(createTerrainTable()); | ||
1736 | // string createLand = defineTable(createLandTable()); | ||
1737 | // string createLandAccessList = defineTable(createLandAccessListTable()); | ||
1738 | |||
1739 | // SqliteCommand pcmd = new SqliteCommand(createPrims, conn); | ||
1740 | // SqliteCommand scmd = new SqliteCommand(createShapes, conn); | ||
1741 | // SqliteCommand icmd = new SqliteCommand(createItems, conn); | ||
1742 | // SqliteCommand tcmd = new SqliteCommand(createTerrain, conn); | ||
1743 | // SqliteCommand lcmd = new SqliteCommand(createLand, conn); | ||
1744 | // SqliteCommand lalcmd = new SqliteCommand(createLandAccessList, conn); | ||
1745 | |||
1746 | // try | ||
1747 | // { | ||
1748 | // pcmd.ExecuteNonQuery(); | ||
1749 | // } | ||
1750 | // catch (SqliteSyntaxException) | ||
1751 | // { | ||
1752 | // m_log.Warn("[REGION DB]: Primitives Table Already Exists"); | ||
1753 | // } | ||
1754 | |||
1755 | // try | ||
1756 | // { | ||
1757 | // scmd.ExecuteNonQuery(); | ||
1758 | // } | ||
1759 | // catch (SqliteSyntaxException) | ||
1760 | // { | ||
1761 | // m_log.Warn("[REGION DB]: Shapes Table Already Exists"); | ||
1762 | // } | ||
1763 | |||
1764 | // try | ||
1765 | // { | ||
1766 | // icmd.ExecuteNonQuery(); | ||
1767 | // } | ||
1768 | // catch (SqliteSyntaxException) | ||
1769 | // { | ||
1770 | // m_log.Warn("[REGION DB]: Primitives Inventory Table Already Exists"); | ||
1771 | // } | ||
1772 | |||
1773 | // try | ||
1774 | // { | ||
1775 | // tcmd.ExecuteNonQuery(); | ||
1776 | // } | ||
1777 | // catch (SqliteSyntaxException) | ||
1778 | // { | ||
1779 | // m_log.Warn("[REGION DB]: Terrain Table Already Exists"); | ||
1780 | // } | ||
1781 | |||
1782 | // try | ||
1783 | // { | ||
1784 | // lcmd.ExecuteNonQuery(); | ||
1785 | // } | ||
1786 | // catch (SqliteSyntaxException) | ||
1787 | // { | ||
1788 | // m_log.Warn("[REGION DB]: Land Table Already Exists"); | ||
1789 | // } | ||
1790 | |||
1791 | // try | ||
1792 | // { | ||
1793 | // lalcmd.ExecuteNonQuery(); | ||
1794 | // } | ||
1795 | // catch (SqliteSyntaxException) | ||
1796 | // { | ||
1797 | // m_log.Warn("[SQLITE]: LandAccessList Table Already Exists"); | ||
1798 | // } | ||
1799 | // } | ||
1800 | |||
1801 | /// <summary> | ||
1802 | /// | ||
1803 | /// </summary> | ||
1804 | /// <param name="conn"></param> | ||
1805 | /// <param name="m"></param> | ||
1806 | /// <returns></returns> | ||
1807 | private bool TestTables(SqliteConnection conn, Migration m) | ||
1808 | { | ||
1809 | SqliteCommand primSelectCmd = new SqliteCommand(primSelect, conn); | ||
1810 | SqliteDataAdapter pDa = new SqliteDataAdapter(primSelectCmd); | ||
1811 | |||
1812 | SqliteCommand shapeSelectCmd = new SqliteCommand(shapeSelect, conn); | ||
1813 | SqliteDataAdapter sDa = new SqliteDataAdapter(shapeSelectCmd); | ||
1814 | |||
1815 | SqliteCommand itemsSelectCmd = new SqliteCommand(itemsSelect, conn); | ||
1816 | SqliteDataAdapter iDa = new SqliteDataAdapter(itemsSelectCmd); | ||
1817 | |||
1818 | SqliteCommand terrainSelectCmd = new SqliteCommand(terrainSelect, conn); | ||
1819 | SqliteDataAdapter tDa = new SqliteDataAdapter(terrainSelectCmd); | ||
1820 | |||
1821 | SqliteCommand landSelectCmd = new SqliteCommand(landSelect, conn); | ||
1822 | SqliteDataAdapter lDa = new SqliteDataAdapter(landSelectCmd); | ||
1823 | |||
1824 | SqliteCommand landAccessListSelectCmd = new SqliteCommand(landAccessListSelect, conn); | ||
1825 | SqliteDataAdapter lalDa = new SqliteDataAdapter(landAccessListSelectCmd); | ||
1826 | |||
1827 | DataSet tmpDS = new DataSet(); | ||
1828 | try | ||
1829 | { | ||
1830 | pDa.Fill(tmpDS, "prims"); | ||
1831 | sDa.Fill(tmpDS, "primshapes"); | ||
1832 | |||
1833 | iDa.Fill(tmpDS, "primitems"); | ||
1834 | |||
1835 | tDa.Fill(tmpDS, "terrain"); | ||
1836 | lDa.Fill(tmpDS, "land"); | ||
1837 | lalDa.Fill(tmpDS, "landaccesslist"); | ||
1838 | } | ||
1839 | catch (SqliteSyntaxException) | ||
1840 | { | ||
1841 | m_log.Info("[DATASTORE]: SQLite Database doesn't exist... creating"); | ||
1842 | return false; | ||
1843 | } | ||
1844 | |||
1845 | // if we've gotten this far, and our version is still 0, | ||
1846 | // it's because the migration was never done, so | ||
1847 | // initialize to 1 just to sync up to where we should be. | ||
1848 | |||
1849 | if (m.Version == 0) | ||
1850 | m.Version = 1; | ||
1851 | |||
1852 | // pDa.Fill(tmpDS, "prims"); | ||
1853 | // sDa.Fill(tmpDS, "primshapes"); | ||
1854 | |||
1855 | // iDa.Fill(tmpDS, "primitems"); | ||
1856 | |||
1857 | // tDa.Fill(tmpDS, "terrain"); | ||
1858 | // lDa.Fill(tmpDS, "land"); | ||
1859 | // lalDa.Fill(tmpDS, "landaccesslist"); | ||
1860 | |||
1861 | // foreach (DataColumn col in createPrimTable().Columns) | ||
1862 | // { | ||
1863 | // if (!tmpDS.Tables["prims"].Columns.Contains(col.ColumnName)) | ||
1864 | // { | ||
1865 | // m_log.Info("[REGION DB]: Missing required column:" + col.ColumnName); | ||
1866 | // return false; | ||
1867 | // } | ||
1868 | // } | ||
1869 | |||
1870 | // foreach (DataColumn col in createShapeTable().Columns) | ||
1871 | // { | ||
1872 | // if (!tmpDS.Tables["primshapes"].Columns.Contains(col.ColumnName)) | ||
1873 | // { | ||
1874 | // m_log.Info("[REGION DB]: Missing required column:" + col.ColumnName); | ||
1875 | // return false; | ||
1876 | // } | ||
1877 | // } | ||
1878 | |||
1879 | // // XXX primitems should probably go here eventually | ||
1880 | |||
1881 | // foreach (DataColumn col in createTerrainTable().Columns) | ||
1882 | // { | ||
1883 | // if (!tmpDS.Tables["terrain"].Columns.Contains(col.ColumnName)) | ||
1884 | // { | ||
1885 | // m_log.Info("[REGION DB]: Missing require column:" + col.ColumnName); | ||
1886 | // return false; | ||
1887 | // } | ||
1888 | // } | ||
1889 | |||
1890 | // foreach (DataColumn col in createLandTable().Columns) | ||
1891 | // { | ||
1892 | // if (!tmpDS.Tables["land"].Columns.Contains(col.ColumnName)) | ||
1893 | // { | ||
1894 | // m_log.Info("[REGION DB]: Missing require column:" + col.ColumnName); | ||
1895 | // return false; | ||
1896 | // } | ||
1897 | // } | ||
1898 | |||
1899 | // foreach (DataColumn col in createLandAccessListTable().Columns) | ||
1900 | // { | ||
1901 | // if (!tmpDS.Tables["landaccesslist"].Columns.Contains(col.ColumnName)) | ||
1902 | // { | ||
1903 | // m_log.Info("[DATASTORE]: Missing require column:" + col.ColumnName); | ||
1904 | // return false; | ||
1905 | // } | ||
1906 | // } | ||
1907 | |||
1908 | return true; | ||
1909 | } | ||
1910 | |||
1911 | /*********************************************************************** | 1721 | /*********************************************************************** |
1912 | * | 1722 | * |
1913 | * Type conversion functions | 1723 | * Type conversion functions |
@@ -1951,37 +1761,5 @@ namespace OpenSim.Data.SQLite | |||
1951 | } | 1761 | } |
1952 | } | 1762 | } |
1953 | 1763 | ||
1954 | /// <summary> | ||
1955 | /// </summary> | ||
1956 | /// <param name="type">a Type</param> | ||
1957 | /// <returns>an sqliteType</returns> | ||
1958 | /// <remarks>this is something we'll need to implement for each db slightly differently.</remarks> | ||
1959 | // private static string sqliteType(Type type) | ||
1960 | // { | ||
1961 | // if (type == typeof (String)) | ||
1962 | // { | ||
1963 | // return "varchar(255)"; | ||
1964 | // } | ||
1965 | // else if (type == typeof (Int32)) | ||
1966 | // { | ||
1967 | // return "integer"; | ||
1968 | // } | ||
1969 | // else if (type == typeof (Int64)) | ||
1970 | // { | ||
1971 | // return "integer"; | ||
1972 | // } | ||
1973 | // else if (type == typeof (Double)) | ||
1974 | // { | ||
1975 | // return "float"; | ||
1976 | // } | ||
1977 | // else if (type == typeof (Byte[])) | ||
1978 | // { | ||
1979 | // return "blob"; | ||
1980 | // } | ||
1981 | // else | ||
1982 | // { | ||
1983 | // return "string"; | ||
1984 | // } | ||
1985 | // } | ||
1986 | } | 1764 | } |
1987 | } | 1765 | } |