Access2Base - RunSql: execute i.o. executeUpdate

execute on Statement seems safer for some DDL statements
Additionally error handling was initiated, not terminated.

Change-Id: Ic2e987a84e87c01048b65f74efc938163ca17f2c
This commit is contained in:
Jean-Pierre Ledure
2017-03-11 15:24:31 +01:00
parent 0aa12db1c7
commit 71a646895d

View File

@@ -898,7 +898,8 @@ Public Function RunSQL(Optional ByVal pvSQL As Variant _
If _ErrorHandler() Then On Local Error Goto Error_Function
Utils._SetCalledSub("RunSQL")
Const cstThisSub = "Database.RunSQL"
Utils._SetCalledSub(cstThisSub)
RunSQL = False
If IsMissing(pvSQL) Then Call _TraceArguments()
@@ -914,14 +915,15 @@ Dim oStatement As Object, vResult As Variant
Set oStatement = Connection.createStatement()
oStatement.EscapeProcessing = Not ( pvOption = dbSQLPassThrough )
On Local Error Goto SQL_Error
vResult = oStatement.executeUpdate(_ReplaceSquareBrackets(pvSQL))
vResult = oStatement.execute(_ReplaceSquareBrackets(pvSQL))
On Local Error Goto Error_Function
RunSQL = True
Exit_Function:
Utils._ResetCalledSub(cstThisSub)
Exit Function
Error_Function:
TraceError(TRACEABORT, Err, "RunSQL", Erl)
TraceError(TRACEABORT, Err, cstThisSub, Erl)
GoTo Exit_Function
SQL_Error:
TraceError(TRACEFATAL, ERRSQLSTATEMENT, Utils._CalledSub(), 0, , pvSQL)