From b1592a80c9432a89e1edf34d5e8dbcb1e1f84338 Mon Sep 17 00:00:00 2001 From: Zaid Date: Sat, 29 Aug 2020 23:55:37 +0200 Subject: [PATCH] Publish v3.12 with better analysis due to parameter nullability inference --- NpgsqlFSharpAnalyzer.sln | 15 ++++ RELEASE_NOTES.md | 5 ++ build.fsx | 6 +- src/FParsec/AssemblyInfo.fs | 31 +++++--- src/FParsecCS/Properties/AssemblyInfo.cs | 31 +------- src/NpgsqlFSharpAnalyzer.Core/AssemblyInfo.fs | 20 +++--- src/NpgsqlFSharpAnalyzer.Core/SqlAnalysis.fs | 63 ++++++++++++++-- src/NpgsqlFSharpAnalyzer/AssemblyInfo.fs | 20 +++--- src/NpgsqlFSharpParser/AssemblyInfo.fs | 23 ++++++ src/NpgsqlFSharpVs/Properties/AssemblyInfo.cs | 20 +++--- .../source.extension.vsixmanifest | 2 +- src/ParserTestsWithNet48/App.config | 6 ++ .../ParserTestsWithNet48.csproj | 71 +++++++++++++++++++ src/ParserTestsWithNet48/Program.cs | 18 +++++ .../Properties/AssemblyInfo.cs | 24 +++++++ .../AssemblyInfo.fs | 20 +++--- tests/NpgsqlFSharpAnalyzer.Tests/Tests.fs | 4 +- tests/examples/hashing/AssemblyInfo.fs | 20 +++--- 18 files changed, 298 insertions(+), 101 deletions(-) create mode 100644 src/NpgsqlFSharpParser/AssemblyInfo.fs create mode 100644 src/ParserTestsWithNet48/App.config create mode 100644 src/ParserTestsWithNet48/ParserTestsWithNet48.csproj create mode 100644 src/ParserTestsWithNet48/Program.cs create mode 100644 src/ParserTestsWithNet48/Properties/AssemblyInfo.cs diff --git a/NpgsqlFSharpAnalyzer.sln b/NpgsqlFSharpAnalyzer.sln index 03e99e5..4701772 100644 --- a/NpgsqlFSharpAnalyzer.sln +++ b/NpgsqlFSharpAnalyzer.sln @@ -39,6 +39,8 @@ Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "FParsecCS", "src\FParsecCS\ EndProject Project("{6EC3EE1D-3C4E-46DD-8F32-0CC8E7565705}") = "FParsec", "src\FParsec\FParsec.fsproj", "{9C8E7641-9DC8-470C-8009-71A747C01DC5}" EndProject +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "ParserTestsWithNet48", "src\ParserTestsWithNet48\ParserTestsWithNet48.csproj", "{40067E09-6281-4DC2-905D-60F7C6E3B812}" +EndProject Global GlobalSection(SolutionConfigurationPlatforms) = preSolution Debug|Any CPU = Debug|Any CPU @@ -145,6 +147,18 @@ Global {9C8E7641-9DC8-470C-8009-71A747C01DC5}.Release|x64.Build.0 = Release|Any CPU {9C8E7641-9DC8-470C-8009-71A747C01DC5}.Release|x86.ActiveCfg = Release|Any CPU {9C8E7641-9DC8-470C-8009-71A747C01DC5}.Release|x86.Build.0 = Release|Any CPU + {40067E09-6281-4DC2-905D-60F7C6E3B812}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {40067E09-6281-4DC2-905D-60F7C6E3B812}.Debug|Any CPU.Build.0 = Debug|Any CPU + {40067E09-6281-4DC2-905D-60F7C6E3B812}.Debug|x64.ActiveCfg = Debug|Any CPU + {40067E09-6281-4DC2-905D-60F7C6E3B812}.Debug|x64.Build.0 = Debug|Any CPU + {40067E09-6281-4DC2-905D-60F7C6E3B812}.Debug|x86.ActiveCfg = Debug|Any CPU + {40067E09-6281-4DC2-905D-60F7C6E3B812}.Debug|x86.Build.0 = Debug|Any CPU + {40067E09-6281-4DC2-905D-60F7C6E3B812}.Release|Any CPU.ActiveCfg = Release|Any CPU + {40067E09-6281-4DC2-905D-60F7C6E3B812}.Release|Any CPU.Build.0 = Release|Any CPU + {40067E09-6281-4DC2-905D-60F7C6E3B812}.Release|x64.ActiveCfg = Release|Any CPU + {40067E09-6281-4DC2-905D-60F7C6E3B812}.Release|x64.Build.0 = Release|Any CPU + {40067E09-6281-4DC2-905D-60F7C6E3B812}.Release|x86.ActiveCfg = Release|Any CPU + {40067E09-6281-4DC2-905D-60F7C6E3B812}.Release|x86.Build.0 = Release|Any CPU EndGlobalSection GlobalSection(SolutionProperties) = preSolution HideSolutionNode = FALSE @@ -159,6 +173,7 @@ Global {BC524F8E-6282-4E31-9A0E-29FCE38832E7} = {C397A34C-84F1-49E7-AEBC-2F9F2B196216} {C5EB813F-4278-4EE7-925B-6757BAD0FE9B} = {C397A34C-84F1-49E7-AEBC-2F9F2B196216} {9C8E7641-9DC8-470C-8009-71A747C01DC5} = {C397A34C-84F1-49E7-AEBC-2F9F2B196216} + {40067E09-6281-4DC2-905D-60F7C6E3B812} = {ACBEE43C-7A88-4FB1-9B06-DB064D22B29F} EndGlobalSection GlobalSection(ExtensibilityGlobals) = postSolution SolutionGuid = {BC821061-2FB3-4ABD-9FA1-044D4C59C475} diff --git a/RELEASE_NOTES.md b/RELEASE_NOTES.md index 8a4375e..0d40e24 100644 --- a/RELEASE_NOTES.md +++ b/RELEASE_NOTES.md @@ -1,3 +1,8 @@ +### 3.12.0 - 2020-08-29 +* Parameter nullability inference for parsable queries +* Detecting the missing columns which are required for INSERT queries +* Better error messages when reading from a result set which doesn't return any columns + ### 3.11.0 - 2020-08-18 * Even better error messages that include whether types were arrays or not diff --git a/build.fsx b/build.fsx index a5aa115..def63cb 100644 --- a/build.fsx +++ b/build.fsx @@ -250,9 +250,9 @@ let generateAssemblyInfo _ = |> Seq.iter (fun (projFileName, _, folderName, attributes) -> match projFileName with | Fsproj -> AssemblyInfoFile.createFSharp (folderName @@ "AssemblyInfo.fs") attributes - | Csproj -> AssemblyInfoFile.createCSharp ((folderName @@ "Properties") @@ "AssemblyInfo.cs") attributes - | Vbproj -> AssemblyInfoFile.createVisualBasic ((folderName @@ "My Project") @@ "AssemblyInfo.vb") attributes - ) + | Csproj -> ignore() + | Vbproj -> ignore() + ) let dotnetPack ctx = let args = diff --git a/src/FParsec/AssemblyInfo.fs b/src/FParsec/AssemblyInfo.fs index 25b6cec..ff0dfc0 100644 --- a/src/FParsec/AssemblyInfo.fs +++ b/src/FParsec/AssemblyInfo.fs @@ -1,14 +1,23 @@ -namespace FParsec - +// Auto-Generated by FAKE; do not edit +namespace System open System.Reflection -open System.Runtime.CompilerServices -open System.Runtime.InteropServices -[] +[] +[] +[] +[] +[] +[] +[] +[] +do () -#if LOW_TRUST - [] - [] -#endif -[] -do () \ No newline at end of file +module internal AssemblyVersionInformation = + let [] AssemblyTitle = "FParsec" + let [] AssemblyProduct = "NpgsqlFSharpAnalyzer" + let [] AssemblyVersion = "3.12.0" + let [] AssemblyMetadata_ReleaseDate = "2020-08-29T00:00:00.0000000" + let [] AssemblyFileVersion = "3.12.0" + let [] AssemblyInformationalVersion = "3.12.0" + let [] AssemblyMetadata_ReleaseChannel = "release" + let [] AssemblyMetadata_GitHash = "fdb4e9da4d035afc38f1941a84adf621fd8c2574" diff --git a/src/FParsecCS/Properties/AssemblyInfo.cs b/src/FParsecCS/Properties/AssemblyInfo.cs index 9c2b71c..bd31d92 100644 --- a/src/FParsecCS/Properties/AssemblyInfo.cs +++ b/src/FParsecCS/Properties/AssemblyInfo.cs @@ -1,32 +1,5 @@ -using System.Reflection; -using System.Runtime.CompilerServices; +using System.Runtime.CompilerServices; using System.Runtime.InteropServices; [assembly: ComVisible(false)] - -#if LOW_TRUST - [assembly: System.Security.AllowPartiallyTrustedCallers] - [assembly: System.Security.SecurityTransparent] -#endif - -[assembly: InternalsVisibleTo ("FParsec" + FParsec.CommonAssemblyInfo.StrongNamePublicKey)] -[assembly: InternalsVisibleTo (FParsec.CommonAssemblyInfo.TestAssemblyName + FParsec.CommonAssemblyInfo.StrongNamePublicKey)] - -namespace FParsec { - -internal static partial class CommonAssemblyInfo { - public const string TestAssemblyName = "Test"; - -#if STRONG_NAME - public const string StrongNamePublicKey = - ", PublicKey=002400000480000094000000060200000024000052534131000400000100010077c6be48a40f5b" + - "194ec9f992e5b512bbbba33e211354d9ee50c3214decddad8356470a9a19a9ee84637cbd6ff690" + - "9527d3973741dbe0a69b1461eeae774af9a78de45618ffd6fe7c7d52e0441b92f3bc7e8fb5757f" + - "b8b1611a0b6b8c9f9ef64edcf51d44218ae040f3015373fd261d30f8e1f5a1f914fd9ebcde7d7e" + - "f42dbaa5"; -#else - public const string StrongNamePublicKey = ""; -#endif -}; - -} +[assembly: InternalsVisibleTo ("FParsec")] diff --git a/src/NpgsqlFSharpAnalyzer.Core/AssemblyInfo.fs b/src/NpgsqlFSharpAnalyzer.Core/AssemblyInfo.fs index 3e4b169..c093733 100644 --- a/src/NpgsqlFSharpAnalyzer.Core/AssemblyInfo.fs +++ b/src/NpgsqlFSharpAnalyzer.Core/AssemblyInfo.fs @@ -4,20 +4,20 @@ open System.Reflection [] [] -[] -[] -[] -[] +[] +[] +[] +[] [] -[] +[] do () module internal AssemblyVersionInformation = let [] AssemblyTitle = "NpgsqlFSharpAnalyzer.Core" let [] AssemblyProduct = "NpgsqlFSharpAnalyzer" - let [] AssemblyVersion = "3.11.0" - let [] AssemblyMetadata_ReleaseDate = "2020-08-18T00:00:00.0000000" - let [] AssemblyFileVersion = "3.11.0" - let [] AssemblyInformationalVersion = "3.11.0" + let [] AssemblyVersion = "3.12.0" + let [] AssemblyMetadata_ReleaseDate = "2020-08-29T00:00:00.0000000" + let [] AssemblyFileVersion = "3.12.0" + let [] AssemblyInformationalVersion = "3.12.0" let [] AssemblyMetadata_ReleaseChannel = "release" - let [] AssemblyMetadata_GitHash = "dbe65f09faf4b6ddf40d5e84320acd761f6b4d81" + let [] AssemblyMetadata_GitHash = "fdb4e9da4d035afc38f1941a84adf621fd8c2574" diff --git a/src/NpgsqlFSharpAnalyzer.Core/SqlAnalysis.fs b/src/NpgsqlFSharpAnalyzer.Core/SqlAnalysis.fs index 25bdf24..1d984f0 100644 --- a/src/NpgsqlFSharpAnalyzer.Core/SqlAnalysis.fs +++ b/src/NpgsqlFSharpAnalyzer.Core/SqlAnalysis.fs @@ -304,15 +304,57 @@ module SqlAnalysis = | Result.Ok expr -> parameters + let missingInsertColumns (schema: DbSchemaLookups) (query:string) = + match Parser.parse query with + | Result.Error _ -> None + | Result.Ok expression -> + match expression with + | Expr.InsertQuery insertQuery -> + let missingInsertColumns = + schema.Columns.Values + |> Seq.filter (fun column -> column.BaseTableName = insertQuery.Table && not column.OptionalForInsert) + |> Seq.filter (fun column -> not (List.contains column.Name insertQuery.Columns)) + + if Seq.isEmpty missingInsertColumns then + None + else + let errorMessage = + missingInsertColumns + |> Seq.map (fun column -> sprintf "'%s'" column.Name) + |> Seq.toList + |> function + | [ ] -> "" + | [ first ] -> first + | [ first; second ] -> sprintf "%s and %s" first second + | columns -> + let lastColumn = List.last columns + let firstColumns = + columns + |> List.rev + |> List.skip 1 + |> List.rev + |> String.concat ", " + + sprintf "%s and %s" firstColumns lastColumn + + |> fun columns -> sprintf "INSERT query is missing required columns %s when adding rows to the '%s' table" columns insertQuery.Table + + Some errorMessage + | _ -> + None + let extractParametersAndOutputColumns(connectionString, commandText, dbSchemaLookups) = try let parameters, output, enums = InformationSchema.extractParametersAndOutputColumns(connectionString, commandText, false, dbSchemaLookups) let parametersWithNullability = determineParameterNullability parameters dbSchemaLookups commandText - Result.Ok (parametersWithNullability, output) + let potentiallyMissingColumns = missingInsertColumns dbSchemaLookups commandText + Result.Ok (parametersWithNullability, output, potentiallyMissingColumns) with | :? PostgresException as databaseError -> - Result.Error databaseError.Message + // errors such as syntax errors are reported here + Result.Error (sprintf "%s: %s" databaseError.Severity databaseError.MessageText) | error -> + // any other generic error Result.Error (sprintf "%s\n%s" error.Message error.StackTrace) let createWarning (message: string) (range: range) : Message = @@ -409,6 +451,8 @@ module SqlAnalysis = let warning = if String.IsNullOrWhiteSpace(providedParam.name) then createWarning (sprintf "Empty parameter name was provided. Please provide one of %s" expectedParameters) providedParam.range + else if List.length codeFixes = 1 + then createWarning (sprintf "Unexpected parameter '%s' is provided. Did you mean '%s'?" providedParam.name closestAlternative) providedParam.range else createWarning (sprintf "Unexpected parameter '%s' is provided. Did you mean '%s'? %s" providedParam.name closestAlternative expectedParameters) providedParam.range yield { warning with Fixes = codeFixes } @@ -453,7 +497,10 @@ module SqlAnalysis = { createWarning warning providedParam.paramFuncRange with Fixes = codeFixs } - if not requiredParam.DataType.IsArray then + if providedParam.paramFunc = "Sql.parameter" then + // do not do anything when the input is a generic param + () + else if not requiredParam.DataType.IsArray then match requiredParam.DataType.Name with | "bit" -> if requiredParam.IsNullable then @@ -617,7 +664,7 @@ module SqlAnalysis = match findColumn attempt.columnName availableColumns with | None -> if List.isEmpty availableColumns then - let warningMsg = sprintf "Attempting to read column named '%s' from a result set which doesn't return any columns. In case you are executing DELETE, INSERT or UPDATE queries, you might want to use Sql.executeNonQuery or Sql.executeNonQueryAsync to obtain the number of affected rows." attempt.columnName + let warningMsg = sprintf "Attempting to read column named '%s' from a result set which doesn't return any columns. In case you are executing DELETE, INSERT or UPDATE queries, you might want to use Sql.executeNonQuery or Sql.executeNonQueryAsync to obtain the number of affected rows. You can also add a RETURNING clause in your query to make it return the rows which are updated, inserted or deleted from that query." attempt.columnName yield createWarning warningMsg attempt.columnNameRange else let levenshtein = new NormalizedLevenshtein() @@ -890,9 +937,15 @@ module SqlAnalysis = match queryAnalysis with | Result.Error queryError -> [ createWarning queryError queryRange ] - | Result.Ok (parameters, outputColunms) -> + | Result.Ok (parameters, outputColunms, errorMessage) -> + let potentialInsertQueryError = + match errorMessage with + | None -> [ ] + | Some message -> [ createWarning message queryRange ] + let readingAttempts = defaultArg (findColumnReadAttempts operation) [ ] [ + yield! potentialInsertQueryError yield! analyzeParameters operation parameters yield! analyzeColumnReadingAttempts readingAttempts outputColunms ] diff --git a/src/NpgsqlFSharpAnalyzer/AssemblyInfo.fs b/src/NpgsqlFSharpAnalyzer/AssemblyInfo.fs index 4f3f647..58fd606 100644 --- a/src/NpgsqlFSharpAnalyzer/AssemblyInfo.fs +++ b/src/NpgsqlFSharpAnalyzer/AssemblyInfo.fs @@ -4,20 +4,20 @@ open System.Reflection [] [] -[] -[] -[] -[] +[] +[] +[] +[] [] -[] +[] do () module internal AssemblyVersionInformation = let [] AssemblyTitle = "NpgsqlFSharpAnalyzer" let [] AssemblyProduct = "NpgsqlFSharpAnalyzer" - let [] AssemblyVersion = "3.11.0" - let [] AssemblyMetadata_ReleaseDate = "2020-08-18T00:00:00.0000000" - let [] AssemblyFileVersion = "3.11.0" - let [] AssemblyInformationalVersion = "3.11.0" + let [] AssemblyVersion = "3.12.0" + let [] AssemblyMetadata_ReleaseDate = "2020-08-29T00:00:00.0000000" + let [] AssemblyFileVersion = "3.12.0" + let [] AssemblyInformationalVersion = "3.12.0" let [] AssemblyMetadata_ReleaseChannel = "release" - let [] AssemblyMetadata_GitHash = "dbe65f09faf4b6ddf40d5e84320acd761f6b4d81" + let [] AssemblyMetadata_GitHash = "fdb4e9da4d035afc38f1941a84adf621fd8c2574" diff --git a/src/NpgsqlFSharpParser/AssemblyInfo.fs b/src/NpgsqlFSharpParser/AssemblyInfo.fs new file mode 100644 index 0000000..d1bc395 --- /dev/null +++ b/src/NpgsqlFSharpParser/AssemblyInfo.fs @@ -0,0 +1,23 @@ +// Auto-Generated by FAKE; do not edit +namespace System +open System.Reflection + +[] +[] +[] +[] +[] +[] +[] +[] +do () + +module internal AssemblyVersionInformation = + let [] AssemblyTitle = "NpgsqlFSharpParser" + let [] AssemblyProduct = "NpgsqlFSharpAnalyzer" + let [] AssemblyVersion = "3.12.0" + let [] AssemblyMetadata_ReleaseDate = "2020-08-29T00:00:00.0000000" + let [] AssemblyFileVersion = "3.12.0" + let [] AssemblyInformationalVersion = "3.12.0" + let [] AssemblyMetadata_ReleaseChannel = "release" + let [] AssemblyMetadata_GitHash = "fdb4e9da4d035afc38f1941a84adf621fd8c2574" diff --git a/src/NpgsqlFSharpVs/Properties/AssemblyInfo.cs b/src/NpgsqlFSharpVs/Properties/AssemblyInfo.cs index 47cf724..47b5041 100644 --- a/src/NpgsqlFSharpVs/Properties/AssemblyInfo.cs +++ b/src/NpgsqlFSharpVs/Properties/AssemblyInfo.cs @@ -4,21 +4,21 @@ [assembly: AssemblyTitle("NpgsqlFSharpVs")] [assembly: AssemblyProduct("NpgsqlFSharpAnalyzer")] -[assembly: AssemblyVersion("3.11.0")] -[assembly: AssemblyMetadata("ReleaseDate","2020-08-18T00:00:00.0000000")] -[assembly: AssemblyFileVersion("3.11.0")] -[assembly: AssemblyInformationalVersion("3.11.0")] +[assembly: AssemblyVersion("3.12.0")] +[assembly: AssemblyMetadata("ReleaseDate","2020-08-29T00:00:00.0000000")] +[assembly: AssemblyFileVersion("3.12.0")] +[assembly: AssemblyInformationalVersion("3.12.0")] [assembly: AssemblyMetadata("ReleaseChannel","release")] -[assembly: AssemblyMetadata("GitHash","dbe65f09faf4b6ddf40d5e84320acd761f6b4d81")] +[assembly: AssemblyMetadata("GitHash","fdb4e9da4d035afc38f1941a84adf621fd8c2574")] namespace System { internal static class AssemblyVersionInformation { internal const System.String AssemblyTitle = "NpgsqlFSharpVs"; internal const System.String AssemblyProduct = "NpgsqlFSharpAnalyzer"; - internal const System.String AssemblyVersion = "3.11.0"; - internal const System.String AssemblyMetadata_ReleaseDate = "2020-08-18T00:00:00.0000000"; - internal const System.String AssemblyFileVersion = "3.11.0"; - internal const System.String AssemblyInformationalVersion = "3.11.0"; + internal const System.String AssemblyVersion = "3.12.0"; + internal const System.String AssemblyMetadata_ReleaseDate = "2020-08-29T00:00:00.0000000"; + internal const System.String AssemblyFileVersion = "3.12.0"; + internal const System.String AssemblyInformationalVersion = "3.12.0"; internal const System.String AssemblyMetadata_ReleaseChannel = "release"; - internal const System.String AssemblyMetadata_GitHash = "dbe65f09faf4b6ddf40d5e84320acd761f6b4d81"; + internal const System.String AssemblyMetadata_GitHash = "fdb4e9da4d035afc38f1941a84adf621fd8c2574"; } } diff --git a/src/NpgsqlFSharpVs/source.extension.vsixmanifest b/src/NpgsqlFSharpVs/source.extension.vsixmanifest index c4eefac..a036aa3 100644 --- a/src/NpgsqlFSharpVs/source.extension.vsixmanifest +++ b/src/NpgsqlFSharpVs/source.extension.vsixmanifest @@ -3,7 +3,7 @@ xmlns="http://schemas.microsoft.com/developer/vsx-schema/2011" xmlns:d="http://schemas.microsoft.com/developer/vsx-schema-design/2011"> - + NpgsqlFSharpVs F# Analyzer for embedded SQL syntax analysis, type-checking for parameters and result sets and nullable column detection when writing queries using Npgsql.FSharp. https://github.com/Zaid-Ajaj/Npgsql.FSharp.Analyzer diff --git a/src/ParserTestsWithNet48/App.config b/src/ParserTestsWithNet48/App.config new file mode 100644 index 0000000..193aecc --- /dev/null +++ b/src/ParserTestsWithNet48/App.config @@ -0,0 +1,6 @@ + + + + + + \ No newline at end of file diff --git a/src/ParserTestsWithNet48/ParserTestsWithNet48.csproj b/src/ParserTestsWithNet48/ParserTestsWithNet48.csproj new file mode 100644 index 0000000..c89a5dd --- /dev/null +++ b/src/ParserTestsWithNet48/ParserTestsWithNet48.csproj @@ -0,0 +1,71 @@ + + + + + Debug + AnyCPU + {40067E09-6281-4DC2-905D-60F7C6E3B812} + Exe + ParserTestsWithNet48 + ParserTestsWithNet48 + v4.8 + 512 + true + true + + + AnyCPU + true + full + false + bin\Debug\ + DEBUG;TRACE + prompt + 4 + + + AnyCPU + pdbonly + true + bin\Release\ + TRACE + prompt + 4 + + + + + + + + + + + + + + + + + + + + + {c5eb813f-4278-4ee7-925b-6757bad0fe9b} + FParsecCS + + + {9c8e7641-9dc8-470c-8009-71a747c01dc5} + FParsec + + + {5964bb56-97b8-4fae-9933-8113db11438d} + NpgsqlFSharpAnalyzer.Core + + + {bc524f8e-6282-4e31-9a0e-29fce38832e7} + NpgsqlFSharpParser + + + + \ No newline at end of file diff --git a/src/ParserTestsWithNet48/Program.cs b/src/ParserTestsWithNet48/Program.cs new file mode 100644 index 0000000..b1ee665 --- /dev/null +++ b/src/ParserTestsWithNet48/Program.cs @@ -0,0 +1,18 @@ +using System; +using NpgsqlFSharpParser; + +namespace ParserTestsWithNet48 +{ + static class Program + { + static void Main(string[] args) + { + // Making sure the code from the parser + // can be called from a net48 .NET Framework library + // simulating the VS extension + var query = "SELECT * FROM users"; + var result = Parser.parseUnsafe(query); + Console.WriteLine(result.ToString()); + } + } +} diff --git a/src/ParserTestsWithNet48/Properties/AssemblyInfo.cs b/src/ParserTestsWithNet48/Properties/AssemblyInfo.cs new file mode 100644 index 0000000..3ce1c9a --- /dev/null +++ b/src/ParserTestsWithNet48/Properties/AssemblyInfo.cs @@ -0,0 +1,24 @@ +// Auto-Generated by FAKE; do not edit +// +using System.Reflection; + +[assembly: AssemblyTitle("ParserTestsWithNet48")] +[assembly: AssemblyProduct("NpgsqlFSharpAnalyzer")] +[assembly: AssemblyVersion("3.12.0")] +[assembly: AssemblyMetadata("ReleaseDate","2020-08-29T00:00:00.0000000")] +[assembly: AssemblyFileVersion("3.12.0")] +[assembly: AssemblyInformationalVersion("3.12.0")] +[assembly: AssemblyMetadata("ReleaseChannel","release")] +[assembly: AssemblyMetadata("GitHash","fdb4e9da4d035afc38f1941a84adf621fd8c2574")] +namespace System { + internal static class AssemblyVersionInformation { + internal const System.String AssemblyTitle = "ParserTestsWithNet48"; + internal const System.String AssemblyProduct = "NpgsqlFSharpAnalyzer"; + internal const System.String AssemblyVersion = "3.12.0"; + internal const System.String AssemblyMetadata_ReleaseDate = "2020-08-29T00:00:00.0000000"; + internal const System.String AssemblyFileVersion = "3.12.0"; + internal const System.String AssemblyInformationalVersion = "3.12.0"; + internal const System.String AssemblyMetadata_ReleaseChannel = "release"; + internal const System.String AssemblyMetadata_GitHash = "fdb4e9da4d035afc38f1941a84adf621fd8c2574"; + } +} diff --git a/tests/NpgsqlFSharpAnalyzer.Tests/AssemblyInfo.fs b/tests/NpgsqlFSharpAnalyzer.Tests/AssemblyInfo.fs index ff35d3e..14769de 100644 --- a/tests/NpgsqlFSharpAnalyzer.Tests/AssemblyInfo.fs +++ b/tests/NpgsqlFSharpAnalyzer.Tests/AssemblyInfo.fs @@ -4,20 +4,20 @@ open System.Reflection [] [] -[] -[] -[] -[] +[] +[] +[] +[] [] -[] +[] do () module internal AssemblyVersionInformation = let [] AssemblyTitle = "NpgsqlFSharpAnalyzer.Tests" let [] AssemblyProduct = "NpgsqlFSharpAnalyzer" - let [] AssemblyVersion = "3.11.0" - let [] AssemblyMetadata_ReleaseDate = "2020-08-18T00:00:00.0000000" - let [] AssemblyFileVersion = "3.11.0" - let [] AssemblyInformationalVersion = "3.11.0" + let [] AssemblyVersion = "3.12.0" + let [] AssemblyMetadata_ReleaseDate = "2020-08-29T00:00:00.0000000" + let [] AssemblyFileVersion = "3.12.0" + let [] AssemblyInformationalVersion = "3.12.0" let [] AssemblyMetadata_ReleaseChannel = "release" - let [] AssemblyMetadata_GitHash = "dbe65f09faf4b6ddf40d5e84320acd761f6b4d81" + let [] AssemblyMetadata_GitHash = "fdb4e9da4d035afc38f1941a84adf621fd8c2574" diff --git a/tests/NpgsqlFSharpAnalyzer.Tests/Tests.fs b/tests/NpgsqlFSharpAnalyzer.Tests/Tests.fs index 61770b5..18ced81 100644 --- a/tests/NpgsqlFSharpAnalyzer.Tests/Tests.fs +++ b/tests/NpgsqlFSharpAnalyzer.Tests/Tests.fs @@ -221,7 +221,7 @@ let tests = match resultSetMetadata with | Result.Error errorMsg -> failwithf "Could not analyse result set metadata %s" errorMsg - | Result.Ok (parameters, outputColumns) -> + | Result.Ok (parameters, outputColumns, _) -> Expect.isEmpty parameters "Query shouldn't contain any parameters" Expect.equal 1 outputColumns.Length "There is one column returned" } @@ -248,7 +248,7 @@ let tests = match resultSetMetadata with | Result.Error errorMsg -> failwithf "Could not analyse result set metadata %s" errorMsg - | Result.Ok (parameters, outputColumns) -> + | Result.Ok (parameters, outputColumns, _) -> Expect.equal 1 parameters.Length "Query has one parameter" Expect.equal "integer" parameters.[0].DataType.Name "The parameter is int4" Expect.equal 1 outputColumns.Length "There is one column returned" diff --git a/tests/examples/hashing/AssemblyInfo.fs b/tests/examples/hashing/AssemblyInfo.fs index 069b16d..884483b 100644 --- a/tests/examples/hashing/AssemblyInfo.fs +++ b/tests/examples/hashing/AssemblyInfo.fs @@ -4,20 +4,20 @@ open System.Reflection [] [] -[] -[] -[] -[] +[] +[] +[] +[] [] -[] +[] do () module internal AssemblyVersionInformation = let [] AssemblyTitle = "examples" let [] AssemblyProduct = "NpgsqlFSharpAnalyzer" - let [] AssemblyVersion = "3.11.0" - let [] AssemblyMetadata_ReleaseDate = "2020-08-18T00:00:00.0000000" - let [] AssemblyFileVersion = "3.11.0" - let [] AssemblyInformationalVersion = "3.11.0" + let [] AssemblyVersion = "3.12.0" + let [] AssemblyMetadata_ReleaseDate = "2020-08-29T00:00:00.0000000" + let [] AssemblyFileVersion = "3.12.0" + let [] AssemblyInformationalVersion = "3.12.0" let [] AssemblyMetadata_ReleaseChannel = "release" - let [] AssemblyMetadata_GitHash = "dbe65f09faf4b6ddf40d5e84320acd761f6b4d81" + let [] AssemblyMetadata_GitHash = "fdb4e9da4d035afc38f1941a84adf621fd8c2574"