forked from sqlancer/sqlancer
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: add support of advanced functions (sqlancer#882)
- Loading branch information
1 parent
b694a3a
commit 7f37778
Showing
2 changed files
with
40 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
package sqlancer.stonedb.ast; | ||
|
||
import java.util.List; | ||
|
||
import sqlancer.Randomly; | ||
import sqlancer.common.ast.FunctionNode; | ||
import sqlancer.stonedb.ast.StoneDBAdvancedFunction.StoneDBAdvancedFunc; | ||
|
||
public class StoneDBAdvancedFunction extends FunctionNode<StoneDBAdvancedFunc, StoneDBExpression> | ||
implements StoneDBExpression { | ||
|
||
// https://stonedb.io/docs/SQL-reference/functions/advanced-functions | ||
public enum StoneDBAdvancedFunc { | ||
IFNULL(2), IF(3), NULLIF(2), BIN(1), BINARY(1), CONV(3); | ||
|
||
private int nrArgs; | ||
|
||
StoneDBAdvancedFunc(int nrArgs) { | ||
this.nrArgs = nrArgs; | ||
} | ||
|
||
public static StoneDBAdvancedFunc getRandom() { | ||
return Randomly.fromOptions(values()); | ||
} | ||
|
||
public int getNrArgs() { | ||
return nrArgs; | ||
} | ||
} | ||
|
||
protected StoneDBAdvancedFunction(StoneDBAdvancedFunc function, List<StoneDBExpression> args) { | ||
super(function, args); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters