Beefy Boxes and Bandwidth Generously Provided by pair Networks
Keep It Simple, Stupid
 
PerlMonks  

statement handles (dbi)

by opensourcer (Monk)
on Nov 22, 2006 at 06:25 UTC ( #585446=perlquestion: print w/ replies, xml ) Need Help??
opensourcer has asked for the wisdom of the Perl Monks concerning the following question:

hi, could some 1 help me with statement handles using perl:dbi with examples if possible on "mysql_table" and "TYPE". i have read the docs, searched google and finally asking here. thank you.

Comment on statement handles (dbi)
Re: statement handles (dbi)
by chargrill (Parson) on Nov 22, 2006 at 06:28 UTC

    What is it in the documentation and examples provided by the respective modules is it that you don't understand?

    Do you have a more specific question?



    --chargrill
    s**lil*; $*=join'',sort split q**; s;.*;grr; &&s+(.(.)).+$2$1+; $; = qq-$_-;s,.*,ahc,;$,.=chop for split q,,,reverse;print for($,,$;,$*,$/)
      use DBmanager qw ($dbh $table); sub tableinfo { my ($dbh, $table) = @_; $table = "download"; my $sth = $dbh->prepare("QUERY"); my $tables = $sth->{'NUM_OF_FIELDS'}; print Dumper($tables); } &tableinfo ($dbh, $table);
      output : $VAR1 = undef;
      may be im doing somewhere wrong, i hoping for an sample code.

        What's "DBmanager"?

        I'm used to seeing database code like this (for mysql):

        use DBI; my $dbh = DBI->connect( "DBI:mysql:database=test;host=localhost", "username", "password" ); my $sth = $dbh->prepare( 'select * from table_foo' ); $sth->execute(); my $numrecords = $sth->rows; my $numfields = $sth->{'NUM_OF_FIELDS'}; $sth->finish; print "I found $numrecords records, each having $numfields fields.\n";

        Please note, I took this example code directly from the documentation. It makes sense to me - is there something you have a question about that the documentation doesn't answer?



        --chargrill
        s**lil*; $*=join'',sort split q**; s;.*;grr; &&s+(.(.)).+$2$1+; $; = qq-$_-;s,.*,ahc,;$,.=chop for split q,,,reverse;print for($,,$;,$*,$/)
Re: STATEMENT HANDLES
by Zaxo (Archbishop) on Nov 22, 2006 at 06:44 UTC

    A DBI statement handle is an object that represents a database query, usually an SQL statement. You obtain a statement handle from one of its constructors, prepare or prepare_cached. Those constructors are methods of a connection handle, since the statement handle must depend on a particular db connection.

    A statement handle's execute method causes the statement to be run by the server, and there are a variety of fetch methods to obtain the results of the query.

    After Compline,
    Zaxo

Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: perlquestion [id://585446]
Approved by davido
help
Chatterbox?
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others chilling in the Monastery: (7)
As of 2014-12-25 11:42 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    Is guessing a good strategy for surviving in the IT business?





    Results (160 votes), past polls