*Warning* (512): *SQL Error:* ERROR:  duplicate key value violates
unique constraint "tblcdlog_pkey"
[*CORE/cake/libs/model/datasources/dbo_source.php*, line *526*]



On Thu, May 13, 2010 at 6:28 PM, Jeremy Burns <jeremybu...@me.com> wrote:

> I'm sorry to sound unhelpful, but have you read the error message?
>
>
> Jeremy Burns
> jeremybu...@me.com <jeremybu...@mac.com>
>
>
> On 13 May 2010, at 13:53, Narendra Padala wrote:
>
> hi sir,
> i did that one now i got this error sir please help me out sir
>
> *Warning* (2): pg_query() [function.pg-query 
> <http://php.net/function.pg-query>]: Query failed: ERROR:  duplicate key 
> value violates unique constraint "tblcdlog_pkey" 
> [*CORE/cake/libs/model/datasources/dbo/dbo_postgres.php*, line *155*]
>
> Code | Context
>
> $sql  =       "INSERT INTO "tblcdlog" ("lngcdlog", "dtmcreated", 
> "lngcdlog_type", "blnsuccess", "tblcdlog_id", "strerrordesc") VALUES ('157', 
> '2010-05-13 13:42:50', '1', '0', '124', 'Naru')"
>
> pg_query - [internal], line ??
> DboPostgres::_execute() - 
> CORE/cake/libs/model/datasources/dbo/dbo_postgres.php, line 155
> DboSource::execute() - CORE/cake/libs/model/datasources/dbo_source.php, line 
> 189
> DboSource::create() - CORE/cake/libs/model/datasources/dbo_source.php, line 
> 586
> Model::save() - CORE/cake/libs/model/model.php, line 1287
> TblstoresController::datacdload() - APP/controllers/tblstores_controller.php, 
> line 1037
> Object::dispatchMethod() - CORE/cake/libs/object.php, line 115
> Dispatcher::_invoke() - CORE/cake/dispatcher.php, line 226
> Dispatcher::dispatch() - CORE/cake/dispatcher.php, line 193
> [main] - APP/webroot/index.php, line 87
>
> *Warning* (512): *SQL Error:* ERROR:  duplicate key value violates unique 
> constraint "tblcdlog_pkey" 
> [*CORE/cake/libs/model/datasources/dbo_source.php*, line *526*]
>
> Code | Context
>
> $sql  =       "INSERT INTO "tblcdlog" ("lngcdlog", "dtmcreated", 
> "lngcdlog_type", "blnsuccess", "tblcdlog_id", "strerrordesc") VALUES ('157', 
> '2010-05-13 13:42:50', '1', '0', '124', 'Naru')"
> $error        =       "ERROR:  duplicate key value violates unique constraint 
> "tblcdlog_pkey""
> $out  =       null
>
>             $out = null;            if ($error) {                
> trigger_error("<span style = \"color:Red;text-align:left\"><b>SQL Error:</b> 
> {$this->error}</span>", E_USER_WARNING);
>
> DboSource::showQuery() - CORE/cake/libs/model/datasources/dbo_source.php, 
> line 526
> DboSource::execute() - CORE/cake/libs/model/datasources/dbo_source.php, line 
> 202
> DboSource::create() - CORE/cake/libs/model/datasources/dbo_source.php, line 
> 586
> Model::save() - CORE/cake/libs/model/model.php, line 1287
> TblstoresController::datacdload() - APP/controllers/tblstores_controller.php, 
> line 1037
> Object::dispatchMethod() - CORE/cake/libs/object.php, line 115
> Dispatcher::_invoke() - CORE/cake/dispatcher.php, line 226
> Dispatcher::dispatch() - CORE/cake/dispatcher.php, line 193
> [main] - APP/webroot/index.php, line 87
>
> *Query:* INSERT INTO "tblcdlog" ("lngcdlog", "dtmcreated", "lngcdlog_type", 
> "blnsuccess", "tblcdlog_id", "strerrordesc") VALUES ('157', '2010-05-13 
> 13:42:50', '1', '0', '124', 'Naru')
>
>
>
> I wrote code like this...
>
>                 $this->data['Tblcdlog']['lngcdlog']=157;
>                 $this->data['Tblcdlog']['dtmcreated']='2010-05-13
> 13:42:50';
>                 $this->data['Tblcdlog']['lngcdlog_type']=1;
>                 $this->data['Tblcdlog']['blnsuccess']=0;
>                 $this->data['Tblcdlog']['tblcdlog_id']=124;
>                 $this->data['Tblcdlog']['strerrordesc']='Naru';
>
>
>                 $this->Tblcdlog->save($this->data);
>
> Please help me out sir
>
>
> On Thu, May 13, 2010 at 6:10 PM, Jeremy Burns <jeremybu...@me.com> wrote:
>
>> That's a fairly self explanatory error message. Your dtmcreated field
>> cannot be null. You need to include the dtmcreatedthild and a matching value
>> in the update statement.
>>
>> Something like:
>>
>> $this->data['Tblcdlog']['lngcdlog']=157;
>> $this->data['Tblcdlog']['strerrordesc']='value';
>>
>> *$this->data['Tblcdlog']['dtmcreated']='value';*
>>
>> $this->Tblcdlog->save($this->data);
>>
>>
>>
>> Jeremy Burns
>> jeremybu...@me.com <jeremybu...@mac.com>
>>
>>
>> On 13 May 2010, at 13:36, Narendra Padala wrote:
>>
>> when i am tried above like that, i got this error message
>>
>> *Warning* (2): pg_query() [function.pg-query 
>> <http://php.net/function.pg-query>]: Query failed: ERROR:  null value in 
>> column "dtmcreated" violates not-null constraint 
>> [*CORE/cake/libs/model/datasources/dbo/dbo_postgres.php*, line *155*]
>>
>>  Code | Context
>>
>> $sql =       "INSERT INTO "tblcdlog" ("lngcdlog", "strerrordesc") VALUES 
>> ('157', 'value')"
>>
>> pg_query - [internal], line ??
>> DboPostgres::_execute() - 
>> CORE/cake/libs/model/datasources/dbo/dbo_postgres.php, line 155
>> DboSource::execute() - CORE/cake/libs/model/datasources/dbo_source.php, line 
>> 189
>> DboSource::create() - CORE/cake/libs/model/datasources/dbo_source.php, line 
>> 586
>> Model::save() - CORE/cake/libs/model/model.php, line 1287
>> TblstoresController::datacdload() - 
>> APP/controllers/tblstores_controller.php, line 1031
>> Object::dispatchMethod() - CORE/cake/libs/object.php, line 115
>> Dispatcher::_invoke() - CORE/cake/dispatcher.php, line 226
>> Dispatcher::dispatch() - CORE/cake/dispatcher.php, line 193
>> [main] - APP/webroot/index.php, line 87
>>
>> *Warning* (512): *SQL Error:* ERROR:  null value in column "dtmcreated" 
>> violates not-null constraint 
>> [*CORE/cake/libs/model/datasources/dbo_source.php*, line *526*]
>>
>>  Code | Context
>>
>> $sql =       "INSERT INTO "tblcdlog" ("lngcdlog", "strerrordesc") VALUES 
>> ('157', 'value')"
>> $error       =       "ERROR:  null value in column "dtmcreated" violates 
>> not-null constraint"
>> $out =       null
>>
>>             $out = null;            if ($error) {                
>> trigger_error("<span style = \"color:Red;text-align:left\"><b>SQL Error:</b> 
>> {$this->error}</span>", E_USER_WARNING);
>>
>> DboSource::showQuery() - CORE/cake/libs/model/datasources/dbo_source.php, 
>> line 526
>> DboSource::execute() - CORE/cake/libs/model/datasources/dbo_source.php, line 
>> 202
>> DboSource::create() - CORE/cake/libs/model/datasources/dbo_source.php, line 
>> 586
>> Model::save() - CORE/cake/libs/model/model.php, line 1287
>> TblstoresController::datacdload() - 
>> APP/controllers/tblstores_controller.php, line 1031
>> Object::dispatchMethod() - CORE/cake/libs/object.php, line 115
>> Dispatcher::_invoke() - CORE/cake/dispatcher.php, line 226
>> Dispatcher::dispatch() - CORE/cake/dispatcher.php, line 193
>> [main] - APP/webroot/index.php, line 87
>>
>> *Query:* INSERT INTO "tblcdlog" ("lngcdlog", "strerrordesc") VALUES ('157', 
>> 'value')
>>
>>
>>
>> this is my table structure
>>
>> ----------------------------
>>
>>
>>
>>                                            Table "public.tblcdlog"
>>      Column      |            Type             |                          
>> Modifiers
>>
>>
>> -----------------+-----------------------------+-------------------------------------------------------------
>>  lngcdlog        | integer                     | not null default 
>> nextval('tblcdlog_lngcdlog_seq'::regclass)
>>
>>
>>  dtmcreated      | timestamp without time zone | not null
>>  strcdno         | character varying(50)       |
>>  strversion      | character varying(50)       |
>>  lngcdlog_type   | integer                     | not null
>>
>>
>>  blnsuccess      | bit(1)                      | not null
>>  strerrordesc    | character varying(255)      |
>>  strupdateno     | character varying(10)       |
>>  blnlogged_to_rr | boolean                     | not null default false
>>
>>
>>  tblcdlog_id     | integer                     | not null default 
>> nextval('tblcdlog_id_seq'::regclass)
>> Indexes:
>>     "tblcdlog_pkey" PRIMARY KEY, btree (lngcdlog)
>> Foreign-key constraints:
>>     "tblcdlog_lngcdlog_type_fkey" FOREIGN KEY (lngcdlog_type) REFERENCES 
>> tlkcdlog_type(lngcdlog_type)
>>
>> --------------------------------------
>>
>>
>> i wrote code like this
>>
>>
>>
>>
>>                 $this->data['Tblcdlog']['lngcdlog']=157;
>>                 $this->data['Tblcdlog']['strerrordesc']='value';
>>                 $this->Tblcdlog->save($this->data);
>>
>>
>>
>> Please any one help me out....
>>
>>
>>
>> On Thu, May 13, 2010 at 4:46 PM, Dilip Godhani 
>> <dilip.godh...@gmail.com>wrote:
>>
>>> Hi,
>>> Suppose u want to update one row and its id is 1
>>> then u want
>>> following array
>>>
>>> $this->data['ModdelName']['id']=1;
>>> $this->data['ModdelName']['2field']='value';
>>>
>>> $this->ModelName->save($this->data);
>>>
>>>
>>> Array
>>> (
>>>     [ModelName] => Array
>>>         (
>>>             [id] => 1
>>>             [2field] => 'value'
>>>         )
>>> )
>>>
>>>
>>>
>>>
>>>
>>>
>>> On Thu, May 13, 2010 at 3:52 PM, Narendra Padala <crazycake...@gmail.com
>>> > wrote:
>>>
>>>>
>>>>  Sir, looked at sir, but i am not getting properly, can u write one
>>>> example for my above code..please help me out sir
>>>>
>>>> On Thu, May 13, 2010 at 3:31 PM, Jeremy Burns <jeremybu...@me.com>wrote:
>>>>
>>>>> Have you even looked at the online guide?
>>>>> http://book.cakephp.org/view/1031/Saving-Your-Data
>>>>>
>>>>> Jeremy Burns
>>>>> jeremybu...@me.com
>>>>>
>>>>>
>>>>> On 13 May 2010, at 11:00, Narendra Padala wrote:
>>>>>
>>>>> >
>>>>> > Hi...All!,
>>>>> >
>>>>> > I am new to cake php,I am suing postgreSql i need to update some
>>>>> > fields in my database. In my controller my code like this....here i
>>>>> > need convert these update command to cake, Please anyone can help me
>>>>> > out how to convert this in to cake.
>>>>> >
>>>>> >
>>>>> > function fun() {
>>>>> >
>>>>> > /**********************************
>>>>> > ( 1 )**********************************************/
>>>>> > pg_exec($conn,"UPDATE tblcdlog SET strerrordesc = 'The CD could not
>>>>> be
>>>>> > mounted. Make sure it is a valid $COMPANY_NAME Data CD.' WHERE
>>>>> > lngcdlog = $lngCDLog");
>>>>> >
>>>>> >
>>>>> > /*************** Here some content related to our script
>>>>> > *****************/
>>>>> > $fError = fopen("/tmp/errorlog", "a+");
>>>>> > fwrite($fError, "ERROR : The CD may not be loaded in this
>>>>> $DEST_NAME...
>>>>> > \n\n");
>>>>> > fclose($fError);
>>>>> >
>>>>> > /
>>>>> >
>>>>> ************************************(2)********************************************/
>>>>> > pg_exec($conn,"UPDATE tblcdlog SET strerrordesc = 'There is not
>>>>> > sufficient space on your hard drive.' WHERE lngcdlog = $lngCDLog");
>>>>> >
>>>>> > /*************** Here some content related to our script
>>>>> > *****************/
>>>>> > $fError = fopen("/tmp/errorlog", "a+");
>>>>> > fwrite($fError, "ERROR : The CD may not be loaded in this
>>>>> $DEST_NAME...
>>>>> > \n\n");
>>>>> > fclose($fError);
>>>>> >
>>>>> > /
>>>>> >
>>>>> **************************************(3)******************************************/
>>>>> > pg_exec($conn,"UPDATE tblcdlog SET strerrordesc = 'There is not
>>>>> > sufficient space on your hard drive.' WHERE lngcdlog = $lngCDLog");
>>>>> >
>>>>> > /*************** Here some content related to our script
>>>>> > *****************/
>>>>> > $fError = fopen("/tmp/errorlog", "a+");
>>>>> > fwrite($fError, "ERROR : The CD may not be loaded in this
>>>>> $DEST_NAME...
>>>>> > \n\n");
>>>>> > fclose($fError);
>>>>> >
>>>>> > /
>>>>> >
>>>>> **************************************(4)******************************************/
>>>>> > pg_exec($conn,"UPDATE tblcdlog SET strerrordesc = 'The CD is not a
>>>>> > valid $COMPANY_NAME data CD.' WHERE lngcdlog = $lngCDLog");
>>>>> >
>>>>> > /*************** Here some content related to our script
>>>>> > *****************/
>>>>> > $fError = fopen("/tmp/errorlog", "a+");
>>>>> > fwrite($fError, "ERROR : The CD may not be loaded in this
>>>>> $DEST_NAME...
>>>>> > \n\n");
>>>>> > fclose($fError);
>>>>> >
>>>>> > /
>>>>> >
>>>>> **************************************(5)******************************************/
>>>>> > pg_exec($conn,"UPDATE tblcdlog SET strerrordesc = 'The CD may not be
>>>>> > loaded in this $DEST_NAME.' WHERE lngcdlog = $lngCDLog");
>>>>> >
>>>>> > /*************** Here some content related to our script
>>>>> > *****************/
>>>>> > $fError = fopen("/tmp/errorlog", "a+");
>>>>> > fwrite($fError, "ERROR : The CD may not be loaded in this
>>>>> $DEST_NAME...
>>>>> > \n\n");
>>>>> > fclose($fError);
>>>>> >
>>>>> > /
>>>>> >
>>>>> **************************************(6)******************************************/
>>>>> > pg_exec($conn,"UPDATE tblcdlog SET strcdno = '$identifiercode' WHERE
>>>>> > lngcdlog = $lngCDLog");
>>>>> >
>>>>> > /*************** Here some content related to our script
>>>>> > *****************/
>>>>> > $fError = fopen("/tmp/errorlog", "a+");
>>>>> > fwrite($fError, "ERROR : The CD may not be loaded in this
>>>>> $DEST_NAME...
>>>>> > \n\n");
>>>>> > fclose($fError);
>>>>> >
>>>>> > /
>>>>> >
>>>>> **************************************(7)******************************************/
>>>>> > pg_exec($conn,"UPDATE tblcdlog SET strerrordesc = 'Invalid
>>>>> > $COMPANY_NAME CD-Rom ID Code.' WHERE lngcdlog = $lngCDLog");
>>>>> >
>>>>> > /*************** Here some content related to our script
>>>>> > *****************/
>>>>> > $fError = fopen("/tmp/errorlog", "a+");
>>>>> > fwrite($fError, "ERROR : The CD may not be loaded in this
>>>>> $DEST_NAME...
>>>>> > \n\n");
>>>>> > fclose($fError);
>>>>> >
>>>>> > /
>>>>> >
>>>>> **************************************(8)******************************************/
>>>>> > pg_exec($conn,"UPDATE tblcdlog SET strerrordesc = 'The CD has already
>>>>> > been loaded, and may not be loaded again.' WHERE lngcdlog =
>>>>> > $lngCDLog");
>>>>> >
>>>>> > /*************** Here some content related to our script
>>>>> > *****************/
>>>>> > $fError = fopen("/tmp/errorlog", "a+");
>>>>> > fwrite($fError, "ERROR : The CD may not be loaded in this
>>>>> $DEST_NAME...
>>>>> > \n\n");
>>>>> > fclose($fError);
>>>>> >
>>>>> > /
>>>>> >
>>>>> **************************************(9)******************************************/
>>>>> > pg_exec($conn,"UPDATE tblcdlog SET blnsuccess = '1', strversion =
>>>>> > '$strVersion', strupdateno = '$strUpdateNo' WHERE lngcdlog =
>>>>> > $lngCDLog");
>>>>> >
>>>>> > }
>>>>> >
>>>>> >
>>>>> >
>>>>> > Please help me out ....Thanks in Advance..!
>>>>> >
>>>>> >
>>>>> >
>>>>> > Check out the new CakePHP Questions site http://cakeqs.org and help
>>>>> others with their CakePHP related questions.
>>>>> >
>>>>> > You received this message because you are subscribed to the Google
>>>>> Groups "CakePHP" group.
>>>>> > To post to this group, send email to cake-php@googlegroups.com
>>>>> > To unsubscribe from this group, send email to
>>>>> > cake-php+unsubscr...@googlegroups.com<cake-php%2bunsubscr...@googlegroups.com>For
>>>>> >  more options, visit this group at
>>>>> http://groups.google.com/group/cake-php?hl=en
>>>>>
>>>>> Check out the new CakePHP Questions site http://cakeqs.org and help
>>>>> others with their CakePHP related questions.
>>>>>
>>>>> You received this message because you are subscribed to the Google
>>>>> Groups "CakePHP" group.
>>>>> To post to this group, send email to cake-php@googlegroups.com
>>>>> To unsubscribe from this group, send email to
>>>>> cake-php+unsubscr...@googlegroups.com<cake-php%2bunsubscr...@googlegroups.com>For
>>>>>  more options, visit this group at
>>>>> http://groups.google.com/group/cake-php?hl=en
>>>>>
>>>>
>>>>
>>>> Check out the new CakePHP Questions site http://cakeqs.org and help
>>>> others with their CakePHP related questions.
>>>>
>>>> You received this message because you are subscribed to the Google
>>>> Groups "CakePHP" group.
>>>> To post to this group, send email to cake-php@googlegroups.com
>>>> To unsubscribe from this group, send email to
>>>> cake-php+unsubscr...@googlegroups.com<cake-php%2bunsubscr...@googlegroups.com>For
>>>>  more options, visit this group at
>>>> http://groups.google.com/group/cake-php?hl=en
>>>>
>>>
>>>
>>>
>>> --
>>> Dilip Godhani
>>> Jr Software Developer, Entourage Solutions
>>> e-mail: di...@entouragesolutions.com
>>>           dilip.godh...@gmail.com
>>> Web.: www.entouragesolutions.com
>>> m. 9913822582
>>>
>>>
>>> Check out the new CakePHP Questions site http://cakeqs.org and help
>>> others with their CakePHP related questions.
>>>
>>> You received this message because you are subscribed to the Google Groups
>>> "CakePHP" group.
>>> To post to this group, send email to cake-php@googlegroups.com
>>> To unsubscribe from this group, send email to
>>> cake-php+unsubscr...@googlegroups.com<cake-php%2bunsubscr...@googlegroups.com>For
>>>  more options, visit this group at
>>> http://groups.google.com/group/cake-php?hl=en
>>>
>>
>>
>> Check out the new CakePHP Questions site http://cakeqs.org and help
>> others with their CakePHP related questions.
>>
>> You received this message because you are subscribed to the Google Groups
>> "CakePHP" group.
>> To post to this group, send email to cake-php@googlegroups.com
>> To unsubscribe from this group, send email to
>> cake-php+unsubscr...@googlegroups.com For more options, visit this group
>> at http://groups.google.com/group/cake-php?hl=en
>>
>>
>>
>> Check out the new CakePHP Questions site http://cakeqs.org and help
>> others with their CakePHP related questions.
>>
>> You received this message because you are subscribed to the Google Groups
>> "CakePHP" group.
>> To post to this group, send email to cake-php@googlegroups.com
>> To unsubscribe from this group, send email to
>> cake-php+unsubscr...@googlegroups.com<cake-php%2bunsubscr...@googlegroups.com>For
>>  more options, visit this group at
>> http://groups.google.com/group/cake-php?hl=en
>>
>
>
> Check out the new CakePHP Questions site http://cakeqs.org and help others
> with their CakePHP related questions.
>
> You received this message because you are subscribed to the Google Groups
> "CakePHP" group.
> To post to this group, send email to cake-php@googlegroups.com
> To unsubscribe from this group, send email to
> cake-php+unsubscr...@googlegroups.com For more options, visit this group
> at http://groups.google.com/group/cake-php?hl=en
>
>
>  Check out the new CakePHP Questions site http://cakeqs.org and help
> others with their CakePHP related questions.
>
> You received this message because you are subscribed to the Google Groups
> "CakePHP" group.
> To post to this group, send email to cake-php@googlegroups.com
> To unsubscribe from this group, send email to
> cake-php+unsubscr...@googlegroups.com<cake-php%2bunsubscr...@googlegroups.com>For
>  more options, visit this group at
> http://groups.google.com/group/cake-php?hl=en
>

Check out the new CakePHP Questions site http://cakeqs.org and help others with 
their CakePHP related questions.

You received this message because you are subscribed to the Google Groups 
"CakePHP" group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to
cake-php+unsubscr...@googlegroups.com For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en

Reply via email to