On 12 June 2013 16:50, e-mail mgbg25171 <mgbg25...@blueyonder.co.uk> wrote:
> Tbank you in anticipation for any forthcoming advice
> I include my program below in Powerbasic (not disimilar to C)
> and wonder what I need to do in order to "wrap"
> multiple statements (which use prepare,step & finalise) as transactions?
>
.
.
.
.
>
> FUNCTION exec_sql( _
>    hDB AS DWORD, _
>    hD AS DWORD, _
>    BYVAL pzSql AS ASCIZ PTR, _
>    BYVAL pzErr_msg AS ASCIZ PTR _
>    ) AS LONG
>
>    LOCAL lresult           AS LONG
>    LOCAL pzTail            AS ASCIZ PTR
>    LOCAL pzPrepared        AS ASCIZ PTR
>    LOCAL pzStmt            AS ASCIZ PTR
>    LOCAL azcols()          AS ASCIZ PTR      ' array of dword pointers to
> column name strings
>    LOCAL azvals()          AS ASCIZ PTR      ' array of dword pointers to
> column values
>    LOCAL ncols             AS LONG           ' the column count
>    LOCAL nErmsg            AS LONG
>    LOCAL szErmsg           AS ASCIZ * 512
>    LOCAL nRetry            AS LONG
>    LOCAL s                 AS STRING
>    LOCAL i, l              AS LONG
>
>    lresult = %SQLITE_OK
>
>    IF @pzSql = "" THEN
>       FUNCTION = %SQLITE_OK
>       EXIT FUNCTION ' called with null SQL statement
>    END IF
>
>    lresult = sqlite3_prepare( hDB, @pzSql, -1, pzPrepared, pzTail )

Your exec_sql function is passed multiple sql statements in a single
string, but you are only ever preparing the first statement.

Reread http://www.sqlite.org/c3ref/prepare.html with particular focus on pzTail

.
.
.

Regards,
Simon
_______________________________________________
sqlite-users mailing list
sqlite-users@sqlite.org
http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users

Reply via email to