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

FbScript not parsing comments in SQL script. [DNET761] #703

Closed
firebird-automations opened this issue May 9, 2017 · 5 comments
Closed

Comments

@firebird-automations
Copy link

Submitted by: Andrew Ayre (aayreth)

Relate to DNET176

Some older version of the .NET Data Provider seem to work OK.
I think the issue was introduced on 5-Oct-2015.

In general this issue seems to be related to the parsing of SQL by FbScript.

This issues seems to be related to how comment are handled within an SQL script when it is parsed by FbScript.
Both multiline comments as well as single line comments are impacted.

Multiline comments seem to have an issue if the comment contains a "@" character.
The below is an example of valid SQL that fails to parse correctly with FbScript:

====== Begin SQL Example 1 ======
/*@@metadata

<Title Metadata\> Summary: Metadata\. Description Metadata is the collection of scripts that create the structure and supporting business rules for the Firebird Database\. All scripts are written in ANSI92 SQL language which is the language used by the Firebird Server\.

* *
Developers please consult the SDK for coding and documentation standards.
*/

CREATE EXCEPTION ACTUAL_DATE_CANCELLATION
'Actual Date must be null if Cancellation Reason is set.';

====== End SQL Example 1======

The error returned is:
Exception thrown: 'FirebirdSql.Data.FirebirdClient.FbException' in FirebirdSql.Data.FirebirdClient.dll
Additional information: Must declare command parameters.

Single line comments seem to have an issue with comments occurring after the last SQL statement.
The below is an example of valid SQL that fails to parse correctly with FbScript:

====== Begin SQL Example 2 ======
CREATE EXCEPTION ACTUAL_DATE_CANCELLATION
'Actual Date must be null if Cancellation Reason is set.';

-- This is a test
====== End SQL Example 2======

Exception thrown: 'System.ArgumentException' in FirebirdSql.Data.FirebirdClient.dll
Additional information: The type of the SQL statement could not be determined. See also UnknownStatement event.
Statement:

-- This is a test

.

SQL Scripts containing "Commit" also seem to have issues in some situations, but don't have any details at this time.
I will add more details regarding the issue of "Commit" within SQL script and FbScript parsing when I have more details.

@firebird-automations
Copy link
Author

Modified by: Andrew Ayre (aayreth)

description: Some older version of the .NET Data Provider seem to work OK.

This issues seems to be related to how comment are handled within an SQL script when it is parsed by FbScript.
Both multiline comments as well as single line comments are impacted.

Multiline comments seem to have an issue if the comment contains a "@" character.
The below is an example of valid SQL that fails to parse correctly with FbScript:

====== Begin SQL Example 1 ======
/*@@metadata

<Title Metadata\> Summary: Metadata\. Description Metadata is the collection of scripts that create the structure and supporting business rules for the Firebird Database\. All scripts are written in ANSI92 SQL language which is the language used by the Firebird Server\.

* *
Developers please consult the SDK for coding and documentation standards.
*/

CREATE EXCEPTION ACTUAL_DATE_CANCELLATION
'Actual Date must be null if Cancellation Reason is set.';

====== End SQL Example 1======

The error returned is:
Exception thrown: 'FirebirdSql.Data.FirebirdClient.FbException' in FirebirdSql.Data.FirebirdClient.dll
Additional information: Must declare command parameters.

Single line comments seem to have an issue with comments occurring after the last SQL statement.
The below is an example of valid SQL that fails to parse correctly with FbScript:

====== Begin SQL Example 2 ======
CREATE EXCEPTION ACTUAL_DATE_CANCELLATION
'Actual Date must be null if Cancellation Reason is set.';

-- This is a test
====== End SQL Example 2======

Exception thrown: 'System.ArgumentException' in FirebirdSql.Data.FirebirdClient.dll
Additional information: The type of the SQL statement could not be determined. See also UnknownStatement event.
Statement:

-- This is a test

.

=>

Some older version of the .NET Data Provider seem to work OK.
I think the issue was introduced on 5-Oct-2015.

This issues seems to be related to how comment are handled within an SQL script when it is parsed by FbScript.
Both multiline comments as well as single line comments are impacted.

Multiline comments seem to have an issue if the comment contains a "@" character.
The below is an example of valid SQL that fails to parse correctly with FbScript:

====== Begin SQL Example 1 ======
/*@@metadata

<Title Metadata\> Summary: Metadata\. Description Metadata is the collection of scripts that create the structure and supporting business rules for the Firebird Database\. All scripts are written in ANSI92 SQL language which is the language used by the Firebird Server\.

* *
Developers please consult the SDK for coding and documentation standards.
*/

CREATE EXCEPTION ACTUAL_DATE_CANCELLATION
'Actual Date must be null if Cancellation Reason is set.';

====== End SQL Example 1======

The error returned is:
Exception thrown: 'FirebirdSql.Data.FirebirdClient.FbException' in FirebirdSql.Data.FirebirdClient.dll
Additional information: Must declare command parameters.

