| 
      
      
      From: <tu...@us...> - 2018-02-09 05:30:42
      
     | 
| Revision: 7943
          http://sourceforge.net/p/web-erp/reponame/7943
Author:   turbopt
Date:     2018-02-09 05:30:40 +0000 (Fri, 09 Feb 2018)
Log Message:
-----------
Tim (PaulT commit): ConnectDB_xxxx.inc files: Add function DB_table_exists() function to all DB support files, by Tim suggestion. Note that this function will be used in other files in a future commit.
Modified Paths:
--------------
    trunk/doc/Change.log
    trunk/includes/ConnectDB_mysql.inc
    trunk/includes/ConnectDB_mysqli.inc
    trunk/includes/ConnectDB_postgres.inc
Modified: trunk/doc/Change.log
===================================================================
--- trunk/doc/Change.log	2018-02-08 01:31:13 UTC (rev 7942)
+++ trunk/doc/Change.log	2018-02-09 05:30:40 UTC (rev 7943)
@@ -1,5 +1,6 @@
 webERP Change Log
 
+9/2/18   Tim (PaulT commit): ConnectDB_xxxx.inc files: Add function DB_table_exists() function to all DB support files, by Tim suggestion. Note that this function will be used in other files in a future commit.
 7/2/18   Paul Becker (PaulT commit): Z_SalesIntegrityCheck.php: Fix that the does not take into account discountpercent so it shows an issue where non exists. (Reported in forums: http://www.weberp.org/forum/showthread.php?tid=8084) 
 7/2/18   Tim (PaulT commit) UserSettings.php: Fix the 'Maximum Number of Records to Display' from populating with the session default at page load instead of the user's setting. Applied Tim's improved handling. (Reported in forums by Paul Becker: http://www.weberp.org/forum/showthread.php?tid=8081) 
 6/2/18   geo_displaymap_customers.php, geo_displaymap_suppliers.php: Fix a few PHP short-tags, and move some javascript from PHP output to fix 'missing tag' validation complaints.
Modified: trunk/includes/ConnectDB_mysql.inc
===================================================================
--- trunk/includes/ConnectDB_mysql.inc	2018-02-08 01:31:13 UTC (rev 7942)
+++ trunk/includes/ConnectDB_mysql.inc	2018-02-09 05:30:40 UTC (rev 7943)
@@ -209,4 +209,16 @@
 	mysql_query('SET FOREIGN_KEY_CHECKS=1',$db);
 }
 
+function DB_table_exists($TableName) {
+	global $db;
+
+	$SQL = "SELECT TABLE_NAME FROM information_schema.tables WHERE TABLE_SCHEMA = '" . $_SESSION['DatabaseName'] . "' AND TABLE_NAME = '" . $TableName . "'";
+	$Result = DB_query($SQL);
+
+	if (DB_num_rows($Result) > 0) {
+		return True;
+	} else {
+		return False;
+	}
+}
 ?>
\ No newline at end of file
Modified: trunk/includes/ConnectDB_mysqli.inc
===================================================================
--- trunk/includes/ConnectDB_mysqli.inc	2018-02-08 01:31:13 UTC (rev 7942)
+++ trunk/includes/ConnectDB_mysqli.inc	2018-02-09 05:30:40 UTC (rev 7943)
@@ -224,4 +224,17 @@
 	global $db;
 	mysqli_query($db, 'SET FOREIGN_KEY_CHECKS=1');
 }
+
+function DB_table_exists($TableName) {
+	global $db;
+
+	$SQL = "SELECT TABLE_NAME FROM information_schema.tables WHERE TABLE_SCHEMA = '" . $_SESSION['DatabaseName'] . "' AND TABLE_NAME = '" . $TableName . "'";
+	$Result = DB_query($SQL);
+
+	if (DB_num_rows($Result) > 0) {
+		return True;
+	} else {
+		return False;
+	}
+}
 ?>
\ No newline at end of file
Modified: trunk/includes/ConnectDB_postgres.inc
===================================================================
--- trunk/includes/ConnectDB_postgres.inc	2018-02-08 01:31:13 UTC (rev 7942)
+++ trunk/includes/ConnectDB_postgres.inc	2018-02-09 05:30:40 UTC (rev 7943)
@@ -149,4 +149,16 @@
 				WHERE confname = 'DB_Maintenance_LastRun'");
 }
 
+function DB_table_exists($TableName) {
+	global $db;
+
+	$SQL = "SELECT TABLE_NAME FROM information_schema.tables WHERE TABLE_SCHEMA = '" . $_SESSION['DatabaseName'] . "' AND TABLE_NAME = '" . $TableName . "'";
+	$Result = DB_query($SQL);
+
+	if (DB_num_rows($Result) > 0) {
+		return True;
+	} else {
+		return False;
+	}
+}
 ?>
\ No newline at end of file
 |