Skip to main content

Hi,

I just added an end-sql statement to some workspaces, each with a comment on the preceding line. The comment is a T-SQL line comment on a separate line, i.e. with prepended "--" (two dashes).

This fails, as it seems FME gobbles up the first dash before execution, rendering the complete statement invalid.

If this WAD og a bug ?

Is it possible to add comments as "/* ... */" instead, or would "--- ..." (i.e. 3+ dashes) work ?

It also doesn't look like line-feeds in the statement are respected, so maybe line comments are a complete no-go ?

Cheers

Lars

Hi @lifalin2016, there is an FME specific syntax says any error occurs while executing a SQL statement won't stop the translation (i.e. FME ignores the error) if the statement was preceded with a single hyphen.

"An individual statement may be preceded with a hyphen, indicating that errors should be ignored.
The following example contains two SQL commands where errors from the first command will be ignored:FME_SQL_DELIMITER ;-SELECT * FROM TABLEA;SELECT * FROM TABLEB;" -- SQL Statement, Parameters, SQLExecutor HelpBecause of that, I think that FME removes the leading hyphen from any statement before passing the statement to a database engine and therefore it could cause the error you have observed on a comment statement starting with two hyphens.I don't consider it as a bug, but think it should be documented somewhere, or there is a room to improve the implementation not to remove the first hyphen if the line starts with two consecutive hyphens.

Hi @lifalin2016, there is an FME specific syntax says any error occurs while executing a SQL statement won't stop the translation (i.e. FME ignores the error) if the statement was preceded with a single hyphen.

"An individual statement may be preceded with a hyphen, indicating that errors should be ignored.
The following example contains two SQL commands where errors from the first command will be ignored:FME_SQL_DELIMITER ;-SELECT * FROM TABLEA;SELECT * FROM TABLEB;" -- SQL Statement, Parameters, SQLExecutor HelpBecause of that, I think that FME removes the leading hyphen from any statement before passing the statement to a database engine and therefore it could cause the error you have observed on a comment statement starting with two hyphens.I don't consider it as a bug, but think it should be documented somewhere, or there is a room to improve the implementation not to remove the first hyphen if the line starts with two consecutive hyphens.
(adding as comment instead of answer)

 


Thanks Takashi.

 

That would explain it, although I didn't use SqlExecutor, so its embedded help wasn't readily available.

 

But
yes, there's room for some improvement. My expectation in an SQL window
designed for SQL Server commands would clearly be, that it supports
standard T-SQL. At least having the FME "syntax extensions" be
optionally added (e.g. with a checkbox) would go a long way to resolve
expectations.

 

But summarizing, it seems that three dashes would indeed work, and /* ... */ would also work.

 

Cheers, and have a nice weekend.

 

 


(adding as comment instead of answer)

 


Thanks Takashi.

 

That would explain it, although I didn't use SqlExecutor, so its embedded help wasn't readily available.

 

But
yes, there's room for some improvement. My expectation in an SQL window
designed for SQL Server commands would clearly be, that it supports
standard T-SQL. At least having the FME "syntax extensions" be
optionally added (e.g. with a checkbox) would go a long way to resolve
expectations.

 

But summarizing, it seems that three dashes would indeed work, and /* ... */ would also work.

 

Cheers, and have a nice weekend.

 

 

Actually, it's still not quite good.

 

Even when I know that a command will fail, and prepend the command with a dash, it still (when failing) gets logged as an error in the log file.

 

This is most irritating, as I assumed the dash would make FME ignore any errors. At least don't log it as an error, just as a warning.

 


Closing this as behaviour has changed in later versions.


Reply