[Gambas-user] Changes in LINK
Benoit Minisini
gambas at ...1...
Sun Oct 29 11:05:22 CET 2006
On Sunday 29 October 2006 10:57, rolf wrote:
> Hi Christopher,
>
> > > And I don't understand why you are talking about base64 too.
> >
> > If you are going to use a DB in place of files the problem becomes
> > finding a clean way to store the data without all the escaping issues
> > involved with 8-bit data (such as in images, audio, etc). Base64 is one
> > such encoding designed to prevent those problems.
>
> The code for quoting (for example a picture) for postqresql is like - so it
> is not so complex to do it or to put it into a function (perhaps Benoit can
> doit into the database component):
>
> DIM buffer AS Byte
> DIM bildText AS String ' String with converted picture. The string can
> be ' written in a bytea-field of a postgresql
> database
>
> OPEN NameOfPic FOR INPUT AS #hFile
>
> WHILE NOT Eof(hFile)
> READ #hfile, buffer, Lof(hFile)
> IF buffer < 32 OR buffer > 126 THEN
> bildText = bildText & "\\\\" & Coct(buffer)
> ELSE
> ' check if value < 32 or > 127 or 92 (\) or 44 (')
> SELECT buffer
> CASE 92 ' (\)
> bildText = bildText & "\\\\134"
> CASE 39 ' (')
> bildText = bildText & "\\'"
> DEFAULT
> bildText = bildText & Chr$(buffer)
> END SELECT
> END IF
> WEND
> CLOSE hFile
>
> bye
> Rolf
>
It is automatically done if you use BLOBs.
Regards,
--
Benoit Minisini
More information about the User
mailing list