For most situations, the format of the $name parameter to db_next_id($name) should be: {sometable}_someid.

This rule is followed by all calls to db_next_id() in core, and part of contrib. However, there are many contributed modules using the non-prefixed form: sometable_someid instead, which can cause issues on multisites.

This should be documented on the API page for db_next_id().

Comments

webchick’s picture

Project: Documentation » Drupal core
Version: » x.y.z
Component: Documentation in CVS » database system
Assigned: Unassigned » webchick
Category: bug » task
Status: Active » Needs review
StatusFileSize
new3.46 KB

Yes, it should. Thanks for catching this.

webchick’s picture

StatusFileSize
new1.57 KB

Oops. That included a completely different thing.

drumm’s picture

Version: x.y.z » 5.x-dev
Status: Needs review » Needs work

The examples should have single quotes.

fgm’s picture

StatusFileSize
new1.57 KB

Changed quotes to single.

morbus iff’s picture

Status: Needs work » Reviewed & tested by the community
keith.smith’s picture

Status: Reviewed & tested by the community » Needs review
StatusFileSize
new1.61 KB

Modified the patch in #4 such that both examples of db_next_id calls in the comments used single quotes, and added "curly" before the word brackets as well, per http://en.wikipedia.org/wiki/Bracket which states, in part:

"Presumably due to the similarity of the words brace and bracket (although they do not share an etymology), many people casually treat brace as a synonym for bracket. Therefore, when it is necessary to avoid any possibility of confusion, such as in computer programming, it may be best to use the term curly bracket rather than brace. However, general usage in North American English favours the latter form. The term curly braces is redundant since no other type of brace exists. Indian programmers often use the name "flower bracket"."

RobRoy’s picture

Status: Needs review » Reviewed & tested by the community

Looks good to me.

RobRoy’s picture

Status: Reviewed & tested by the community » Needs work

Oops, think we're missing mysqli docs.

keith.smith’s picture

Status: Needs work » Needs review
StatusFileSize
new2.4 KB

...and comments copied to equivalent position within database.mysqli.inc....

dries’s picture

Status: Needs review » Fixed

Committed to CVS HEAD. Thanks.

Anonymous’s picture

Status: Fixed » Closed (fixed)