GSP
Quick Navigator

Search Site

Unix VPS
A - Starter
B - Basic
C - Preferred
D - Commercial
MPS - Dedicated
Previous VPSs
* Sign Up! *

Support
Contact Us
Online Help
Handbooks
Domain Status
Man Pages

FAQ
Virtual Servers
Pricing
Billing
Technical

Network
Facilities
Connectivity
Topology Map

Miscellaneous
Server Agreement
Year 2038
Credits
 

USA Flag

 

 

Man Pages
SQLEngine::Driver::NullP(3) User Contributed Perl Documentation SQLEngine::Driver::NullP(3)

DBIx::SQLEngine::Driver::NullP - Extends SQLEngine for Simple Testing

DBI Wrapper: Adds methods to a DBI database handle.

  my $sqldb = DBIx::SQLEngine->new( 'dbi:NullP:' );

Testing Subclass: To allow basic framework testing.

  $sqldb->next_result(
    rowcount => 1,
    hashref => [ { id => 201, name => "Dave Jones" } ],
  );
  
  my $rows = $sqldb->fetch_select( 
    table => 'students' 
  );
  
  ok( $sqldb->last_query, 'select * from students' );
  ok( scalar @$rows == $sqldb->last_result->{rowcount} );

This package provides a subclass of DBIx::SQLEngine which works with the DBI's DBD::NullP to provide a simple testing capability. See the "t/null.t" test script for a usage example.

Queries using the NullP driver and subclass keep track of the SQL statements that are executed against them, allowing a simple way of checking whether the SQL generation code is working as expected. You can also provide raw results to be returned by the next query, in order to confirm that other aspects of the result processing are operational.

To simulate normal driver operation, before executing your query, load the results you would expect to receive using next_result, and afterwards confirm that the SQL statement and parameters used matched what you expected.
next_result()
  $sqldb->next_result( 
    rowcount => $number, 
    hashref => $array_of_hashes, 
    arrayref => $array_of_arrays, 
    columns => $array_of_hashes,
  )
    

Sets up the values that will be returned by the next query.

last_query()
  $sqldb->last_query() : $statement_and_params
    

Returns the most recent query and parameters captured by prepare_execute(). Parameters are joined by "/" characters.

last_result()
  $sqldb->last_result() : $result_hash_ref
    

Returns the values set with next_result() and used by the most recent query.

prepare_execute()
  $sqldb->prepare_execute ($sql, @params) : $sth
    

Captures the statement and parameters that would otherwise have been sent to the Null driver to be used for later reporting by last_query().

done_with_query()
  $sqldb->done_with_query ($sth) : ()
    

Clears the values stored by next_result.

get_execute_rowcount()
  $sqldb->get_execute_rowcount ($sth) : $row_count
    

Returns the value stored by next_result() using the key "rowcount".

fetchall_hashref()
  $sqldb->fetchall_hashref ($sth) : $array_of_hashes
    

Returns the value stored by next_result() using the key "hashref".

fetchall_hashref_columns()
  $sqldb->fetchall_hashref ($sth) : $array_of_hashes
  $sqldb->fetchall_hashref ($sth) : ( $array_of_hashes, $column_info )
    

Returns the value stored by next_result() using the key "hashref", and if called in a list context, also returns the value for the key "columns".

fetchall_arrayref()
  $sqldb->fetchall_arrayref ($sth) : $array_of_arrays
    

Returns the value stored by next_result() using the key "arrayref".

fetchall_arrayref_columns()
  $sqldb->fetchall_hashref ($sth) : $array_of_arrays
  $sqldb->fetchall_hashref ($sth) : ( $array_of_arrays, $column_info )
    

Returns the value stored by next_result() using the key "arrayref", and if called in a list context, also returns the value for the key "columns".

retrieve_columns()
  $sqldb->retrieve_columns ($sth) : $column_info
    

Retrieves the value stored by next_result() using the key "columns".

visitall_hashref()
  $sqldb->visitall_hashref ($sth, $coderef) : ()
    

Uses the value stored by next_result() using the key "hashref". Calls the coderef on each row with values as a hashref, and returns a list of their results.

visitall_array()
  $sqldb->visitall_array ($sth, $coderef) : ()
    

Uses the value stored by next_result() using the key "arrayref". Calls the coderef on each row with values as a list, and returns a list of their results.

See DBIx::SQLEngine for the overall interface and developer documentation.

See DBIx::SQLEngine::Docs::ReadMe for general information about this distribution, including installation and license information.

2004-11-13 perl v5.32.1

Search for    or go to Top of page |  Section 3 |  Main Index

Powered by GSP Visit the GSP FreeBSD Man Page Interface.
Output converted with ManDoc.