Yii Framework Forum: Relations Problem While Using Backend As Postgres - Yii Framework Forum

Jump to content

Page 1 of 1
  • You cannot start a new topic
  • You cannot reply to this topic

Relations Problem While Using Backend As Postgres CDbCommand failed to execute the SQL statement: SQLSTATE[42883]: Undef Rate Topic: -----

#1 User is offline   manusaxena 

  • Newbie
  • Yii
  • Group: Members
  • Posts: 2
  • Joined: 18-April 13

Posted 19 April 2013 - 12:55 AM

CDbCommand failed to execute the SQL statement: SQLSTATE[42883]: Undefined function: 7 ERROR: operator does not exist: character varying = integer
LINE 1: ...ecords" "devlivery" WHERE ("devlivery"."messageid"=2109493)
^
HINT: No operator matches the given name and argument type(s). You might need to add explicit type casts.. The SQL statement executed was: SELECT "devlivery"."from_sender" AS "t1_c0", "devlivery"."to_receiver" AS "t1_c1", "devlivery"."message" AS "t1_c2", "devlivery"."relation" AS "t1_c3", "devlivery"."messagetype" AS "t1_c4", "devlivery"."status" AS "t1_c5", "devlivery"."errorcode" AS "t1_c6", "devlivery"."aspname" AS "t1_c7", "devlivery"."application" AS "t1_c8", "devlivery"."scid" AS "t1_c9", "devlivery"."scconnection" AS "t1_c10", "devlivery"."messageid" AS "t1_c11", "devlivery"."msisdn" AS "t1_c12", "devlivery"."amount" AS "t1_c13", "devlivery"."method" AS "t1_c14", "devlivery"."sequenceid" AS "t1_c15", "devlivery"."minimumcredit" AS "t1_c16", "devlivery"."servicename" AS "t1_c17", "devlivery"."reason" AS "t1_c18", "devlivery"."tstmp1" AS "t1_c19", "devlivery"."tstmp2" AS "t1_c20", "devlivery"."tstmp3" AS "t1_c21", "devlivery"."siprotocol" AS "t1_c22", "devlivery"."ston" AS "t1_c23", "devlivery"."snpi" AS "t1_c24", "devlivery"."dton" AS "t1_c25", "devlivery"."dnpi" AS "t1_c26", "devlivery"."dcs" AS "t1_c27", "devlivery"."esm_class" AS "t1_c28", "devlivery"."totalparts" AS "t1_c29", "devlivery"."vlrid" AS "t1_c30", "devlivery"."simessageid" AS "t1_c31", "devlivery"."mtfdareturned" AS "t1_c32", "devlivery"."billingtypeforaparty" AS "t1_c33", "devlivery"."billingtypeforbparty" AS "t1_c34", "devlivery"."timestamp_filerecord" AS "t1_c35", "devlivery"."id" AS "t1_c36" FROM "delivery_master_records" "devlivery" WHERE ("devlivery"."messageid"=:ypl0)



I am having problem when trying to get value of relational table . I have two tables master_records and delivery_master_records. Both table have messageid column character varing. I and try to get value $data->delivery->messageid where delivery has relation like

return array(
'devlivery'=>array(self::HAS_ONE,'DeliveryMasterRecords','messageid')
);

Attached File(s)

  • Attached File  1.png (121.34K)
    Number of downloads: 6

0

#2 User is offline   Maurizio Domba Cerin 

  • Yii - Yesss It Is !!!
  • Yii
  • Group: Yii Dev Team
  • Posts: 4,379
  • Joined: 12-October 09
  • Location:Croatia

Posted 19 April 2013 - 02:41 AM

This happens when there are no related reocrds for the current row. You need to fist check the existance of related data... so it would be something like
echo isset($data->devlivery) ? $data->devlivery->messageId : '';

Find more about me.... btw. Do you know your WAN IP?
0

#3 User is offline   manusaxena 

  • Newbie
  • Yii
  • Group: Members
  • Posts: 2
  • Joined: 18-April 13

Posted 19 April 2013 - 04:55 AM

View PostMaurizio Domba, on 19 April 2013 - 02:41 AM, said:

This happens when there are no related reocrds for the current row. You need to fist check the existance of related data... so it would be something like
echo isset($data->devlivery) ? $data->devlivery->messageId : '';



Thanks issue has been fixed
0

Share this topic:


Page 1 of 1
  • You cannot start a new topic
  • You cannot reply to this topic

1 User(s) are reading this topic
0 members, 1 guests, 0 anonymous users