Gossamer Forum
Home : Products : Gossamer Links : Version 1.x :

dbsql.pm question

Quote Reply
dbsql.pm question
hi,
i read the mini guide on dbsql.pm and i have one question
remaining. we want to update our database for products we
are selling through a web-shop. there are now more than 37000 products and we get our different tables with new - update and to be deleted products. it would be no problem to delete and modify the products with a small .cgi - script but i wonder if it possible to add a product with a determined id we want to keep. for example some products are new in the database but should be in the range of 50-100 and not added at the end of somewhere where we had the last id+1.

thanks

niko

http://www.master-productions.com
Quote Reply
Re: dbsql.pm question In reply to
Hmm...if I understand you correctly, it seems that you would have to edit the db_track codes in the sub add_record routine. You would have to find a way to identify a range of IDS and rather than increment by 1, increment by 10 or a 100 depending on the range of IDs you are seeking to use.

Regards,

Eliot Lee

Quote Reply
Re: dbsql.pm question In reply to
not exactly. we have different tables from the companies
where we buy our products. we want to keep their ids and so
it could be possible that we want to add a product with
ID 1542 but we already have ID 5000000 in use. The point is
I want to write a small script which checks if a flag says
add delete or modify. delete or modify is quite simple.
If I want to add 1542 I have a problem becaus there will be
an automatic created ID No 5000001 and I would have to change it to 1542.

Cheers

Niko

http://www.master-productions.com
Quote Reply
Re: dbsql.pm question In reply to
Don't use "add" record, use "do->("insert...") syntax.

If you want to use the DBSQL.pm to check your records, and get all the benefits, grab your ID, then do an INSERT for a blank record.

Then, use that same ID (make sure to check for a valid return code) and use the update_record call on that blank record.

Make sense??

DBSQL.pm auto-generates the ID #, but MySQL lets you INSERT any ID into an AutoIncrement field that does not already exist. You just need to bypass DBSQL.pm's auto insert features to create the record, then just use it to modify it.



PUGDOGŪ
PUGDOGŪ Enterprises, Inc.
FAQ: http://postcards.com/FAQ


Quote Reply
Re: dbsql.pm question In reply to
Thanks for the suggestion, pugdog...that helps for one of the scripts I am working on.

Regards,

Eliot Lee