view release on metacpan or search on metacpan
DTF_CAT_PAGEALGO DTF_CAT_SRVSETUP
DTF_CAT_R4MODE DTF_CAT_AUTORECOVER
S< >I<TRANSACTION SCOPE ATTRIBUTES>
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
--------------------+------------+---------------+---------------+-------------------
DTF_TAT_AUTOCOMMIT | Enum | false | false | false,true
DTF_TAT_RESULTTYPE | Enum | sequential | sequential | sequential,random
--------------------+------------+---------------+---------------+-------------------
# destroy the column handle
Arguments:
input: $hcol a valid column handle
=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);>
# retrieve information about a result set's field
Arguments:
input: $hres a valid result handle
$colIndex is the 0-based index of the field to retrieve information about
blib/lib/DBD/DtfSQLmac.pm view on Meta::CPAN
#
# Here we have a valid result handle only if $reqClass == Mac::DtfSQL::DTF_RC_RESULT_AVAILABLE(),
# else $hres will be NULL (0). The result table may be empty, though ($affectedRecords == 0).
# Don't get confused by this.
#
if ( $reqClass == Mac::DtfSQL::DTF_RC_RESULT_AVAILABLE() ) {
# We have a result table, which is a two column table, were a row/record looks like
# <user-table name, table comment>. We are only interested in the first column.
# We have a sequential cursor (by default) and will use DtfResMoveToFirstRow()
# and DtfResMoveToNextRow() for iterating through the result.
Mac::DtfSQL::DtfResMoveToFirstRow($hres);
for (my $row = 0; $row < $affectedRecords; $row++) {
my $data_item = ''; # field data (init to avoid undef warnings)
my $isNULL = 0; # NULL indicator (init to avoid undef warnings)
my $colIndex = 0; # first column
blib/lib/DBD/DtfSQLmac.pm view on Meta::CPAN
if ($affectedRecords > 0) { # ... and this table has rows
if ( ( $columncount = Mac::DtfSQL::DtfResColumnCount($hres) ) != 5 ) { # should be 5
$errstr = "ERROR(table_col_info): Unexpected result table for $statement";
# Do not forget to destroy the result handle.
Mac::DtfSQL::DtfResDestroy($hres);
return $dbh->DBI::set_err(64, $errstr); # Mac::DtfSQL::DTF_ERR_USER()
}
# We have a sequential cursor (by default) and will use DtfResMoveToFirstRow()
# and DtfResMoveToNextRow() for iterating through the result.
Mac::DtfSQL::DtfResMoveToFirstRow($hres);
my $columnname = ''; # columnname
my $typestring = ''; # columns data type as string
my $type = 0; # columns data type as DBI SQL type number
my $nullable = ''; # nullable attribute
for (my $row = 0; $row < $affectedRecords; $row++) {
blib/lib/DBD/DtfSQLmac.pm view on Meta::CPAN
if ($affectedRecords > 0) { # ... and this table has rows
if ( ( $columncount = Mac::DtfSQL::DtfResColumnCount($hres) ) != 5 ) { # should be 5
$errstr = "ERROR(_col_nullable): Unexpected result table for $statement";
# Do not forget to destroy the result handle.
Mac::DtfSQL::DtfResDestroy($hres);
return (64, $errstr, 0);
}
# We have a sequential cursor (by default) and will use DtfResMoveToFirstRow()
# and DtfResMoveToNextRow() for iterating through the result.
Mac::DtfSQL::DtfResMoveToFirstRow($hres);
my $columnname = ''; # columnname, column 0
my $nullable = ''; # nullable attribute , column 3
for (my $row = 0; $row < $affectedRecords; $row++) {
my $data_item = 0; # field data (init to avoid undef warnings)
blib/lib/DBD/DtfSQLmac.pm view on Meta::CPAN
}#for
# concatenate statement, and that's it
$statement = join ('', @stmt_array);
#print "QUERY= $statement\n"; # TEST
}#if placeholders
# Now we have a proper SQL string we will send to the database engine using the
# function DtfTraExecute() which is typically used for sending SQL requests which
# are unknown to the program developer. Note that, other than with DtfTraExecuteQuery(),
# the parameter "restype" is missing. Instead, the default result type (DTF_RT_SEQUENTIAL
# => sequential cursor), modifiable with DtfHdlSetAttribute(), will be used.
# Description
# DTF_RT_SEQUENTIAL sequential cursor; restricted to DtfResMoveToFirstRow() and
# DtfResMoveToNextRow() for iterating through the result; needs little memory,
# independent from the resultÕs size.
# After the function DtfTraExecute returns, $reqClass will contain the SQL requestÕs
# class if the request was executed successfully; $reqClass will be one of the following
# values:
# DTF_RC_ROWS_AFFECTED (= 0)
# The statement was of a modifying kind (insert, update, delete statements), and
blib/lib/DBD/DtfSQLmac.pm view on Meta::CPAN
$sth->{'dtf_precision'} = \@precisionArray;
$sth->{'dtf_scale'} = \@scaleArray;
#
# Step 2: retrieve and store result table
#
my @resulttable = (); # this is my LoL
# We have a sequential cursor (by default) and will use DtfResMoveToFirstRow()
# and DtfResMoveToNextRow() for iterating through the result.
Mac::DtfSQL::DtfResMoveToFirstRow($hres);
for (my $row = 0; $row < $affectedRecords; $row++) {
my $data_item = 0; # field data (init to avoid undef warnings)
my $isNULL = 0; # NULL indicator (init to avoid undef warnings)
my @rowdata = ();
blib/lib/DBD/DtfSQLmac.pm view on Meta::CPAN
# NULLABLE (array-ref, read-only): * valid after execute *
# Returns a reference to an array indicating the possibility of each column
# returning a null: 0 = no, 1 = yes, 2 = unknown.
# example: print "First column may return NULL\n" if $sth->{NULLABLE}->[0];
if ($attr eq 'NULLABLE') {
return $sth->{'dtf_nullable'};
}
# CursorName (string, read-only): * not supported *
# Returns the name of the cursor associated with the statement handle if available.
# If not available or the database driver does not support the "where current of ..."
# SQL syntax then it returns undef.
if ($attr eq 'CursorName') {
return undef; # Not supported.
}
# RowsInCache (integer, read-only):
# If the driver supports a local row cache for select statements then this attribute
# holds the number of un-fetched rows in the cache. If the driver doesn't, then it
blib/lib/Mac/DtfSQL.pm view on Meta::CPAN
DTF_CAT_PAGEALGO DTF_CAT_SRVSETUP
DTF_CAT_R4MODE DTF_CAT_AUTORECOVER
S< >I<TRANSACTION SCOPE ATTRIBUTES>
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
--------------------+------------+---------------+---------------+-------------------
DTF_TAT_AUTOCOMMIT | Enum | false | false | false,true
DTF_TAT_RESULTTYPE | Enum | sequential | sequential | sequential,random
--------------------+------------+---------------+---------------+-------------------
blib/lib/Mac/DtfSQL.pm view on Meta::CPAN
# destroy the column handle
Arguments:
input: $hcol a valid column handle
=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);>
# retrieve information about a result set's field
Arguments:
input: $hres a valid result handle
$colIndex is the 0-based index of the field to retrieve information about
lib/DBD/DtfSQLmac.pm view on Meta::CPAN
#
# Here we have a valid result handle only if $reqClass == Mac::DtfSQL::DTF_RC_RESULT_AVAILABLE(),
# else $hres will be NULL (0). The result table may be empty, though ($affectedRecords == 0).
# Don't get confused by this.
#
if ( $reqClass == Mac::DtfSQL::DTF_RC_RESULT_AVAILABLE() ) {
# We have a result table, which is a two column table, were a row/record looks like
# <user-table name, table comment>. We are only interested in the first column.
# We have a sequential cursor (by default) and will use DtfResMoveToFirstRow()
# and DtfResMoveToNextRow() for iterating through the result.
Mac::DtfSQL::DtfResMoveToFirstRow($hres);
for (my $row = 0; $row < $affectedRecords; $row++) {
my $data_item = ''; # field data (init to avoid undef warnings)
my $isNULL = 0; # NULL indicator (init to avoid undef warnings)
my $colIndex = 0; # first column
lib/DBD/DtfSQLmac.pm view on Meta::CPAN
if ($affectedRecords > 0) { # ... and this table has rows
if ( ( $columncount = Mac::DtfSQL::DtfResColumnCount($hres) ) != 5 ) { # should be 5
$errstr = "ERROR(table_col_info): Unexpected result table for $statement";
# Do not forget to destroy the result handle.
Mac::DtfSQL::DtfResDestroy($hres);
return $dbh->DBI::set_err(64, $errstr); # Mac::DtfSQL::DTF_ERR_USER()
}
# We have a sequential cursor (by default) and will use DtfResMoveToFirstRow()
# and DtfResMoveToNextRow() for iterating through the result.
Mac::DtfSQL::DtfResMoveToFirstRow($hres);
my $columnname = ''; # columnname
my $typestring = ''; # columns data type as string
my $type = 0; # columns data type as DBI SQL type number
my $nullable = ''; # nullable attribute
for (my $row = 0; $row < $affectedRecords; $row++) {
lib/DBD/DtfSQLmac.pm view on Meta::CPAN
if ($affectedRecords > 0) { # ... and this table has rows
if ( ( $columncount = Mac::DtfSQL::DtfResColumnCount($hres) ) != 5 ) { # should be 5
$errstr = "ERROR(_col_nullable): Unexpected result table for $statement";
# Do not forget to destroy the result handle.
Mac::DtfSQL::DtfResDestroy($hres);
return (64, $errstr, 0);
}
# We have a sequential cursor (by default) and will use DtfResMoveToFirstRow()
# and DtfResMoveToNextRow() for iterating through the result.
Mac::DtfSQL::DtfResMoveToFirstRow($hres);
my $columnname = ''; # columnname, column 0
my $nullable = ''; # nullable attribute , column 3
for (my $row = 0; $row < $affectedRecords; $row++) {
my $data_item = 0; # field data (init to avoid undef warnings)
lib/DBD/DtfSQLmac.pm view on Meta::CPAN
}#for
# concatenate statement, and that's it
$statement = join ('', @stmt_array);
#print "QUERY= $statement\n"; # TEST
}#if placeholders
# Now we have a proper SQL string we will send to the database engine using the
# function DtfTraExecute() which is typically used for sending SQL requests which
# are unknown to the program developer. Note that, other than with DtfTraExecuteQuery(),
# the parameter "restype" is missing. Instead, the default result type (DTF_RT_SEQUENTIAL
# => sequential cursor), modifiable with DtfHdlSetAttribute(), will be used.
# Description
# DTF_RT_SEQUENTIAL sequential cursor; restricted to DtfResMoveToFirstRow() and
# DtfResMoveToNextRow() for iterating through the result; needs little memory,
# independent from the resultÕs size.
# After the function DtfTraExecute returns, $reqClass will contain the SQL requestÕs
# class if the request was executed successfully; $reqClass will be one of the following
# values:
# DTF_RC_ROWS_AFFECTED (= 0)
# The statement was of a modifying kind (insert, update, delete statements), and
lib/DBD/DtfSQLmac.pm view on Meta::CPAN
$sth->{'dtf_precision'} = \@precisionArray;
$sth->{'dtf_scale'} = \@scaleArray;
#
# Step 2: retrieve and store result table
#
my @resulttable = (); # this is my LoL
# We have a sequential cursor (by default) and will use DtfResMoveToFirstRow()
# and DtfResMoveToNextRow() for iterating through the result.
Mac::DtfSQL::DtfResMoveToFirstRow($hres);
for (my $row = 0; $row < $affectedRecords; $row++) {
my $data_item = 0; # field data (init to avoid undef warnings)
my $isNULL = 0; # NULL indicator (init to avoid undef warnings)
my @rowdata = ();
lib/DBD/DtfSQLmac.pm view on Meta::CPAN
# NULLABLE (array-ref, read-only): * valid after execute *
# Returns a reference to an array indicating the possibility of each column
# returning a null: 0 = no, 1 = yes, 2 = unknown.
# example: print "First column may return NULL\n" if $sth->{NULLABLE}->[0];
if ($attr eq 'NULLABLE') {
return $sth->{'dtf_nullable'};
}
# CursorName (string, read-only): * not supported *
# Returns the name of the cursor associated with the statement handle if available.
# If not available or the database driver does not support the "where current of ..."
# SQL syntax then it returns undef.
if ($attr eq 'CursorName') {
return undef; # Not supported.
}
# RowsInCache (integer, read-only):
# If the driver supports a local row cache for select statements then this attribute
# holds the number of un-fetched rows in the cache. If the driver doesn't, then it
t/40insertfetch.t view on Meta::CPAN
#
### Test 5
Test($state or $dbh->do("DELETE FROM $table WHERE id = 1"))
or DbiError($dbh->err, $dbh->errstr);
#
# Now, try SELECT'ing the row out. This should fail.
#
#
### Test 6
Test($state or $cursor = $dbh->prepare("SELECT * FROM $table"
. " WHERE id = 1"))
or DbiError($dbh->err, $dbh->errstr);
#
### Test 7
Test($state or $cursor->execute)
or DbiError($cursor->err, $cursor->errstr);
my ($row, $errstr);
#
### Test 8
Test($state or (!defined($row = $cursor->fetchrow_arrayref) &&
(!defined($errstr = $cursor->errstr) ||
$cursor->errstr eq '')))
or DbiError($cursor->err, $cursor->errstr);
#
### Test 9
Test($state or $cursor->finish, "\$sth->finish failed")
or DbiError($cursor->err, $cursor->errstr);
#
### Test 10
Test($state or undef $cursor || 1);
#
# Drop the test table.
#
#
### Test 11
Test($state or $dbh->do("DROP TABLE $table"))
or DbiError($dbh->err, $dbh->errstr);
t/50bindparam.t view on Meta::CPAN
Test($state or ($def = TableDefinition($table,
["id", SQL_INTEGER(), 0, 0, $COL_PRIMARY_KEY], # column name, DBI SQL code, size/precision, scale, flags
["name", SQL_VARCHAR(), 64, 0, $COL_NULLABLE]),
$dbh->do($def)))
or DbiError($dbh->err, $dbh->errstr);
#
### Test 4
Test($state or $cursor = $dbh->prepare("INSERT INTO $table"
. " VALUES (?, ?)"))
or DbiError($dbh->err, $dbh->errstr);
#
# Insert some rows
#
#
### Test 5
Test($state or $cursor->bind_param(1, 1, SQL_INTEGER()))
or DbiError($dbh->err, $dbh->errstr);
#
### Test 6
Test($state or $cursor->bind_param(2, "Fred Feuerstein", SQL_VARCHAR()))
or DbiError($dbh->err, $dbh->errstr);
#
### Test 7
Test($state or $cursor->execute)
or DbiError($dbh->err, $dbh->errstr);
# Does the driver remember the type?
#
### Test 8
Test($state or $cursor->execute("3", "Ally McBeal"))
or DbiError($dbh->err, $dbh->errstr);
#
### Test 9
$numericVal = 2;
$charVal = "Bart Simpson";
Test($state or $cursor->execute($numericVal, $charVal))
or DbiError($dbh->err, $dbh->errstr);
# Now try the explicit type settings
#
### Test 10
Test($state or $cursor->bind_param(1, " 4", SQL_INTEGER()))
or DbiError($dbh->err, $dbh->errstr);
#
### Test 11
Test($state or $cursor->bind_param(2, "Thomas Wegner"))
or DbiError($dbh->err, $dbh->errstr);
#
### Test 12
Test($state or $cursor->execute)
or DbiError($dbh->err, $dbh->errstr);
# Works undef -> NULL?
#
### Test 13
Test($state or $cursor->bind_param(1, 5, SQL_INTEGER()))
or DbiError($dbh->err, $dbh->errstr);
#
### Test 14
Test($state or $cursor->bind_param(2, undef))
or DbiError($dbh->err, $dbh->errstr);
#
### Test 15
Test($state or $cursor->execute)
or DbiError($dbh->err, $dbh->errstr);
#
# Try inserting a question mark
#
#
### Test 16
Test($state or $dbh->do("INSERT INTO $table VALUES (6, '?')"))
or DbiError($dbh->err, $dbh->errstr);
t/50bindparam.t view on Meta::CPAN
### Test 17
Test($state or ($string = $dbh->quote("don't")) );
#
### Test 18
Test($state or $dbh->do("INSERT INTO $table VALUES (7, $string)"))
or DbiError($dbh->err, $dbh->errstr);
#
### Test 19
Test($state or undef $cursor || 1);
#
# And now retrieve the rows using bind_columns
#
#
### Test 20
Test($state or $cursor = $dbh->prepare("SELECT * FROM $table"
. " ORDER BY id"))
or DbiError($dbh->err, $dbh->errstr);
#
### Test 21
Test($state or $cursor->execute)
or DbiError($dbh->err, $dbh->errstr);
#
### Test 22
Test($state or $cursor->bind_columns(\$id, \$name))
or DbiError($dbh->err, $dbh->errstr);
#
### Test 23
Test($state or ( $ref = $cursor->fetch && $id == 1))
or printf("# Query returned id = %s, name = %20.20s, ref = %s, %d\n",
$id, $name, $ref, scalar(@$ref));
#
### Test 24
Test($state or (($ref = $cursor->fetch) && $id == 2 &&
$name eq 'Bart Simpson'))
or printf("# Query returned id = %s, name = -%s-, ref = %s, %d\n",
$id, $name, $ref, scalar(@$ref));
#
### Test 25
Test($state or (($ref = $cursor->fetch) && $id == 3 &&
$name eq 'Ally McBeal'))
or printf("# Query returned id = %s, name = %s, ref = %s, %d\n",
$id, $name, $ref, scalar(@$ref));
#
### Test 26
Test($state or (($ref = $cursor->fetch) && $id == 4 &&
$name eq 'Thomas Wegner'))
or printf("# Query returned id = %s, name = %s, ref = %s, %d\n",
$id, $name, $ref, scalar(@$ref));
#
### Test 27
Test($state or (($ref = $cursor->fetch) && $id == 5 &&
!defined($name)))
or printf("# Query returned id = %s, name = %s, ref = %s, %d\n",
$id, $name, $ref, scalar(@$ref));
#
### Test 28
Test($state or (($ref = $cursor->fetch) && $id == 6 &&
$name eq '?'))
or print("# Query returned id = $id, name = $name, expected 6, ?\n");
#
### Test 29
Test($state or (($ref = $cursor->fetch) && $id == 7 &&
$name eq "don't"))
or print("# Query returned id = $id, name = $name, expected 7, don't\n");
#
### Test 30
Test($state or undef $cursor or 1);
#
# Drop the test table.
#
#
### Test 31
Test($state or $dbh->do("DROP TABLE $table"))
or DbiError($dbh->err, $dbh->errstr);
t/51listfields.t view on Meta::CPAN
# Create a new table
#
#
### Test 3
Test($state or ($def = TableDefinition($table, @table_def),
$dbh->do($def)))
or DbiError($dbh->err, $dbh->errstr);
#
### Test 4
Test($state or $cursor = $dbh->prepare("SELECT * FROM $table"))
or DbiError($dbh->err, $dbh->errstr);
#
### Test 5
Test($state or $cursor->execute)
or DbiError($cursor->err, $cursor->errstr);
my $res;
#
### Test 6
Test($state or (($res = $cursor->{'NUM_OF_FIELDS'}) == @table_def))
or DbiError($cursor->err, $cursor->errstr);
if (!$state && $verbose) {
printf("# Number of fields: %s\n", defined($res) ? $res : "undef");
}
#
### Test 7
Test($state or ($ref = $cursor->{'NAME'}) && @$ref == @table_def
&& (lc $$ref[0]) eq $table_def[0][0]
&& (lc $$ref[1]) eq $table_def[1][0])
or DbiError($cursor->err, $cursor->errstr);
if (!$state && $verbose) {
print "# Names:\n";
for ($i = 0; $i < @$ref; $i++) {
print "# ", $$ref[$i], "\n";
}
}
#
### Test 8
Test($state or ($ref = $cursor->{'NULLABLE'}) && @$ref == @table_def
&& !($$ref[0] xor ($table_def[0][4] & $COL_NULLABLE))
&& !($$ref[1] xor ($table_def[1][4] & $COL_NULLABLE)))
or DbiError($cursor->err, $cursor->errstr);
if (!$state && $verbose) {
print "# Nullable:\n";
for ($i = 0; $i < @$ref; $i++) {
print "# ", ($$ref[$i] & $COL_NULLABLE) ? "yes" : "no", "\n";
}
}
#
### Test 9
Test($state or (($ref = $cursor->{TYPE}) && (@$ref == @table_def)
&& ($ref->[0] eq DBI::SQL_INTEGER())
&& ($ref->[1] eq DBI::SQL_VARCHAR() ||
$ref->[1] eq DBI::SQL_CHAR())))
or printf("# Expected types %d and %d, got %s and %s\n",
&DBI::SQL_INTEGER(), &DBI::SQL_VARCHAR(),
defined($ref->[0]) ? $ref->[0] : "undef",
defined($ref->[1]) ? $ref->[1] : "undef");
#
### Test 10
Test($state or undef $cursor || 1);
#
# Drop the test table
#
#
### Test 11
Test($state or ($cursor = $dbh->prepare("DROP TABLE $table")))
or DbiError($dbh->err, $dbh->errstr);
#
### Test 12
Test($state or $cursor->execute)
or DbiError($cursor->err, $cursor->errstr);
# NUM_OF_FIELDS should be zero (Non-Select)
#
### Test 13
Test($state or ($cursor->{'NUM_OF_FIELDS'} == 0))
or !$verbose or printf("# NUM_OF_FIELDS is %s, not zero.\n",
$cursor->{'NUM_OF_FIELDS'});
#
### Test 14
Test($state or (undef $cursor) or 1);
#
# Test different flavours of quote. Need to work around a bug in
# DBI 1.02 ...
#
my $quoted;
if (!$state) {
$quoted = eval { $dbh->quote(0, DBI::SQL_INTEGER()) };
}
#
t/52nulls.t view on Meta::CPAN
# as undef, or something much more bizarre
#
#
### Test 4
Test($state or $dbh->do("INSERT INTO $table VALUES"
. " ( NULL, 'NULL-valued id' )"))
or DbiError($dbh->err, $dbh->errstr);
#
### Test 5
Test($state or $cursor = $dbh->prepare("SELECT * FROM $table"
. " WHERE " . IsNull("id")))
or DbiError($dbh->err, $dbh->errstr);
#
### Test 6
Test($state or $cursor->execute)
or DbiError($dbh->err, $dbh->errstr);
#
### Test 7
Test($state or ($rv = $cursor->fetchrow_arrayref) )
or DbiError($dbh->err, $dbh->errstr);
#
### Test 8
Test($state or (!defined($$rv[0]) and defined($$rv[1])) )
or DbiError($dbh->err, $dbh->errstr);
#
### Test 9
Test($state or $cursor->finish)
or DbiError($dbh->err, $dbh->errstr);
#
### Test 10
Test($state or undef $cursor || 1);
#
# Drop the test table.
#
#
### Test 11
Test($state or $dbh->do("DROP TABLE $table"))
or DbiError($dbh->err, $dbh->errstr);
t/53numrows.t view on Meta::CPAN
# number of rows affected by the statement will be returned.
#
#
### Test 4
Test($state or $dbh->do("INSERT INTO $table"
. " VALUES( 1, 'Thomas Wegner' )"))
or DbiError($dbh->err, $dbh->errstr);
#
### Test 5
Test($state or ($cursor = $dbh->prepare("SELECT * FROM $table"
. " WHERE id = 1")))
or DbiError($dbh->err, $dbh->errstr);
#
### Test 6
Test($state or $cursor->execute)
or DbiError($dbh->err, $dbh->errstr);
#
### Test 7
Test($state or ($numrows = $cursor->rows) == 1 or ($numrows == -1))
or ErrMsgF("Expected 1 rows, got %s.\n", $numrows);
#
### Test 8
Test($state or ($numrows = TrueRows($cursor)) == 1)
or ErrMsgF("Expected to fetch 1 rows, got %s.\n", $numrows);
#
### Test 9
Test($state or $cursor->finish)
or DbiError($dbh->err, $dbh->errstr);
#
### Test 10
Test($state or undef $cursor or 1);
#
### Test 11
Test($state or $dbh->do("INSERT INTO $table"
. " VALUES( 2, 'Ally McBeal' )"))
or DbiError($dbh->err, $dbh->errstr);
#
### Test 12
Test($state or ($cursor = $dbh->prepare("SELECT * FROM $table"
. " WHERE id >= 1")))
or DbiError($dbh->err, $dbh->errstr);
#
### Test 13
Test($state or $cursor->execute)
or DbiError($dbh->err, $dbh->errstr);
#
### Test 14
Test($state or ($numrows = $cursor->rows) == 2 or ($numrows == -1))
or ErrMsgF("Expected 2 rows, got %s.\n", $numrows);
#
### Test 15
Test($state or ($numrows = TrueRows($cursor)) == 2)
or ErrMsgF("Expected to fetch 2 rows, got %s.\n", $numrows);
#
### Test 16
Test($state or $cursor->finish)
or DbiError($dbh->err, $dbh->errstr);
#
### Test 17
Test($state or undef $cursor or 1);
#
### Test 18
Test($state or $dbh->do("INSERT INTO $table"
. " VALUES(3, 'Bart Simpson')"))
or DbiError($dbh->err, $dbh->errstr);
#
### Test 19
Test($state or ($cursor = $dbh->prepare("SELECT * FROM $table"
. " WHERE id >= 2")))
or DbiError($dbh->err, $dbh->errstr);
#
### Test 20
Test($state or $cursor->execute)
or DbiError($dbh->err, $dbh->errstr);
#
### Test 21
Test($state or ($numrows = $cursor->rows) == 2 or ($numrows == -1))
or ErrMsgF("Expected 2 rows, got %s.\n", $numrows);
#
### Test 22
Test($state or ($numrows = TrueRows($cursor)) == 2)
or ErrMsgF("Expected to fetch 2 rows, got %s.\n", $numrows);
#
### Test 23
Test($state or $cursor->finish)
or DbiError($dbh->err, $dbh->errstr);
#
### Test 24
Test($state or undef $cursor or 1);
#
# Drop the test table.
#
#
### Test 25
Test($state or $dbh->do("DROP TABLE $table"))
or DbiError($dbh->err, $dbh->errstr);
#