Thought inc.

The Dynamic O/R Mapping Company
     

CocoBase Technical Support Forums
For access to developer site with software download and doc's, please request CocoBase download and password
will be emailed to you. Response to posts will appear when answered by THOUGHT Support team.
NOTE:You must register separately with forum in order to post your questions, please click on register icon below.
Home   Frequently Asked Questions   Search   Edit your profile   Registration is free!  
Email This Page to Someone!
Show a Printable Version
CocoBase Enterprise O/R Forums > CocoBase Questions
update that does not update
< Previous Thread     Next Thread >
Author
Thread    Post New Thread     Post A Reply
CristianRubio
Member

Registered: Jun 2007
Posts: 9

Hello,

I'm tryin to update one row in the database by calling the following method:

result = dataSource.update(oldobj, newobj, mapName);

where:
result is an interger,
dataSource is the Cocobase Driver
oldobj is the object to overwrite
newobj is the object to store
mapName is the name of the oldObj and newobj class

Of course oldobj and newobj have the same type.
this objext have a list of 40 fields and in one particular case where field number 25 is different the update does not work and the result is 0. In other cases seems to be working fine.

Please, do yoi know why this could be happening??
thanks in advance.

Cristian

06-20-2007 09:55 AM
Click Here to See the Profile for CristianRubio    Find more posts by CristianRubio        Edit/Delete Message    Reply w/Quote    IP: Logged
admin
Administrator

Registered: Apr 2001
Posts: 19

The fields in oldobj are used for optimistic locking where conditions. So, your update statement should be similar to:

update newObj.f1 = :f1, newObj.f2 = :f2 ....
where oldObj.f1 = :f1, oldObj.f2 = :f2 ....

Now, depending on the database field type, the where condition may fail - for example, numeric values may fail because of the precision, which may not be exactly the same. So, one is to use a lower precision db type for that particular map field.

Hope that helps!

THOUGHT Support

06-20-2007 11:11 AM
Click Here to See the Profile for admin    Find more posts by admin        Edit/Delete Message    Reply w/Quote    IP: Logged
CristianRubio
Member

Registered: Jun 2007
Posts: 9

Hellow

It does not help very much ...
I've being comparing this failing field with other one which works fine at the updates.

I checked same definition in the database and same definition in the xml file.

Any idea will apreciated ...
Many thanks
Cristian

BTW:
These are the definitions at the xml file, BNK_LOAN_QTY works fine, STOCK_BORROWED_QTY is failing

<CBField location="24" catalogname="null" schemaname="" tablename="DEPOT_POSITION" fieldname="BNK_LOAN_QTY" fieldvalue=":BNK_LOAN_QTY" dbfieldtype="NUMBER" fielddirection="0" dbtype="3" dbfieldsize="26" searchable="26" signed="26" keyposition="-1">
<CBField location="25" catalogname="null" schemaname="" tablename="DEPOT_POSITION" fieldname="STOCK_BORROWED_QTY" fieldvalue=":STOCK_BORROWED_QTY" dbfieldtype="NUMBER" fielddirection="0" dbtype="3" dbfieldsize="26" searchable="26" signed="26" keyposition="-1">

06-25-2007 07:18 AM
Click Here to See the Profile for CristianRubio    Find more posts by CristianRubio        Edit/Delete Message    Reply w/Quote    IP: Logged
admin
Administrator

Registered: Apr 2001
Posts: 19

Hi,

Do you have update where clauses in your map for both fields as well? You should see a <CBClause> entry in the xml such as

<CBClause conjunctive="" leftfield="DEPOT_POSITION.STOCK_BORROWED_QTY " ... rightvalue==":STOCK_BORROWED_QTY"/>

The where clause above is required so it will be included in the where conditions for the update sql, thus allowing you to filter updates based on that field. Perhaps that's what is missing?

THOUGHT Support

07-18-2007 05:40 AM
Click Here to See the Profile for admin    Find more posts by admin        Edit/Delete Message    Reply w/Quote    IP: Logged
All times are PST (US)    Post New Thread     Post A Reply
Forum Jump:
< Previous Thread     Next Thread >

Forum Rules:
Who Can Read The Forum? Any registered user or guest.
Who Can Post New Topics? Any registered user.
Who Can Post Replies? Any registered user.
Changes: Messages can be edited by their author. Messages can be deleted by their author.
Posts: HTML code is OFF. Smilies are OFF. vB code is OFF. [IMG] code is OFF.

Admin Options:
Open / Close Thread
Move Thread
Delete Thread
Edit Thread

< Contact Us - THOUGHT Inc. >

Copyright © Jelsoft Enterprises Limited 2000.
Copyright 2001 All Rights Reserved, THOUGHT Inc.