Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Documentation error on home page and Getting Started page #363

Closed
augiem opened this issue May 6, 2015 · 2 comments
Closed

Documentation error on home page and Getting Started page #363

augiem opened this issue May 6, 2015 · 2 comments
Assignees
Labels

Comments

@augiem
Copy link

augiem commented May 6, 2015

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);
}

@nurchi
Copy link

nurchi commented Jun 9, 2015

Continue reading the same page:

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.
...

@augiem
Copy link
Author

augiem commented Jun 9, 2015

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.

@praeclarum praeclarum added the Bug label Aug 11, 2017
@praeclarum praeclarum self-assigned this Aug 11, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

3 participants