Permalink
Browse files

better documentation for last_insert_id

  • Loading branch information...
1 parent 0858e72 commit 91cd318877bd5468263c251917c4f1969fae84b0 Matias Alejo Garcia committed May 15, 2012
Showing with 16 additions and 7 deletions.
  1. +4 −4 Makefile
  2. +12 −3 lib/SQL/Bibliosoph.pm
View
@@ -1,7 +1,7 @@
# This Makefile is for the SQL::Bibliosoph extension to perl.
#
# It was generated automatically by MakeMaker version
-# 6.59 (Revision: 65900) from the contents of
+# 6.58 (Revision: 65800) from the contents of
# Makefile.PL. Don't edit this file, edit Makefile.PL instead.
#
# ANY CHANGES MADE HERE WILL BE LOST!
@@ -137,8 +137,8 @@ PERM_RW = 644
PERM_RWX = 755
MAKEMAKER = /opt/local/lib/perl5/5.10.1/ExtUtils/MakeMaker.pm
-MM_VERSION = 6.59
-MM_REVISION = 65900
+MM_VERSION = 6.58
+MM_REVISION = 65800
# FULLEXT = Pathname for extension directory (eg Foo/Bar/Oracle).
# BASEEXT = Basename part of FULLEXT. May be just equal FULLEXT. (eg Oracle)
@@ -205,7 +205,7 @@ PM_TO_BLIB = lib/SQL/Bibliosoph/Dummy.pm \
# --- MakeMaker platform_constants section:
-MM_Unix_VERSION = 6.59
+MM_Unix_VERSION = 6.58
PERL_MALLOC_DEF = -DPERL_EXTMALLOC_DEF -Dmalloc=Perl_malloc -Dfree=Perl_mfree -Drealloc=Perl_realloc -Dcalloc=Perl_calloc
View
@@ -10,7 +10,7 @@ package SQL::Bibliosoph; {
use SQL::Bibliosoph::Query;
use SQL::Bibliosoph::CatalogFile;
- our $VERSION = "2.45";
+ our $VERSION = "2.46";
has 'dbh' => ( is => 'ro', isa => 'DBI::db', required=> 1);
@@ -417,8 +417,8 @@ package SQL::Bibliosoph; {
/^INSERT/ && do {
# Returns
- # scalar : last_insert_id
- # array : (last insert_id, row_count)
+ # scalar : last_insert_id (only mysql)
+ # array : (last insert_id (only mysql), row_count)
# do
*$name = sub {
@@ -593,6 +593,15 @@ SQL::Bibliosoph - A SQL Statements Library
# Usefull when no primary key is defined
my ($dummy_last_insert_id, $total_inserted) = $bs->insert_person($name,$age);
+ Note that last_insert_id is only returned when using MYSQL (undef in other case).
+ When using other engine you need to call an other query to get the last value.
+ For example, in ProgreSQL you can define:
+
+ --[ LAST_VAL ]
+ SELECT lastval()
+
+ and then call LAST_VAL after an insert.
+
# Updating some rows
# Query:

0 comments on commit 91cd318

Please sign in to comment.