Download & Extend

Doc for db_next_id should mention braces

Project:Drupal core
Version:5.x-dev
Component:database system
Category:task
Priority:normal
Assigned:webchick
Status:closed (fixed)

Issue Summary

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

#1

Project:Documentation» Drupal core
Version:<none>» x.y.z
Component:Documentation in CVS» database system
Category:bug report» task
Assigned to:Anonymous» webchick
Status:active» needs review

Yes, it should. Thanks for catching this.

AttachmentSizeStatusTest resultOperations
db_next_id.patch3.46 KBIgnored: Check issue status.NoneNone

#2

Oops. That included a completely different thing.

AttachmentSizeStatusTest resultOperations
db_next_id_0.patch1.57 KBIgnored: Check issue status.NoneNone

#3

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

The examples should have single quotes.

#4

Changed quotes to single.

AttachmentSizeStatusTest resultOperations
db_next_id_1.patch1.57 KBIgnored: Check issue status.NoneNone

#5

Status:needs work» reviewed & tested by the community

#6

Status:reviewed & tested by the community» needs review

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"."

AttachmentSizeStatusTest resultOperations
db_next_id_2.patch1.61 KBIgnored: Check issue status.NoneNone

#7

Status:needs review» reviewed & tested by the community

Looks good to me.

#8

Status:reviewed & tested by the community» needs work

Oops, think we're missing mysqli docs.

#9

Status:needs work» needs review

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

AttachmentSizeStatusTest resultOperations
85979.patch2.4 KBIgnored: Check issue status.NoneNone

#10

Status:needs review» fixed

Committed to CVS HEAD. Thanks.

#11

Status:fixed» closed (fixed)