ViewVC Help
View File | Revision Log | Show Annotations | Download File
/cvs/PApp-SQL/SQL.pm
(Generate patch)

Comparing PApp-SQL/SQL.pm (file contents):
Revision 1.2 by root, Wed Nov 1 03:22:07 2000 UTC vs.
Revision 1.3 by root, Sun Nov 5 01:54:38 2000 UTC

186 die "duplicate key" 186 die "duplicate key"
187 if sql_exists "user where name = ? and pass = ?", "stefan", "geheim"; 187 if sql_exists "user where name = ? and pass = ?", "stefan", "geheim";
188 188
189=cut 189=cut
190 190
191# uncodumented, since unportable (only works with DBH even!). yet it is exported (aaargh!) 191=item $lastid = sql_insertid $sth
192
193Returns the last automatically created key value (e.g. for mysql
194AUTO_INCREMENT or sybase IDENTITY fields). It must be executed directly
195after executing the insert statement that created it.
196
197=cut
198
192sub sql_insertid { 199sub sql_insertid($) {
193 $DBH->{mysql_insertid}; 200 my $sth = shift or die "sql_insertid requires a statement handle";
201 my $dbh = $sth->{Database};
202 my $driver = $dbh->{Driver}{Name};
203
204 $driver eq "mysql" and return $sth->{mysql_insertid};
205 $driver eq "Sybase" and return sql_fetch($dbh, 'SELECT @@IDENTITY');
206 $driver eq "Informix" and return $sth->{ix_sqlerrd}[1];
207
208 die "sql_insertid does not spport the dbd driver '$driver', please see PApp::SQL::sql_insertid";
194} 209}
195 210
196=item [old-size] = cachesize [new-size] 211=item [old-size] = cachesize [new-size]
197 212
198Returns (and possibly changes) the LRU cache size used by C<sql_exec>. The 213Returns (and possibly changes) the LRU cache size used by C<sql_exec>. The

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines