You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
This bit of documentation on the home page and getting started page shows invalid SQLite syntax, using a single quote to surround the column names. According to this: https://www.sqlite.org/lang_keywords.html
A single-quoted string is a string literal, not an identifier, so this cannot return the correct values from the table. Instead, the column identifiers should be surrounded by escaped double quotes.
public class Val {
public decimal Money { get; set; }
public DateTime Date { get; set; }
}
public static IEnumerable QueryVals (SQLiteConnection db, Stock stock)
{
return db.Query ("select 'Price' as 'Money', 'Time' as 'Date' from Valuation where StockId = ?", stock.Id);
}
The text was updated successfully, but these errors were encountered:
For resilience when confronted with historical SQL statements, SQLite will sometimes bend the quoting rules above:
- If a keyword in single quotes (ex: 'key' or 'glob') is used in a context where an identifier is allowed but where a string literal is not allowed, then the token is understood to be an identifier instead of a string literal.
- If a keyword in double quotes (ex: "key" or "glob") is used in a context where it cannot be resolved to an identifier but where a string literal is allowed, then the token is understood to be a string literal instead of an identifier.
...
The sql queries as documented do not work in my testing. Doesn't matter what the page says, the code doesn't work as stated and is misleading. Showing users incorrect syntax in the most basic getting started documentation is not helpful to anyone. This cost me several hours of time because I didn't catch it immediately. It should be corrected.
This bit of documentation on the home page and getting started page shows invalid SQLite syntax, using a single quote to surround the column names. According to this:
https://www.sqlite.org/lang_keywords.html
A single-quoted string is a string literal, not an identifier, so this cannot return the correct values from the table. Instead, the column identifiers should be surrounded by escaped double quotes.
public class Val {
public decimal Money { get; set; }
public DateTime Date { get; set; }
}
public static IEnumerable QueryVals (SQLiteConnection db, Stock stock)
{
return db.Query ("select 'Price' as 'Money', 'Time' as 'Date' from Valuation where StockId = ?", stock.Id);
}
The text was updated successfully, but these errors were encountered: