On 7/4/06, [EMAIL PROTECTED] <[EMAIL PROTECTED]> wrote:

Hello List,

I have a working informix environment with DBI and DBD::Informix. (see
details for version, configuration below).

I do have the problem that I cannot get the serial after a insert
statement is executed.
I always get '0' back. In the database each inserted record gets a unique
number assigned.

Why?



I'm not clear why you are running into a problem.   Tielman asked about the
table schema; the most interesting question would be whether the serial
column is actually a SERIAL8.  That would account for the problem; it seems
unlikely though.

Thanks for including the configuration information.  Your Perl is clearly a
32-bit version, but the ESQL/C version you quote is 64-bit (because of the F
in  2.90.FC4).  You can't be using that - or, if you are really sure that
you are, you need to explain to me how you did it, because I've made others
get consistent all 32-bit or all 64-bit setups.

The DB-Access version says 9.21.UC6 - that's a surrogate for the version of
the server.  Are you really still using IDS 9.21?  You should be on 9.40, if
not 10.00.  Your CSDK and ESQL/C versions are current; your database engine
is very old.

The code is as follows:
----------------------------------------------------------

# Vorbereiten des DBI/DBD::Informix Einfüge-Statements für das Importieren
der Daten in die Informix-Datenbank
(my $sth = $dbh->prepare("INSERT INTO stammdatenkundeninfo (uid,
firstname, lastname, formofaddress, title, email, phone, mobile, fax,
company, orgshort, orglong, costcenter, type, nameaffix, room, building,
street, postalcode, country, status) VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?,
?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?)"))
  or die "${spacer_two}\nFehler: Vorbereiten des DBI/DBD::Informix
Einfüge-Statements gescheitert -". $dbh->errstr() ."\n${spacer_two}\n";

(my $sth_upd = $dbh->prepare("Update stammdatenkundeninfo SET requestid =
? WHERE id = ?"))
  or die "${spacer_two}\nFehler: Vorbereiten des DBI/DBD::Informix
Update-Statements gescheitert -". $dbh->errstr() ."\n${spacer_two}\n";

# Durchlaufen der einzelnen Zeilen der CSV-Datei bis keine mehr da ist
my $anzahl=0;
while ($csv->get_row()) {

  # Zuweisen der einzelnen Inhalte der aktuellen Zeile zu Variablen
  (my $user_id, $first_name, $lastname, $form_of_adress, $title, $email,
$phone, $mobile, $fax, $company, $orgshort, $orglong, $costcenter, $type,
$nameaffix, $room, $building, $street, $postalcode, $country) =
$csv->extract("User ID","First Name","Last Name","Form of
Address","Title","E-Mail","Telephone","Mobile","Fax","Company","OrgShort","OrgLong","Cost
Center","Type of Employement", "Name affix", "Room", "Building", "Street",
"Postal Code", "Country")
   or warn "${spacer_two}\nWarnung: Probleme beim Zuweisen der Spalten des
CSV-Datensatz zu Variablen - ${!}\n${spacer_two}\n";


  # Ausführen des DBI/DBD::Informix Einfüge-Statements mit den
vorbereitenen Variablen
  $@ ='';
  eval{
   $sth->execute($user_id, $first_name, $lastname, $form_of_adress,
$title, $email, $phone, $mobile, $fax, $company, $orgshort, $orglong,
$costcenter, $type, $nameaffix, $room, $building, $street, $postalcode,
$country, "imported");
  };
  # Fehlerbehandlung
  if ($@){
   die "${spacer_two}\nFehler: Import des Datensatzes mit der User-ID
\"${user_id}\" ist gescheitert -". $dbh->errstr() ."\n${spacer_two}\n";
  }
  else{
   my $id = $sth->{ix_sqlerrd}[1];
   printf ILOG "<%6s> %s (DB-ID: %10s)\n", $anzahl, "Import des
Datensatzes mit der User-ID \"${user_id}\" war erfolgreich.", $id;
   $anzahl++;

   $sth_upd->execute($id, $id) or die "Update: $!";
  }

}

----------------------------------------------------------







Bugreport-Info:

perl -V
---------------------------------------
Summary of my perl5 (revision 5 version 8 subversion 7) configuration:
  Platform:
    osname=solaris, osvers=2.8, archname=sun4-solaris
    uname='sunos solaris 5.8 generic_108528-11 sun4u sparc sunw,ultra-5_10
'
    config_args='-Dcc=gcc -B/usr/ccs/bin/'
    hint=recommended, useposix=true, d_sigaction=define
    usethreads=undef use5005threads=undef useithreads=undef
usemultiplicity=undef
    useperlio=define d_sfio=undef uselargefiles=define usesocks=undef
    use64bitint=undef use64bitall=undef uselongdouble=undef
    usemymalloc=n, bincompat5005=undef
  Compiler:
    cc='gcc -B/usr/ccs/bin/', ccflags ='-fno-strict-aliasing -pipe
-I/usr/local/include -D_LARGEFILE_SOURCE -D_FILE_OFFSET_BITS=64',
    optimize='-O',
    cppflags='-fno-strict-aliasing -pipe -I/usr/local/include'
    ccversion='', gccversion='3.3.2', gccosandvers='solaris2.8'
    intsize=4, longsize=4, ptrsize=4, doublesize=8, byteorder=4321
    d_longlong=define, longlongsize=8, d_longdbl=define, longdblsize=16
    ivtype='long', ivsize=4, nvtype='double', nvsize=8, Off_t='off_t',
lseeksize=8
    alignbytes=8, prototype=define
  Linker and Libraries:
    ld='gcc -B/usr/ccs/bin/', ldflags =' -L/usr/local/lib '
    libpth=/usr/local/lib /usr/lib /usr/ccs/lib
    libs=-lsocket -lnsl -ldl -lm -lc
    perllibs=-lsocket -lnsl -ldl -lm -lc
    libc=/lib/libc.so, so=so, useshrplib=false, libperl=libperl.a
    gnulibc_version=''
  Dynamic Linking:
    dlsrc=dl_dlopen.xs, dlext=so, d_dlsymun=undef, ccdlflags=' '
    cccdlflags='-fPIC', lddlflags='-G -L/usr/local/lib'


Characteristics of this binary (from libperl):
  Compile-time options: USE_LARGE_FILES
  Built under solaris
  Compiled at Dec  2 2005 01:34:16
  @INC:
    /usr/local/lib/perl5/5.8.7/sun4-solaris
    /usr/local/lib/perl5/5.8.7
    /usr/local/lib/perl5/site_perl/5.8.7/sun4-solaris
    /usr/local/lib/perl5/site_perl/5.8.7
    /usr/local/lib/perl5/site_perl/5.6.1
    /usr/local/lib/perl5/site_perl


esql -v
---------------------------------------
IBM Informix CSDK Version 2.90, IBM Informix-ESQL Version 2.90.FC4
Software Serial Number AAA#B000000

dbaccess -V
----------------------------------------
DB-Access Version 9.21.UC6
Software Serial Number AAD#J179567


Govinda Pfister
Remedy Approved Consultant, Clarify Certified Consultant, ITIL-Certified

Projectcenter Business Process Solutions
Solution & Service Center Business Enabling Solutions
Global Competence Center
T-Systems Enterprise Services GmbH
Memmelsdorfer Str. 209a, 96052 Bamberg
+49 951 4097-161 (Tel)
+49 951 4097-200 (Fax)
E-Mail: Govinda.Pfister <mailto:[EMAIL PROTECTED]> @
t-systems.com
Internet:  <http://www.t-systems.com/> http://www.t-systems.com









--
Jonathan Leffler <[EMAIL PROTECTED]>  #include <disclaimer.h>
Guardian of DBD::Informix - v2005.02 - http://dbi.perl.org
"I don't suffer from insanity - I enjoy every minute of it."

Reply via email to