> 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
Great! Thanks for the feedback Tobias. :) I just added the binary
column issue to the bugbase.