Page 1 of 1

Image in Database will not show via Query Builder

Posted: Sun Jan 10, 2010 9:59 pm
by Kristallprinz
Hello,

i've a Problem with Image that i stored in Database(SQLite). I use revEnterprise 4.0.

Every Field and one Image-Area are connected to a Column in Database.
I ask the Database via a Query in Query Builder.
All fields display the right Data when the standalone open or the Recordnumber changed.

Only the Image (connected to a BLOB-Column) does not display.

i stored the Image via

Code: Select all

revExecuteSQL tDatabaseID, "UPDATE Schablonen SET bilddaten = :1 WHERE ID = :2", "*bgBild", "gID"
as Binary-Data.
I tested the same without binary-prefix.

Can anybody help?

best regards...

Re: Image in Database will not show via Query Builder

Posted: Thu Jan 14, 2010 10:45 am
by Kristallprinz
Since here probably nobody which about it understands, having the problem immediately by I with Blob fields the data base ask manually.

Code: Select all

set the Text of image "imageF" to empty
put field "idF" into tID
put revConnectionOfQuery("Daten") into tDatabaseID
get revQueryDatabase(tDatabaseID, "SELECT bilddaten FROM Schablonen WHERE ID = :1", "tID")
put it into tRecordSetID
get revDatabaseColumnNamed(tRecordSetID, "bilddaten", "gBild")
setBild gBild
Functioned if I write the code in a “queryRecordChanged” Handler.
I do not understand however yet, why the filling of Image-Areas via Database Query Builder do not functioned.

Re: Image in Database will not show via Query Builder

Posted: Fri Jan 15, 2010 3:54 pm
by Kristallprinz
Do anybody knowing how to use revDBQueryColumnByName?

Code: Select all

get revDBQueryColumnByName("Daten", "bilddaten", "gBild")
Is that right?

Re: Image in Database will not show via Query Builder

Posted: Sat Jan 16, 2010 12:16 pm
by Klaus
Hi Prinz,

I could not find "revDBQueryColumnByName" in the docs?
Are you sure this command exists?


Gruß

Klaus

Re: Image in Database will not show via Query Builder

Posted: Sat Jan 16, 2010 1:19 pm
by Kristallprinz
Hello Klaus,

It is not a documented function.
It is a function from stack revlibrary.rev in the Folder Toolset of the program folder.

The Header from the Handler in revlibrary is:

Code: Select all

on revDBQueryColumnByName pObject, pWhichcolumn, @pHolder
But i don't know, how i must use the @pHolder parameter.

I've tested the Forms below:

Code: Select all

Version 1:
get revDBQueryColumnByName("Daten", "bilddaten", "gBild")
setBild gBild 

Version 2:
get revDBQueryColumnByName("Daten", "bilddaten", gBild)
setBild gBild
The variable gBild is allways empty

setBild is a Handler that works with my old Code:

Code: Select all

put revConnectionOfQuery("Daten") into tDatabaseID
get revQueryDatabase(tDatabaseID, "SELECT bilddaten FROM Schablonen WHERE ID = :1", "tID")
put it into tRecordSetID
get revDatabaseColumnNamed(tRecordSetID, "bilddaten", "gBild")
setBild gBild
But I would find it naturally better, if I could replace the 4 lines code over setBild with the one line.

Greetings, Kristallprinz(Bernhard)

Re: Image in Database will not show via Query Builder

Posted: Sat Jan 16, 2010 1:45 pm
by Klaus
Hi Bernhard,

AHA!

The @ in front of the parameter means "pass by reference"!

Try this:
Version 1:
...
put empty into gBild
get revDBQueryColumnByName("Daten", "bilddaten", "gBild")
setBild gBild
...

Version 2:
...
put empty into gBild
get revDBQueryColumnByName("Daten", "bilddaten", gBild)
setBild gBild
...

Now one of these version should do!

"Pass by reference" means that the value will not be put into this variable,
but into the PLACE IN MEMORY (RAM address) where the variable has its (temporary) place, know what I mean?
And thus the variable has to be initialized (with empty or whatever) first!


Best

Klaus

Re: Image in Database will not show via Query Builder

Posted: Sat Jan 16, 2010 2:34 pm
by Kristallprinz
Hello Klaus,

no, don't work.

I put a answer-dialog above and below the line:

Code: Select all

answer "dies ist ein 1.Test"
get revDBQueryColumnByName("Daten", "bilddaten", "gBild")
answer "dies ist ein 2.Test"
The second answer don't display, also the following code in the handler is not executed, but it is no error displayed.

*arrgh* ich könnte in die Tischkante beissen.

Grüße, Bernhard

Re: Image in Database will not show via Query Builder

Posted: Sat Jan 16, 2010 2:50 pm
by Klaus
Hi Bernhard,

I just saw that this is a HANDLER and no function!
Omit the "get" and it should work
...
put empty into gBild
revDBQueryColumnByName "Daten", "bilddaten", gBild
## Now gBild should have some content
## If not check "the result" right after the handler
...

Best und "Mahlzeit" (die Tischkante ;))

Klaus

Re: Image in Database will not show via Query Builder

Posted: Sat Jan 16, 2010 4:48 pm
by Kristallprinz
What for a dump error.... :oops:

Now I get data, but not in the form like I stored it.

The same Data from Database, they i can handle when i get it by

Code: Select all

get revDatabaseColumnNamed(tRecordSetID, "bilddaten", "gBild")
will not be suitable to use, when i get it by

Code: Select all

revDBQueryColumnByName "Daten","bilddaten",gBild
What for an expenditure, to save 3 lines. :P

btw: I deleted "put empty into gBild".
gBild is a global variable, so that the place in RAM would have to be already reserved.

Now i must look, how to use the Data that i get
But first, i must look and buy what i want to eat at weekend 8)

So i say thankyou very much for your help.
Maybe we can look at the new problem later... other day

greetings to you, Bernhard