Jump to content

Recommended Posts

Posted

Hello Iczer

I have a working program dealing with distances.
I added:

#include "sqlite_funcs.au3"

; *snip*

; Square distance between P(x,y) anq Q(x,y)
Func _dist2($pCtx, $iArgs, $pArgs)
    Local $Result = 0
    Local $aArgs = _SQLite_FuncArgs($iArgs, $pArgs), $Arg
    If UBound($aArgs) <> 4 Then Return
    Local $px = _SQLite_GetValue($aArgs[0])
    Local $py = _SQLite_GetValue($aArgs[1])
    Local $qx = _SQLite_GetValue($aArgs[2])
    Local $qy = _SQLite_GetValue($aArgs[3])
    $result = ($px-$qx)*($px-$qx) + ($py-$qy)*($py-$qy)
    ConsoleWrite("> Result: " & $result & @CRLF)

    _SQLite_ResultText($pCtx, $Result)
 EndFunc
 Global $dllCb = _SQLite_FuncCallbackRegister("_dist2")
_SQLite_CreateFunction(-1, "dist2", -1, 0, 0, DllCallbackGetPtr($dllCb), 0, 0)

Then I reworked my SQL to use the new function:

Quote

SELECT dist2(R1.sx, R2.ex, R1.sy, R2.sy) AS sqd_distance ... ...

and finally got

Quote

!   SQLite.au3 Error
--> Function: _SQLite_Query
--> Query:    SELECT ...
--> Error:    no such function: dist2

The ConsoleWrite debug line doesn't show anything.

Is this UDF working anymore ?

Thanks for any help ^^
Apzo.

  • Moderators
Posted

@Apzo you hit the trifecta: resurrecting an old thread, which had nothing to do with your question, and in the wrong forum. I have moved this post to the appropriate forum; please think through where you're posting in the future.

"Profanity is the last vestige of the feeble mind. For the man who cannot express himself forcibly through intellect must do so through shock and awe" - Spencer W. Kimball

How to get your question answered on this forum!

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...