Has anybody successfully stored / retrieved an MP3 or MPG files TO/FROM BLOB in SQlite database ?
Any examples, tips ?
Arthur
Has anybody successfully stored / retrieved an MP3 or MPG files TO/FROM BLOB in SQlite database ?
Any examples, tips ?
Arthur
Not from php no. As SQLite in essence stores everything in text format I don’t recommend doing so. But technically it should be possible. From Delphi I stored loads of images which is more-or-less same blob issue. But issues you might run into is the size of the MP3 files. Using a db upload field might fail due to upload restrictions set in php.ini
You can do this when you convert it when saving it and converting it back…
An easy way would be to base64 encode it so it is simply a long text string. Converting it back would be a simple decode then…
AN alternative way may be achieved (not tested by me) is to use quote and hex.
quote: The quote(X) function returns the text of an SQL literal which is the value of its argument suitable for inclusion into an SQL statement. Strings are surrounded by single-quotes with escapes on interior quotes as needed. BLOBs are encoded as hexadecimal literals. Strings with embedded NUL characters cannot be represented as string literals in SQL and hence the returned string literal is truncated prior to the first NUL.
hex: The hex() function interprets its argument as a BLOB and returns a string which is the upper-case hexadecimal rendering of the content of that blob.
So you see that if you use these two functions you may get it to work. For the base 64 encode/decode you would have to use php encode decode… So it is slightly tricky but it should be able.
I advise to keep the files stored on a normal path tho, since this would make access faster and keep your database smaller. And it is easily supported in scriptcase…
From Delphi I stored loads of images which is more-or-less same blob issue. But issues you might run into is the size of the MP3 files. Using a db upload field might fail due to upload restrictions set in php.ini
Why repeat my post???