Result:
found more than 469 distributions - search limited to the first 2001 files matching your query ( run in 0.596 )


DBD-Avatica

 view release on metacpan or  search on metacpan

t/lib/Mock.pm  view on Meta::CPAN

    mock_call('database_property', 'DatabasePropertyResponse', '{"props":[{"key":{"name":"GET_DATABASE_MAJOR_VERSION"},"value":{"type":"INTEGER","numberValue":4}},{"key":{"name":"GET_DEFAULT_TRANSACTION_ISOLATION"},"value":{"type":"INTEGER","numberVa...
}

sub mock_create_table {
    mock_prepare_seq([
        '{"statement":{"connectionId":"35p0fchr4g6az0wwy8l541zl0ys2yh","id":79,"signature":{"sql":"DROP TABLE IF EXISTS TEST","cursorFactory":{"style":"LIST"}}},"metadata":{"serverAddress":"c497a18abde6:8765"}}',
        '{"statement":{"connectionId":"35p0fchr4g6az0wwy8l541zl0ys2yh","id":81,"signature":{"sql":"CREATE TABLE TEST(ID BIGINT PRIMARY KEY, TEXT VARCHAR)","cursorFactory":{"style":"LIST"}}},"metadata":{"serverAddress":"c497a18abde6:8765"}}'
    ]);
    mock_execute_seq([
        '{"results":[{"connectionId":"35p0fchr4g6az0wwy8l541zl0ys2yh","statementId":80,"metadata":{"serverAddress":"c497a18abde6:8765"}}],"metadata":{"serverAddress":"c497a18abde6:8765"}}',
        '{"results":[{"connectionId":"35p0fchr4g6az0wwy8l541zl0ys2yh","statementId":82,"metadata":{"serverAddress":"c497a18abde6:8765"}}],"metadata":{"serverAddress":"c497a18abde6:8765"}}'
    ]);

 view all matches for this distribution


DBD-DB2

 view release on metacpan or  search on metacpan

tests/perld043_stmtTryFetchForNonSelect.pl  view on Meta::CPAN

$sth->execute();
check_error("EXECUTE");

@row_ary = $sth->fetchrow();
check_error("FETCHROW",
            "[IBM][CLI Driver] CLI0115E  Invalid cursor state. SQLSTATE=24000",
            "DBI::errstr");
check_value("FETCHROW", "row_ary", undef);

$sth->finish();
check_error("FINISH");

 view all matches for this distribution


DBD-DBMaker

 view release on metacpan or  search on metacpan

DBMaker.pm  view on Meta::CPAN

  Example: 
  print "First column may return NULL\n" if $sth->{NULLABLE}->[0];

=item CursorName (string)      read-only

Returns the name of the cursor associated with the statement handle if
available.

=item Statement (string)       read-only

Returns the statement string passed to the the prepare entry elsewhere in

 view all matches for this distribution


DBD-DtfSQLmac

 view release on metacpan or  search on metacpan

DtfSQL.pm  view on Meta::CPAN


    DTF_TAT_AUTOCOMMIT
    DTF_TAT_RESULTTYPE

    These two attributes are very important, as they control the auto-commit behavior of the
    database and the kind (sequential, random) of the result set's cursor. The following table 
    shows the available information regarding these attributes:

    --------------------+------------+---------------+---------------+-------------------
    Attribute           | Attr. Type | current Value | default Value | Range
    --------------------+------------+---------------+---------------+-------------------

DtfSQL.pm  view on Meta::CPAN




=item B<$errcode = DtfResMoveToFirstRow ($hres);> 

 # move to the first row of a result table with a sequential cursor
 # (the result table must be of type DTF_RT_SEQUENTIAL)

 Arguments: 
   input:  $hres  a valid result handle



=item B<$errcode = DtfMoveToNextRow ($hres);> 

 # move to the next row of a result table with a sequential cursor
 # (the result table must be of type DTF_RT_SEQUENTIAL)

 Arguments: 
   input:  $hres  a valid result handle



=item B<$errcode = DtfResMoveToRow ($hres, $rowIndex);> 

 # moves a result set's cursor to an absolute position
 # (the result table must be of type DTF_RT_RANDOM)

 Arguments: 
   input:  $hres      a valid result handle
           $rowIndex  is the 0-based index of the row to move the cursor to



=item B<$errcode = DtfResQueryFieldInfo ($hres, $colIndex, $fieldSize, $isNull);> 

 view all matches for this distribution


DBD-Empress

 view release on metacpan or  search on metacpan

j_test.pl  view on Meta::CPAN


# --------------------------------------------------------------------------
# Cursor functions: prepare/execute/fetch/nrows, etc.
# --------------------------------------------------------------------------

print "Testing: \$cursor = \$dbh->prepare( 'SELECT FROM $test_tabname WHERE ¼±ÊÌ»Ò = 1' ): ";
( $cursor = $dbh->prepare( "SELECT * FROM $test_tabname WHERE ¼±ÊÌ»Ò = 1" ) )
    and print( "prepare select ok\n" )
    or print( "prepare select not ok: $DBI::errstr\n" );

print "Testing: \$cursor->execute: ";
( $cursor->execute )
    and print( "execute select ok\n" )
    or die "execute select not ok: $DBI::errstr\n";

# expect the following select to fail, as id=1 has been deleted already

print "Testing: \$cursor->fetchrow: ";
if ( @row = $cursor->fetchrow ) 
{
	print( "not ok ($DBI::err): $DBI::errstr, record: @row\n" );
}
else
{
	print( "ok\n" );	# expect it to fail for id=1
}

print "Testing: \$cursor->finish: ";
( $cursor->finish )
    and print( "ok\n" )
    or print( "not ok: $DBI::errstr\n" );

# multiple record tests

print "Testing: \$cursor = \$dbh->prepare( 'SELECT FROM $test_tabname' ): ";
( $cursor = $dbh->prepare( "SELECT * FROM $test_tabname" ) )
    and print( "prepare select ok\n" )
    or die "prepare select not ok: $DBI::errstr\n";

print "Testing: \$cursor->execute: ";
( $cursor->execute )
    and print( "ok\n" )
    or die "not ok: $DBI::errstr\n";

print "Testing: multiple \$cursor->fetchrow's:\n";
while ( @row = $cursor->fetchrow ) 
{
    if ( $DBD::Empress::err != 0 )
    {
	print "Fetch Error ($DBD::Empress::err): $DBD::Empress::errstr\n";
    }
    print( "@row\n" )
}

print "Testing: \$cursor->finish: ";
( $cursor->finish )
    and print( "ok\n" )
    or die "not ok: $DBI::errstr\n";

( $dbh->disconnect )
    and print(" d$iconnect\n") 

 view all matches for this distribution


DBD-EmpressNet

 view release on metacpan or  search on metacpan

j_test.pl  view on Meta::CPAN


# --------------------------------------------------------------------------
# Cursor functions: prepare/execute/fetch/nrows, etc.
# --------------------------------------------------------------------------

print "Testing: \$cursor = \$dbh->prepare( 'SELECT FROM $test_tabname WHERE ¼±ÊÌ»Ò = 1' ): ";
( $cursor = $dbh->prepare( "SELECT * FROM $test_tabname WHERE ¼±ÊÌ»Ò = 1" ) )
    and print( "prepare select ok\n" )
    or print( "prepare select not ok: $DBI::errstr\n" );

print "Testing: \$cursor->execute: ";
( $cursor->execute )
    and print( "execute select ok\n" )
    or die "execute select not ok: $DBI::errstr\n";

# expect the following select to fail, as id=1 has been deleted already

print "Testing: \$cursor->fetchrow: ";
if ( @row = $cursor->fetchrow ) 
{
	print( "not ok ($DBI::err): $DBI::errstr, record: @row\n" );
}
else
{
	print( "ok\n" );	# expect it to fail for id=1
}

print "Testing: \$cursor->finish: ";
( $cursor->finish )
    and print( "ok\n" )
    or print( "not ok: $DBI::errstr\n" );

# multiple record tests

print "Testing: \$cursor = \$dbh->prepare( 'SELECT FROM $test_tabname' ): ";
( $cursor = $dbh->prepare( "SELECT * FROM $test_tabname" ) )
    and print( "prepare select ok\n" )
    or die "prepare select not ok: $DBI::errstr\n";

print "Testing: \$cursor->execute: ";
( $cursor->execute )
    and print( "ok\n" )
    or die "not ok: $DBI::errstr\n";

print "Testing: multiple \$cursor->fetchrow's:\n";
while ( @row = $cursor->fetchrow ) 
{
    if ( $DBD::EmpressNet::err != 0 )
    {
	print "Fetch Error ($DBD::EmpressNet::err): $DBD::EmpressNet::errstr\n";
    }
    print( "@row\n" )
}

print "Testing: \$cursor->finish: ";
( $cursor->finish )
    and print( "ok\n" )
    or die "not ok: $DBI::errstr\n";

( $dbh->disconnect )
    and print(" d$iconnect\n") 

 view all matches for this distribution


DBD-Firebird

 view release on metacpan or  search on metacpan

Firebird.pm  view on Meta::CPAN

Calling do() method without bind value(s) will do the same.

=item * CLOSE, OPEN, DECLARE CURSOR

$sth->{CursorName} is automagically available upon executing a "SELECT .. FOR
UPDATE" statement. A cursor is closed after the last fetch(), or by calling
$sth->finish(). 

=item * PREPARE, EXECUTE, FETCH

Similar functionalities are obtained by using prepare(), execute(), and 

 view all matches for this distribution


DBD-Fulcrum

 view release on metacpan or  search on metacpan

test.pl  view on Meta::CPAN



print "Doing a query (expecting 'Data truncated' error)... ";
#$::ful_dbh->{LongTruncOk} = 0;

#my $cursor = $::ful_dbh->prepare ('select ft_text,ft_sfname,filesize,title from test where title contains \'pippo\'', {fulcrum_MaximumHitsInInternalColumns => 100});
my $cursor = $::ful_dbh->prepare ('select ft_text,ft_sfname,filesize,title from test where title contains \'pippo\'');
if ($cursor) {
   print "(execute) ... ";
   $cursor->execute;
   print "ok, now fetching (fetchrow): ";
   my $text;
   my @row;
   my $eot;
   my $data_truncated = 0;
   while (@row  = $cursor->fetchrow) {
      $data_truncated++ if ($cursor->state =~ /01004/);
   }
   print "checking data truncated condition... ";
   if ($data_truncated == 0) {
      print "FAILED: did not detect 01004 [Data truncated] condition!\n";
      exit 1;

test.pl  view on Meta::CPAN

   exit 1;
}

print "Doing another query (this time you'll see the data)... ";
$DBD::Fulcrum::ful_maxhitsinternalcolumns = 64;
$cursor = $::ful_dbh->prepare ('select ft_text,ft_sfname,filesize,title from test where title contains \'pippo\'');
if ($cursor) {
   print "(execute) ... ";
   $cursor->execute;
   print "ok, now fetching (fetchrow):\n***\n";
   my $text;
   my @row;
   my $eot;
   my $data_truncated = 0;
   while (@row  = $cursor->fetchrow) {
      $data_truncated++ if ($DBI::state =~ /truncated/);
      $cursor->blob_read (1, 0, 8192, \$text);
      #or (print "+++ RB NOT OK:$DBI::errstr\n");
      $text = $` if ($text =~ /\x00/);
      print "(FILE: $row[1] TITLE: '$row[3]') "; #$text removed to clean up output
   }
   if ($data_truncated > 0) {

test.pl  view on Meta::CPAN

else {
   print "FAILED: Prepare failed ($DBI::errstr)\n";
   exit 1;
}

$cursor->finish;
$ful_dbh->disconnect;

print "Exiting\nIf you are here, then most likely all tests were successful.\n";
exit 0;
# end.

 view all matches for this distribution


DBD-Illustra

 view release on metacpan or  search on metacpan

dbd-illustra.pod  view on Meta::CPAN

Neither automatic row numbering nor row count limitations are supported.


=head3 Positioned updates and deletes

Illustra supports positioned updates or deletes in cursors that have been
explicitly created and opened C<FOR UPDATE>. For example:

  $dbh->do("DECLARE cur1 CURSOR FOR SELECT * FROM tab1 FOR UPDATE");
  $dbh->do("OPEN cur1");
  $sth = $dbh->prepare("FETCH NEXT FROM cur1");

 view all matches for this distribution


DBD-Informix

 view release on metacpan or  search on metacpan

Informix.pm  view on Meta::CPAN

at the moment; yes, some clown in marketing decreased the version number).
All version families acquire extra versions on occasion.

Note that DBD::Informix does not work with Informix ESQL/C Version
4.1x or earlier versions because it uses both SQL descriptors and
strings for cursor names and statement names, and these features were
not available before Version 5.00.

For information about Informix software, you should also read the
Notes/FAQ file that is distributed with Informix Database Driver for Perl DBI.

Informix.pm  view on Meta::CPAN


=head2 CREATING STATEMENTS

You can also prepare a statement for multiple uses, and you can do
this for SELECT and EXECUTE PROCEDURE statements that return data
(cursory statements) as well as noncursory statements that return no data.
You create a statement handle (another reference) using:

    $sth = $dbh->prepare($stmt);

If the statement is a SELECT that returns data (not SELECT...INTO TEMP) or
an EXECUTE PROCEDURE for a procedure that returns values, a cursor is
declared for the prepared statement.

The prepare call accepts an optional attributes parameter that is a
reference to a hash.
Starting with version 1.03.PC1, the following attributes are recognized:

Informix.pm  view on Meta::CPAN

The ix_ScrollCursor is a placeholder that may become unnecessary with a
future revision of DBI.

The ix_CursorWithHold attribute is only of relevance if AutoCommit is
disabled.
When AutoCommit is enabled, all cursors have to be WITH HOLD (just one
more reason to hate AutoCommit).

    $sth = $dbh->prepare("SELECT id, name FROM tablename", {'ix_CursorWithHold' => 1});

After the cursor is opened ($sth->execute), it is not closed by
$dbh->commit().
Either fetch all the rows or use $sth->finish() to close it.

The ix_InsertCursor attribute can be applied to an INSERT statement (but
generates an error -481 for other types of statement).
Subsequent uses of $sth->execute() will use the ESQL/C PUT statement to
insert the data, and $sth->finish() will close the INSERT cursor.
There is at present no mechanism to invoke the FLUSH statement.

It would be reasonable to add {ix_BlobLocation => 'InFile'} to support
per-statement blob location.

Informix.pm  view on Meta::CPAN


    # Emphasizing the SQL action.
    $sth = $dbh->prepare($stmt) or die "Failed to prepare '$stmt'\n"

You can tell whether the statement is just executable or whether it is
a cursory (fetchable) statement by testing the
Informix-specific attribute ix_Fetchable.
The approved, canonical DBI method of doing this check is
"$sth->{NUM_OF_FIELDS} > 0".

Once the statement is prepared, you can execute it:

    $sth->execute;

For a noncursory statement, this simply executes the statement.
If the statement is executed successfully, the number of rows
affected will be returned.
If an error occurs, the returned value will be undef.
If the statement does not affect any rows, the string returned is
"0E0", which evaluates to true but also to zero.

For a cursory statement, $sth->execute opens the cursor.
If the cursor is opened successfully, it returns the value "0E0",
which evaluates to true but also to zero.
If an error occurs, the returned value will be undef.

You can also specify the input parameters for a statement that contains
question-marks as place-holders using:

Informix.pm  view on Meta::CPAN

clause of the INSERT statement.
The INSERT statement is a special case, and it provides support for
code that implements the non-SQL statement 'LOAD FROM "file" INSERT
INTO SomeTable'.

For cursory statements, you can discover the returned column
names, types, nullability, and so on.
You do this with:

    @name = @{$sth->{NAME}};        # Column names
    @null = @{$sth->{NULLABLE}};    # True => accepts nulls

Informix.pm  view on Meta::CPAN

For example, in "SELECT A.Column, B.Column FROM Table1 A, Table1 B
WHERE ...", both the return columns are described as 'column'.

=back

If the statement is a cursory statement, you can retrieve the
values in any of a number of ways, as described in the DBI
specification.

    $ref = $sth->fetchrow_arrayref;
    $ref = $sth->fetch;                 # Alternative spelling...

Informix.pm  view on Meta::CPAN


BUG: ix_BlobLocation is not handled properly.

=back

When you have fetched as many rows as required, you close the cursor using:

    $sth->finish;

You do not have to finish a cursor explicitly if you executed a fetch
that failed to retrieve any data.

Using $sth->finish simply closes the cursor but does not free the cursor
or the statement.
That is done when you destroy (undef) the statement handle:

    undef $sth;

Informix.pm  view on Meta::CPAN

    $txt = $sth->{Statement};

=head2 CURSORS FOR UPDATE

You can use the (DBI standard) attribute $sth->{CursorName} to retrieve the name of a
cursor.
If the statement for $sth is actually a SELECT and the cursor is in a
MODE ANSI database or is declared with the 'FOR UPDATE [OF col,...'
tag, you can use the cursor name in a 'DELETE...WHERE CURRENT OF'
or 'UPDATE...WHERE CURRENT OF' statement.

    $st1 = $dbh->prepare("SELECT * FROM SomeTable FOR UPDATE");
    $wc = "WHERE CURRENT OF $st1->{CursorName}";
    $st2 = $dbh->prepare("UPDATE SomeTable SET SomeColumn = ? $wc");

Informix.pm  view on Meta::CPAN

In a MODE ANSI database, you can execute BEGIN WORK successfully.
However, if AutoCommit is On, the transaction is immediately
committed, so it does you no good.

If the user elects to switch to AutoCommit On, things get trickier.
All cursors need to be declared WITH HOLD so that Group 4B statements
being committed do not close the active cursors.
Whenever a Group 4B statement is executed, the statement needs to be
committed.
With OnLine (and theoretically with SE), if the statement fails there
is no need to do a rollback -- the statement failing did the rollback
anyway.

Informix.pm  view on Meta::CPAN

    $sth->execute           => EXECUTE or OPEN
    $sth->fetch             => FETCH
    $sth->fetchrow          => FETCH
    $sth->finish            => CLOSE

    undef $sth              => FREE cursor, FREE statement, etc

=head1 KNOWN RESTRICTIONS

=over 2

 view all matches for this distribution


DBD-Informix4

 view release on metacpan or  search on metacpan

Informix4.xs  view on Meta::CPAN

    CODE:
    D_imp_dbh(dbh);
    if ( !DBIc_ACTIVE(imp_dbh) ) {
	XSRETURN_YES;
    }
    /* Check for disconnect() being called whilst refs to cursors	*/
    /* still exists. This possibly needs some more thought.			*/
    if (DBIc_ACTIVE_KIDS(imp_dbh) && DBIc_WARN(imp_dbh) && !dirty) {
	warn("disconnect(%s) invalidates %d active cursor(s)",
	    SvPV(dbh,na), (int)DBIc_ACTIVE_KIDS(imp_dbh));
    }
    ST(0) = dbd_db_disconnect(dbh, imp_dbh) ? &sv_yes : &sv_no;


 view all matches for this distribution


DBD-Ingres

 view release on metacpan or  search on metacpan

Ingperl.pm  view on Meta::CPAN

    if ($sql_sth) {
        $sql_sth->finish;
        undef $sql_sth;
        1;
    } else {
        carp "Ingperl: close with no open cursor, at"
            if $sql_drh->{Warn};
        1;
    }
}

sub sql_fetch {
    croak "Ingperl: No active cursor, at" unless $sql_sth;
    my(@row) = $sql_sth->fetchrow();
    $sql_rowcount = $sql_sth->rows();
    unless (@row) {
	&sql_close();
	return wantarray ? () : undef;

Ingperl.pm  view on Meta::CPAN

sub sql_eval_row1{
	my $sth = $sql_dbh->prepare(@_);
	return undef unless $sth;
	$sth->execute or return undef;
	my(@row) = $sth->fetchrow;	# fetch one row
	$sth->finish;			# close the cursor
	undef $sth;
	@row;
}

# Library function to execute a select and return first col

Ingperl.pm  view on Meta::CPAN

	$sth->execute or return undef;
        my ($row, @col);
	while ($row = $sth->fetch){
		push(@col, $row->[0]);
	}
	$sth->finish;			# close the cursor
	undef $sth;
	@col;
}

package Ingperl::var;

Ingperl.pm  view on Meta::CPAN


    @values = &sql_fetch;

Fetch the next record of data returned from the last prepared
select statement. When all records have been returned &sql_fetch
will close the select statement cursor and return an empty array.

For example:

    &sql('select * from iitables') || die $sql_error;
    while(@values = &sql_fetch){

Ingperl.pm  view on Meta::CPAN


B<DBD:> C<&sql_fetch> will call C<&sql_close> when the last row of data
has been fetched. This has been the way it was supposed to be...

B<DBD:> C<&sql_fetch> will die with the error C<Ingperl: No active
cursor> if an error has occured in the C<&sql(select..)>-statement.

B<DBD:> C<$scalar = &sql_fetch> returns the first column of data if
C<$sql_sth-E<gt>{CompatMode}> is set; this is the default mode for
Ingperl and is the expected behaviour for Perl4. In Perl5 (and with 
C<$sql_sth-E<gt>{CompatMode}> unset) the number of columns will be

Ingperl.pm  view on Meta::CPAN

=item * sql_close

    &sql_close;

This function needs to be called B<only> if you do not use C<&sql_fetch>
to fetch B<all> the records B<and> you wish to close the cursor as soon as
possible (to release locks etc). Otherwise ignore it. Always returns
true.

B<DBD:> If C<$sql_sth-E<gt>{Warn}> is false the warning C<Ingperl: close
with no open cursor> will be given whenever a closed cursor is reclosed.
The default behaviour is to omit the warning.

=back

IngPerl Functions to describe the currently prepared statement. These

Ingperl.pm  view on Meta::CPAN

Create Table As Select or Copy this variable holds the number of rows
affected.

=item * $sql_readonly (default 1)

If true then prepared sql statements are given read only cursors this is
generally a considerable performance gain.

B<DBD:> Not implemented. All cursors are readonly - there is no way to
modify the value of a cursor element, therefore no reason not to make
the cursors readonly. The value of this variable was ignored already in
Ingperl 2.0.

=item * $sql_showerrors (default 0)

If true then ingres error and warning messages are printed by

Ingperl.pm  view on Meta::CPAN


    @row1 = &sql_eval_row1('select ...');

Execute a select statement and return the first row.

B<DBD:> This is executed in a separate cursor and can therefore be
executed while a &sql_fetch-loop is in progres.

=item * sql_eval_col1

    @col1 = &sql_eval_col1('select ...');

Execute a select statement and return the first column.

B<DBD:> As &sql_eval_col1 this is executed in a separate cursor.

=head1 NOTES

The DBD::Ingres module has been modelled closely on Tim Bunce's
DBD::Oracle module and warnings that apply to DBD::Oracle and the

 view all matches for this distribution


DBD-IngresII

 view release on metacpan or  search on metacpan

IngresII.pm  view on Meta::CPAN

execute time rather than bind time. (Similar to bind_param_inout, except
you don't pass them as references.)

=head2 ing_readonly

Normally cursors are declared C<READONLY> to increase speed. READONLY
cursors don't create exclusive locks for all the rows selected; this is
the default.

If you need to update a row then you will need to ensure that either

=over 4

IngresII.pm  view on Meta::CPAN

                       { ing_readonly => 1} );

will be opened C<FOR READONLY>.

When you wish to actually do the update, where you would normally put the
cursor name, you put:

  $sth->{CursorName}

instead,  for example:

IngresII.pm  view on Meta::CPAN

  $sth->execute;

and so on. B<Note> that an C<update> will now cause an SQL error.

In fact the "FOR UPDATE" seems to be optional, i.e., you can update
cursors even if their SELECT statements do not contain a C<for update>
part.

If you wish to update such a cursor you B<must> include the C<ing_readonly>
attribute.

B<NOTE> DBD::IngresII version later than 0.19_1 have opened all cursors for
update. This change breaks that behaviour. Sorry if this breaks your code.

=head2 ing_rollback

The DBI docs state that 'Changing C<AutoCommit> from off to on will

IngresII.pm  view on Meta::CPAN


=head2 disconnect_all

Not implemented

=head2 commit and rollback invalidate open cursors

DBD::IngresII should warn when a commit or rollback is isssued on a $dbh
with open cursors.

Possibly a commit/rollback should also undef the $sth's. (This should
probably be done in the DBI-layer as other drivers will have the same
problems).

After a commit or rollback the cursors are all ->finish'ed, i.e., they
are closed and the DBI/DBD will warn if an attempt is made to fetch
from them.

A future version of DBD::IngresII wil possibly re-prepare the statement.

 view all matches for this distribution


DBD-InterBase

 view release on metacpan or  search on metacpan

InterBase.pm  view on Meta::CPAN

Calling do() method without bind value(s) will do the same.

=item * CLOSE, OPEN, DECLARE CURSOR

$sth->{CursorName} is automagically available upon executing a "SELECT .. FOR
UPDATE" statement. A cursor is closed after the last fetch(), or by calling
$sth->finish(). 

=item * PREPARE, EXECUTE, FETCH

Similar functionalities are obtained by using prepare(), execute(), and 

InterBase.pm  view on Meta::CPAN

 }

=item * Using $dbh->{ib_softcommit} = 1

This driver-specific attribute is available as of version 0.30. You may want
to look at t/40cursoron.t to see it in action.

=back

=head2 Why do nested statement handles break under AutoCommit mode?

 view all matches for this distribution


DBD-JDBC

 view release on metacpan or  search on metacpan

lib/DBD/JDBC.pod  view on Meta::CPAN

  $h->jdbc_func(parameter, ..., <jdbc_method_name>);

For example, 

  $ret = $dbh->jdbc_func("getAutoCommit");
  $ret = $sth->jdbc_func("mycursor", "Statement.setCursorName");

The driver-specific method C<jdbc_func> replaces the previous use
of the standard DBI method C<func> for calling JDBC
methods. Since C<jdbc_func> is a driver-specific method, the
C<jdbc_> prefix previously required on the method name argument

lib/DBD/JDBC.pod  view on Meta::CPAN


Examples


    $ret = $sth->jdbc_func("jdbc_Statement.getMaxFieldSize");
    $sth1->jdbc_func("mycursor", "jdbc_Statement.setCursorName");
    $sth1->jdbc_func([22 => SQL_INTEGER], "jdbc_Statement.setMaxFieldSize");

    $ret = $sth1->jdbc_func("jdbc_ResultSet.next");
    $ret = $sth1->jdbc_func("cname", "jdbc_ResultSet.getString");
    $ret = $sth2->jdbc_func("eno", [5003 => SQL_INTEGER], "jdbc_ResultSet.updateInt");

lib/DBD/JDBC.pod  view on Meta::CPAN

Some sort of explicit support for scrollable result sets will
probably be implemented at a later date.



=head2 Closing cursors

When a statement handle goes out of scope, Perl will call its
DESTROY method. This method will cause C<Statement.close> to be
called on the associated Java C<Statement> object in the
DBD::JDBC server. For many applications, this is

lib/DBD/JDBC.pod  view on Meta::CPAN

The server was asked to return the value of an unknown attribute.

=item Error code 4

This error code indicates that the client attempted to do
something which requires a cursor (a ResultSet) on the server,
but no cursor is present. 

=item Error code 5

No metadata is currently available. This error will result if a
request is made for a statement attribute at a time when no

 view all matches for this distribution


DBD-MVS_FTPSQL

 view release on metacpan or  search on metacpan

lib/DBD/MVS_FTPSQL.pm  view on Meta::CPAN

(precisely phantom) rows, as another concurrent transaction can insert rows that match 
the search criteria of the query.

=item Cursor Stability (CS)  

This is the default isolation level. It locks only the row (the page) that is currently being returned. As the cursor leaves the row, the lock is released and acquired for the next one, until all the data is returned.
While this maximizes concurrency and prevents dirty reads it does not 
ensure that the data retrieved will not be changed by other transactions, so
if the transaction reads the same row of data more than once odds are it
gets different results each time (nonrepetable read phenomena).

 view all matches for this distribution


DBD-MariaDB

 view release on metacpan or  search on metacpan

Changes.historic  view on Meta::CPAN


21/07/95:09:22  Added a field into imp_sth (currow) which keeps track of the
                current row that's been fetched from the result struct. If I
                can fix the return codes coming from fetchrow, it'll work!

21/07/95:10:30  Pondered bind variables in cursors. Since there isn't a bind
                function in the API, I may have to frig the way that prepare/
                execute works, ie, move the call to msqlQuery *after* it's
                done some parsing for bind values......Hm.

21/07/95:10:35  Twiddled some bits in the fetchrow cycle.

 view all matches for this distribution


DBD-MaxDB

 view release on metacpan or  search on metacpan

dbdimp.c  view on Meta::CPAN

             SQLDBC_PreparedStatement_setMaxRows (imp_sth->m_prepstmt, maxrows);
             erg = SQLDBC_TRUE;
             break;
          }
          case sth_maxdb_option_CursorName:{
             char* cursorname = SvPV(valuesv,kl);
             SQLDBC_PreparedStatement_setCursorName (imp_sth->m_prepstmt, cursorname, kl, SQLDBC_StringEncodingType_Encoding_UTF8) ;
             erg = SQLDBC_TRUE;
             break;
          }
       }
    }  

 view all matches for this distribution


DBD-Mimer

 view release on metacpan or  search on metacpan

dbdimp.c  view on Meta::CPAN

{
    D_imp_dbh(dbh);
    D_imp_sth(sth);
    RETCODE rc;
    /* SV **svp; */
    /* char cname[128];	*/				/* cursorname */
    dTHR;

    imp_sth->henv = imp_dbh->henv;	/* needed for dbd_error */
    imp_sth->hdbc = imp_dbh->hdbc;

dbdimp.c  view on Meta::CPAN

{
    dTHR;
    D_imp_dbh_from_sth;
    RETCODE rc;
    /* SV **svp;
    char cname[128]; */		/* cursorname */

    imp_sth->done_desc = 0;
    imp_sth->henv = imp_dbh->henv;	/* needed for dbd_error */
    imp_sth->hdbc = imp_dbh->hdbc;
    imp_sth->odbc_ignore_named_placeholders = imp_dbh->odbc_ignore_named_placeholders;

dbdimp.c  view on Meta::CPAN

    dTHR;
    D_imp_dbh_from_sth;
    RETCODE rc;
    int ret = 0;

    /* Cancel further fetches from this cursor.                 */
    /* We don't close the cursor till DESTROY (dbd_st_destroy). */
    /* The application may re execute(...) it.                  */

    /* XXX semantics of finish (eg oracle vs odbc) need lots more thought */
    /* re-read latest DBI specs and ODBC manuals */
    if (DBIc_ACTIVE(imp_sth) && imp_dbh->hdbc != SQL_NULL_HDBC) {

dbdimp.c  view on Meta::CPAN

    STRLEN kl;
    char *key = SvPV(keysv,kl);
    int i;
    SV *retsv = NULL;
    T_st_params *par;
    char cursor_name[256];
    SWORD cursor_name_len;
    RETCODE rc;

    for (par = S_st_fetch_params; par->len > 0; par++)
	if (par->len == kl && strEQ(key, par->str))
	    break;

dbdimp.c  view on Meta::CPAN

	    while(--i >= 0) 
		av_store(av, i, newSViv(imp_sth->fbh[i].ColLength));
	    break;
	case 9:			/* CursorName */
	    rc = SQLGetCursorName(imp_sth->hstmt,
				  cursor_name, sizeof(cursor_name), &cursor_name_len);
	    if (!SQL_ok(rc)) {
		dbd_error(sth, rc, "st_FETCH/SQLGetCursorName");
		return Nullsv;
	    }
	    retsv = newSVpv(cursor_name, cursor_name_len);
	    break;
	case 10:                /* odbc_more_results */
	    retsv = newSViv(imp_sth->moreResults);
	    break;
	case 11:

dbdimp.c  view on Meta::CPAN

    dTHR;
    D_imp_dbh(dbh);
    D_imp_sth(sth);
    RETCODE rc;
#if 0
    /* TBD: cursorname? */
    char cname[128];			/* cursorname */
#endif

    imp_sth->henv = imp_dbh->henv;	/* needed for dbd_error */
    imp_sth->hdbc = imp_dbh->hdbc;

 view all matches for this distribution


DBD-NET

 view release on metacpan or  search on metacpan

dbdnet/extratests/multicursor.pl  view on Meta::CPAN

#!/usr/bin/perl -w
#
# Tests multiple simultaneous cursors being open
#
# Assuming we have a table of the schema in 'numerics.pl'

$dbname = "test";
$tablename1 = "test3";

dbdnet/extratests/multicursor.pl  view on Meta::CPAN

$dbh = $drh->connect( 'dbhost', $dbname, 'blah', 'blah' );
if ( !defined $dbh ) {
    die "Cannot connect to database: $DBI::errstr\n";
  }

# Open the first cursor
$sth1 = $dbh->prepare( "
    SELECT id1, id2, id3, id4, name
    FROM $tablename1" );
if ( !defined $sth1 ) {
    die "Cannot prepare sth1: $DBI::errstr\n";
  }

# Open the second cursor
$sth2 = $dbh->prepare( "
    SELECT id, name
    FROM $tablename2" );
if ( !defined $sth2 ) {
    die "Cannot prepare sth2: $DBI::errstr\n";

 view all matches for this distribution


DBD-ODBC

 view release on metacpan or  search on metacpan

ODBC.pm  view on Meta::CPAN

            odbc_async_exec                => undef, # sth and dbh
            odbc_exec_direct               => undef,
            odbc_describe_parameters       => undef,
            odbc_SQL_ROWSET_SIZE           => undef,
            odbc_SQL_DRIVER_ODBC_VER       => undef,
            odbc_cursortype                => undef,
            odbc_query_timeout             => undef, # sth and dbh
            odbc_has_unicode               => undef,
            odbc_out_connect_string        => undef,
            odbc_version                   => undef,
            odbc_err_handler               => undef,

ODBC.pm  view on Meta::CPAN

=head3 odbc_SQL_DRIVER_ODBC_VER

This, while available via get_info() is captured here.  I may get rid
of this as I only used it for debugging purposes.

=head3 odbc_cursortype

This allows multiple concurrent statements on SQL*Server.  In your
connect, add

  { odbc_cursortype => 2 }.

If you are using DBI > 1.41, you should also be able to use

 { odbc_cursortype => DBI::SQL_CURSOR_DYNAMIC }

instead.  For example:

    my $dbh = DBI->connect("dbi:ODBC:$DSN", $user, $pass,
                  { RaiseError => 1, odbc_cursortype => 2});
    my $sth = $dbh->prepare("one statement");
    my $sth2 = $dbh->prepare("two statement");
    $sth->execute;
    my @row;
    while (@row = $sth->fetchrow_array) {

ODBC.pm  view on Meta::CPAN

normal and it will be subject to LongReadLen and b) fail
odbc_lob_read.

NOTE: Some database engines and ODBC drivers do not allow you to
retrieve columns out of order (e.g., MS SQL Server unless you are
using cursors).  In those cases you must ensure the lob retrieved is
the last (or only) column in your select list.

NOTE: You can retrieve only part of a lob but you will probably have
to call finish on the statement handle before you do anything else
with that statement. When only retrieving part of a large lob you

 view all matches for this distribution


DBD-Oracle

 view release on metacpan or  search on metacpan

examples/curref.pl  view on Meta::CPAN

#
# curref.pl          - by Geoffrey Young
#
# for this example, we create a package that contains
# two procedures:
#   emp_cursor       - returns a specific cursor reference
#   ref_cursor_close - closes any cursor reference
#
# to actually run this example as is, you will need the
# oracle demo tables.  otherwise, it's just sample code...

use DBI;

examples/curref.pl  view on Meta::CPAN

    or die $DBI::errstr;

my $sql = qq(
  CREATE OR REPLACE PACKAGE curref_test
  IS
    TYPE cursor_ref IS REF CURSOR;
    PROCEDURE emp_cursor (job_in  IN VARCHAR2, curref IN OUT cursor_ref);
    PROCEDURE ref_cursor_close (curref IN cursor_ref);
  END;
);
my $rv = $dbh->do($sql);
print "The package has been created...\n";

$sql = qq(
  CREATE OR REPLACE PACKAGE BODY curref_test
  IS 
    PROCEDURE emp_cursor (job_in IN VARCHAR2, curref IN OUT cursor_ref)
    IS
    BEGIN
      OPEN curref FOR select ename, job from emp where job = job_in;
    END;

    PROCEDURE ref_cursor_close (curref IN cursor_ref)
    IS
    BEGIN
      close curref;
    END;
  END;
);
$rv = $dbh->do($sql);
print "The package body has been created...\n";

print "These are the results from the ref cursor:\n";
$sql = qq(
   BEGIN
     curref_test.emp_cursor(:job_in, :curref);
   END;
);
my $curref;
my $sth = $dbh->prepare($sql);
$sth->bind_param(":job_in", "CLERK");
$sth->bind_param_inout(":curref", \$curref, 0, {ora_type => ORA_RSET});
$sth->execute;
$curref->dump_results;
open_cursors();

$sql = qq(
   BEGIN
     curref_test.ref_cursor_close(:curref);
   END;
);
$sth = $dbh->prepare($sql);
$sth->bind_param(":curref", $curref, {ora_type => ORA_RSET});
$sth->execute;

print "The cursor is now closed\n";
print "just to prove it...\n";
open_cursors();

$sql = "DROP PACKAGE curref_test"; # Also drops PACKAGE BODY
$rv = $dbh->do($sql);
print "The package has been dropped...\n";

$dbh->disconnect;

sub open_cursors {
  eval {
    $sth = $dbh->prepare(
      'SELECT user, sql_text FROM sys.v_$open_cursor ORDER BY user, sql_text');
    $sth->execute;
    print "Here are the open cursors:\n";
    $sth->dump_results;
  };
  if ( $@ ) {
      print "Unable to SELECT from SYS.V_\$OPEN_CURSOR:\n";
      if ( 942 == $DBI::err ) {

 view all matches for this distribution


DBD-Ovrimos

 view release on metacpan or  search on metacpan

lib/DBD/Ovrimos.pm  view on Meta::CPAN

Underlying the DBI is a protocol using the ODBC-equivalent 'connections' and
'statements'. Sessions are kept live until commit/rollback, and that can
result in denial of service if you reach the License limit. The database 
handle will reuse an inactive statement handle, so finish() often.

Commit/rollback finish()'es implicitly all open cursors (that's the answer
one asks ODBC with SQL_CURSOR_COMMIT_BEHAVIOR and SQL_CURSOR_ROLLBACK_BEHAVIOR).

Cached statements are not available. In the near future it is planned to
cache SQL statements internally at the SQL Server, so preparing the same
SQL statement as some time before will return a new $sth but without the

lib/DBD/Ovrimos.pm  view on Meta::CPAN

=head2 LOW-LEVEL LIBRARY

The entire low-level library that implements the Ovrimos protocol
is included. The DBI driver is based on this library, but one could conceivably
use the library on its own. It is the only way, for the time being, to use
scrollable cursors and bookmarks, since the DBI does not support them (yet?).
See the package C<DBD::Ovrimos::lowlevel> in C<Ovrimos.pm>. No documentation is
provided in this version about the low-level library.

=head1 COMFORMANCE

 view all matches for this distribution


DBD-Pg

 view release on metacpan or  search on metacpan

Pg.pm  view on Meta::CPAN

your Perl has 64-bit integers, it will use the 64-bit variants of the seek,
tell and truncate methods.

=head2 Cursors

Although PostgreSQL supports cursors, they have not been used in the current
implementation. When DBD::Pg was created, cursors in PostgreSQL could only be
used inside a transaction block. Because only one transaction block at a time
is allowed, this would have implied the restriction not to use any nested
C<SELECT> statements. Therefore the L</execute> method fetches all data at
once into data structures located in the front-end application. This fact
must to be considered when selecting large amounts of data!

You can use cursors in your application, but you'll need to do a little
work. First you must declare your cursor. Now you can issue queries against
the cursor, then select against your queries. This typically results in a
double loop, like this:

  # WITH HOLD is not needed if AutoCommit is off
  $dbh->do("DECLARE csr CURSOR WITH HOLD FOR $sql");
  while (1) {

 view all matches for this distribution


DBD-PgPP

 view release on metacpan or  search on metacpan

lib/DBD/PgPP.pm  view on Meta::CPAN

    }
    while ($packet->is_notice_response) {
        # XXX: discard it for now
        $packet = $stream->each;
    }
    if ($packet->is_cursor_response) {
        $packet->compute($pgsql);
        my $row_info = $stream->each; # fetch RowDescription
        if ($row_info->is_error) {
            $self->_to_end_of_response($stream);
            Carp::croak($row_info->get_message);

lib/DBD/PgPP.pm  view on Meta::CPAN

           : $type eq BACKEND_KEY_DATA      ? $self->_each_backend_key_data
           : $type eq BINARY_ROW            ? $self->_each_binary_row
           : $type eq COMPLETED_RESPONSE    ? $self->_each_completed_response
           : $type eq COPY_IN_RESPONSE      ? $self->_each_copy_in_response
           : $type eq COPY_OUT_RESPONSE     ? $self->_each_copy_out_response
           : $type eq CURSOR_RESPONSE       ? $self->_each_cursor_response
           : $type eq EMPTY_QUERY_RESPONSE  ? $self->_each_empty_query_response
           : $type eq ERROR_RESPONSE        ? $self->_each_error_response
           : $type eq FUNCTION_RESPONSE     ? $self->_each_function_response
           : $type eq NOTICE_RESPONSE       ? $self->_each_notice_response
           : $type eq NOTIFICATION_RESPONSE ? $self->_each_notification_response

lib/DBD/PgPP.pm  view on Meta::CPAN

sub _each_ready_for_query {
    my ($self) = @_;
    return DBD::PgPP::ReadyForQuery->new;
}

sub _each_cursor_response {
    my ($self) = @_;
    my $name = $self->_get_c_string;
    return DBD::PgPP::CursorResponse->new($name);
}

lib/DBD/PgPP.pm  view on Meta::CPAN

sub compute            { return }
sub is_empty           { undef }
sub is_error           { undef }
sub is_end_of_response { undef }
sub get_result         { undef }
sub is_cursor_response { undef }
sub is_notice_response { undef }


package DBD::PgPP::AuthenticationOk;
use base qw<DBD::PgPP::Response>;

lib/DBD/PgPP.pm  view on Meta::CPAN

    $self->{name} = $name;
    return $self;
}

sub get_name           { $_[0]{name} }
sub is_cursor_response { 1 }

sub compute {
    my ($self, $pgsql) = @_;
    $pgsql->{cursor_name} = $self->get_name;
}


package DBD::PgPP::RowDescription;
use base qw<DBD::PgPP::Response>;

lib/DBD/PgPP.pm  view on Meta::CPAN

    ++$length if $number % 8;
    return $length;
}

sub get_result         { $_[0]{result} }
sub is_cursor_response { 1 }


package DBD::PgPP::CompletedResponse;
use base qw<DBD::PgPP::Response>;

 view all matches for this distribution


DBD-PgPPSjis

 view release on metacpan or  search on metacpan

lib/DBD/PgPPSjis.pm  view on Meta::CPAN

    }
    while ($packet->is_notice_response) {
        # XXX: discard it for now
        $packet = $stream->each;
    }
    if ($packet->is_cursor_response) {
        $packet->compute($pgsql);
        my $row_info = $stream->each; # fetch RowDescription
        if ($row_info->is_error) {
            $self->_to_end_of_response($stream);
            Carp::croak($row_info->get_message);

lib/DBD/PgPPSjis.pm  view on Meta::CPAN

           : $type eq BACKEND_KEY_DATA      ? $self->_each_backend_key_data
           : $type eq BINARY_ROW            ? $self->_each_binary_row
           : $type eq COMPLETED_RESPONSE    ? $self->_each_completed_response
           : $type eq COPY_IN_RESPONSE      ? $self->_each_copy_in_response
           : $type eq COPY_OUT_RESPONSE     ? $self->_each_copy_out_response
           : $type eq CURSOR_RESPONSE       ? $self->_each_cursor_response
           : $type eq EMPTY_QUERY_RESPONSE  ? $self->_each_empty_query_response
           : $type eq ERROR_RESPONSE        ? $self->_each_error_response
           : $type eq FUNCTION_RESPONSE     ? $self->_each_function_response
           : $type eq NOTICE_RESPONSE       ? $self->_each_notice_response
           : $type eq NOTIFICATION_RESPONSE ? $self->_each_notification_response

lib/DBD/PgPPSjis.pm  view on Meta::CPAN

sub _each_ready_for_query {
    my ($self) = @_;
    return DBD::PgPPSjis::ReadyForQuery->new;
}

sub _each_cursor_response {
    my ($self) = @_;
    my $name = $self->_get_c_string;
    return DBD::PgPPSjis::CursorResponse->new($name);
}

lib/DBD/PgPPSjis.pm  view on Meta::CPAN

sub compute            { return }
sub is_empty           { undef }
sub is_error           { undef }
sub is_end_of_response { undef }
sub get_result         { undef }
sub is_cursor_response { undef }
sub is_notice_response { undef }


package DBD::PgPPSjis::AuthenticationOk;
use base qw<DBD::PgPPSjis::Response>;

lib/DBD/PgPPSjis.pm  view on Meta::CPAN

    $self->{name} = $name;
    return $self;
}

sub get_name           { $_[0]{name} }
sub is_cursor_response { 1 }

sub compute {
    my ($self, $pgsql) = @_;
    $pgsql->{cursor_name} = $self->get_name;
}


package DBD::PgPPSjis::RowDescription;
use base qw<DBD::PgPPSjis::Response>;

lib/DBD/PgPPSjis.pm  view on Meta::CPAN

    ++$length if $number % 8;
    return $length;
}

sub get_result         { $_[0]{result} }
sub is_cursor_response { 1 }


package DBD::PgPPSjis::CompletedResponse;
use base qw<DBD::PgPPSjis::Response>;

 view all matches for this distribution


DBD-PgSPI

 view release on metacpan or  search on metacpan

PgSPI.xs  view on Meta::CPAN

    /* pre-disconnect checks and tidy-ups */
    if (DBIc_CACHED_KIDS(imp_dbh)) {
        SvREFCNT_dec(DBIc_CACHED_KIDS(imp_dbh));
        DBIc_CACHED_KIDS(imp_dbh) = Nullhv;
    }
    /* Check for disconnect() being called whilst refs to cursors	*/
    /* still exists. This possibly needs some more thought.		*/
    if (DBIc_ACTIVE_KIDS(imp_dbh) && DBIc_WARN(imp_dbh) && !PL_dirty) {
        char *plural = (DBIc_ACTIVE_KIDS(imp_dbh)==1) ? "" : "s";
        warn("disconnect(%s) invalidates %d active statement%s. %s",
            SvPV(dbh,PL_na), (int)DBIc_ACTIVE_KIDS(imp_dbh), plural,

 view all matches for this distribution


DBD-PrimeBase

 view release on metacpan or  search on metacpan

benchmarks/server-cfg  view on Meta::CPAN

#	  1 question should be retried
#

sub abort_if_fatal_error
{
  return 1 if ($DBI::errstr =~ /Table locked by another cursor/);
  return 0;
}

sub small_rollback_segment
{

benchmarks/server-cfg  view on Meta::CPAN

#	  1 question should be retried
#

sub abort_if_fatal_error
{
  return 1 if ($DBI::errstr =~ /Table locked by another cursor/);
  return 0;
}

sub small_rollback_segment
{

 view all matches for this distribution


DBD-QBase

 view release on metacpan or  search on metacpan

qb.pl  view on Meta::CPAN

$dbh = $drh->connect( 'testdb','test','testdb' );
die unless $dbh;
print "Ok!\n";

printf "Insert Test..";
$cursor = $dbh->prepare( "INSERT Table1 (name,age) values (\"Mouring\",16)" );
$cursor->execute;
$cursor->finish;
printf "Ok\n";

printf "Update test..";
$cursor = $dbh->prepare( "UPDATE Table1 SET age=20 where name=\"Mouring\"" );
$cursor->execute;
$cursor->finish;
printf "Ok\n";

printf "Fetch test...\n";
$cursor = $dbh->prepare( "SELECT * from Table1" );
$cursor->execute;
 
while (@field = $cursor->fetchrow) {
   print "User: @field\n";
  }
$cursor->finish;

printf "Rollback test...Currently Broken\n";
#$cursor = $dbh->prepare( "INSERT Table1 SET age=23 where name=\"New User\"" );
#$cursor->execute;
#$cursor->finish;
#
#$cursor = $dbh->prepare( "SELECT * from Table1" );
#$cursor->execute;
#
#printf "** Changed State **\n"; 
#while (@field = $cursor->fetchrow) {
#   print "User: @field\n";
#  }
#$cursor->finish;
#
#$cursor->rollback;
#printf "** Original State **\n";
#$cursor = $dbh->prepare( "SELECT * from Table1" );
#$cursor->execute;
# 
#while (@field = $cursor->fetchrow) {
#   print "User: @field\n";
#  }
#$cursor->finish;

$dbh->disconnect;

exit;

 view all matches for this distribution


DBD-Redbase

 view release on metacpan or  search on metacpan

t/30insertfetch.t  view on Meta::CPAN

	#
	#   Now, try SELECT'ing the row out. 
	#
	Test(
		  $state
			or $cursor =
			$dbh->prepare( "SELECT * FROM $table" . " WHERE id = 1" ),
		  'prepare select'
	  )
	  or DbiError( $dbh->err, $dbh->errstr );

	Test( $state or $cursor->execute, 'execute select' )
	  or DbiError( $cursor->err, $cursor->errstr );

	my ( $row, $errstr );
	Test(
		  $state
			or ( defined( $row = $cursor->fetchrow_arrayref )
				 && !( $cursor->errstr ) ),
		  'fetch select'
	  )
	  or DbiError( $cursor->err, $cursor->errstr );

	Test(
		  $state
			or ( $row->[ 0 ] == 1
				 && $row->[ 1 ] eq 'Alligator Descartes'
				 && $row->[ 2 ] == 1111
				 && $row->[ 3 ] eq 'Some Text' ),
		  'compare select'
	  )
	  or DbiError( $cursor->err, $cursor->errstr );

	Test( $state or $cursor->finish, 'finish select' )
	  or DbiError( $cursor->err, $cursor->errstr );

	Test( $state or undef $cursor || 1, 'undef select' );

	#
	#   ...and delete it........
	#
	Test( $state or $dbh->do( "DELETE FROM $table WHERE id = 1" ), 'delete' )

t/30insertfetch.t  view on Meta::CPAN

	#
	#   Now, try SELECT'ing the row out. This should fail.
	#
	Test(
		  $state
			or $cursor =
			$dbh->prepare( "SELECT * FROM $table" . " WHERE id = 1" ),
		  'prepare select deleted'
	  )
	  or DbiError( $dbh->err, $dbh->errstr );

	Test( $state or $cursor->execute, 'execute select deleted' )
	  or DbiError( $cursor->err, $cursor->errstr );

	Test(
		  $state
			or (
				 !defined( $row = $cursor->fetchrow_arrayref )
				 && ( !defined( $errstr = $cursor->errstr )
					  || $cursor->errstr eq '' )
			),
		  'fetch select deleted'
	  )
	  or DbiError( $cursor->err, $cursor->errstr );

	Test( $state or $cursor->finish, 'finish select deleted' )
	  or DbiError( $cursor->err, $cursor->errstr );

	Test( $state or undef $cursor || 1, 'undef select deleted' );

	#
	#   Finally drop the test table.
	#
	Test( $state or $dbh->do( "DROP TABLE $table" ), 'drop' )

 view all matches for this distribution


( run in 0.596 second using v1.01-cache-2.11-cpan-4d50c553e7e )