2009年11月3日星期二

[fw-db] Zend Application Session SaveHandler DB Table issue

I'm having issues  trying to use  Zend Application Resource Session  with Save Handler DB Table.

I'm getting the following  error.

Fatal error: Uncaught exception 'Zend_Db_Statement_Exception' with message 'SQLSTATE[42P01]: Undefined table: 7 ERROR: relation "session__seq" does not exist LINE 1: SELECT NEXTVAL('"session__seq"') ^' in C:\Zend\Apache2\htdocs\projects\genscript\library\Zend\Db\Statement\Pdo.php:234 Stack trace: #0 C:\Zend\Apache2\htdocs\projects\genscript\library\Zend\Db\Statement.php(320): Zend_Db_Statement_Pdo->_execute(Array) #1 C:\Zend\Apache2\htdocs\projects\genscript\library\Zend\Db\Adapter\Abstract.php(468): Zend_Db_Statement->execute(Array) #2 C:\Zend\Apache2\htdocs\projects\genscript\library\Zend\Db\Adapter\Pdo\Abstract.php(238): Zend_Db_Adapter_Abstract->query('SELECT NEXTVAL(...', Array) #3 C:\Zend\Apache2\htdocs\projects\genscript\library\Zend\Db\Adapter\Abstract.php(799): Zend_Db_Adapter_Pdo_Abstract->query('SELECT NEXTVAL(...', Array) #4 C:\Zend\Apache2\htdocs\projects\genscript\library\Zend\Db\Adapter\Pdo\Pgsql.php(299): Zend_Db_Adapter_Abstract->fetchOne('SELECT NEXTVAL(...') #5 C:\Zend\Apache2\ht in C:\Zend\Apache2\htdocs\projects\genscript\library\Zend\Db\Statement\Pdo.php on line 234



My configuration is the following:

obviously I removed the username and password for this post.


<resources>
            <modules>
                <!-- Placeholder to ensure an array is created -->
                <placeholder />
            </modules>
            <db>
                <adapter>Pdo_Pgsql</adapter>
                <params>
                    <host>localhost</host>
                    <username></username>
                    <password></password>
                    <dbname>test_db</dbname>
                    <port>5432</port>
                </params>
                <isDefaultTableAdapter>true</isDefaultTableAdapter>
            </db>
            <session>
                <save_path><zf:const zf:name="APPLICATION_PATH" />/../data/sessions</save_path>
                <use_only_cookies>true</use_only_cookies>
                <remember_me_seconds>864000</remember_me_seconds>
                <saveHandler>
                    <class>Zend_Session_SaveHandler_DbTable</class>
                    <options>
                        <name>session</name>
                        <primary>
                            <session_id>session_id</session_id>
                            <save_path>save_path</save_path>
                            <name>name</name>
                        </primary>
                        <primaryAssignment>
                            <sessionId>sessionId</sessionId>
                            <sessionSavePath>sessionSavePath</sessionSavePath>
                            <sessionName>sessionName</sessionName>
                        </primaryAssignment>
                        <modifiedColumn>modified</modifiedColumn>
                        <dataColumn>session_data</dataColumn>
                        <lifetimeColumn>lifetime</lifetimeColumn>
                    </options>
                </saveHandler>
            </session>


Table Structure:

I added the column "session" to see if it fixes  it but it did not help.



CREATE TABLE "session"
(
  "session" serial NOT NULL,
  session_id character(32) NOT NULL,
  save_path character varying(32) NOT NULL,
  "name" character varying(32) NOT NULL DEFAULT ''::character varying,
  modified integer,
  lifetime integer,
  session_data text,
  CONSTRAINT session_pk PRIMARY KEY (session, session_id)
)
WITH (
  OIDS=FALSE
);



-- Index: session_idx

-- DROP INDEX session_idx;

CREATE UNIQUE INDEX session_idx
  ON "session"
  USING btree
  (session);




没有评论: