Re: DB_DataObjects - Update issues
| From: | Justin Patrin | Date: | Sun, 13 Aug 2006 01:53:11 +0000 |
| Subject: | Re: DB_DataObjects - Update issues | ||
| References: | 1 | Groups: | php.pear.general |
| Request: | Send a blank email to pear-general+get-24903@lists.php.net to get a copy of this message | ||
On 8/12/06, Ian Warner <iwarner@triangle-solutions.com> wrote:
Hi
Just ran into a strange issue with Update that I have never encountered
before, google yields no rewards.
Code to execute:
DB_DataObject::debugLevel(5);
$sql1 = DB_DataObject::factory(TBL_SMS_CENTER_PENDING);
$sql1->status = 'Suspended';
$sql1->whereAdd("pending_id = '" . $sql->pending_id . "'");
$sql1->update();
print_r($sql1);
DB_DataObject::debugLevel(0);
Error info is:
DO_Sms_pending: CONNECT: Checking for database database_ in options
DO_Sms_pending: CONNECT: USING CACHED CONNECTION
DO_Sms_pending: ERROR: update: trying to perform an update without
the key set, and argument to update is not
DB_DATAOBJECT_WHEREADD_ONLY
Read the error message again.
$sql1->update(DB_DATAOBJECT_WHEREADD_ONLY);
DO_Sms_pending Object ( [__table] => sms_pending [pending_id] => [data] => [priority] => [creation_date] => [revision_date] => [status] => Suspended [id] => [_DB_DataObject_version] => 1.8.4 [N] => 0 [_database_dsn] => [_database_dsn_md5] => c9f3ecac1f2cadc9e5c4095e36c2ad6b [_database] => admin [_query] => Array ( [condition] => WHERE (-- Justin Patrinpending_id= '1' ) [group_by] => [order_by] => [having] => [limit_start] => [limit_count] => [data_select] => * ) [_DB_resultid] => [_resultFields] => [_link_loaded] => [_join] => [_lastError] => ) Array ( [condition] => WHERE (pending_id= '1' ) [group_by] => [order_by] => [having] => [limit_start] => [limit_count] => [data_select] => * ) The schema is set as: which is correct, pending_id is a primary key also. [sms_pending] pending_id = 129 data = 194 priority = 130 creation_date = 129 revision_date = 129 status = 130 [sms_pending__keys] pending_id = N Any help appreciated Cheers Ian -- PEAR General Mailing List (http://pear.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php