mirror of
https://github.com/rbock/sqlpp11.git
synced 2024-11-15 20:31:16 +08:00
Add mysql DIV operator
This commit is contained in:
parent
bea910e122
commit
a77d8009bb
@ -45,7 +45,7 @@ ddlString = (
|
|||||||
ddlTerm = pp.Word(pp.alphas + "_", pp.alphanums + "_.$")
|
ddlTerm = pp.Word(pp.alphas + "_", pp.alphanums + "_.$")
|
||||||
ddlName = pp.Or([ddlTerm, ddlString, pp.Combine(ddlString + "." + ddlString)])
|
ddlName = pp.Or([ddlTerm, ddlString, pp.Combine(ddlString + "." + ddlString)])
|
||||||
ddlOperator = pp.Or(
|
ddlOperator = pp.Or(
|
||||||
map(pp.CaselessLiteral, ["+", "-", "*", "/", "<", "<=", ">", ">=", "=", "%"])
|
map(pp.CaselessLiteral, ["+", "-", "*", "/", "<", "<=", ">", ">=", "=", "%", "DIV"])
|
||||||
)
|
)
|
||||||
|
|
||||||
ddlBracedExpression = pp.Forward()
|
ddlBracedExpression = pp.Forward()
|
||||||
@ -372,6 +372,14 @@ def testConstraint():
|
|||||||
result = ddlConstraint.parseString(text, parseAll=True)
|
result = ddlConstraint.parseString(text, parseAll=True)
|
||||||
assert result.isConstraint
|
assert result.isConstraint
|
||||||
|
|
||||||
|
def testMathExpression():
|
||||||
|
text = "2 DIV 2"
|
||||||
|
result = ddlExpression.parseString(text, parseAll=True)
|
||||||
|
assert len(result) == 3
|
||||||
|
assert result[0] == "2"
|
||||||
|
assert result[1] == "DIV"
|
||||||
|
assert result[2] == "2"
|
||||||
|
|
||||||
|
|
||||||
def testRational():
|
def testRational():
|
||||||
for text in [
|
for text in [
|
||||||
@ -409,6 +417,7 @@ def testParser():
|
|||||||
testDateTime()
|
testDateTime()
|
||||||
testColumn()
|
testColumn()
|
||||||
testConstraint()
|
testConstraint()
|
||||||
|
testMathExpression()
|
||||||
testRational()
|
testRational()
|
||||||
testTable()
|
testTable()
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user