[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 mikeh@minivend.com ******
Quoting Frank Miedreich (miedreich@acm.org):
> >>
> >>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
> }
>
This will work until you switch to Storable, as indeed MiniVend stores
a tab-delimited record in a versions prior to MV3.12beta8.
You can actually use a series of password-protected MiniVend pages
to do something like this. If you have loaded the recommended
LWP libraries, you get a little gem of an executable called GET, which
is a simple URL getter. But it has some nice features....
GET -C minivend:nevairbe http://localhost:7786/simple/protected/export
This will perform a get with the appropriate auth info. (Of course
the password is the default one that I put in the distribution.)
Run these shell commands:
# CATALOG_DIR is where your catalog is
cd CATALOG_DIR
mkdir pages/protected
# protect the directory
echo something > pages/protected/.access
# create a page
cat <<EOF > pages/protected/export.html
[new]
Exporting products at
[tag op=time send=1][/tag] --> [tag export products][/tag]
EOF
That will create a little page and protect it from anyone except
the RemoteUser with the right Password. Then run the GET command
above.
This type of thing is also very nice for building lists from large
databases or for heavily trafficked catalogs; those can get slow if you
do it on the fly every time. A cron job that does it every so often and
reads the results with [include file] is kind of nice. Other possible uses:
- generating static pages for search engines
- updating specials or ads
- indexing
I had toyed with the idea of a MiniVend "cron" that would perform
scheduled tasks and decided that this facility in combination with
some documenation would work just as well. I use it all the time
myself.
--
Mike Heins http://www.minivend.com/ ___
Internet Robotics |_ _|____
If you like what you're gettin', 131 Willow Lane, Floor 2 | || _ \
keep doin' what you're doin'. Oxford, OH 45056 | || |_) |
-- Hector <mikeh@minivend.com> |___| _ <
513.523.7621 FAX 7501 |_| \_\
-
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