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

Support the Boolean data type in the providers SQL syntax #22

Open
DaveRMaltby opened this issue Apr 6, 2023 · 1 comment
Open

Support the Boolean data type in the providers SQL syntax #22

DaveRMaltby opened this issue Apr 6, 2023 · 1 comment

Comments

@DaveRMaltby
Copy link
Contributor

Although it appears that we support boolean values in the data sources (for example: https://github.com/Servant-Software-LLC/ADO.NET.FileBased.DataProviders/blob/main/tests/Data.Json.Tests/Sources/Folder/employees.json#L6), if we change the INSERT statement in https://github.com/Servant-Software-LLC/ADO.NET.FileBased.DataProviders/blob/main/tests/Data.Tests.Common/InsertTests.cs#L34 to provide the literal true instead of a string quoted literal 'true', then the Irony parsing assumes that it is a simple_id and an exception occurs.

Data.Csv.Tests.FolderAsDatabase.CsvInsertTests.Insert_ShouldInsertData
   Source: CsvInsertTests.cs line 15
   Duration: 154 ms

  Message: 
    System.ArgumentOutOfRangeException : Index was out of range. Must be non-negative and less than the size of the collection. (Parameter 'index')

  Stack Trace: 
    List`1.get_Item(Int32 index)
    FileQuery.GetValue(ParseTreeNodeList x) line 91
    FileInsertQuery.<GetValues>b__1_0(ParseTreeNode x) line 16
    SelectListIterator`2.GetCount(Boolean onlyIfCheap)
    FileInsertQuery.GetValues() line 17
    FileInsert.Execute() line 43
    FileCommand.ExecuteNonQuery() line 71
    InsertTests.Insert_ShouldInsertData(Func`1 createFileConnection) line 35
    CsvInsertTests.Insert_ShouldInsertData() line 18
    RuntimeMethodHandle.InvokeMethod(Object target, Void** arguments, Signature sig, Boolean isConstructor)
    MethodInvoker.Invoke(Object obj, IntPtr* args, BindingFlags invokeAttr)

@DaveRMaltby
Copy link
Contributor Author

ANSI SQL as defined in SQL:1992 can be found at https://www.contrib.andrew.cmu.edu/~shadow/sql/sql1992.txt. There it describes boolean literals:

         <truth value> ::=
                TRUE
              | FALSE
              | UNKNOWN

I am not advocating that we also support the UNKNOWN literal constant. Just TRUE and FALSE.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant