Hi,
As I was trying to get rid of a couple bugs in my application, I
have found a very strange behavior:
In a textarea (WOForm, using form-data as the type as there's also
a WOUpload for an image), it seems that the content gets truncated
when send to the database?!
What do you mean by truncated? Not sent at all? Long strings lose
their end? An exception? The maximum amount of text in an text
area varies with each browser. Usually around 40 - 60K I think.
Now I have some more tests done, I meant truncated, but the EOAdaptor
has the entire string committed to the database.
But the database doesn't have the entire string in it.
So it led to the exception cannot update row describe by qualifier.
The database is MySQL and the type is MEDIUMTEXT.
If I add content directly to the database, the application is able
to get it and display the entire content, but if I try to update
is crashes with:
[2005-08-26 03:36:18 CEST] <WorkerThread3>
<com.webobjects.appserver._private.WOComponentRequestHandler>:
Exception occurred while handling request:
com.webobjects.eoaccess.EOGeneralAdaptorException:
updateValuesInRowDescribedByQualifier --
com.webobjects.jdbcadaptor.JDBCChannel method failed to update row
in database
Anyone experience problem with long strings? Do I have to set
something to handle the long string correctly?
That error does not look like it has anything to do with the form.
I agree.
Can you save changes made only in code?
What do you mean by that, I don't understand very well.
If I take another item with nothing in the text field, I can add or
update content as long as it's short enough (but seems to start
behaving incorrectly at about 10 lines!
This error is saying that the snapshot of the row that EOF holds
does not match the values as seen by the database.
Completely agree.
This could mean that something else has changed the database,
I'm on my local machine, only this application access the Database,
and if I look at the log, between the "add" action and the time to
check what's inside the database, nothing writes to it.
but probably indicates that one of the value types in the model or
the internal types are incorrect. Log out the SQL Update statement
and see what the Where clause is. One or more columns are not
matching.
I've checked that, but nothing seems wrong with the WHERE statement.
Here's the 3 steps:
===generating the list===
evaluateExpression: <com.webobjects.jdbcadaptor.MySQLPlugIn
$MySQLExpression: "SELECT t0.C_ITEM_BIRTH, t0.C_ITEM_COMMENT,
t0.C_ITEM_DATEPOSTED, t0.C_ITEM_DATEUPDATED, t0.C_ITEM_DEATH,
t0.C_ITEM_FATHER_FID, t0.C_ITEM_FORSALE, t0.C_ITEM_HARAS,
t0.C_ITEM_IMAGE, t0.C_ITEM_ISFROMHOME, t0.C_ITEM_MOTHER_FID,
t0.C_ITEM_NAME, t0.C_ITEM_PK, t0.C_ITEM__PERF_COMMENT,
t0.C_ITEM_RACE_FID, t0.C_ITEM_ROBE_FID, t0.C_ITEM_SIRE,
t0.C_ITEM_TYPE_FID FROM ITEM t0 ORDER BY t0.C_ITEM_NAME ASC">
===adding something to the C_ITEM_COMMENT (C_ITEM_DATEUPDATED is also
edited)===
evaluateExpression: <com.webobjects.jdbcadaptor.MySQLPlugIn
$MySQLExpression: "UPDATE ITEM SET C_ITEM_DATEUPDATED = ?,
C_ITEM_COMMENT = ? WHERE (C_ITEM_PK = ? AND C_ITEM_DATEUPDATED = ?
AND C_ITEM_IMAGE is NULL AND C_ITEM_ISFROMHOME = ? AND C_ITEM_BIRTH
= ? AND C_ITEM_HARAS = ? AND C_ITEM_ROBE_FID = ? AND C_ITEM_TYPE_FID
= ? AND C_ITEM_DEATH is NULL AND C_ITEM_COMMENT is NULL AND
C_ITEM__PERF_COMMENT = ? AND C_ITEM_FORSALE = ? AND C_ITEM_NAME = ?
AND C_ITEM_MOTHER_FID = ? AND C_ITEM_RACE_FID = ? AND C_ITEM_SIRE = ?
AND C_ITEM_FATHER_FID = ? AND C_ITEM_DATEPOSTED = ?)" withBindings:
1:2005-08-26 17:35:46(itemDateUpdated), 2:"
Branche D...e passe
Identifiant"(itemComment), 3:36(itemPK), 4:2005-08-26 17:22:04
(itemDateUpdated), 5:true(itemIsFromHome), 6:1976-04-26 00:00:00
(itemBirthdate), 7:2(itemHarasFID), 8:19(itemRobeFID), 9:5
(itemTypeFID), 10:"une intro"(itemPerformanceComment), 11:true
(itemForSale), 12:"trucd'hurlvent"(itemName), 13:5(itemMotherFID),
14:29(itemRaceFID), 15:"5896547"(itemSire), 16:11(itemFatherFID),
17:2005-08-26 03:25:23(itemDatePosted)>
it works ok, except that the C_ITEM_COMMENT here isn't the one that
will be written to the database, it will get truncated.
===and now trying to updateeht entry====
evaluateExpression: <com.webobjects.jdbcadaptor.MySQLPlugIn
$MySQLExpression: "UPDATE ITEM SET C_ITEM_DATEUPDATED = ?,
C_ITEM_COMMENT = ? WHERE (C_ITEM_PK = ? AND C_ITEM_DATEUPDATED = ?
AND C_ITEM_IMAGE is NULL AND C_ITEM_ISFROMHOME = ? AND C_ITEM_BIRTH
= ? AND C_ITEM_HARAS = ? AND C_ITEM_ROBE_FID = ? AND C_ITEM_TYPE_FID
= ? AND C_ITEM_DEATH is NULL AND C_ITEM_COMMENT = ? AND
C_ITEM__PERF_COMMENT = ? AND C_ITEM_FORSALE = ? AND C_ITEM_NAME = ?
AND C_ITEM_MOTHER_FID = ? AND C_ITEM_RACE_FID = ? AND C_ITEM_SIRE = ?
AND C_ITEM_FATHER_FID = ? AND C_ITEM_DATEPOSTED = ?)" withBindings:
1:2005-08-26 17:54:24(itemDateUpdated), 2:"Branche D\216v... suite
\210 un incident"(itemComment), 3:36(itemPK), 4:2005-08-26 17:35:46
(itemDateUpdated), 5:true(itemIsFromHome), 6:1976-04-26 00:00:00
(itemBirthdate), 7:2(itemHarasFID), 8:19(itemRobeFID), 9:5
(itemTypeFID), 10:"
Branche D...e suite \210 un inciden"(itemComment), 11:"une
intro"(itemPerformanceComment), 12:true(itemForSale),
13:"trucd'hurlvent"(itemName), 14:5(itemMotherFID), 15:29
(itemRaceFID), 16:"5896547"(itemSire), 17:11(itemFatherFID),
18:2005-08-26 03:25:23(itemDatePosted)>
so the update will fail because it'll have a C_ITEM_COMMENT
truncated.
You might also get this if you are locking on a timestamp or
floating point number column.
Could you develop just a little:) I'm using the
defaultEditingContext.
Chuck
--
Practical WebObjects - a book for intermediate WebObjects
developers who want to increase their overall knowledge of
WebObjects, or those who are trying to solve specific application
development problems.
http://www.global-village.net/products/practical_webobjects