Revision: 1479
          http://mrbs.svn.sourceforge.net/mrbs/?rev=1479&view=rev
Author:   cimorrison
Date:     2010-09-30 10:05:11 +0000 (Thu, 30 Sep 2010)

Log Message:
-----------
Added note imposing a restriction on custom field names, together with an 
explanation. (The restriction is to names consisting of letters, numbers and 
underscores)

Modified Paths:
--------------
    mrbs/trunk/INSTALL

Modified: mrbs/trunk/INSTALL
===================================================================
--- mrbs/trunk/INSTALL  2010-09-26 15:59:47 UTC (rev 1478)
+++ mrbs/trunk/INSTALL  2010-09-30 10:05:11 UTC (rev 1479)
@@ -164,9 +164,17 @@
 and handle them automatically, displaying the information in the lists of rooms
 and users and allowing you to edit the data in the appropriate forms.
 
-NOTE: if you are adding a field to the entry table you must add an
+NOTES:
+(1) if you are adding a field to the entry table you must add an
 identical field to the repeat table.   If you do not MRBS will fail with
 a fatal error when you try and run it.
+(2) names must consist of letters, numbers or underscores.  If you are
+using PostgreSQL then the name must begin with a letter or an underscore.
+If you are using MySQL then there is no restriction on the first character
+as long as it is in the permitted set, ie a letter, number or underscore.
+(Although MySQL will allow other characters in column names, MRBS imposes
+restrictions on the characters allowed in order to simplify the code. For
+a technical explanation see below).
 
 At the moment only text, varchar, int, smallint and tinyint columns are 
 supported, displayed as textarea, text or checkbox fields as appropriate.
@@ -198,7 +206,51 @@
 should then do the rest and display your coffee machine field on the room
 pages.
 
+Technical explanation of the restriction on column names for custom fields
+--------------------------------------------------------------------------
+// Column names for custom fields are used by MRBS in a number of ways:
+// - as the column name in the database
+// - as part of an HTML name attibute for a form input
+// - as part of a PHP variable name
+//
+// MySQL, PostgreSQL, HTML and PHP all have different rules for these tokens:
+// - MySQL: almost anything is allowed except that:
+//       - "No identifier can contain ASCII NUL (0x00) or a byte with a value
+//         of 255."
+//       - "Database, table, and column names should not end with space
+//         characters."
+//   (http://dev.mysql.com/doc/refman/5.0/en/identifiers.html)
+//
+// - PostgreSQL:  "SQL identifiers and key words must begin with a letter (a-z,
+//   but also letters with diacritical marks and non-Latin letters) or an
+//   underscore (_).   Subsequent characters in an identifier or key word can
+//   be letters, underscores, digits (0-9), or dollar signs ($). Note that
+//   dollar signs are not allowed in identifiers according to the letter of the
+//   SQL standard, so their use may render applications less portable. The SQL
+//   standard will not define a key word that contains digits or starts or ends
+//   with an underscore, so identifiers of this form are safe against possible
+//   conflict with future extensions of the standard."
+//   
(http://www.postgresql.org/docs/8.1/interactive/sql-syntax.html#SQL-SYNTAX-IDENTIFIERS)
+//
+// - PHP:  "Variable names follow the same rules as other labels in PHP. A
+//   valid variable name starts with a letter or underscore, followed by any
+//   number of letters, numbers, or underscores. As a regular expression, it
+//   would be expressed thus: '[a-zA-Z_\x7f-\xff][a-zA-Z0-9_\x7f-\xff]*' "
+//   (http://php.net/manual/en/language.variables.basics.php)
+//
+// - HTML: "ID and NAME tokens must begin with a letter ([A-Za-z]) and may be
+//   followed by any number of letters, digits ([0-9]), hyphens ("-"),
+//   underscores ("_"), colons (":"), and periods (".")."
+//   (http://www.w3.org/TR/html401/types.html#type-cdata)
+//
+// In order to avoid complications with using names in each of these contexts,
+// we restrict custom field names to the set of names which conforms to all
+// four rules, taking into account the fact that when MRBS uses column names
+// in PHP and HTML it always prefixes them with a string beginning with a 
letter.
+// This gives us the rule that custom field names must consist of letters,
+// numbers or underscores.
 
+
 CONFIGURING MRBS
 ---------------------------------------------------------------------------
 Next, you will need to customize the file "config.inc.php"...


This was sent by the SourceForge.net collaborative development platform, the 
world's largest Open Source development site.

------------------------------------------------------------------------------
Start uncovering the many advantages of virtual appliances
and start using them to simplify application deployment and
accelerate your shift to cloud computing.
http://p.sf.net/sfu/novell-sfdev2dev
_______________________________________________
Mrbs-commits mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/mrbs-commits

Reply via email to