本文整理汇总了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])");
}
示例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);
}
示例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();
}