Jump to content

Recommended Posts

Posted (edited)

DLL call rookie having trouble figuring this out...

#include <sqlite.au3>

; sqlite limit constants
; defined in https://www.sqlite.org/c3ref/c_limit_attached.html

Local $SQLITE_LIMIT_LENGTH = 0
Local $SQLITE_LIMIT_SQL_LENGTH = 1
Local $SQLITE_LIMIT_COLUMN = 2
Local $SQLITE_LIMIT_EXPR_DEPTH = 3
Local $SQLITE_LIMIT_COMPOUND_SELECT = 4
Local $SQLITE_LIMIT_VDBE_OP = 5
Local $SQLITE_LIMIT_FUNCTION_ARG = 6
Local $SQLITE_LIMIT_ATTACHED = 7
Local $SQLITE_LIMIT_LIKE_PATTERN_LENGTH = 8
Local $SQLITE_LIMIT_VARIABLE_NUMBER = 9
Local $SQLITE_LIMIT_TRIGGER_DEPTH = 10
Local $SQLITE_LIMIT_WORKER_THREADS = 11

Local $dllName = _SQLite_Startup()
If @error Then Exit MsgBox(17, 'Startup Error', '@ERROR = ' & @error & @CRLF & '@EXTENDED = ' & @extended)

ConsoleWrite($dllName & @CRLF)

If Not $__g_hDll_SQLite Then Exit MsgBox(17, '', '$SQLITE_MISUSE')

Local $hdb = _SQLite_Open()
If @error Then Exit MsgBox(17, 'DB open failed', '@ERROR = ' & @error & @CRLF & '@EXTENDED = ' & @extended)

; call defined in https://www.sqlite.org/c3ref/limit.html

Local $r = DllCall($__g_hDll_SQLite, "int", "sqlite3_limit", "ptr", $hdb, "int", $SQLITE_LIMIT_SQL_LENGTH, "int", -1)
If @error Then Exit ConsoleWrite(@error & @CRLF)
ConsoleWrite($r[0] & @CRLF)

_SQLite_Shutdown()

Returns

Quote

>"C:\Program Files (x86)\AutoIt3\SciTE\..\AutoIt3.exe" "C:\Program Files (x86)\AutoIt3\SciTE\AutoIt3Wrapper\AutoIt3Wrapper.au3" /run /prod /ErrorStdOut /in "C:\Users\Tom\Desktop\limits.au3" /UserParams   
+>15:41:30 Starting AutoIt3Wrapper v.15.920.938.0 SciTE v.3.6.0.0   Keyboard:00000409  OS:WIN_7/Service Pack 1  CPU:X64 OS:X64    Environment(Language:0409)
+>         SciTEDir => C:\Program Files (x86)\AutoIt3\SciTE   UserDir => C:\Users\Tom\AppData\Local\AutoIt v3\SciTE\AutoIt3Wrapper   SCITE_USERHOME => C:\Users\Tom\AppData\Local\AutoIt v3\SciTE
>Running AU3Check (3.3.14.2)  from:C:\Program Files (x86)\AutoIt3  input:C:\Users\Tom\Desktop\limits.au3
+>15:41:30 AU3Check ended.rc:0
>Running:(3.3.14.2):C:\Program Files (x86)\AutoIt3\autoit3.exe "C:\Users\Tom\Desktop\limits.au3"   
--> Press Ctrl+Alt+Break to Restart or Ctrl+Break to Stop
sqlite3.dll
!>15:41:32 AutoIt3.exe ended.rc:-1073741819
+>15:41:32 AutoIt3Wrapper Finished.
>Exit code: 3221225477    Time: 2.286
 

Help, please,

kylomas

P.S. Tried return type as "int:cdecl",  "long" and "long:cdecl" with same results

Edited by kylomas
additional info

Forum Rules         Procedure for posting code

"I like pigs.  Dogs look up to us.  Cats look down on us.  Pigs treat us as equals."

- Sir Winston Churchill

Posted (edited)

Hello. This works for me.

Local $r = DllCall($__g_hDll_SQLite, "int:cdecl", "sqlite3_limit", "ptr", $hdb, "int", $SQLITE_LIMIT_SQL_LENGTH, "int", -1)

Saludos

Edited by Danyfirex
Posted

i do believe

34 minutes ago, kylomas said:

-1073741819

is the code for an access violation.

and if i do this:

DllCall($__g_hDll_SQLite, "int:cdecl", "sqlite3_limit", "ptr", $hdb, "int", $SQLITE_LIMIT_SQL_LENGTH, "int", -1)

it seems to solve the issue.

Posted

Thank you both...it works.   It did not work when I tried "int:cdecl" because I did not have a valid DB conn.

kylomas

Forum Rules         Procedure for posting code

"I like pigs.  Dogs look up to us.  Cats look down on us.  Pigs treat us as equals."

- Sir Winston Churchill

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
×
×
  • Create New...