Want to win a PS4? Go Premium and enter to win our High-Tech Treats giveaway. Enter to Win


GetFullState, SetFullState Problem with DBMS Blob retrieval

Posted on 2006-11-09
Medium Priority
Last Modified: 2013-12-26
I am having problems with setFullState and getFullState.  I have datastores which requires some complex calculations to populate with data.  After population, I'd like to save the datastore in the database for subsequent rapid retrieval.  I use a long varchar column (Adaptive Server Anywhere 9.0.2 via ODBC), as the datastore size is always > 32K.

GetFullState, updateblob, and the subsequent selectblob work fine, but the final setFullState never succeeds, and the datastore is never populated with the saved image from the database.  Here's the sample code:

//the database table; col PK_ID is primary key
CREATE table blob_table
(pk_id  float not null,
blob_col long varchar);

long id = 1234567
blob blb_var

ds_datastore.getFullState (blb_var)

INSERT into blob_table (pk_id) VALUES (:id);

UPDATEBLOB blob_table SET blob_col = blb_var WHERE pk_id = :id;

SELECTBLOB blob_col into :blb_var from blob_table WHERE pk_id = :id;

//this always returns -1 (fail)
ds_datastore.setFullState (blb_var);

The blb_var value from the initial getFullState works just fine if applied directly in setFullState.
If blb_var is saved to a file in streammode, then read back into a blob in streammode, the blob also works fine in setFullState.
Only if saved to the database as shown above, then retrieved to a blob and applied in setFullState does it fail.

I saved to a file the blob retrieved by the SELECTBLOB and compared it to the blob from the initial getFullState, saved to a file.  In the former case, the contents are certainly recognizable as a datawindow, but some bytes are rearranged, and the file size is different by 1 byte, compared to the latter case.

It seems that saving and retrieving the blob representation of the datastore state causes it to get mangled.  Is there some setting on either the ASA side, the ODBC driver or PowerBuilder side to retrieve an exact copy of what is initially stored.

(I used a long varchar column instead of a long binary after reading Sybase notes about values exceeding 32K).  Using PowerBuilder 10.0 Build 4510.

Advice is most thankfully appreciated!

Ted Craven
Knowledge Management Systems, Inc.
Question by:museful
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
LVL 14

Accepted Solution

sandeep_patel earned 2000 total points
ID: 17912302

Which PB version you are using ? I found the same problem with pb10 and after talking to sybase it has been resolved.

In your database change datatype for that column from 'Long Varchar' to 'Long Binary'. If anytime you use Oracle it should be always 'Blob' it won't work with 'Clob'.

This is due to Unicode encoding introduced in newer version of PB.

Another problem can be say you have datawindow created in old PB version and after getfullstate you have stored entire datawindow image in database for later use. Now you have migrated your application to higher version of pb and if you try to selectblob and set the old datawindow defination(image) in new version datastore or datawindow it will crash or will not work properly due to changes in datawindow.

So remember that GetFullState and SetFullState is designed to work for the same versions of powerbuilder.

Hope this will solve your problem.


Author Comment

ID: 17914602

Changing the database column type to LONG BINARY worked perfectly.  Many thanks for your prompt advice!

Ted Craven
Knowledge Management Systems, Inc.

Featured Post

Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Update (December 2011): Since this article was published, the things have changed for good for Android native developers. The Sequoyah Project (http://www.eclipse.org/sequoyah/) automates most of the tasks discussed in this article. You can even fin…
How to install Selenium IDE and loops for quick automated testing. Get Selenium IDE from http://seleniumhq.org Go to that link and select download selenium in the right hand column That will then direct you to their download page. From that p…
The viewer will learn how to synchronize PHP projects with a remote server in NetBeans IDE 8.0 for Windows.
The viewer will learn how to use and create new code templates in NetBeans IDE 8.0 for Windows.
Suggested Courses

610 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question