forked from openemr/openemr
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Changed function SLConnect() to use $GLOBALS['oer_config']['ws_accoun…
…ting']['server'] as the hostname instead of 'localhost'
- Loading branch information
ballards
committed
May 5, 2007
1 parent
1a7a2d3
commit 4c16fa7
Showing
1 changed file
with
66 additions
and
41 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,53 +1,78 @@ | ||
<? | ||
// include_once("../interface/globals.php"); | ||
<?php | ||
// sql-ledger.inc | ||
// ------------------------------------------------------------------------ // | ||
// OpenEMR Electronic Medical Records System // | ||
// Copyright (c) 2005 oemr.org // | ||
// <http:https://www.oemr.org/> // | ||
// ------------------------------------------------------------------------ // | ||
// This program is free software; you can redistribute it and/or modify // | ||
// it under the terms of the GNU General Public License as published by // | ||
// the Free Software Foundation; either version 2 of the License, or // | ||
// (at your option) any later version. // | ||
// // | ||
// You may not change or alter any portion of this comment or credits // | ||
// of supporting developers from this source code or any supporting // | ||
// source code which is considered copyrighted (c) material of the // | ||
// original comment or credit authors. // | ||
// // | ||
// This program is distributed in the hope that it will be useful, // | ||
// but WITHOUT ANY WARRANTY; without even the implied warranty of // | ||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // | ||
// GNU General Public License for more details. // | ||
// // | ||
// You should have received a copy of the GNU General Public License // | ||
// along with this program; if not, write to the Free Software // | ||
// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA // | ||
// ------------------------------------------------------------------------ // | ||
|
||
$sl_conn = 0; // connection object | ||
$sl_err = ""; // global error message | ||
$sl_conn = 0; // connection object | ||
$sl_err = ""; // global error message | ||
|
||
function SLConnect() { | ||
global $sl_conn, $sl_dbname, $sl_dbuser, $sl_dbpass; | ||
$sl_conn = pg_pconnect("host=localhost dbname=$sl_dbname user=$sl_dbuser password=$sl_dbpass"); | ||
if (!$sl_conn) die("Failed to connect to SQL-Ledger database."); | ||
} | ||
function SLConnect() { | ||
global $sl_conn, $sl_dbname, $sl_dbuser, $sl_dbpass; | ||
$sl_host = $GLOBALS['oer_config']['ws_accounting']['server']; | ||
$sl_conn = pg_pconnect("host=$sl_host dbname=$sl_dbname user=$sl_dbuser password=$sl_dbpass"); | ||
if (!$sl_conn) die("Failed to connect to SQL-Ledger database."); | ||
} | ||
|
||
function SLClose() { | ||
global $sl_conn; | ||
if ($sl_conn) pg_close($sl_conn); | ||
} | ||
function SLClose() { | ||
global $sl_conn; | ||
if ($sl_conn) pg_close($sl_conn); | ||
} | ||
|
||
function SLQuery($query) { | ||
global $sl_conn, $sl_err; | ||
$sl_err = ""; | ||
$res = pg_exec($sl_conn, $query); | ||
if (!$res || pg_numrows($res) < 0) { | ||
$sl_err = pg_errormessage($sl_conn) . ": $query"; | ||
if (! $sl_err) $sl_err = "Query failed:" + $query; | ||
} | ||
return $res; | ||
function SLQuery($query) { | ||
global $sl_conn, $sl_err; | ||
$sl_err = ""; | ||
$res = pg_exec($sl_conn, $query); | ||
if (!$res || pg_numrows($res) < 0) { | ||
$sl_err = pg_errormessage($sl_conn) . ": $query"; | ||
if (! $sl_err) $sl_err = "Query failed:" + $query; | ||
} | ||
return $res; | ||
} | ||
|
||
function SLRowCount($res) { | ||
return pg_numrows($res); | ||
} | ||
function SLRowCount($res) { | ||
return pg_numrows($res); | ||
} | ||
|
||
function SLAffectedCount($res) { | ||
return pg_affected_rows($res); | ||
} | ||
function SLAffectedCount($res) { | ||
return pg_affected_rows($res); | ||
} | ||
|
||
function SLGetRow($res, $rownum) { | ||
return pg_fetch_array($res, $rownum, PGSQL_ASSOC); | ||
} | ||
function SLGetRow($res, $rownum) { | ||
return pg_fetch_array($res, $rownum, PGSQL_ASSOC); | ||
} | ||
|
||
function SLQueryValue($query) { | ||
$res = SLQuery($query); | ||
if (! $sl_err && SLRowCount($res) > 0) { | ||
$tmp = pg_fetch_array($res, 0); | ||
return $tmp[0]; | ||
} | ||
return ""; | ||
function SLQueryValue($query) { | ||
$res = SLQuery($query); | ||
if (! $sl_err && SLRowCount($res) > 0) { | ||
$tmp = pg_fetch_array($res, 0); | ||
return $tmp[0]; | ||
} | ||
return ""; | ||
} | ||
|
||
function SLFreeResult($res) { | ||
pg_freeresult($res); | ||
} | ||
function SLFreeResult($res) { | ||
pg_freeresult($res); | ||
} | ||
?> |