I've posted the whole lot. Please note there are a lot of comments etc, where I have been trying to get this to work. I've so far been successfull in outputting normal records (ie names etc) to txt files or within a jpg file when view with wordpad. This just doesn't seem to read the BLOB's.
#include <GUIConstants.au3>
Dim $oMyError
; Initializes COM handler
$oMyError = ObjEvent("AutoIt.Error","MyErrFunc")
$ado = ObjCreate( "ADODB.Connection" ) ; Create a COM ADODB Object with the Beta version
With $ado
; 'Set data source - for OLEDB this is a tns alias, for ODBC it can be 'either a tns alias or a DSN.
; If "provider" is used this means that the ODBC connections is used via DSN.
; if Driver is used = "Driver={Microsoft ODBC for Oracle};Server=TNSnames_ora;Uid=demo;Pwd=demo;" then this is a DSN Less connector
; More Info for Oracle MS KB Q193332
.ConnectionString =("Provider='OraOLEDB.Oracle';Data Source='XXXXXX';User Id='xxxxxx';Password='xxxxxx';")
.Open
EndWith
$adors = ObjCreate( "ADODB.RecordSet" ) ; Create a Record Set to handles SQL Records
#Region --- CodeWizard generated code Start ---
;InputBox features: Title=Yes, Prompt=Yes, Default Text=Yes, Mandatory
If Not IsDeclared("sInputBoxAnswer") Then Local $sInputBoxAnswer
$sInputBoxAnswer = InputBox("SQL Query","Please Enter The SQL Query to use.","Select content From images"," M","-1","-1","-1","-1")
Select
Case @Error = 0;OK - The string returned is valid
Case @Error = 1;The Cancel button was pushed
Exit
Case @Error = 3;The InputBox failed to open
Exit
EndSelect
#EndRegion --- CodeWizard generated code End ---
With $adors
.ActiveConnection = $ado
;.CursorLocation = "adUseClient"
;.LockType = "adLockReadOnly"; Set ODBC connection read only
; .Source = "select camerastatusdata from camerastatus"
.Source = $sInputBoxAnswer
.Open
EndWith
$j=0
While not $adors.EOF
For $i = 0 To $adors.Fields.Count - 1
; ConsoleWrite( $adors.Fields( $i ).Value & @TAB ) ; Columns in the AutoIt console use Column Name or Index
msgbox(1,"test",$adors.Fields($i).Value)
; msgbox(1,"test",Hex($adors.Fields($i).Value))
; msgbox(1,"test",BinaryString($adors.Fields($i).Value))
;msgbox(0,"",$i)
;msgbox(0,"",$j)
;msgbox(0,"",$adors.Fields($i).Value)
;$file = FileOpen(@ScriptDir & "\test"&$j&".jpg", 1)
;$filename = @ScriptDir & "\test"&$j&".jpg"
$file = FileOpen("C:\test"&$j&".jpg", 1)
$filename = "C:\test"&$j&".jpg"
msgbox(0,"",$filename)
FileWrite($filename, $adors.Fields($i).Value)
;FileWrite($file, @CRLF)
;FileWrite($filename, $filename)
FileClose($filename)
;RunWait("rundll32.exe C:\WINDOWS\system32\shimgvw.dll,ImageView_Fullscreen" &$filename)
RunWait("C:\windows\system32\mspaint.exe "&$filename)
$j=$j+1
Next
; ConsoleWrite(@CR)
$adors.MoveNext ; Go to the next record
WEnd
; This COM error Handler
Func MyErrFunc()
$HexNumber=hex($oMyError.number,8)
$iMsgBoxAnswer = Msgbox(1,"AutoItCOM Test","We intercepted a COM Error !" & @CRLF & @CRLF & _
"err.description is: " & @TAB & $oMyError.description & @CRLF & _
"err.windescription:" & @TAB & $oMyError.windescription & @CRLF & _
"err.number is: " & @TAB & $HexNumber & @CRLF & _
"err.lastdllerror is: " & @TAB & $oMyError.lastdllerror & @CRLF & _
"err.scriptline is: " & @TAB & $oMyError.scriptline & @CRLF & _
"err.source is: " & @TAB & $oMyError.source & @CRLF & _
"err.helpfile is: " & @TAB & $oMyError.helpfile & @CRLF & _
"err.helpcontext is: " & @TAB & $oMyError.helpcontext _
)
SetError(1) ; to check for after this function returns
Select
Case $iMsgBoxAnswer = 1;OK
Case $iMsgBoxAnswer = 2;Cancel
Exit
EndSelect
Endfunc