public InventoryMigration(string connectString, string inventoryServiceUrl, string userServiceUrl)
        {
            using (m_connection = new MySqlConnection(connectString))
            {
                using (m_db = new opensim(m_connection))
                {
                    m_inventoryUrl = inventoryServiceUrl;
                    m_userUrl = userServiceUrl;

                    var rootFolders = from i in m_db.inventoryfolders
                                      where i.parentFolderID == UUID_ZERO
                                      select i;

                    foreach (var rootFolder in rootFolders)
                    {
                        // SimianGrid uses UserIDs as root inventory folderIDs. Rewrite all of the
                        // root folderIDs
                        m_rewriteFolderIDs[rootFolder.folderID] = rootFolder.agentID;

                        CreateFolder(rootFolder);

                        m_counter = 0;
                        Console.Write("+");
                    }
                }
            }
        }
        public FriendMigration(string connectString, string userServiceUrl)
        {
            using (m_connection = new MySqlConnection(connectString))
            {
                using (m_db = new opensim(m_connection))
                {
                    m_userUrl = userServiceUrl;
                    m_userUrl = userServiceUrl;

                    var friends = from f in m_db.userfriends
                                  select f;

                    int i = 0;
                    foreach (var friend in friends)
                    {
                        CreateFriend(friend);
                        if (++i % 100 == 0) Console.Write("+");
                    }
                }
            }
        }
        public UserMigration(string connectString, string userServiceUrl, string gridOwner)
        {
            using (m_connection = new MySqlConnection(connectString))
            {
                using (m_db = new opensim(m_connection))
                {
                    m_userUrl = userServiceUrl;
                    m_userUrl = userServiceUrl;

                    var users = from u in m_db.users
                                select u;

                    foreach (var user in users)
                    {
                        CreateUser(user, gridOwner);
                        Console.Write("+");
                    }
                }
            }

            if (!m_masterUserSet)
                Console.WriteLine("No grid owner set. You should manually assign one user to have an access level of 255 in the database");
        }
        private void CreateAssetSet(string lstr, string hstr)
        {
            string query = String.Format("SELECT * FROM assets where id > '{0}' and id <= '{1}'", lstr, hstr);
            Console.WriteLine(String.Empty);
            Console.WriteLine(query);

            using (m_db = new opensim(m_connection))
            {
                var assets = m_db.ExecuteQuery<assets>(query);

                int count = 0;
                foreach (var asset in assets)
                {
                    CreateAsset(asset);
                    if (++count % 10 == 0) Console.Write(".");
                }
            }
        }
        static bool TryGetStoreVersion(string connectString, out bool is070)
        {
            const string ASSET_STORE_MIGRATION = "AssetStore";
            const int LAST_069_ASSET_MIGRATION = 6;

            using (MySqlConnection connection = new MySqlConnection(connectString))
            {
                using (v069.opensim db = new v069.opensim(connection))
                {
                    var assetStoreMigration = db.migrations.SingleOrDefault(m => ASSET_STORE_MIGRATION == m.name);

                    if (assetStoreMigration != null && assetStoreMigration.version.HasValue)
                    {
                        is070 = (assetStoreMigration.version.Value > LAST_069_ASSET_MIGRATION);
                        return true;
                    }
                }
            }

            is070 = false;
            return false;
        }