Reading text from a blob to String problem

Hi,

I’ve got an Oracle DB with blob’s in which SQL statements are stored.

I want to retrieve the SQL from the Blob and then run the SQL with getDateSetByQuery from Servoy. But I’m getting the following error:

org.mozilla.javascript.PropertyException: Constructor for “TypeError” not found.

The way I retrieve the text from the blob is the following:

var query = new java.lang.String(sql); //sql is the blobfield in the DB

I figured out that it’s a type conversion error, because if I display the the var query in an infodialog, I see the text correct.

I then tried doing the following, just to test:

application.setClipboardContent(new java.lang.String(sql))
var query = application.getClipboardString();

After setting the text from the blob into the clipboard and then retrieve it again into var query, when I use var query in the getDateSetByQuery, all works fine.

How can I get this to work without copying and retrieving to/from the clipboard?

tnx in advance…

Paul

try sticking it in a global

Brilliant, it works!

BLOB :?:

BLOB = Binary Large OBject

Thanx Bob! So this could be a Word document or a PDF file?

yep, any kind of file (audio, images, textfile, PDF’s etc)

Paul

I want to retrieve the SQL from the Blob and then run the SQL with getDateSetByQuery from Servoy

So this would mean that it’s possible to perform search WITHIN a Blob file?

Depends on your backend database and on how you program it. If you’re just getting started you don’t want to go into this. Most db’s will offer you either access through stored procedures or full text search capabilities to search through any blob. Oracle has some interesting full text search capabilities that will search inside many kinds of documents stored in BLOB’s for example. So if your customer really wants it (and has some cash to get it implemented): Yes it can be done (as anything in Servoy can).