… | |
… | |
43 | use DBI (); |
43 | use DBI (); |
44 | |
44 | |
45 | BEGIN { |
45 | BEGIN { |
46 | use base qw(Exporter DynaLoader); |
46 | use base qw(Exporter DynaLoader); |
47 | |
47 | |
48 | $VERSION = 0.121; |
48 | $VERSION = 0.122; |
49 | @EXPORT = qw( |
49 | @EXPORT = qw( |
50 | sql_exec sql_fetch sql_fetchall sql_exists sql_insertid $sql_exec |
50 | sql_exec sql_fetch sql_fetchall sql_exists sql_insertid $sql_exec |
51 | ); |
51 | ); |
52 | @EXPORT_OK = qw( |
52 | @EXPORT_OK = qw( |
53 | connect_cached |
53 | connect_cached |
… | |
… | |
228 | |
228 | |
229 | =item sql_exists "<table> where ...", args... |
229 | =item sql_exists "<table> where ...", args... |
230 | |
230 | |
231 | Check wether the result of the sql-statement "select xxx from |
231 | Check wether the result of the sql-statement "select xxx from |
232 | $first_argument" would be empty or not (that is, imagine the string |
232 | $first_argument" would be empty or not (that is, imagine the string |
233 | "select from" were prepended to your statement (it isn't)). Should work |
233 | "select * from" were prepended to your statement (it isn't)). Should work |
234 | with every database but can be quite slow, except on mysql, where this |
234 | with every database but can be quite slow, except on mysql, where this |
235 | should be quite fast. |
235 | should be quite fast. |
236 | |
236 | |
237 | Examples: |
237 | Examples: |
238 | |
238 | |
… | |
… | |
366 | |
366 | |
367 | =item $db->dsn |
367 | =item $db->dsn |
368 | |
368 | |
369 | Return the DSN (L<DBI>) fo the database object (e.g. for error messages). |
369 | Return the DSN (L<DBI>) fo the database object (e.g. for error messages). |
370 | |
370 | |
|
|
371 | =item $db->login |
|
|
372 | |
|
|
373 | Return the login name. |
|
|
374 | |
|
|
375 | =item $db->password |
|
|
376 | |
|
|
377 | Return the password (emphasizing the fact that the apssword is stored plaintext ;) |
|
|
378 | |
371 | =cut |
379 | =cut |
372 | |
380 | |
373 | sub dsn($) { |
381 | sub dsn($) { |
374 | my $self = shift; |
382 | my $self = shift; |
375 | (split /\x00/, $self->[0])[1]; |
383 | (split /\x00/, $self->[0])[1]; |
376 | } |
384 | } |
377 | |
385 | |
|
|
386 | sub login($) { |
|
|
387 | my $self = shift; |
|
|
388 | (split /\x00/, $self->[0])[2]; |
|
|
389 | } |
|
|
390 | |
|
|
391 | sub password($) { |
|
|
392 | my $self = shift; |
|
|
393 | (split /\x00/, $self->[0])[3]; |
|
|
394 | } |
|
|
395 | |
378 | =back |
396 | =back |
379 | |
397 | |
380 | =cut |
398 | =cut |
381 | |
399 | |
382 | 1; |
400 | 1; |