Page 1 of 2 12 LastLast
Results 1 to 10 of 12

Thread: manage binary data

  1. #1
    Senior Member
    Join Date
    Oct 2012
    Posts
    213

    Question manage binary data

    How can I handle and store binary data in VTs (remote SQL server)? What type of field should I use? How can I read, load and save data?

  2. #2
    Lianja Development Team barrymavin's Avatar
    Join Date
    Feb 2012
    Location
    UK, USA, Thailand
    Posts
    6,301
    What are you wanting to store in binary. For what purpose? What database server? Do you know how to do that in SQL for that server?
    Principal developer of Lianja, Recital and other products

    Follow me on:

    Twitter: http://twitter.com/lianjaInc
    Facebook: http://www.facebook.com/LianjaInc
    LinkedIn: http://www.linkedin.com/in/barrymavin

  3. #3
    Senior Member
    Join Date
    Oct 2012
    Posts
    213
    images, documents, other objects (files), just like in the lianjademo app, employee details page, attachments section. But the data table is on an SQL server so it can be accessed via VT

  4. #4
    Lianja MVP
    Join Date
    Feb 2012
    Location
    Berea, KY, USA
    Posts
    2,079
    Hi Strato,

    Memo field: varchar(max)
    Image field: varbinary(max)

    Hank

  5. #5
    Senior Member
    Join Date
    Oct 2012
    Posts
    213
    thanks Hank, so far so good,
    the problem is with the VT: replace (insert, update)

  6. #6
    Lianja MVP
    Join Date
    Feb 2012
    Location
    Berea, KY, USA
    Posts
    2,079
    see: Append Memo

    Sending a 1 gig memo field over as part of an insert won't work in any backend. Whatever the backend, they all have workarounds for that. Lianja's is append memo.

    https://www.lianja.com/doc/index.php/APPEND_MEMO

    Hank

  7. #7
    Senior Member
    Join Date
    Oct 2012
    Posts
    213
    hi Hank,
    have you tried this with vt?
    Varbinary interpeted in Lianja as blob, so append memo doesn't work (**** Lianja error ****
    MEMO field expected)
    append memo (varchar or longtext) from {file}
    doesn't cause error, but memo field left blank

    if you have a a working solution , may I have a look?

  8. #8
    Member
    Join Date
    Feb 2012
    Location
    S„o Paulo - Brasil
    Posts
    38

  9. #9
    Lianja Development Team barrymavin's Avatar
    Join Date
    Feb 2012
    Location
    UK, USA, Thailand
    Posts
    6,301
    In web apps Lianja cloud server handles large varchar that are edited on the client.

    Lianja 6 also handles this in desktop apps. There will always be some practical limit depending on the backend server.

    Photos and images again are automatically handled in web apps.

    If you absolutely must use a different backend server (have you actually built any apps yet) you will find that Lianja 6 will handle SQL update and insert for you. varchar and varbinary columns use base64 encoding for MySQL which seems to be your preferred database backend.

    You do not mention if what you are trying to achieve is through the UI or programatically. You do not mention if itís in desktop or web app.

    As Jefferson pointed out, programatically you can use objectRead() to load photos and images into blobs. When using the Lianja database huge memos (varchar) and images (blob) is all handled for you.

    Are you are asking how to use MySQL to store images and large text documents when used as a VT in Lianja? There is a practical limit which is the command line length to ODBC. There are some things that are better done with native Lianja and images are one of them.
    Principal developer of Lianja, Recital and other products

    Follow me on:

    Twitter: http://twitter.com/lianjaInc
    Facebook: http://www.facebook.com/LianjaInc
    LinkedIn: http://www.linkedin.com/in/barrymavin

  10. #10
    Lianja Development Team barrymavin's Avatar
    Join Date
    Feb 2012
    Location
    UK, USA, Thailand
    Posts
    6,301
    In your code, programatically you can load a text file into a memo like this.

    replace mymemo with “filename.txt”

    ”filename.txt” will be read and loaded into the mymemo field.

    to load an image into a blob field use objectread()

    the cursoradaptor for your VT will convert the memo to base64 (in the case of MySQL) and use the MySQL from_base64() function in the sql UPDATE and INSERT statements. In the case of MSSQL it will convert the data to a long hex string.

    That’s what happens in Lianja 6.

    If it doesn’t work as expected submit a ticket and will be looked at.
    Principal developer of Lianja, Recital and other products

    Follow me on:

    Twitter: http://twitter.com/lianjaInc
    Facebook: http://www.facebook.com/LianjaInc
    LinkedIn: http://www.linkedin.com/in/barrymavin

Bookmarks

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Journey into the Cloud
Join us