You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
In SQLDSL, some methods like sum create an OperatorAST with a neutral argument (4th parameter) null, but in some cases (when exprs is empty) OperatorAST calls this.neutral.writeTo(b); so I guess it can create errors, something like:
AST tree = select(sum(), from(id("songs")));
because in OperatorAST in method writeTo, if this.neutral is null there is no method writeTo():
if (n == 0) {
this.neutral.writeTo(b);
}
Obviously this would lead to incorrect SQL, so a choice must be taken: either throw an exception either write wrong SQL and let the SQL library trigger an error. Personally I would choose the second option because the objective of this library sqltrees is probably not to re-implement the whole (dialects of) SQL semantics.
I’m not completely affirmative because I’m not fluent in Java, so perhaps I miss some language detail. But I was interested by the article in MISC and I took as an exercice to transpile/implement it to PHP (I master this language), and in the corresponding situation PHP complains.
The text was updated successfully, but these errors were encountered:
In
SQLDSL
, some methods likesum
create anOperatorAST
with aneutral
argument (4th parameter)null
, but in some cases (whenexprs
is empty)OperatorAST
callsthis.neutral.writeTo(b);
so I guess it can create errors, something like:because in
OperatorAST
in methodwriteTo
, ifthis.neutral
is null there is no methodwriteTo()
:Obviously this would lead to incorrect SQL, so a choice must be taken: either throw an exception either write wrong SQL and let the SQL library trigger an error. Personally I would choose the second option because the objective of this library sqltrees is probably not to re-implement the whole (dialects of) SQL semantics.
I’m not completely affirmative because I’m not fluent in Java, so perhaps I miss some language detail. But I was interested by the article in MISC and I took as an exercice to transpile/implement it to PHP (I master this language), and in the corresponding situation PHP complains.
The text was updated successfully, but these errors were encountered: