No announcement yet.

BLOB problem

  • Filter
  • Time
  • Show
Clear All
new posts

  • BLOB problem

    SC71_BlobProblem.jpgI have a Form which saves an image in a BLOB. There is something wired going on. I can select and assign an image. the image seems to save within database (SQLite), but when I open a SQLite manager the image looks strange (depending on what SQLite browsking tool I use). When I opened the table in (Firefox) SQLite Manager the field looks like on the attached image. When I open this same table i.e. in SQLite Expoert it is even worse, because the image is invisible. I tried to add the same image manuall in SQLite Manager and it works finm and I can see theimage in a record's BLOB.
    I have an Android App which uses the same database and I'm haing problem reading BLOB images saved with SC Application.

    Take a look at SQLite manager screenshoot. As you cee the first BLOB looks OK and it was added with SQLite Expert. The other two were aded with SC App. Why they look so different ?
    To make it even worse - when I go to EDIT mode with SQLite manager it cashes the program completely.

    Any ideas ?

    Last edited by aka; 01-31-2014, 10:04 PM.

  • #2
    The problem is that sqlite does not support blobs originally. Nowadays it does see:
    However I don't know since when. I am an author of sqlite open source delphi components and originally all was stored as text, causing to keep track of how the physical record looks. So it might be that there are different implementations out there implementing a blob. To make it even worse, sqlite does not support a datatype like varchar(x). There are a lot of implementations who allow this and then handle the size by themselves and convert it to text. I know this is not very helpful to you, but bottom line is that SQLite is a great local database for simple data, not for complex datastructures. Not even for a multiuser environment as it does only do tablelocking.
    Albert Drent
    aducom software netherlands
    scriptcase partner, reseller, support and (turn-key) development /


    • #3
      Be aware that sqlite expert (I use that one) has two viewing modes urf-8 and non utf-8. So choose the proper on. PHP is all about utf-8 tho. So just try the other setting.....


      • #4
        Thanks for the tip, but ....
        I have 2 images. One assigned manually and one saved by SC App. Without any changes to the settings I can see one but not another, so the problem is not in the settings. I created a trouble ticket but I do not understand the message I got from the Tech Support - as they speak some extraterrestial language. I really do not understand how people who cannot speak/write proper English could work in Tech Support Department (?), is what they said:

        Hello Sir,

        I perfectly understand the question, however I had to take some tests.

        It happens because the image/file upload, a field that it's BLOB type, it's normal.

        When a image or file it's uploaded by BLOB type on the scriptcase, the database creates a "code" on it, that the scriptcase can "translate" it as well and then, use on the field That are BLOB type AND Image/File Field.

        Probably there is a type of code that "translate" this "code" and then use it as a function of php, to use outside of scriptcase.

        NET MAKE for fact has the most frustrating Tech Support I have ever used in my last 30 years IT career :-(
        On top of everything they closed my ticked as RESOLVED while I'm still struggling with the issue.

        Anyway,... I wonder if anybody could have an answer to that ?
        Last edited by aka; 02-20-2014, 01:13 PM.


        • #5
          Hi Arthur. I have similar experiences. Good willing but that's about it. But I'm sorry I don't know what's going wrong here.
          Albert Drent
          aducom software netherlands
          scriptcase partner, reseller, support and (turn-key) development


          • #6
            My guess is that they add a code in front of the blob data or do a conversion to another format. I havent tried it yet so this is just my wild guess.
            Now another point is that scriptcase does conversion of the data as well (sometimes incorrectly). So if you use ISO8859-1 on your webpage then data gets converted to on from UTF-8 <--> ISO8859-1 and to be honest that sometimes goes wrong (see some of my posts elsewhere). I dot know if a blob field also gets converted by sc but you would have to check the generated sources for that.


            • #7
              I just download version (which apparently is the latest if you download directly).
              I can simply upload an image in an sqlite blob without any problem, provided the original filename dowsn have strange characters in it.


              • #8
                Anyway some sqlite programs will not be able to determine what format the file is in basically because the data is not as expected.
                My image in a blob field looks like: *nm*/9j/4AAQSkZJRgABAQEASABIAAD/2wBDABcQERQRDhcUE.....
                The data gets stored with the php UpdateBlob command in the pdo code and it gets decoded using the BlobDecode command. This is not standard behaviour for sqlite it is just a choice how it is implemented. So various sqlite browsers will not be able to decode it to an image.
                see your wwwroot\scritpcase\prod\third\adodb\drivers\adodb-*.inc.php files.
                Hence the storage is determined upon the UpdateBlob command of the pdo driver.
                SQLITE Expert and SQLIteAdmin handle this differently so I guess you need to find another tool if you insist in getting the data, or you save it as a test and use some code to decode it.
                Be aware that for each database type (sqlite, informix, oracle, ...) the blob data may or may not be encoded differently.
                Last edited by rr; 02-21-2014, 10:22 AM.