Re: DB_DataObject producing incorrect SQL

From: Date: Mon, 13 Nov 2006 22:50:15 +0000
Subject: Re: DB_DataObject producing incorrect SQL
References: 1 2 3 4 5  Groups: php.pear.general 
Request: Send a blank email to pear-general+get-25813@lists.php.net to get a copy of this message
On 11/13/06, Michael Henry <michael.k.henry@gmail.com> wrote:
Justin Patrin wrote: What you need to do is look at your db.ini file for the entry for this table and see what it has set as your key. Here are the relevant blocks from that file:
    [mlci.translations]
    id = 1
    string_id = 1
    page = 2
    lang = 2
    translation = 34
    [mlci.translations__keys]
Hmm, I assume there should be something in that second block.
Yep, that's your problem. Put this there: id = N
It should automatically detect the PK but perhaps the DBMS or schema you're using is funky somehow. I'm not aware of any funkiness. I'm using PostgreSQL and the DDL is straightforward:
    CREATE TABLE mlci.translations (
        id SERIAL PRIMARY KEY,
        string_id integer,
        page varchar(128),
        lang varchar(10),
        translation text
    );
    CREATE INDEX page ON mlci.translations (page);
    CREATE INDEX lang ON mlci.translations (lang);
    CREATE INDEX string_id ON mlci.translations (string_id);
This is a port of the MySQL DDL from the Translations2 documentation.
-- Justin Patrin

« previous php.pear.general (#25813) next »