Skip to content

Commit

Permalink
Tim (PaulT commit): ConnectDB_xxxx.inc files: Add function DB_table_e…
Browse files Browse the repository at this point in the history
…xists() function to all DB support files, by Tim suggestion. Note that this function will be used in other files in a future commit.

Signed-off-by: Paul Thursby <pthursby2@gmail.com>
  • Loading branch information
timschofield committed Feb 26, 2018
1 parent b449690 commit d502bb7
Show file tree
Hide file tree
Showing 4 changed files with 38 additions and 0 deletions.
1 change: 1 addition & 0 deletions doc/Change.log
@@ -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.
Expand Down
12 changes: 12 additions & 0 deletions includes/ConnectDB_mysql.inc
Expand Up @@ -209,4 +209,16 @@ function DB_ReinstateForeignKeys() {
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;
}
}
?>
13 changes: 13 additions & 0 deletions includes/ConnectDB_mysqli.inc
Expand Up @@ -224,4 +224,17 @@ function DB_ReinstateForeignKeys() {
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;
}
}
?>
12 changes: 12 additions & 0 deletions includes/ConnectDB_postgres.inc
Expand Up @@ -149,4 +149,16 @@ function DB_Maintenance() {
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;
}
}
?>

0 comments on commit d502bb7

Please sign in to comment.