Use of GenID() function

Talk about writing modules and plugins for CMS Made Simple, or about specific core functionality. This board is for PHP programmers that are contributing to CMSMS not for site developers
Locked
nervino
Power Poster
Power Poster
Posts: 448
Joined: Sun Dec 28, 2008 12:15 pm
Location: Roma, Italy

Use of GenID() function

Post by nervino »

Hi All,
I've noticed for a long time that modules use the GenID() function to pick up a new ID for a new item to be inserted in db.
Why? An auto-increment db field wouldn't be better?

Thanks for clarification
calguy1000
Support Guru
Support Guru
Posts: 8169
Joined: Tue Oct 19, 2004 6:44 pm
Location: Fernie British Columbia, Canada

Re: Use of GenID() function

Post by calguy1000 »

This is a historical thing.

Back when these modules were originally written, postgres did not support auto-increment fields.  Therefore a 'sequence' table had to be used.

But that problem is now solved, and most new development uses auto increment fields.

However, for compatibility reasons, and because 'if it aint broke don't fix it'.  we aren't going back to remove this stuff from existing code.
Follow me on twitter
Please post system information from "Extensions >> System Information" (there is a bbcode option) on all posts asking for assistance.
--------------------
If you can't bother explaining your problem well, you shouldn't expect much in the way of assistance.
nervino
Power Poster
Power Poster
Posts: 448
Joined: Sun Dec 28, 2008 12:15 pm
Location: Roma, Italy

Re: Use of GenID() function

Post by nervino »

I see.

Thank you!
Locked

Return to “Developers Discussion”