UniverseUniversity


Home Projects Jobs Clientele Contact

uu


[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Problem with recreation of session_info table



Nah. You are right. I've just had too many beers :)

Alexey Parshin wrote:
> This test tries both :) Just read it more carefully. Or, may be I
> didn't get your point?
>
> 2007/3/19, Ilya A. Volynets-Evenbakh <ilya@total-knowledge.com
> <mailto:ilya@total-knowledge.com>>:
>
>     How about doing logout, and then login on same connection, instead of
>     reopening it? That is what should ultimately work, when we get real
>     connection
>     pool.
>
>     Alexey Parshin wrote:
>     > The following test works like a charm:
>     >
>     > void loginTest(CDatabase& db) {
>     >     CQuery loginQuery(&db,"SELECT login('alexey','password',1)");
>     >     CQuery logoutQuery(&db,"SELECT logout()");
>     >     loginQuery.exec();
>     >     cout << "Logged in" << endl;
>     >     logoutQuery.exec();
>     >     cout << "Logged out" << endl;
>     >
>     >     loginQuery.exec();
>     >     cout << "Logged in" << endl;
>     >     logoutQuery.exec();
>     >     cout << "Logged out" << endl;
>     >
>     >     cout << endl << "Reopening database" << endl;
>     >     db.close();
>     >     db.open();
>     >
>     >     loginQuery.exec();
>     >     cout << "Logged in" << endl;
>     >     logoutQuery.exec();
>     >     cout << "Logged out" << endl;
>     > }
>     >
>     >
>     >
>     > 2007/3/19, Alexey Parshin < alexeyp@gmail.com
>     <mailto:alexeyp@gmail.com>
>     > <mailto:alexeyp@gmail.com <mailto:alexeyp@gmail.com>>>:
>     >
>     >     Can you send me the code that has that problem, as a tar
>     archive?
>     >
>     >     2007/3/19, sergey@total-knowledge.com
>     <mailto:sergey@total-knowledge.com>
>     >     <mailto: sergey@total-knowledge.com
>     <mailto:sergey@total-knowledge.com>> < sergey@total-knowledge.com
>     <mailto:sergey@total-knowledge.com>
>     >     <mailto:sergey@total-knowledge.com
>     <mailto:sergey@total-knowledge.com>>>:
>     >
>     >         After I used logout() stored procedure I'm unable to
>     recreate
>     >         session_info
>     >         table.
>     >         Here is the error message which I get after
>     >         select login ('sergey', 'password12', 1);
>     >         -----
>     >         ERROR:  relation with OID 37226 does not exist
>     >         CONTEXT:  SQL statement "INSERT INTO session_info SELECT
>     pl_id,
>     >         pl_first_name || ' ' || pl_last_name,  $1  FROM person_list
>     >         WHERE pl_login
>     >         =  $2 "
>     >         PL/pgSQL function "login" line 27 at SQL statement
>     >         -----
>     >
>     >         I did some research and I found out that it could be
>     related
>     >         to PL/PgSQL
>     >         caching of function scripts. The solution is to use EXECUTE
>     >         for temporary
>     >         table access. This should cause the query to be reparsed
>     every
>     >         time.
>     >         Here is what I did:
>     >
>     >         prepare testplan (varchar, varchar, int) as select login($1,
>     >         $2, $3);
>     >         execute testplan('sergey', 'password12', 1);
>     >
>     >         but got exactly the same error message as above.
>     >
>     >         I guess it could be a mismatch between tables in DB b/c of
>     >         'drop' that
>     >         logout() proc performs.
>     >         Do we need to use prepared statements in stored procs to
>     avoid
>     >         this problem?
>     >
>     >         Another thing, I need session_info table with si_session
>     >         column. I'll pass
>     >         session id as a parameter, as we agreed.
>     >
>     >
>     >
>     >
>     >
>     >
>     >     --
>     >     Alexey Parshin,
>     >     http://www.sptk.net < http://www.sptk.net>
>     >
>     >
>     >
>     >
>     > --
>     > Alexey Parshin,
>     > http://www.sptk.net
>
>     --
>     Ilya A. Volynets-Evenbakh
>     Total Knowledge. CTO
>     http://www.total-knowledge.com
>
>
>
>
> -- 
> Alexey Parshin,
> http://www.sptk.net 

-- 
Ilya A. Volynets-Evenbakh
Total Knowledge. CTO
http://www.total-knowledge.com


Authoright © Total Knowledge: 2001-2008