Revision: 1117
          http://mrbs.svn.sourceforge.net/mrbs/?rev=1117&view=rev
Author:   cimorrison
Date:     2009-06-17 14:48:40 +0000 (Wed, 17 Jun 2009)

Log Message:
-----------
Converted the 'private' field in the entry and repeat tables from a boolean to 
a smallint for PostgreSQL implementations.

PHP returns PostgreSQL boolean fields as strings, ie 't' or 'f' which always 
evaluate to true without a lot of processing.   This means that entries are 
always considered to be private, whether they really are or not.    Although 
using smallints takes up more space (2 bytes instead of 1 bit), it makes the 
code much simpler.

The upgrade SQL files have been retrospectively changed, ie no attempt has been 
made to provide an Upgrade 4 file which converts existing booleans to 
smallints.   As MRBS fails immediately an entry is created when using booleans 
and no reports of failure have been seen, it seems unlikely that there are any 
existing PostgreSQL implementations using a 1.4.1 + SVN version of MRBS.   If 
there are, the fields can always be converted using a PostgreSQL admin tool.

Modified Paths:
--------------
    mrbs/trunk/tables.pg.73and_above.sql
    mrbs/trunk/tables.pg.sql
    mrbs/trunk/web/mrbs_sql.inc
    mrbs/trunk/web/upgrade/3/pgsql.sql

Modified: mrbs/trunk/tables.pg.73and_above.sql
===================================================================
--- mrbs/trunk/tables.pg.73and_above.sql        2009-06-15 20:23:39 UTC (rev 
1116)
+++ mrbs/trunk/tables.pg.73and_above.sql        2009-06-17 14:48:40 UTC (rev 
1117)
@@ -64,7 +64,7 @@
   name        varchar(80) NOT NULL,
   type        char DEFAULT 'E' NOT NULL,
   description text,
-  private     BOOLEAN NOT NULL DEFAULT FALSE
+  private     smallint DEFAULT 0 NOT NULL
 );
 create index idxStartTime on mrbs_entry(start_time);
 create index idxEndTime on mrbs_entry(end_time);
@@ -84,7 +84,7 @@
   type        char DEFAULT 'E' NOT NULL,
   description text,
   rep_num_weeks smallint DEFAULT 0 NULL,
-  private     BOOLEAN NOT NULL DEFAULT FALSE
+  private     smallint DEFAULT 0 NOT NULL
 );
 
 CREATE TABLE mrbs_variables

Modified: mrbs/trunk/tables.pg.sql
===================================================================
--- mrbs/trunk/tables.pg.sql    2009-06-15 20:23:39 UTC (rev 1116)
+++ mrbs/trunk/tables.pg.sql    2009-06-17 14:48:40 UTC (rev 1117)
@@ -52,7 +52,7 @@
   name        varchar(80) DEFAULT '' NOT NULL,
   type        char DEFAULT 'E' NOT NULL,
   description text,
-  private     BOOLEAN NOT NULL DEFAULT FALSE
+  private     smallint DEFAULT 0 NOT NULL
 );
 create index idxStartTime on mrbs_entry(start_time);
 create index idxEndTime on mrbs_entry(end_time);
@@ -72,7 +72,7 @@
   type        char DEFAULT 'E' NOT NULL,
   description text,
   rep_num_weeks smallint DEFAULT NULL NULL,
-  private     BOOLEAN NOT NULL DEFAULT FALSE
+  private     smallint DEFAULT 0 NOT NULL
 );
 
 CREATE TABLE mrbs_variables

Modified: mrbs/trunk/web/mrbs_sql.inc
===================================================================
--- mrbs/trunk/web/mrbs_sql.inc 2009-06-15 20:23:39 UTC (rev 1116)
+++ mrbs/trunk/web/mrbs_sql.inc 2009-06-17 14:48:40 UTC (rev 1117)
@@ -177,7 +177,7 @@
 {
   global $tbl_entry;
  
-  $private = $private ? "TRUE" : "FALSE";
+  $private = $private ? 1 : 0;
   $name        = addslashes($name);
   $description = addslashes($description);
    
@@ -231,7 +231,7 @@
 {
   global $tbl_repeat;
 
-  $private = $private ? "TRUE" : "FALSE";
+  $private = $private ? 1 : 0;
   $name        = addslashes($name);
   $description = addslashes($description);
 

Modified: mrbs/trunk/web/upgrade/3/pgsql.sql
===================================================================
--- mrbs/trunk/web/upgrade/3/pgsql.sql  2009-06-15 20:23:39 UTC (rev 1116)
+++ mrbs/trunk/web/upgrade/3/pgsql.sql  2009-06-17 14:48:40 UTC (rev 1117)
@@ -5,6 +5,6 @@
 -- for private bookings handling
 
 ALTER TABLE %DB_TBL_PREFIX%repeat 
- ADD private BOOLEAN NOT NULL DEFAULT FALSE;
+ ADD private SMALLINT  DEFAULT 0 NOT NULL;
 ALTER TABLE %DB_TBL_PREFIX%entry 
- ADD private BOOLEAN NOT NULL DEFAULT FALSE;
+ ADD private SMALLINT  DEFAULT 0 NOT NULL;


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

------------------------------------------------------------------------------
Crystal Reports - New Free Runtime and 30 Day Trial
Check out the new simplified licensing option that enables unlimited
royalty-free distribution of the report engine for externally facing 
server and web deployment.
http://p.sf.net/sfu/businessobjects
_______________________________________________
Mrbs-commits mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/mrbs-commits

Reply via email to