From 1fd9dbb92177229303c3b65bdd562f0cbc2a6994 Mon Sep 17 00:00:00 2001 From: Kenichi Ishigaki Date: Wed, 6 May 2009 08:59:43 +0000 Subject: [PATCH] DBD-SQLite: fixed pod to use installed methods --- lib/DBD/SQLite.pm | 24 ++++++++++++++---------- 1 file changed, 14 insertions(+), 10 deletions(-) diff --git a/lib/DBD/SQLite.pm b/lib/DBD/SQLite.pm index 29585e3..045e01b 100644 --- a/lib/DBD/SQLite.pm +++ b/lib/DBD/SQLite.pm @@ -518,7 +518,11 @@ Defining the column type as C in the DDL is B sufficient. =head1 DRIVER PRIVATE METHODS -=head2 $dbh->func('last_insert_rowid') +The following methods can be called via the func() method with a little tweak, but the use of func() method is now discouraged by the L author for various reasons (see L for details). So, if you're using L >= 1.608, use these C methods. If you need to use an older L, you can call these like this: + + $dbh->func( ..., "(method name without sqlite_ prefix)" ); + +=head2 $dbh->sqlite_last_insert_rowid() This method returns the last inserted rowid. If you specify an INTEGER PRIMARY KEY as the first column in your table, that is the column that is returned. @@ -530,17 +534,17 @@ method instead. The usage of this is: $h->last_insert_id($catalog, $schema, $table_name, $field_name [, \%attr ]) Running C<$h-Elast_insert_id("","","","")> is the equivalent of running -C<$dbh-Efunc('last_insert_rowid')> directly. +C<$dbh-Esqlite_last_insert_rowid()> directly. -=head2 $dbh->func('busy_timeout') +=head2 $dbh->sqlite_busy_timeout() Retrieve the current busy timeout. -=head2 $dbh->func( $ms, 'busy_timeout' ) +=head2 $dbh->sqlite_busy_timeout( $ms ) Set the current busy timeout. The timeout is in milliseconds. -=head2 $dbh->func( $name, $argc, $code_ref, "create_function" ) +=head2 $dbh->sqlite_create_function( $name, $argc, $code_ref ) This method will register a new function which will be useable in an SQL query. The method's parameters are: @@ -566,13 +570,13 @@ This should be a reference to the function's implementation. For example, here is how to define a now() function which returns the current number of seconds since the epoch: - $dbh->func( 'now', 0, sub { return time }, 'create_function' ); + $dbh->sqlite_create_function( 'now', 0, sub { return time } ); After this, it could be use from SQL as: INSERT INTO mytable ( now() ); -=head2 $dbh->func( $name, $code_ref, "create_collation" ) +=head2 $dbh->sqlite_create_collation( $name, $code_ref ) This method will register a new function which will be useable in an SQL query as a COLLATE option for sorting. The method's parameters are: @@ -622,7 +626,7 @@ is to set the parameter at connection time : } ); -=head2 $dbh->func( $name, $argc, $pkg, 'create_aggregate' ) +=head2 $dbh->sqlite_create_aggregate( $name, $argc, $pkg ) This method will register a new aggregate function which can then be used from SQL. The method's parameters are: @@ -706,7 +710,7 @@ Here is a simple aggregate function which returns the variance return $sigma; } - $dbh->func( "variance", 1, 'variance', "create_aggregate" ); + $dbh->sqlite_create_aggregate( "variance", 1, 'variance' ); The aggregate function can then be used as: @@ -716,7 +720,7 @@ The aggregate function can then be used as: For more examples, see the L. -=head2 $dbh->func( $n_opcodes, $code_ref, 'progress_handler' ) +=head2 $dbh->sqlite_progress_handler( $n_opcodes, $code_ref ) This method registers a handler to be invoked periodically during long running calls to SQLite.