planetarydev/json-sql-builder2

table alias don't seem to be right for oracle dialect

belgac opened this issue · 5 comments

Hi,

fantastic work on this library, it really helps me.

I noticed that for the oracle dialect there is a syntax error in the aliasing of tables (for from, and join clauses). In oracle tables are aliased without the "AS" keyword (https://www.techonthenet.com/oracle/alias.php) but json-sql-builder2 doesn't seem to take this into account.

I'm looking at the doc to implement a PR with this modification for the oracle dialect.

I'm not sure how i can set a syntax by dialect

I have fixed it for the from clause. Please have a look at the from.js in sql/helpers/queries/from.

@belgac : Was the fix for the from clause helpful and fit your needs?
Can you do a PR for the join clauses?

Hi,

yes the fix was perfect and i understand how it works, thanks a lot.

I will do the PR for the join clauses ;)

@belgac : First of all THANKS for your PR!
In addition - if you need some specific Oracle helper you can define this directly by Syntax in a way like the SELECT-example in the main README.md. This works only if you are targeting a addional helper like the $top helper for SQLServer -->(SQLServer).

SELECT
{ [$top]}-->(SQLServer)
{ DISTINCT[$distinct]}
{ SQL_CALC_FOUND_ROWS[$calcFoundRows]}-->(MySQL,MariaDB)

{ <$columns>}
    { [$into]}-->(MySQL,MariaDB,SQLServer)

{ FROM [$from]}    { [$join]}
{ WHERE [$where]}