[Date Prev][Date Next][Thread Prev][Thread Next][Minivend by date
][Minivend by thread
]
Re: Database Administration
****** message to minivend-users from Frank Miedreich <miedreich@acm.org> ******
> Hi Everyone, I have 2 questions regarding Database Administration:
1) I have it set up so that my clients can add/edit products from a
password protected form. Is there a way to have MV auto-increment a
part-number, if they so desire, for the next part they add? Another
application of this may be if you were trying to do some type of message
board using MV, and wanted it to assign a part-number, as opposed to having
the user enter one.
2) Is there a way to add or delete items from the command line? If
there is not, we have missed one of the most powerful functions of Linux
and that would be a great addition to 3.12 when it is released. If there
is already a way to do it, how do you, and what is the syntax. Thank you
very much, and Happy Presidents Day Weekend, Brian brian@purenetfx.com
Yet another HTML formatted email...
Please note:
- Reading email, I do not use a Microsoft product or a web browser.
- I am happy with the font size I have set, thank you. There is no need for
you to suggest a different one, the same goes for font color and background
color.
1: Counter
Put this into your minivend.cfg:
UserTag counter hasEndTag 0
UserTag counter Interpolate 1
UserTag counter Order name inc
UserTag counter Routine <<EOF
sub {
my ($name, $inc) = @_;
$File::CounterFile::DEFAULT_DIR = $Vend::Cfg->{'VendRoot'};
my $c = new File::CounterFile "etc/$name".'.counter', "0";
my $number = $inc?$c->inc:$c->value;
undef $c;
return $number;
}
EOF
Access from withing minivend pages:
[counter name="counter_name" inc=1]
This will return the increment of the counter named "counter_name".
[counter name="counter_name"]
This will return the current value of the counter named "counter_name".
2: Is there anything wrong with vi?
Unless you specifically disable importing the products.asc file, or any
other database source for that matter, minivend will automagically reimport
the database when it changes. Editing a textfile is not one of the most
powerful functions of linux.
If you allow editing via the web (which changes the db or whatever you use)
and the command line (changing the db source) at the same time, you may run
into interesting consistency problems of course. This could be resolved by
creating a file with changes to the database, incorporating the execution
of the change-file into the reconfig script, and creating an admin page
that exports the database and then executes reconfig.
Another way may be to implement a locking scheme.
Frank
--
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