mirror of
https://github.com/WiiLink24/wfc-server.git
synced 2026-05-06 05:26:33 -05:00
Database: Support NULL and int64 in SAKE filter
This commit is contained in:
parent
4f281ef7cc
commit
2418fbf37d
|
|
@ -81,7 +81,7 @@ func (this *expression) filterSwitchFunction(node *filter.TreeNode) {
|
|||
func (this *expression) filterAppendNode(node *filter.TreeNode) {
|
||||
switch v := node.Value.(type) {
|
||||
case *filter.NumberToken:
|
||||
this.query += "'" + strconv.FormatInt(int64(int32(v.Value)), 10) + "'"
|
||||
this.query += "'" + strconv.FormatInt(v.Value, 10) + "'"
|
||||
case *filter.IdentityToken:
|
||||
this.filterAppendQueryValue(v)
|
||||
case *filter.OperatorToken:
|
||||
|
|
@ -171,7 +171,7 @@ func (this *expression) filterAppendQueryValue(token *filter.IdentityToken) {
|
|||
return
|
||||
}
|
||||
|
||||
this.query += "(fields->" + this.filterPushArg(token.Name) + "->>'value')"
|
||||
this.query += "COALESCE(fields->" + this.filterPushArg(token.Name) + "->>'value', '0')"
|
||||
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -29,6 +29,7 @@ func testGenerateFilter(t *testing.T, expression string) (string, error) {
|
|||
func TestSakeFilter(t *testing.T) {
|
||||
testGenerateFilter(t, "ownerid = 1")
|
||||
testGenerateFilter(t, "course = 12 and gameid = 1687 and time < 195")
|
||||
testGenerateFilter(t, "wiiid = 8880667695734424 and num_ratings = 0")
|
||||
|
||||
// Random complex filter I made up
|
||||
testGenerateFilter(t, "gameid = 1687 and (test = 'aaa' or (DROP = 100000) and ((((UPDATE != 4))))) or (1 = 2 + 7 & SELECT - 9)")
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user