当前位置: 首页>>代码示例>>C#>>正文


C# SQLiteAsyncConnection.QueryAsync方法代码示例

本文整理汇总了C#中SQLiteAsyncConnection.QueryAsync方法的典型用法代码示例。如果您正苦于以下问题:C# SQLiteAsyncConnection.QueryAsync方法的具体用法?C# SQLiteAsyncConnection.QueryAsync怎么用?C# SQLiteAsyncConnection.QueryAsync使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在SQLiteAsyncConnection的用法示例。


在下文中一共展示了SQLiteAsyncConnection.QueryAsync方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: DeviceItemDatabase

		/// <summary>
		/// Initializes a new instance of the <see cref="Tasky.DL.TaskDatabase"/> TaskDatabase. 
		/// if the database doesn't exist, it will create the database and all the tables.
		/// </summary>
		/// <param name='path'>
		/// Path.
		/// </param>
		public DeviceItemDatabase()
		{
			database = DependencyService.Get<ISQLite> ().GetConnection ();
			// create the tables

			database.CreateTableAsync<Login>();
			database.CreateTableAsync<LoginUsernameForDel>();
			database.CreateTableAsync<Db_allnode>();
			database.CreateTableAsync<NameByUser>();
			database.CreateTableAsync<RemoteData>();
			database.CreateTableAsync<ProfileData>();
			database.CreateTableAsync<Profile_IO_Data>();

			//prevent [node_addr] AND [node_io_p] duplicate
			database.QueryAsync<NameByUser>("CREATE UNIQUE INDEX ix_uq ON [NameByUser] ([node_addr], [node_io_p])");
			database.QueryAsync<Profile_IO_Data>("CREATE UNIQUE INDEX ix_uq2 ON [Profile_IO_Data] ([profileName], [node_addr], [node_io_p])");
		
		}
开发者ID:kabsila,项目名称:HomezigXaml,代码行数:25,代码来源:DeviceItemDatabase.cs

示例2: QueryForNearby

        public async static Task<List<Stop>> QueryForNearby(double dist)
        {
            //Get search bounds from location and given radius
            double[][] bounds = LocationHelper.MakeBounds(dist);

            //Query database for stops
            string query = "SELECT * FROM BusStops WHERE Longitude BETWEEN " + bounds[3][1] +
                " AND " + bounds[1][1] + " AND Latitude BETWEEN " + bounds[2][0] + " AND " + bounds[0][0];

            //var _stopsAsyncConnection = new SQLiteAsyncConnection("muni.sqlite");
            var connection = new SQLiteAsyncConnection(() => DbConnection(muniDbPath));
            var results = await connection.QueryAsync<Stop>(query);
            connection = null;

            //Check results for enough stops
            if (results.Count >= 15)
            {
                return results;
            }
            else return await QueryForNearby(dist += .5);
        }
开发者ID:nexDevelopment,项目名称:nexMUNI,代码行数:21,代码来源:DatabaseHelper.cs

示例3: RemoveFavoriteAsync

        public static async Task RemoveFavoriteAsync(Stop stop)
        {
            string q = "DELETE FROM FavoriteData WHERE Id IS " + stop.favId;
            //var _favoritesAsyncConnection = new SQLiteAsyncConnection(favoriteDbPath);
            favoritesConnection = new SQLiteAsyncConnection(() => DbConnection(favoriteDbPath));

            await favoritesConnection.QueryAsync<Favorite>(q);
            await LoadFavoritesAsync();
        }
开发者ID:nexDevelopment,项目名称:nexMUNI,代码行数:9,代码来源:DatabaseHelper.cs


注:本文中的SQLiteAsyncConnection.QueryAsync方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。