tultalk has asked for the wisdom of the Perl Monks concerning the following question:
Code below Execute at Note 1 returns expected result set. Execute at Note 2 returns error Thu Sep 28 13:15:32 2017 manage_users.cgi: (in cleanup) Can't connect to data source '' because I can't work out what driver to use (it doesn't seem to contain a 'dbi:driver:' prefix and the DBI_DRIVER env var is not set) at /usr/local/lib/perl5/site_perl/5.8.8/CGI/Session/Driver/DBI.pm line 26
sub UpdateUserData { my $updateinfoemail = "webpass\@jala-mi.org"; my ($sid, $password,$email,$secret) = @_; warn "'$sid' '$password' '$email' '$secret'"; my $SQL = qq|SELECT id FROM $sql_session_table WHERE id = '$sid' | +; my $sth = ExecuteQuery($SQL); <=====================Note 1 my ($tsid, $userid) = $sth->fetchrow_array(); if (!$tsid) { $sth->finish; warn("Update user data failed: SID '$tsid'"); return 0; } else { warn("Locating existing user data succeded: SID '$tsid'"); $session = OpenSession($dbh,$tsid); my $userid = $session->param("user_id"); my $username = $session->param("username"); warn("userid: '$userid' username: '$username'"); if (! defined $userid ){ $sth->finish; warn("Update user data failed: userid '$userid'"); return 0; } my $passpart = ""; my $mailpart = ""; my $secretpart = ""; if ($password ne "") { $passpart = "password = '$password'"; } if (($email ne "") && ($password eq "")) { $mailpart = "email = '$email'"; } elsif (($email ne "") && ($password ne "")) { $mailpart = ", email = '$email'"; } if (($secret ne "") && ($password eq "") && ($email eq "")) { $secretpart = "secret = '$secret'"; } elsif (($secret ne "") && (($password ne "") || ($email ne "") +)) { $secretpart = ", secret = '$secret'"; } my $wherepart = " where id = '$userid'"; my $statement = "update $sql_user_table set $passpart $mailpar +t $secretpart $wherepart"; $SQL = qq| $statement |; warn ("SQL Statement: '$statement'"); $sth = ExecuteQuery($SQL); <================Note 2 # success so disconnect and send an e-mail with the misisng in +formation to the user. $sth->finish;
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: DBI Problem
by hippo (Archbishop) on Sep 29, 2017 at 08:07 UTC | |
by tultalk (Monk) on Sep 29, 2017 at 11:38 UTC | |
by tultalk (Monk) on Sep 29, 2017 at 12:05 UTC | |
by hippo (Archbishop) on Sep 29, 2017 at 12:46 UTC | |
by tultalk (Monk) on Sep 29, 2017 at 14:23 UTC | |
|
Re: DBI Problem
by huck (Prior) on Sep 28, 2017 at 23:28 UTC | |
by tultalk (Monk) on Sep 29, 2017 at 00:14 UTC | |
by thanos1983 (Parson) on Sep 29, 2017 at 08:04 UTC | |
by tultalk (Monk) on Sep 29, 2017 at 11:30 UTC | |
by thanos1983 (Parson) on Sep 29, 2017 at 12:05 UTC | |
| |
by huck (Prior) on Sep 29, 2017 at 02:13 UTC | |
by tultalk (Monk) on Sep 29, 2017 at 03:42 UTC | |
by poj (Abbot) on Sep 29, 2017 at 10:30 UTC | |
by tultalk (Monk) on Sep 29, 2017 at 10:45 UTC | |
by poj (Abbot) on Sep 29, 2017 at 19:57 UTC | |
|
Re: DBI Problem
by huck (Prior) on Sep 29, 2017 at 20:26 UTC | |
by Anonymous Monk on Sep 29, 2017 at 22:40 UTC | |
by huck (Prior) on Sep 30, 2017 at 00:07 UTC | |
by tultalk (Monk) on Sep 30, 2017 at 00:19 UTC | |
by huck (Prior) on Sep 30, 2017 at 00:29 UTC | |
| |
by Anonymous Monk on Sep 30, 2017 at 00:27 UTC | |
by tultalk (Monk) on Sep 30, 2017 at 00:25 UTC | |
| |
|
Re: DBI Problem
by Anonymous Monk on Sep 29, 2017 at 00:18 UTC | |
by tultalk (Monk) on Sep 29, 2017 at 01:45 UTC | |
by davido (Cardinal) on Sep 29, 2017 at 05:36 UTC | |
by AnomalousMonk (Archbishop) on Sep 29, 2017 at 05:47 UTC | |
by tultalk (Monk) on Sep 29, 2017 at 01:44 UTC |