Welcome, Guest. Register Now!
   
Mark Forums Read Mark Forums Read Mark Forums Read


Reply
 
LinkBack Thread Tools Display Modes
  #1 (permalink)  
Old 05-22-2008, 04:47 PM
Junior Member
 
Join Date: May 2008
Posts: 1
Default Error trying to insert some data using Zend_Db_Table/PostgreSQL

Hey!

I got an error, actually I can't see it, but let me explain the situation, I'm using PostgreSQL 8.3 and I have this table:

clinic_system_platform_xref:
* clinic_id integer NOT NULL
* platform_id integer NOT NULL

Both columns are the primary key of the table:

clinic_system_platform_xref_pkey PRIMARY KEY (clinic_id, platform_id)

So what's the problem ? when I try to insert a record into this table, nothing happend, I mean not even an Exception, nothing, then the PosgreSQL crash!. I recreate the same table but I add a new column, and works perfect now, the question, is this a PDO/ZendFramework error ? maybe a bug or something ?, this is the new table structure:

clinic_system_platform_xref_test:
* clinic_system_platform_xref_id integer NOT NULL
* clinic_id integer NOT NULL
* platform_id integer NOT NULL

PRIMARY KEY: clinic_system_platform_xref_test_pkey PRIMARY KEY (clinic_system_platform_xref_id)

This is my PHP code, with this code doesn't work:

PHP Code:
/**
 * GenericTable class.
 *
 */
class GenericTable extends Zend_Db_Table_Abstract
{
    
/**
     * Class constructor
     *
     * @return void
     */
    
public function __construct ( Array $arrTableInfo = array ( ) )
    {
        
// loop through the table info values and set them to the class' attributes
        
foreach ( $arrTableInfo as $strFieldKey => $strFieldValue )
        {
            
// set it!
            
$this->$strFieldKey $strFieldValue;
        }

        
parent::__construct ( array ( 'db' => Zend_Registry::get"objDb" ) ) );
    }
}

$objClinicPlatformTable = new GenericTable( array(
        
"_name" => "clinic_system_platform_xref",
        
"_schema" => "schema_2",
        
"_primary" => array( "clinic_id""platform_id" ),
        
"_sequence" => false
    
)
);

$arrClinicPlatforms = array( "5""4" );

foreach ( 
$arrClinicPlatforms AS $intPlatformIndex => $intPlatformId )
{
    
$objClinicPlatformTable->insert( array( "clinic_id" => $intClinicId"platform_id" => $intPlatformId ) );

Thx for any help.
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
Reply


Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On



All times are GMT. The time now is 06:54 PM.