Skip to content

Commit 4fabb22

Browse files
authored
Fix identifier escaping used in the query example
Fixes oysteinkrog#363
1 parent d1fa883 commit 4fabb22

File tree

1 file changed

+6
-6
lines changed

1 file changed

+6
-6
lines changed

README.md

+6-6
Original file line numberDiff line numberDiff line change
@@ -102,22 +102,22 @@ foreach (var stock in query)
102102
You can also query the database at a low-level using the `Query` method:
103103

104104
```csharp
105-
public static IEnumerable<Valuation> QueryValuations (SQLiteConnection db, Stock stock)
106-
{
105+
public static IEnumerable<Valuation> QueryValuations (SQLiteConnection db, Stock stock) {
107106
return db.Query<Valuation> ("select * from Valuation where StockId = ?", stock.Id);
108107
}
109108
```
110109

111110
The generic parameter to the `Query` method specifies the type of object to create for each row. It can be one of your table classes, or any other class whose public properties match the column returned by the query. For instance, we could rewrite the above query as:
112111

113112
```csharp
114-
public class Val {
113+
public class Val
114+
{
115115
public decimal Money { get; set; }
116116
public DateTime Date { get; set; }
117117
}
118-
public static IEnumerable<Val> QueryVals (SQLiteConnection db, Stock stock)
119-
{
120-
return db.Query<Val> ("select 'Price' as 'Money', 'Time' as 'Date' from Valuation where StockId = ?", stock.Id);
118+
119+
public static IEnumerable<Val> QueryVals (SQLiteConnection db, Stock stock) {
120+
return db.Query<Val> ("select \"Price\" as \"Money\", \"Time\" as \"Date\" from Valuation where StockId = ?", stock.Id);
121121
}
122122
```
123123

0 commit comments

Comments
 (0)