-
-
Notifications
You must be signed in to change notification settings - Fork 69
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
When command contains comment and there is a "@something" you got error that you need to declare parameter [DNET176] #184
Comments
Commented by: Gareth Goslett (gareth) A patch to fix this issue, not extensively tested. The comment text is removed from the statement but the comment characters '--' are not. One reason to keep comments in is that you can now view the statement from the monitoring tables. I ran the following "sql" text and it executed fine. "INSERT --An insert statement\r\n" + |
Modified by: Gareth Goslett (gareth)Attachment: FbCommand.patch [ 11373 ] |
Commented by: @cincuranet First, the patch is wrong. Try query like "select 'foo' from rdb$database /* @foo */". Secondly, I don't wanna to go this way. We need fast, simple and reliable way to detect and skip (the comment can be pretty long) comments in query, not to extending the method with thousands of ifs. |
Commented by: Gareth Goslett (gareth) Can we strip comments and control characters entirely, only send the query text to the server ? I was not aware that firebird handled the c style comments, I thaught it only allowed the '--' comment characters, thanks. |
Commented by: @cincuranet We can, if somebody creates some reliable function for it. But for now, I don't see this as a big issue. |
Commented by: @cincuranet This is final version from the mailing list thread [http://www.nabble.com/FbCommand-sql-parser-td22215029.html] from Gareth Goslett. Looks good, I'll just create couple of coding style tweaks. string ParseNamedParameters(string sql)
(Char.IsLetterOrDigit(sql[index]) || sql[index] == '_' || sql[index]
&& sql[index] != '\n'); index++);
|
Commented by: Gareth Goslett (gareth) Patch for svn, 908. |
Modified by: Gareth Goslett (gareth)Attachment: FbCommand.patch [ 11440 ] |
Modified by: @cincuranet |
Modified by: @cincuranet |
Thought I submitted this already but I cannot find it. This fixes comments in a command FirebirdSQL#184 IT also fixes quotes in a comment which breaks things too. -- This is a comment with a quote '. That quote will break as -- it thinks the next quote on the email ends a string and -- the param symbol starts a parameter update foo set email = '[email protected]';
Submitted by: @cincuranet
Relate to DNET564
Is related to DNET761
Attachments:
FbCommand.patch
FbCommand.patch
Votes: 2
When command contains comment and there is a "@something" you got error that you need to declare parameter.
I.e.:
select foo from bar --abc @xyz
The text was updated successfully, but these errors were encountered: