[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[ic] Help with Postgres


Hi list,
I am finishing a e-commerce site, the very last thing to do, is what my client calls, the mark up protection. This is a way to protect catalog, from changing the price for the products in the admin interface. So the way to do this is making a trigger. but now the trigger is not allowing the catalog to take orders. Can any one help me with either the trigger, or a better way to do the protection.

Any comment are welcome...

The trigge for postgres 7.2 and IC 5.2:

CREATE FUNCTION price_verify () RETURNS OPAQUE AS'
DECLARE
$7 TEXT;
$21 FLOAT;
BEGIN
SELECT INTO $7 sku FROM products WHERE sku = new.sku;
IF NOT FOUND THEN RAISE EXCEPTION ''NO PRODUCT FOUND'';
END IF;
SELECT INTO $21 price FROM products WHERE sku = new.sku;
IF price > new.price THEN RAISE EXCEPTION ''INVALID PRICE'';
END IF;
RETURN NEW;
'LANGUAGE 'plpgsql';

CREATE TRIGGER mark_up_protection
BEFORE UPDATE
ON orderline
FOR EACH ROW
EXECUTE PROCEDURE
price_verify();

But now with the trigger I get the following error:
(log_orderline_table): There was an error adding the items to the orderline table: DBD::Pg::st execute failed: ERROR: syntax error at or near "" at /home/interchange/server/lib/Vend/Table/DBI.pm line 1626.

Thanks you all for you time, this is a great list. BTW I have written a small article with some of the wierd stuff that we had to implement for this catalog, you can find it here:
http://www.ingenian.com/modules.php?name=News&file=article&sid=12
Pictures are missing, but I will correct that later today.

Thanks to all,
Daniel Castro
Junior Developer
Ingenian Software LLC

_________________________________________________________________
FREE pop-up blocking with the new MSN Toolbar - get it now! http://toolbar.msn.click-url.com/go/onm00200415ave/direct/01/

_______________________________________________
interchange-users mailing list
suppressed
http://www.icdevgroup.org/mailman/listinfo/interchange-users


Mail converted by mhonarc 2.6.15
This archive provided courtesy of JSW4.NET, Internet Hosting Services for Small Business.