[ic] Possible bug with exporting userdb and saved carts in userdb.db!

Joachim Leidinger interchange-users@interchange.redhat.com
Mon Jan 21 10:12:01 2002


Hi list,

I get a big problem, if we can't solve the failure in the export
function of IC 4.8.3!
Anything is wrong with the save/set cart or export functions of IC. 
A wrong export of userdb.db will be wrong (file userdb.asc or
userdb.txt) and therefore the file userdb.db will be wrong later and we
lost users in wrong newest userdb (db or asc or txt) (more than 1000 of
ca. 1280 users). I've deactivate the cart functions in the basket and
I've removed all the saved carts from the backup file of userdb.db,
which is right (over 1280 users) and use it now. The script below works
only, if the userdb.db was not rebuilded by the auto import function of
IC. But I can't stay beside the file userdb.db all the time and use the
script to hold all my users.

The catalogs need the cart function, because user has to order a lot of
the same low-price items periodically.

Did anyone use the cart function with the database type "db" (not sql or
gdbm) with success and without any problem?

Thanks for the helps, hints and suggestions!

Joachim Leidinger


Joachim Leidinger wrote:
> 
> Hi list,
> 
> I noticed some misbehavior with my userdb.asc (using Interchange
> V4.8.3). In my catalog, user or customer can store the cart! If I use
> 
> [tag export userdb userdb.asc][/tag]
> 
> and userdb.db contains no carts, I get all accounts (currently more than
> 1280 users). But if there are a lot of carts in userdb.db and after
> using the above codes, I get only 700 or less users suddenly. Sometimes
> only 100 users! A little check with a perl script like
> 
> ------------ snipp ----------
> #!/usr/bin/perl
> use strict;
> use Fcntl;
> use DB_File;
> my $userdbfile =
> "/www/leidinger.local/ic48/catalogs/owkpa/products/userdb.db";
> my $outdatei =
> "/www/leidinger.local/ic48/catalogs/owkpa/products/expuserdb.asc";
> my $out =
> "code\tpassword\tName\tAnsprechpartner\tStrasse\tPLZ\tOrt\tR_Strasse\tR_PLZ\tR_Ort\tacl\ttime\ts_nickname\tname\taddress\tcity\tstate\tzip\tcountry\tphone_day\tmv_shipmode\tb_nickname\tb_name\tb_address\tb_city\tb_state\tb_zip\tb_country\tb_phone\tmv_credit_card_type\tmv_credit_card_exp_month\tmv_credit_card_exp_year\tmv_credit_card_info\tp_nickname\temail\tfax\tphone_night\tfax_order\taddress_book\taccounts\tpreferences\tcarts\towner\tfile_acl\tdb_acl\torder_numbers\temail_copy\tPreisgruppe\tNewsletter\tmod_time\n";
> sub LOCK_SH { 1 }
> sub LOCK_EX { 2 }
> sub LOCK_NB { 4 }
> sub LOCK_UN { 8 }
> my($fd, $db_obj, %ICDB_HASH, $KEY1, $count, $ecount);
> $db_obj = tie(%ICDB_HASH, 'DB_File', $userdbfile, O_CREAT|O_RDWR, 0644)
>   or die "dbcreat $userdbfile $!";
> $fd = $db_obj->fd;
> open(DB_FH, "+<&=$fd") or die "fdopen $!";
> unless (flock (DB_FH, LOCK_SH | LOCK_NB)) {
>   unless (flock (DB_FH, LOCK_SH)) { die "flock: $!" }
> }
> flock(DB_FH, LOCK_UN);
> unless (flock (DB_FH, LOCK_EX | LOCK_NB)) {
>   unless (flock (DB_FH, LOCK_EX)) { die "flock: $!" }
> }
> 
> my $line = '';
> foreach $KEY1 (keys %ICDB_HASH){
>   $count += 1;
>   $line = $ICDB_HASH{$KEY1};
>   $line =~ s/\n/\r/g;
>   my
> ($code,$password,$Name,$Ansprechpartner,$Strasse,$PLZ,$Ort,$R_Strasse,$R_PLZ,$R_Ort,$acl,$time,$s_nickname,$name,$address,$city,$state,$zip,$country,$phone_day,$mv_shipmode,$b_nickname,$b_name,$b_address,$b_city,$b_state,$b_zip,$b_country,$b_phone,$mv_credit_card_type,$mv_credit_card_exp_month,$mv_credit_card_exp_year,$mv_credit_card_info,$p_nickname,$email,$fax,$phone_night,$fax_order,$address_book,$accounts,$preferences,$carts,$owner,$file_acl,$db_acl,$order_numbers,$email_copy,$Preisgruppe,$Newsletter,$mod_time)
> = split(/\t/,$line);
>   if ($code !~ /code/){
>     $out .=
> "$code\t$password\t$Name\t$Ansprechpartner\t$Strasse\t$PLZ\t$Ort\t$R_Strasse\t$R_PLZ\t$R_Ort\t$acl\t$time\t$s_nickname\t$name\t$address\t$city\t$state\t$zip\t$country\t$phone_day\t$mv_shipmode\t$b_nickname\t$b_name\t$b_address\t$b_city\t$b_state\t$b_zip\t$b_country\t$b_phone\t$mv_credit_card_type\t$mv_credit_card_exp_month\t$mv_credit_card_exp_year\t$mv_credit_card_info\t$p_nickname\t$email\t$fax\t$phone_night\t$fax_order\t\t$accounts\t$preferences\t$carts\t$owner\t$file_acl\t$db_acl\t$order_numbers\t$email_copy\t$Preisgruppe\t$Newsletter\t$mod_time\n";
>   }
>     $ecount += 1;
> }
> undef $db_obj;
> untie %ICDB_HASH;
> close(DB_FH);
> 
> open (DATEI, ">$outdatei") or die "kann $outdatei nicht zum Lesen
> öffnen: $!";
> print DATEI $out;
> close(DATEI);
> 
> print "\n gezählt wurde $ecount Personen\n";
> ------------ snipp ----------
> 
> I get all my users and don't lost any user! What happen? What is the
> cause? Maybe the export function of IC are missing something like
> s/\n/\r/g for the field carts? Or why is my perl script working and the
> export function of IC not?
> 
> Any tips, helps and suggestions are very welcome!
> 
> Thanks!
> 
> Joachim Leidinger
> 
> --
> Hans-Joachim Leidinger | Dipl.-Phys.Ing. Entwicklung eCommerce
> [Hans-Joachim.leidinger@bpanet.de]
> Black Point Arts Internet Solutions GmbH
> http://www.bpanet.de
> _______________________________________________
> interchange-users mailing list
> interchange-users@interchange.redhat.com
> http://interchange.redhat.com/mailman/listinfo/interchange-users

-- 
Hans-Joachim Leidinger | Dipl.-Phys.Ing. Entwicklung eCommerce
[Hans-Joachim.leidinger@bpanet.de]
Black Point Arts Internet Solutions GmbH
http://www.bpanet.de