本文整理汇总了PHP中adodb_addslashes函数的典型用法代码示例。如果您正苦于以下问题:PHP adodb_addslashes函数的具体用法?PHP adodb_addslashes怎么用?PHP adodb_addslashes使用的例子?那么, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了adodb_addslashes函数的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: _connect
function _connect($str, $user = '', $pwd = '', $db = '', $ctype = 0)
{
if (!function_exists('pg_connect')) {
return null;
}
$this->_errorMsg = false;
if ($user || $pwd || $db) {
$user = adodb_addslashes($user);
$pwd = adodb_addslashes($pwd);
if (strlen($db) == 0) {
$db = 'template1';
}
$db = adodb_addslashes($db);
if ($str) {
$host = split(":", $str);
if ($host[0]) {
$str = "host=" . adodb_addslashes($host[0]);
} else {
$str = '';
}
if (isset($host[1])) {
$str .= " port={$host['1']}";
} else {
if (!empty($this->port)) {
$str .= " port=" . $this->port;
}
}
}
if ($user) {
$str .= " user=" . $user;
}
if ($pwd) {
$str .= " password=" . $pwd;
}
if ($db) {
$str .= " dbname=" . $db;
}
}
//if ($user) $linea = "user=$user host=$linea password=$pwd dbname=$db port=5432";
if ($ctype === 1) {
// persistent
$this->_connectionID = pg_pconnect($str);
} else {
if ($ctype === -1) {
// nconnect, we trick pgsql ext by changing the connection str
static $ncnt;
if (empty($ncnt)) {
$ncnt = 1;
} else {
$ncnt += 1;
}
$str .= str_repeat(' ', $ncnt);
}
$this->_connectionID = pg_connect($str);
}
if ($this->_connectionID === false) {
return false;
}
$this->Execute("set datestyle='ISO'");
$info = $this->ServerInfo();
$this->pgVersion = (double) substr($info['version'], 0, 3);
if ($this->pgVersion >= 7.1) {
// good till version 999
$this->_nestedSQL = true;
}
return true;
}
示例2: _connect
function _connect($str, $user = '', $pwd = '', $db = '', $persist = false)
{
if ($user || $pwd || $db) {
$str = adodb_addslashes($str);
$user = adodb_addslashes($user);
$pwd = adodb_addslashes($pwd);
$db = adodb_addslashes($db);
if ($str) {
$host = split(":", $str);
if ($host[0]) {
$str = "host={$host['0']}";
} else {
$str = 'localhost';
}
if (isset($host[1])) {
$str .= " port={$host['1']}";
}
}
if ($user) {
$str .= " user=" . $user;
}
if ($pwd) {
$str .= " password=" . $pwd;
}
if ($db) {
$str .= " dbname=" . $db;
}
}
//if ($user) $linea = "user=$user host=$linea password=$pwd dbname=$db port=5432";
if ($persist) {
$this->_connectionID = pg_pconnect($str);
} else {
$this->_connectionID = pg_connect($str);
}
if ($this->_connectionID === false) {
return false;
}
$this->Execute("set datestyle='ISO'");
return true;
}
示例3: _connect
function _connect($str, $user = '', $pwd = '', $db = '', $ctype = 0)
{
if (!function_exists('pg_pconnect')) {
return false;
}
$this->_errorMsg = false;
if ($user || $pwd || $db) {
$user = adodb_addslashes($user);
$pwd = adodb_addslashes($pwd);
if (strlen($db) == 0) {
$db = 'template1';
}
$db = adodb_addslashes($db);
if ($str) {
$host = explode(":", $str);
if ($host[0]) {
$str = "host=" . adodb_addslashes($host[0]);
} else {
$str = 'host=localhost';
}
if (isset($host[1])) {
$str .= " port={$host['1']}";
}
}
if ($user) {
$str .= " user=" . $user;
}
if ($pwd) {
$str .= " password=" . $pwd;
}
if ($db) {
$str .= " dbname=" . $db;
}
}
//if ($user) $linea = "user=$user host=$linea password=$pwd dbname=$db port=5432";
if ($ctype === 1) {
// persistent
$this->_connectionID = pg_pconnect($str);
} else {
if ($ctype === -1) {
// nconnect, we trick pgsql ext by changing the connection str
static $ncnt;
if (empty($ncnt)) {
$ncnt = 1;
} else {
$ncnt += 1;
}
$str .= str_repeat(' ', $ncnt);
}
$this->_connectionID = pg_connect($str);
}
if ($this->_connectionID === false) {
return false;
}
$this->Execute("set datestyle='ISO'");
return true;
}
示例4: _connect
function _connect($str, $user = '', $pwd = '', $db = '', $ctype = 0)
{
if (!function_exists('pg_connect')) {
return null;
}
$this->_errorMsg = false;
if ($user || $pwd || $db) {
$user = adodb_addslashes($user);
$pwd = adodb_addslashes($pwd);
if (strlen($db) == 0) {
$db = 'template1';
}
$db = adodb_addslashes($db);
if ($str) {
$host = explode(":", $str);
if ($host[0]) {
$str = "host=" . adodb_addslashes($host[0]);
} else {
$str = '';
}
if (isset($host[1])) {
$str .= " port={$host['1']}";
} else {
if (!empty($this->port)) {
$str .= " port=" . $this->port;
}
}
}
if ($user) {
$str .= " user=" . $user;
}
if ($pwd) {
$str .= " password=" . $pwd;
}
if ($db) {
$str .= " dbname=" . $db;
}
}
//if ($user) $linea = "user=$user host=$linea password=$pwd dbname=$db port=5432";
if ($ctype === 1) {
// persistent
$this->_connectionID = pg_pconnect($str);
} else {
if ($ctype === -1) {
// nconnect, we trick pgsql ext by changing the connection str
static $ncnt;
if (empty($ncnt)) {
$ncnt = 1;
} else {
$ncnt += 1;
}
$str .= str_repeat(' ', $ncnt);
}
$this->_connectionID = pg_connect($str);
}
if ($this->_connectionID === false) {
return false;
}
$this->Execute("set datestyle='ISO'");
$info = $this->ServerInfo();
$this->pgVersion = (double) substr($info['version'], 0, 3);
if ($this->pgVersion >= 7.1) {
// good till version 999
$this->_nestedSQL = true;
}
# PostgreSQL 9.0 changed the default output for bytea from 'escape' to 'hex'
# PHP does not handle 'hex' properly ('x74657374' is returned as 't657374')
# https://bugs.php.net/bug.php?id=59831 states this is in fact not a bug,
# so we manually set bytea_output
if (!empty($this->connection->noBlobs) && version_compare($info['version'], '9.0', '>=')) {
$this->Execute('set bytea_output=escape');
}
return true;
}
示例5: _connect
function _connect($str, $user = '', $pwd = '', $db = '', $ctype = 0)
{
if (!function_exists('pg_connect')) {
return null;
}
$this->_errorMsg = false;
if ($user || $pwd || $db) {
$user = adodb_addslashes($user);
$pwd = adodb_addslashes($pwd);
if (strlen($db) == 0) {
$db = 'template1';
}
$db = adodb_addslashes($db);
if ($str) {
$host = split(":", $str);
if ($host[0]) {
$str = "host=" . adodb_addslashes($host[0]);
} else {
$str = 'host=';
}
// Modified 2004-07-23 by Kevin Jamieson (http://pkp.sfu.ca/)
// Don't specify a host if none was entered (so will connect using sockets)
if (isset($host[1])) {
$str .= " port={$host['1']}";
} else {
if (!empty($this->port)) {
$str .= " port=" . $this->port;
}
}
}
if ($user) {
$str .= " user=" . $user;
}
if ($pwd) {
$str .= " password=" . $pwd;
}
if ($db) {
$str .= " dbname=" . $db;
}
}
//if ($user) $linea = "user=$user host=$linea password=$pwd dbname=$db port=5432";
if ($ctype === 1) {
// persistent
$this->_connectionID = pg_pconnect($str);
} else {
if ($ctype === -1) {
// nconnect, we trick pgsql ext by changing the connection str
static $ncnt;
if (empty($ncnt)) {
$ncnt = 1;
} else {
$ncnt += 1;
}
$str .= str_repeat(' ', $ncnt);
}
$this->_connectionID = pg_connect($str);
}
if ($this->_connectionID === false) {
return false;
}
$this->Execute("set datestyle='ISO'");
return true;
}