Single line comments seem to have an issue with comments occurring after the last SQL statement.
The below is an example of valid SQL that fails to parse correctly with FbScript:

====== Begin SQL Example 2 ======
CREATE EXCEPTION ACTUAL_DATE_CANCELLATION
'Actual Date must be null if Cancellation Reason is set.';

-- This is a test
====== End SQL Example 2======

Exception thrown: 'System.ArgumentException' in FirebirdSql.Data.FirebirdClient.dll
Additional information: The type of the SQL statement could not be determined. See also UnknownStatement event.
Statement:

-- This is a test

.

@firebird-automations
Copy link
Author

Modified by: Andrew Ayre (aayreth)

description: Some older version of the .NET Data Provider seem to work OK.
I think the issue was introduced on 5-Oct-2015.

This issues seems to be related to how comment are handled within an SQL script when it is parsed by FbScript.
Both multiline comments as well as single line comments are impacted.

Multiline comments seem to have an issue if the comment contains a "@" character.
The below is an example of valid SQL that fails to parse correctly with FbScript:

====== Begin SQL Example 1 ======
/*@@metadata

<Title Metadata\> Summary: Metadata\. Description Metadata is the collection of scripts that create the structure and supporting business rules for the Firebird Database\. All scripts are written in ANSI92 SQL language which is the language used by the Firebird Server\.

* *
Developers please consult the SDK for coding and documentation standards.
*/

CREATE EXCEPTION ACTUAL_DATE_CANCELLATION
'Actual Date must be null if Cancellation Reason is set.';

====== End SQL Example 1======

The error returned is:
Exception thrown: 'FirebirdSql.Data.FirebirdClient.FbException' in FirebirdSql.Data.FirebirdClient.dll
Additional information: Must declare command parameters.

Single line comments seem to have an issue with comments occurring after the last SQL statement.
The below is an example of valid SQL that fails to parse correctly with FbScript:

====== Begin SQL Example 2 ======
CREATE EXCEPTION ACTUAL_DATE_CANCELLATION
'Actual Date must be null if Cancellation Reason is set.';

-- This is a test
====== End SQL Example 2======

Exception thrown: 'System.ArgumentException' in FirebirdSql.Data.FirebirdClient.dll
Additional information: The type of the SQL statement could not be determined. See also UnknownStatement event.
Statement:

-- This is a test

.

=>

Some older version of the .NET Data Provider seem to work OK.
I think the issue was introduced on 5-Oct-2015.

In general this issue seems to be related to the parsing of SQL by FbScript.

This issues seems to be related to how comment are handled within an SQL script when it is parsed by FbScript.
Both multiline comments as well as single line comments are impacted.

Multiline comments seem to have an issue if the comment contains a "@" character.
The below is an example of valid SQL that fails to parse correctly with FbScript:

====== Begin SQL Example 1 ======
/*@@metadata

<Title Metadata\> Summary: Metadata\. Description Metadata is the collection of scripts that create the structure and supporting business rules for the Firebird Database\. All scripts are written in ANSI92 SQL language which is the language used by the Firebird Server\.

* *
Developers please consult the SDK for coding and documentation standards.
*/

CREATE EXCEPTION ACTUAL_DATE_CANCELLATION
'Actual Date must be null if Cancellation Reason is set.';

====== End SQL Example 1======

The error returned is:
Exception thrown: 'FirebirdSql.Data.FirebirdClient.FbException' in FirebirdSql.Data.FirebirdClient.dll
Additional information: Must declare command parameters.

Single line comments seem to have an issue with comments occurring after the last SQL statement.
The below is an example of valid SQL that fails to parse correctly with FbScript:

====== Begin SQL Example 2 ======
CREATE EXCEPTION ACTUAL_DATE_CANCELLATION
'Actual Date must be null if Cancellation Reason is set.';

-- This is a test
====== End SQL Example 2======

Exception thrown: 'System.ArgumentException' in FirebirdSql.Data.FirebirdClient.dll
Additional information: The type of the SQL statement could not be determined. See also UnknownStatement event.
Statement:

-- This is a test

.

SQL Scripts containing "Commit" also seem to have issues in some situations, but don't have any details at this time.
I will add more details regarding the issue of "Commit" within SQL script and FbScript parsing when I have more details.

@firebird-automations
Copy link
Author

Commented by: @cincuranet

The first one is duplicate of DNET176.
The other one is expected. There's no statement after the previous `;`. You can handle it in `UnknownStatement`, as described in exception.

@firebird-automations
Copy link
Author

Modified by: @cincuranet

Link: This issue relate to DNET176 [ DNET176 ]

@firebird-automations
Copy link
Author

Modified by: @cincuranet

status: Open [ 1 ] => Closed [ 6 ]

resolution: Won't Fix [ 2 ]

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

No branches or pull requests

2 participants