Link to home
Start Free TrialLog in
Avatar of stanleyhuen
stanleyhuen

asked on

count

how can I get the total number of records in a table of a database?
i would like to use PERL, DBI.
any one can provide me a simple source code?

ASKER CERTIFIED SOLUTION
Avatar of yovavm101799
yovavm101799

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of mwhuen
mwhuen

besides  $DBI::rows, $DBI::err, $DBI::errstr, any other useful functions of DBI?
where can I get more information of these useful functions?
In case you mean MetaData, well here are some methods used to obtain Meta Data:

$dbh->tables()
fetch a list of all accessible table names

$DBI::rows
The number of rows affected or returned

After executing the statement, use the statement handle to get:

$sth->{NUM_FIELDS}
The number of fields returned by a select

$sth->{NUM_PARAMS}
The number of parameters returned by any query

After a select query, the following attributes contain references to arrays of field-specific information:

$sth->{NAME}
Column names returned by the query

$sth->{NULLABLE}
Booleans indicating whether fields are nullable or not

$sth->{TYPE}
Field types

$sth->{PRECISION}
Floating-point precision of field

$sth->{SCALE}
Field lengths

Avatar of stanleyhuen

ASKER

thanks yovavm,

i would like to learn more about DBI?

do u know any good resources of DBI?
Check: "Advanced Perl Programming", By Sriram Srinivasan, published by O'Reilly & Associates.