Skip site navigation (1)Skip section navigation (2)

FreeBSD Manual Pages

  
 
  

home | help
SQLEngine::Driver::NulUser)Contributed Perl DocumenSQLEngine::Driver::NullP(3)

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

SYNOPSIS
       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} );

DESCRIPTION
       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.

TESTING	INTERFACE
       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.

INTERNAL STATEMENT METHODS (DBI	STH)
   Statement Handle Lifecycle
       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.

   Retrieving Rows from	a Statement
       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 ALSO
       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.

perl v5.32.1			  2004-11-13	   SQLEngine::Driver::NullP(3)

NAME | SYNOPSIS | DESCRIPTION | TESTING INTERFACE | INTERNAL STATEMENT METHODS (DBI STH) | SEE ALSO

Want to link to this manual page? Use this URL:
<https://www.freebsd.org/cgi/man.cgi?query=DBIx::SQLEngine::Driver::NullP&sektion=3&manpath=FreeBSD+13.0-RELEASE+and+Ports>

home | help