#5830: Oracle - Timestamp field datatype issue ---------------------------+------------------------------------------------ Reporter: jaydipdave | Owner: phishy Type: Bug | Status: new Priority: High | Milestone: 1.2.x.x Component: Oracle | Version: RC2 Severity: Major | Resolution: Keywords: | Php_version: n/a Cake_version: | ---------------------------+------------------------------------------------ Comment (by jaydipdave):
This is the structure of my table "clientusers". {{{ ID NUMBER No - 1 CLIENT_ID NUMBER Yes - - USERNAME VARCHAR2(40) Yes - - PASSWORD VARCHAR2(40) Yes - - SECURITYQUESTION1 VARCHAR2(200) Yes - - ANSWER1 VARCHAR2(50) Yes - - SECURITYQUESTION2 VARCHAR2(200) Yes - - ANSWER2 VARCHAR2(50) Yes - - SECURITYQUESTION3 VARCHAR2(200) Yes - - ANSWER3 VARCHAR2(50) Yes - - SECURITYQUESTION4 VARCHAR2(200) Yes - - ANSWER4 VARCHAR2(50) Yes - - SECURITYQUESTION5 VARCHAR2(200) Yes - - ANSWER5 VARCHAR2(50) Yes - - LASTLOGIN TIMESTAMP(6) Yes SYSDATE - REMARK VARCHAR2(500) Yes - - STATUS NUMBER Yes 0 - URL VARCHAR2(300) Yes - - }}} Here, you can see my MODIFIED column's datatype is timestamp. Now, when i try saving my data using following code: {{{ function admin_add() { $this->setAdminArea(); if (!empty($this->data)) { $this->Client->data = $this->data; $this->Client->Clientuser->data = $this->data; $valid_client = $this->Client->validates(); if($this->Client->Clientuser->validates() && $valid_client) if ($this->Client->save($this->data)) { $this->data['Clientuser']['client_id'] = $this->Client->id; $this->Client->Clientuser->save($this->data); $this->flash('Client has been saved.', '/admin/clients/'); } } } }}} I am getting following Error: {{{ Warning (512): SQL Error: ORA-01843: not a valid month [CORE/cake/libs/model/datasources/dbo_source.php, line 514] }}} {{{ Query: UPDATE clients SET id = 103, companyname = 'xxxxxxxxxxxxxxxxxxxxxxxxxxxxxx', contactpersonfirstname = 'Jaydeep', contactpersonlastname = 'Dave', contactnumber = '9428110096', address1 = 'plot nasdf0asd f-dasf asdf', address2 = 'sdf', city = 'Bhavnagar', state = 'Gujarat', country = 'India', zip = '234234', phone = '123456', fax = '123456', email = '[EMAIL PROTECTED]', modified = '2008-12-01 11:18:12' WHERE clients.id = 103 }}} but when i added one more case in dbo_oracle.php file's function value() like this: {{{ switch($column) { case 'timestamp': // Patch Line case 'date': $data = date('Y-m-d H:i:s', strtotime($data)); $data = "TO_DATE('$data', 'YYYY-MM-DD HH24:MI:SS')"; break; case 'integer' : case 'float' : case null : if (is_numeric($data)) { break; } default: $data = str_replace("'", "''", $data); $data = "'$data'"; break; } }}} It works. The thing is, when the $column variable in value() function is "timestamp" it executes the "default" code segment of switch case. the query is being generated like this: modified = '2008-12-01 11:18:12' Which should be generated like this: modified = TO_DATE('2008-12-01 11:23:23', 'YYYY-MM-DD HH24:MI:SS') If you want to know anything more, don't hesitate to ask me. :) -- Ticket URL: <https://trac.cakephp.org/ticket/5830#comment:3> CakePHP : The Rapid Development Framework for PHP <https://trac.cakephp.org/> Cake is a rapid development framework for PHP which uses commonly known design patterns like ActiveRecord, Association Data Mapping, Front Controller and MVC. Our primary goal is to provide a structured framework that enables PHP users at all levels to rapidly develop robust web applications, without any loss to flexibility. --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "tickets cakephp" group. To post to this group, send email to tickets-cakephp@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/tickets-cakephp?hl=en -~----------~----~----~----~------~----~------~--~---