BLOB

3 views
Skip to first unread message

jot

unread,
Feb 5, 2009, 11:03:21 AM2/5/09
to DataFaucet ORM
Hi,

I'm trying to save an image to my MySql database using datafaucet. Is
that possible?
I get an error message when i try to do it.

Error message:
"Result: The getProperties method was not found. Either there are no
methods with the specified method name and argument types, or the
getProperties method is overloaded with argument types that ColdFusion
cannot decipher reliably. ColdFusion found 0 methods that matched the
provided arguments. If this is a Java object and you verified that the
method exists, you may need to use the javacast function to reduce
ambiguity."

And the code;
logo = ImageNew("", 10, 10, "rgb", "255,10,10");
inputData = {id = createUUID(), logo = logo};
rslt = ds.insert("customer", inputData);

best regards,
Tobias

Isaac Dealey

unread,
Feb 5, 2009, 11:32:12 PM2/5/09
to dataf...@googlegroups.com
Hi Tobias,

> I'm trying to save an image to my MySql database using datafaucet.
> Is that possible?

It should be, but it's not something I've done myself. What is the data
type of the column in your mssql database? Is it a binary data type or a
char data type? I haven't done any work in DF with binary data types yet
so I have no idea how well they work with any given database (if at all).
I may have some time next week to look into it. Things have been on hold
with me for the past few weeks because we moved from Boston back to
Dallas TX and are still waiting for the movers to arrive with most of
our things like the desk, etc.

> I get an error message when i try to do it.
>
> Error message:
> "Result: The getProperties method was not found.

<snip>

>
> And the code;
> logo = ImageNew("", 10, 10, "rgb", "255,10,10");
> inputData = {id = createUUID(), logo = logo};
> rslt = ds.insert("customer", inputData);

Offhand I don't remember if DF is attempting to convert the object
properties into an XML packet or what. I know that there are a couple of
cases in which a method argument or a property that's normally a string
is allowed to be another CFC object, for example, if you specify a
subquery in a filter then the filter content which would normally be a
string is another query object instead. It's possible it could be
attempting to do something similar here. So the error message you're
getting would make sense in that case because it's checking to see if
it's a simple value and when it's not it then assumes that it must be an
object instead. It is an object, but not one of the DF objects it
expects (which is where the getProperties method exists), but rather a
CF image object, which ultimately is just a java object.

I would expect that you would need to convert the image to either a
string or binary value first before performing the insert, so this code
would look more like this:

logo = ImageNew("", 10, 10, "rgb", "255,10,10");

inputData = {id = createUUID(), logo = ImageGetBlob(logo) };


rslt = ds.insert("customer", inputData);

That should work for a binary column. For a character column, I think you
would need to use toBase64(ImageGetBlob(logo)).

The ImageGetBlob function is recommended for this in the adobe livedocs
on this image manip. page with some short-hand notes about how to
perform common tasks

http://livedocs.adobe.com/coldfusion/8/htmldocs/help.html?content=Images_02.html

But I'm not certain that will actually work with a binary column through
DataFaucet just because I haven't tried it. It should work, so if it
doesn't, then I'll need to add a fix for it in the BER.

Let me know how it goes! :)

Thanks Tobias

--
[ ike ] founder - DataFaucet ORM

phone: 781.769.0723

http://www.datafaucet.com


jot

unread,
Feb 6, 2009, 6:07:45 AM2/6/09
to DataFaucet ORM
Hi,

Now i tried both binary(BLOB) and character(LONGTEXT) columns and the
latter works fine if i use toBase64() when i save it. When i tried to
save it to a binary field i used ImageGetBlob(logo) as you
purposed. Everything seemed to be working fine, no exception or
anything. But nothing gets inserted into the database. The executed
query looks fine too. (nice sql with params). But nothing happens in
the database.
Anyway, the latter doesnt matter for me, saving the image to a
character field works fine for me!
Thank you for the help!

//Tobias
> http://livedocs.adobe.com/coldfusion/8/htmldocs/help.html?content=Ima...

Isaac Dealey

unread,
Feb 6, 2009, 11:12:03 AM2/6/09
to dataf...@googlegroups.com
> Hi,
>
> Now i tried both binary(BLOB) and character(LONGTEXT) columns and the
> latter works fine if i use toBase64() when i save it. When i tried to
> save it to a binary field i used ImageGetBlob(logo) as you
> purposed. Everything seemed to be working fine, no exception or
> anything. But nothing gets inserted into the database. The executed
> query looks fine too. (nice sql with params). But nothing happens in
> the database.
> Anyway, the latter doesnt matter for me, saving the image to a
> character field works fine for me!
> Thank you for the help!
>
> //Tobias

Great! Thanks for the feedback Tobias. :) I just added the binary
column issue to the bugbase.

Reply all
Reply to author
Forward
0 new messages