MiniVend Akopia Services

[Date Prev][Date Next][Thread Prev][Thread Next][Minivend by date ][Minivend by thread ]

RE: pulling credit card info - exporting databases



******    message to minivend-users from Frank Miedreich <miedreich@acm.org>     ******

>******    message to minivend-users from Ryan Hertz <rhertz@gyb.baits.com>
>******
>
>At 02:21 PM 3/31/99 , Thompson-Jordan wrote:
>>******    message to minivend-users from "Thompson-Jordan"
><Thompson-Jordan@mindspring.com>     ******
>>
>>Check out [tag export ...][/tag]. It's in the documentation in the section
>>"Databases" under "Exporting from a database".
>>
>>On this same subject. Is there a way to export DB and GDBM databases on
>>the Unix command line? I don't use an AdminPage and would like to
>>administer the databases in Unix. (I'm sure someone will tell me it's in
>>the DB and GDBM docs in the section "Databases" under "Exporting from a
>>database" :-).
>
>	As a matter of fact....  it probably isn't covered. :-)  You could
>try and
>find the code inside Minivend and re-write a little Perl script if you were
>hacking inclined.
>
>>
>>Christopher Thompson
>>
>
>
This is a small script to export a .db database:
call with databasename and name of code field as parameter,
prints tab delimited to stdout.


Greetings, frank


#!/usr/bin/perl -w
use strict ;
use DB_File ;
use vars qw( %h $k $v ) ;

my $database = shift(@ARGV);
my $code = shift(@ARGV) || 'code';
my @data;
my $header;

tie %h, "DB_File", $database, O_RDWR, 0640, $DB_HASH or die "Cannot open
file: $!\n";

while (($k, $v) = each %h)
{
	$k=~s/^.//;
	if ($k) {
		push @data, "$k\t$v\n"
	}
	else {
		$header= "$code\t$v\n"
	}
}
untie %h;

print $header;
foreach (sort @data) {
	print
}


--
Frank Miedreich
Max-Planck-Institut fuer psychologische Forschung


-
To unsubscribe from the list, DO NOT REPLY to this message.  Instead, send
email with 'UNSUBSCRIBE minivend-users' in the body to Majordomo@minivend.com.
Archive of past messages: http://www.minivend.com/minivend/minivend-list


Search for: Match: Format: Sort by: