diff -aburN --exclude='CVS*' phpgwapi.org/inc/adodb/adodb.inc.php phpgwapi/inc/adodb/adodb.inc.php
--- phpgwapi.org/inc/adodb/adodb.inc.php	2004-12-30 07:47:32.000000000 +0100
+++ phpgwapi/inc/adodb/adodb.inc.php	2005-04-20 15:30:48.390119600 +0200
@@ -102,7 +102,7 @@
 		2 = use native-case field names. $rs->fields['OrderID']
 	*/
 	
-		define('ADODB_FETCH_DEFAULT',0);
+		define('ADODB_FETCH_DEFAULT',3);

 		define('ADODB_FETCH_NUM',1);
 		define('ADODB_FETCH_ASSOC',2);
 		define('ADODB_FETCH_BOTH',3);
diff -aburN --exclude='CVS*' phpgwapi.org/inc/class.log.inc.php phpgwapi/inc/class.log.inc.php
--- phpgwapi.org/inc/class.log.inc.php	2004-12-30 07:47:30.000000000 +0100
+++ phpgwapi/inc/class.log.inc.php	2005-04-21 13:35:09.847371800 +0200
@@ -78,13 +78,13 @@
 			}
 			
 			if (    ( isset($GLOBALS['phpgw_info']['flags']['currentapp']) )
-			     && ( array_key_exists( $GLOBALS['phpgw_info']['flags']['currentapp'] , $GLOBALS['phpgw_info']['server']['log_levels']['module']) )
+			     && ( @array_key_exists( $GLOBALS['phpgw_info']['flags']['currentapp'] , $GLOBALS['phpgw_info']['server']['log_levels']['module']) )
 			     && ( $this->log_level_table[$GLOBALS['phpgw_info']['server']['log_levels']['module'][$GLOBALS['phpgw_info']['flags']['currentapp']]] >= $this->log_level_table[$level] ) ) {
 					return true;
 			}
 			
 			if (    ( isset($GLOBALS['phpgw_info']['user']['account_lid']) )
-				 && ( array_key_exists($GLOBALS['phpgw_info']['user']['account_lid'], $GLOBALS['phpgw_info']['server']['log_levels']['user']) )
+				 && ( @array_key_exists($GLOBALS['phpgw_info']['user']['account_lid'], $GLOBALS['phpgw_info']['server']['log_levels']['user']) )
 			     && ( $this->log_level_table[$GLOBALS['phpgw_info']['server']['log_levels']['user'][$GLOBALS['phpgw_info']['user']['account_lid']]] >= $this->log_level_table[$level] ) ) {
 				return true;
 			}
diff -aburN --exclude='CVS*' phpgwapi.org/inc/class.schema_proc.inc.php phpgwapi/inc/class.schema_proc.inc.php
--- phpgwapi.org/inc/class.schema_proc.inc.php	2005-03-03 18:14:26.000000000 +0100
+++ phpgwapi/inc/class.schema_proc.inc.php	2005-04-21 08:49:43.001236200 +0200
@@ -469,6 +469,10 @@
 					//$sBufNullable = ' NOT NULL';
 					$sFieldSQL .= ' NOT NULL';
 				}
+				else
+				{
+					$sFieldSQL .= ' NULL';
+				}
 				
 				if($sDefault == '0')
 				{
diff -aburN --exclude='CVS*' phpgwapi.org/inc/class.schema_proc_mssql.inc.php phpgwapi/inc/class.schema_proc_mssql.inc.php
--- phpgwapi.org/inc/class.schema_proc_mssql.inc.php	2004-12-30 07:47:31.000000000 +0100
+++ phpgwapi/inc/class.schema_proc_mssql.inc.php	2005-01-25 14:56:24.437712300 +0100
@@ -326,7 +326,7 @@
 		function GetSequenceSQL($sTableName, &$sSequenceSQL)
 		{
 			$sSequenceSQL = '';
-			return true;
+			return false;
 		}
 
 		function GetTriggerSQL($sTableName, $sColumnNames, &$sTriggerSQL)
@@ -351,5 +351,15 @@
 
 			return false;
 		}
+        function GetFKSQL($sFields)
+        {
+           if (ereg("\((.*)\)", $sFields, $regs))
+            {
+              $ret = "FOREIGN KEY (".$regs[1].")\n" .
+                "  REFERENCES ".$sFields;
+              return $ret;
+            } else
+              return ""; // incorrect FK declaration found
+        }
 	}
 ?>
diff -aburN --exclude='CVS*' phpgwapi.org/inc/class.setup.inc.php phpgwapi/inc/class.setup.inc.php
--- phpgwapi.org/inc/class.setup.inc.php	2005-01-09 02:46:39.000000000 +0100
+++ phpgwapi/inc/class.setup.inc.php	2005-04-21 12:34:19.740162700 +0200
@@ -378,9 +378,10 @@
 					}
 				}
 				$this->db->query("INSERT INTO $appstbl "
-					. "($app_idstr app_name,app_enabled,app_order,app_tables,app_version) "
+//					. "($app_idstr app_name,app_enabled,app_order,app_tables,app_version) "
+					. "(app_name,app_enabled,app_order,app_tables,app_version) "
 					. "VALUES ("
-					. $app_id
+//					. $app_id
 					. "'" . $setup_info[$appname]['name'] . "',"
 					. $enable . ","
 					. intval($setup_info[$appname]['app_order']) . ","
diff -aburN --exclude='CVS*' phpgwapi.org/inc/functions.inc.php phpgwapi/inc/functions.inc.php
--- phpgwapi.org/inc/functions.inc.php	2005-01-19 00:51:53.000000000 +0100
+++ phpgwapi/inc/functions.inc.php	2005-04-21 13:49:47.692168600 +0200
@@ -134,7 +134,7 @@
 	                                   $GLOBALS['phpgw_info']['server']['db_pass'],
 	                                   $GLOBALS['phpgw_info']['server']['db_name']
 	                                  );
-	if(!$GLOBALS['phpgw']->adodb->ErrorMsg())
+	if(!$GLOBALS['phpgw']->adodb->ErrorMsg() || (substr($GLOBALS['phpgw']->adodb->ErrorMsg(),0,27)=='Changed database context to'))
 	{
 		$GLOBALS['phpgw']->adodb->query('select count(config_name) from phpgw_config');
 		if($GLOBALS['phpgw']->adodb->ErrorMsg())
