Jump to content

Will AU3 can read and write database picture?


Recommended Posts

@all

What he is talking about is storing pictures in a DB and reading it afterwards.

This is supported in SQLite (and other databases).

You need to store the data in "BLOB" field.

I hope this gets you going.

#include <SQLite.au3>

Local $hFile, $vData, $sFileName, $sData, $hQuery, $aRow, $sMsg
_SQLite_Startup()
_SQLite_Open()
_SQLite_Exec(-1,"CREATE TABLE IF NOT EXISTS Test (data blob);")
$vData = BinaryToString("Hello" & Chr(0) & "World"); = 48656C6C6F00576F726C64
$sData = _SQLite_Encode($vData)
_SQLite_Exec(-1,"INSERT INTO Test VALUES (" & $sData & ");")
$vData = BinaryToString(Chr(0) & @CRLF); = 000D0A
$sData = _SQLite_Encode($vData)
_SQLite_Exec(-1,"INSERT INTO Test VALUES (" & $sData & ");")
$vData = BinaryToString(Chr(0)); = 00 but this is interpreted as Number and returns 0000000000000000
$sData = _SQLite_Encode($vData)
_SQLite_Exec(-1,"INSERT INTO Test VALUES ( " & $sData & " );")
_SQLite_Query(-1,"SELECT * FROM Test;",$hQuery)
While _SQLite_FetchData ($hQuery, $aRow, 1) = $SQLITE_OK
    $sMsg &= Hex($aRow[0]) & @CR
WEnd
MsgBox(0,"Result",$sMsg)
_SQLite_Close()
_SQLite_Shutdown()

regards

ptrex

Link to comment
Share on other sites

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
 Share

  • Recently Browsing   0 members

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