On Sep 8, 2004, at 4:01 PM, Michael Peters wrote:
Sean Davis wrote:On Sep 8, 2004, at 3:44 PM, Michael Peters wrote:And for MySQL? I have something like below. Look OK?Sean Davis wrote:
Thanks Michael and William.
To clarify, I have a runmode that goes to a database, does a rather extensive query, then returns an array of unique id's. The form for this runmode then gives the user a chance to choose how the data are to be displayed. I would like to pass this array to the next runmode for processing.
Yeah, that would be a pain to pass around. But if you don't want to use a session then that's what you'll have to do. You might have to do it as a CSV line or multiple hidden parameters, etc.
Using sessions is one possibility, and I should probably go that direction anyway, but....
It's not that hard, really... to use CGI::Application::Plugin::Session is as simple as
use CGI::Application::Plugin::Session;
#then later in a run mode my $data = $self->session('some_data');
That's about it to use file based sessions...
sub setup {
my $self=shift;
$self->start_mode('query_main');
$self->mode_param('rm');
$self->run_modes(
'query_main' => 'query_main',
'process_query' => 'process_query',
'return_results'=> 'return_results',
'mode2' => 'return_probe_overview',
# 'mode3' => 'return_probe_details',
'mode4' => 'return_graphical_results',
'mode5' => 'return_big_graph',
'mode6' => 'sql_query',
'mode7' => 'sql_results',
);
$self->param('dbh' => DBI->connect($dsnnlt,
$nltuser,
$nltpass
))
or croak "Database connection not made: $DBI::errstr";
$self->session_config(
CGI_SESSION_OPTIONS => ['driver:MySQL',$self->query,{Handle=>$self->param('dbh')}],
COOKIE_PARAMS => {
-domain => 'nih.gov'
-expires => '+12h',
-path => '/',
},
SEND_COOKIE => 1,
);
}
looks good at a glance... does it work?
As a matter of fact, it does!!
Just a note--I have a page that allows users to perform direct SQL queries, but with only select priviledges for the database user--means that I need to have two database handles, one for session management and one for that particular page (for security purposes).
Sean
--------------------------------------------------------------------- Web Archive: http://www.mail-archive.com/[EMAIL PROTECTED]/ http://marc.theaimsgroup.com/?l=cgiapp&r=1&w=2 To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
