[Date Prev][Date Next][Thread Prev][Thread Next][Minivend by date
][Minivend by thread
]
Re: SQL product database with other table name
Quoting Stefan Hornburg (racke@ecoservice.de):
> ****** message to minivend-users from Stefan Hornburg <racke@ecoservice.de> ******
>
>
> Hello, MiniVendors !
>
> For www.materialboerse.de I struggled to mate MiniVend with a SQL product
> database. The table name is component, not products. I patched
> MiniVend. I don't know if I overlooked a more simple or elegant
> solution, but the best way I found is the following:
Actually, there is an undocumented directive called Replace which
does essentially the same thing.
Replace ProductFiles
ProductFiles component
Replace Database
Database .....
But you have shamed me into updating MiniVend 3.15 to handle any
name as a products file. 8-) There should be absolutely no dependencies
on that anymore unless you define the Global directive "Legacy Yes".
I have probably been trying too hard to maintain backwards compatibility,
though I am sure there are those that appreciate that as well.
---------------------------------------------------------------------
>
> MiniVend patch:
> ---------------------------------------------------------------------
> diff -u -r1.1.1.2 -r1.2
> --- lib/Vend/Data.pm 1999/08/09 19:40:19 1.1.1.2
> +++ lib/Vend/Data.pm 1999/08/13 10:30:46 1.2
> @@ -371,9 +371,13 @@
> my($type, $internal_query, $query, $msql, $table, $list) = @_;
> my ($db);
> - $table = 'products' unless defined $table;
> - $db = $Vend::Database{$table}
> - or die "dbi_query: unknown base table $table.\n";
> + if (defined $table) {
> + $db = $Vend::Database{$table}
> + or die "dbi_query: unknown base table $table.\n";
> + } else {
> + # use (first) product database as default
> + $db = $Vend::Productbase[0];
> + }
> $db = $db->ref();
> $type = lc $type;
> ---------------------------------------------------------------------
>
I implemented this as well, except with this patch:
> my($type, $internal_query, $query, $msql, $table, $list) = @_;
> my ($db);
> - $table = 'products' unless defined $table;
> + $table = $Vend::Cfg->{ProductFiles}[0] unless defined $table;
> $db = $Vend::Database{$table}
> or die "dbi_query: unknown base table $table.\n";
> $db = $db->ref();
I also made changes that will prevent failure of the searches when
there is no "products.asc" and no "MV_DEFAULT_SEARCH_FILE".
--
Mike Heins http://www.minivend.com/ ___
Internet Robotics |_ _|____
131 Willow Lane, Floor 2 | || _ \
It's a little-known fact Oxford, OH 45056 | || |_) |
that the Y1K problem caused <mikeh@minivend.com> |___| _ <
the Dark Ages. -- unknown 513.523.7621 FAX 7501 |_| \_\