O'Reilly logo

CMS Made Simple Development Cookbook by Samuel Goldstein

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Creating and using a database sequence

In relational databases, tables almost always have a unique identifier for each row, known as the primary key. While there are occasional reasons to do otherwise, it's common practice to use an otherwise meaningless integer for this key. This unique identifier can be used for joining the table or for identifying a row when you perform an update.

When adding data to a database table, it is expected that you will provide a value for this key. So where do you get an integer value that you can rely on to be unique?

This recipe shows you how to use the ADOdb facility for creating unique integer sequences, and for getting values from the sequence.

How to do it...

  1. Create a module stub by any of the methods described ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required