Re: Apache::Session extra record not write to Mysql db.

2003-09-02 Thread Perrin Harkins
James.Q.L wrote:
before i had three fields in table sessions : a_session,id,time in the DB.
Did you add code of your own to update the time column?

and updating table etc from the program was working just fine. however, after i added 
one more
field (username) to the sessions table through phpmysql, updating it in the program
seems has no effect on the username record. no problem on others.
Do you understand what Apache::Session does?  It simply use Storable to 
turn the whole hash of values into a single binary chunk and stores it 
all in the a_session field.  It uses the id field to find the session 
again.  It will not update any other fields unles syou hack the code 
yourself.

$session{'test'} = time();## this doesn't update 'test'
That updates the field test in the session, which is stored as part of 
the column a_session in the database.

$session{'uname'} = $uname if $uname;  ## this doesn't update 'uname'
Same as above -- it updates the uname value of the session.

$session{'time'} = time();## this updates 'time' record
But it doesn't update the time column in the database unless you hacked 
the Apache::Session code to do that.

- Perrin



--
Reporting bugs: http://perl.apache.org/bugs/
Mail list info: http://perl.apache.org/maillist/modperl.html


Re: Apache::Session extra record not write to Mysql db.

2003-09-02 Thread James.Q.L

--- Perrin Harkins [EMAIL PROTECTED] wrote:
 James.Q.L wrote:
  before i had three fields in table sessions : a_session,id,time in the DB.
 
 Did you add code of your own to update the time column?
 

no.

  and updating table etc from the program was working just fine. however, after i 
  added one more
  field (username) to the sessions table through phpmysql, updating it in the program
  seems has no effect on the username record. no problem on others.
 
 Do you understand what Apache::Session does?  It simply use Storable to 
 turn the whole hash of values into a single binary chunk and stores it 
 all in the a_session field.  It uses the id field to find the session 
 again.  It will not update any other fields unles syou hack the code 
 yourself.

I read the doc of Apache::Session::Store::Mysql but there isn't much in it.
and i tried first to have a 'time' field in the sessions table. and it did get 
updated. so that's why i thought the record get stored just like that.

and from my phpmysql, you can see the time record.

id   a_session time unametest  
0543f2dc8dd196c5adeb29f18113f88d  2003090122521800 

and indeed as you said in record a_session it stores the session data. so if i 
understand
correctly, i don't add _new_ column to the sessions table, instead i call 
$session{'username'} =
'username' which add it to the column a_session.



  $session{'time'} = time();## this updates 'time' record
 
 But it doesn't update the time column in the database unless you hacked 
 the Apache::Session code to do that.
 

now i don't know why the time record gets updated. isn't it suppose to update the one 
in
a_session?

one more question if you don't mind.

i know Apache::Session can't do session managerment directly. but i found out that 
when a user
session timeout, the record also gone automatically.is tied(%session)-delete; delete 
the session?


Thanks

Qiang

__
Do you Yahoo!?
Yahoo! SiteBuilder - Free, easy-to-use web site design software
http://sitebuilder.yahoo.com


-- 
Reporting bugs: http://perl.apache.org/bugs/
Mail list info: http://perl.apache.org/maillist/modperl.html



Re: Apache::Session extra record not write to Mysql db.

2003-09-02 Thread Anton Permyakov
   $session{'time'} = time();## this updates 'time' record
 
  But it doesn't update the time column in the database unless you hacked
  the Apache::Session code to do that.
 

 now i don't know why the time record gets updated. isn't it suppose to
update the one in
 a_session?

I guess 'time' field gets updated because of it is 'timestamp' type, isn't
it?
MySQL has this type for automatically updated field with current date and
time (RTFM :)).

Best wishes,
Anton Permyakov.





-- 
Reporting bugs: http://perl.apache.org/bugs/
Mail list info: http://perl.apache.org/maillist/modperl.html



Re: Apache::Session extra record not write to Mysql db.

2003-09-02 Thread Perrin Harkins
On Tue, 2003-09-02 at 00:13, James.Q.L wrote:
 --- Perrin Harkins [EMAIL PROTECTED] wrote:
  Did you add code of your own to update the time column?
  
 
 no.

Maybe you added the time column as an automatic timestamp column?  There
is no time column in the schema described in the Apache::Session
documentation.

 and from my phpmysql, you can see the time record.
 
 id   a_session time unametest  
 0543f2dc8dd196c5adeb29f18113f88d  2003090122521800 

Is that a real column, or just a last-modified time that phpmysql adds
in somehow?

 and indeed as you said in record a_session it stores the session data. so if i 
 understand
 correctly, i don't add _new_ column to the sessions table, instead i call 
 $session{'username'} =
 'username' which add it to the column a_session.

That's right.

 i know Apache::Session can't do session managerment directly. but i found out that 
 when a user
 session timeout, the record also gone automatically.is tied(%session)-delete; 
 delete the session?

Apache::Session has no concept of timeouts so it never deletes sessions,
but you can delete sessions manually with the delete method that you're
talking about.

By the way, you might find it easier to use CGI::Session.  It works fine
with mod_perl, and it directly supports things like timeouts.

- Perrin



-- 
Reporting bugs: http://perl.apache.org/bugs/
Mail list info: http://perl.apache.org/maillist/modperl.html