Re: Saving uploaded file data to database
Re: Saving uploaded file data to database
- Subject: Re: Saving uploaded file data to database
- From: Chuck Hill <email@hidden>
- Date: Tue, 3 Apr 2007 11:27:31 -0700
On Apr 3, 2007, at 11:22 AM, Janine Sisk wrote:
I'm back! Setting the filePath binding fixed the problem I was
having, but now I'm on to a new one.
My EOModel contains a String, a CLOB, two NSTimestamps and two
BLOBs (actually the blobs are in their own model). Each of the
corresponding components is bound to them, like so:
Description : WOText {
value = newPanel.description;
}
ImageFile : WOFileUpload {
filePath = imageFileName;
mimeType = imageMimeType;
data = newPanelImages.big_image;
}
This works fine for everything except the BLOBs, which are tripping
the "not null" constraint on those fields in the database.
I have code to check the length of newPanelImages.big_image and it
is correct, but somehow it's not working. Here's how I'm doing the
save:
EOEditingContext ec = session().defaultEditingContext();
ec.insertObject(newPanelImages);
ec.saveChanges();
And, just in case I'm misinterpreting something, here's the error:
com.webobjects.eoaccess.EOGeneralAdaptorException:
EvaluateExpression failed: : Next exception:SQL State:23 subclass =
00 -- error code: 357 -- msg: Exception condition 357. Integrity
constraint violation (CHECK, PANELIMAGES._C0000000007(\"bigImage\"
IS NOT NULL)). Next exception:SQL State:23 subclass = 00 -- error
code: 357 -- msg: Exception condition 357. Integrity constraint
violation (CHECK, PANELIMAGES._C0000000009(\"thumbnail\" IS NOT
NULL)). Next exception:SQL State:40 subclass = 00 -- error code:
363 -- msg: Exception condition 363. Transaction rollback.
It's like the data is not getting copied from the newPanelImages
object to the database. Is there something special one has to do
to handle BLOBs in FrontBase?
Yes, there is. :-) FrontBase creates the rows and then updates the
CLOB contents. Make the column nullable in the database.
Chuck
--
Practical WebObjects - for developers who want to increase their
overall knowledge of WebObjects or who are trying to solve specific
problems.
http://www.global-village.net/products/practical_webobjects
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Webobjects-dev mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden