B4J Question SQLite math functions

MicroDrie

Well-Known Member
Licensed User
Tested in B4J, not sure if really needed but i have tested it with:
B4J Main module:
#AdditionalJar: sqlite-jdbc-3.36.0

This gives a result for modulo:
1649685264205.png

SQLite Modulo:
    Dim ModX As Int = 153
    Dim ModY As Int = 4
    
    Dim ModXstr As String = "153"
    Dim ModYstr As String = "4"
    
    Dim Result As String = SQL1.ExecQuerySingleResult($"SELECT ${ModX}%${ModY};"$)
    Log($"1. Result MOD(Xint%Yint) = ${Result}"$)

    Dim Result As String = SQL1.ExecQuerySingleResult($"SELECT ${ModX},${ModY};"$)
    Log($"2. Result MOD(Xint,Yint) = ${Result}"$)

    Result = SQL1.ExecQuerySingleResult($"SELECT ${ModX},${ModY};"$)
    Log($"3. Result MOD(Xint,Yint) = ${Result}"$)

    Result = SQL1.ExecQuerySingleResult($"SELECT ${ModXstr},${ModYstr};"$)
    Log($"4. Result MOD(Xstr,Ystr) = ${Result}"$)

    Dim ResultInt As Int = SQL1.ExecQuerySingleResult($"SELECT ${ModX},${ModY};"$)
    Log($"5. Result MOD(Xint,Yint) = ${ResultInt}"$)
Your lucky ;)šŸ˜…, only the SELECT MOD(X%Y) shorthand query can be used in SQLite.
 
Upvote 1
Top