本文整理汇总了PHP中ibase_timefmt函数的典型用法代码示例。如果您正苦于以下问题:PHP ibase_timefmt函数的具体用法?PHP ibase_timefmt怎么用?PHP ibase_timefmt使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了ibase_timefmt函数的9个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: Connect
function Connect()
{
if (!strcmp($this->database_name, "")) {
return $this->SetError("Connect", "it was not specified a valid database name");
}
$database_file = $this->GetDatabaseFile($this->database_name);
if ($this->connection != 0) {
if (!strcmp($this->connected_host, $this->host) && !strcmp($this->connected_user, $this->user) && !strcmp($this->connected_password, $this->password) && !strcmp($this->connected_database_file, $database_file) && $this->opened_persistent == $this->persistent) {
return 1;
}
if (!$this->auto_commit && $this->transaction_id && !ibase_rollback($this->transaction_id)) {
return $this->SetError("Connect", "Could not rollback unfinished transaction: " . ibase_errmsg());
}
$this->transaction_id = 0;
ibase_close($this->connection);
$this->connection = 0;
$this->affected_rows = -1;
}
$function = $this->persistent ? "ibase_pconnect" : "ibase_connect";
if (!function_exists($function)) {
return $this->SetError("Connect", "Interbase support is not available in this PHP configuration");
}
if (($this->connection = @$function($this->host . ":" . $database_file, $this->user, $this->password)) <= 0) {
return $this->SetError("Connect", "Could not connect to Interbase server (" . $this->host . ":{$database_file}): " . ibase_errmsg());
}
if (!$this->auto_commit && !($this->transaction_id = ibase_trans(IBASE_COMMITTED, $this->connection))) {
return $this->SetError("Connect", "Could not open the initial connection transaction: " . ibase_errmsg());
}
$this->connected_host = $this->host;
$this->connected_user = $this->user;
$this->connected_password = $this->password;
$this->opened_persistent = $this->persistent;
$this->connected_database_file = $database_file;
ibase_timefmt("%Y-%m-%d %H:%M:%S", IBASE_TIMESTAMP);
ibase_timefmt("%Y-%m-%d", IBASE_DATE);
return 1;
}
示例2: _connect
function _connect($argHostname, $argUsername, $argPassword, $argDatabasename, $persist = false)
{
if (!function_exists('ibase_pconnect')) {
return null;
}
if ($argDatabasename) {
$argHostname .= ':' . $argDatabasename;
}
$fn = $persist ? 'ibase_pconnect' : 'ibase_connect';
$this->_connectionID = $fn($argHostname, $argUsername, $argPassword, $this->charSet, $this->buffers, $this->dialect);
if ($this->dialect != 1) {
// http://www.ibphoenix.com/ibp_60_del_id_ds.html
$this->replaceQuote = "''";
}
if ($this->_connectionID === false) {
$this->_handleerror();
return false;
}
// PHP5 change.
if (function_exists('ibase_timefmt')) {
ibase_timefmt($this->ibase_datefmt, IBASE_DATE);
if ($this->dialect == 1) {
ibase_timefmt($this->ibase_datefmt, IBASE_TIMESTAMP);
} else {
ibase_timefmt($this->ibase_timestampfmt, IBASE_TIMESTAMP);
}
ibase_timefmt($this->ibase_timefmt, IBASE_TIME);
} else {
ini_set("ibase.timestampformat", $this->ibase_timestampfmt);
ini_set("ibase.dateformat", $this->ibase_datefmt);
ini_set("ibase.timeformat", $this->ibase_timefmt);
}
return true;
}
示例3: ADODB_ibase
function ADODB_ibase()
{
ibase_timefmt('%Y-%m-%d');
}
示例4: _pconnect
function _pconnect($argHostname, $argUsername, $argPassword, $argDatabasename)
{
if (!function_exists('ibase_pconnect')) {
return false;
}
if ($argDatabasename) {
$argHostname .= ':' . $argDatabasename;
}
$this->_connectionID = ibase_pconnect($argHostname, $argUsername, $argPassword, $this->charSet, $this->buffers, $this->dialect);
if ($this->dialect != 1) {
// http://www.ibphoenix.com/ibp_60_del_id_ds.html
$this->replaceQuote = "''";
}
if ($this->_connectionID === false) {
$this->_handleerror();
return false;
}
ibase_timefmt($this->ibase_timefmt);
return true;
}
示例5: connect
/**
* @see ILumine_Connection::connect()
*/
public function connect()
{
if ($this->conn_id && $this->state == self::OPEN) {
Lumine_Log::debug('Utilizando conexao cacheada com ' . $this->getDatabase());
return true;
}
$this->dispatchEvent(new Lumine_ConnectionEvent(Lumine_Event::PRE_CONNECT, $this));
$hostString = $this->getHost();
if ($this->getPort() != '') {
// nao colocamos a porta uma vez que a string de conexao
// nao suporta a informacao da porta
//$hostString .= ':' . $this->getPort();
}
$hostString = empty($hostString) ? $this->getDatabase() : $hostString . ':' . $this->getDatabase();
if (isset($this->options['socket']) && $this->options['socket'] != '') {
$hostString .= ':' . $this->options['socket'];
}
$flags = isset($this->options['flags']) ? $this->options['flags'] : null;
if (isset($this->options['persistent']) && $this->options['persistent'] == true) {
Lumine_Log::debug('Criando conexao persistente com ' . $this->getDatabase());
$this->conn_id = @ibase_pconnect($hostString, $this->getUser(), $this->getPassword());
} else {
Lumine_Log::debug('Criando conexao com ' . $this->getDatabase());
$this->conn_id = @ibase_connect($hostString, $this->getUser(), $this->getPassword());
}
if (!$this->conn_id) {
$this->state = self::CLOSED;
$msg = 'Nao foi possivel conectar no banco de dados: ' . $this->getDatabase() . ' - ' . $this->getErrorMsg();
Lumine_Log::error($msg);
$this->dispatchEvent(new Lumine_ConnectionEvent(Lumine_Event::CONNECTION_ERROR, $this, $msg));
throw new Exception($msg);
return false;
}
if (function_exists('ibase_timefmt')) {
ibase_timefmt($this->ibase_datefmt, IBASE_DATE);
if ($this->dialect == 1) {
ibase_timefmt($this->ibase_datefmt, IBASE_TIMESTAMP);
} else {
ibase_timefmt($this->ibase_timestampfmt, IBASE_TIMESTAMP);
}
ibase_timefmt($this->ibase_timefmt, IBASE_TIME);
} else {
ini_set("ibase.timestampformat", $this->ibase_timestampfmt);
ini_set("ibase.dateformat", $this->ibase_datefmt);
ini_set("ibase.timeformat", $this->ibase_timefmt);
}
$this->state = self::OPEN;
$this->dispatchEvent(new Lumine_ConnectionEvent(Lumine_Event::POS_CONNECT, $this));
$this->setCharset($this->getCharset());
return true;
}
示例6: _doConnect
/**
* Does the grunt work of connecting to the database
*
* @return mixed connection resource on success, MDB2 Error Object on failure
* @access protected
*/
function _doConnect($username, $password, $database_name, $persistent = false)
{
if (!extension_loaded('interbase')) {
return $this->raiseError(MDB2_ERROR_NOT_FOUND, null, null, 'extension ' . $this->phptype . ' is not compiled into PHP', __FUNCTION__);
}
$database_file = $this->_getDatabaseFile($database_name);
$dbhost = $this->dsn['hostspec'] ? $this->dsn['hostspec'] . ':' . $database_file : $database_file;
$params = array();
$params[] = $dbhost;
$params[] = !empty($username) ? $username : null;
$params[] = !empty($password) ? $password : null;
$params[] = isset($this->dsn['charset']) ? $this->dsn['charset'] : null;
$params[] = isset($this->dsn['buffers']) ? $this->dsn['buffers'] : null;
$params[] = isset($this->dsn['dialect']) ? $this->dsn['dialect'] : null;
$params[] = isset($this->dsn['role']) ? $this->dsn['role'] : null;
$connect_function = $persistent ? 'ibase_pconnect' : 'ibase_connect';
$connection = @call_user_func_array($connect_function, $params);
if ($connection <= 0) {
return $this->raiseError(MDB2_ERROR_CONNECT_FAILED, null, null, 'unable to establish a connection', __FUNCTION__);
}
if (empty($this->dsn['disable_iso_date'])) {
if (function_exists('ibase_timefmt')) {
@ibase_timefmt("%Y-%m-%d %H:%M:%S", IBASE_TIMESTAMP);
@ibase_timefmt("%Y-%m-%d", IBASE_DATE);
} else {
@ini_set("ibase.timestampformat", "%Y-%m-%d %H:%M:%S");
//@ini_set("ibase.timeformat", "%H:%M:%S");
@ini_set("ibase.dateformat", "%Y-%m-%d");
}
}
return $connection;
}
示例7: _doConnect
/**
* Does the grunt work of connecting to the database
*
* @return mixed connection resource on success, MDB_Error on failure
* @access private
**/
function _doConnect($database_name, $persistent)
{
$function = $persistent ? 'ibase_pconnect' : 'ibase_connect';
if (!function_exists($function)) {
return $this->raiseError(MDB_ERROR_UNSUPPORTED, NULL, NULL, 'doConnect: FireBird/InterBase support is not available in this PHP configuration');
}
$dbhost = $this->host ? $this->host . ':' . $database_name : $database_name;
$params = array();
$params[] = $dbhost;
$params[] = !empty($this->user) ? $this->user : NULL;
$params[] = !empty($this->password) ? $this->password : NULL;
$connection = @call_user_func_array($function, $params);
if ($connection > 0) {
@ibase_timefmt("%Y-%m-%d %H:%M:%S", IBASE_TIMESTAMP);
@ibase_timefmt("%Y-%m-%d", IBASE_DATE);
return $connection;
}
if (isset($php_errormsg)) {
$error_msg = $php_errormsg;
} else {
$error_msg = 'Could not connect to FireBird/InterBase server';
}
return $this->raiseError(MDB_ERROR_CONNECT_FAILED, NULL, NULL, 'doConnect: ' . $error_msg);
}
示例8: _doConnect
/**
* Does the grunt work of connecting to the database
*
* @return mixed connection resource on success, MDB2 Error Object on failure
* @access protected
*/
function _doConnect($database_name, $persistent = false)
{
$user = $this->dsn['username'];
$pw = $this->dsn['password'];
$dbhost = $this->dsn['hostspec'] ? $this->dsn['hostspec'] . ':' . $database_name : $database_name;
$params = array();
$params[] = $dbhost;
$params[] = !empty($user) ? $user : null;
$params[] = !empty($pw) ? $pw : null;
$params[] = isset($this->dsn['charset']) ? $this->dsn['charset'] : null;
$params[] = isset($this->dsn['buffers']) ? $this->dsn['buffers'] : null;
$params[] = isset($this->dsn['dialect']) ? $this->dsn['dialect'] : null;
$params[] = isset($this->dsn['role']) ? $this->dsn['role'] : null;
$connect_function = $persistent ? 'ibase_pconnect' : 'ibase_connect';
$connection = @call_user_func_array($connect_function, $params);
if ($connection <= 0) {
return $this->raiseError(MDB2_ERROR_CONNECT_FAILED, null, null, 'unable to establish a connection', __FUNCTION__);
}
if (empty($this->dsn['disable_iso_date'])) {
if (function_exists('ibase_timefmt')) {
@ibase_timefmt("%Y-%m-%d %H:%M:%S", IBASE_TIMESTAMP);
@ibase_timefmt("%Y-%m-%d", IBASE_DATE);
} else {
@ini_set("ibase.timestampformat", "%Y-%m-%d %H:%M:%S");
//@ini_set("ibase.timeformat", "%H:%M:%S");
@ini_set("ibase.dateformat", "%Y-%m-%d");
}
}
return $connection;
}
示例9: _doConnect
/**
* Does the grunt work of connecting to the database
*
* @return mixed connection resource on success, MDB2 Error Object on failure
* @access private
**/
function _doConnect($database_name, $persistent = false)
{
$dsninfo = $this->dsn;
$user = $dsninfo['username'];
$pw = $dsninfo['password'];
$dbhost = $dsninfo['hostspec'] ? $dsninfo['hostspec'] . ':' . $database_name : $database_name;
$params = array();
$params[] = $dbhost;
$params[] = !empty($user) ? $user : null;
$params[] = !empty($pw) ? $pw : null;
$params[] = isset($dsninfo['charset']) ? $dsninfo['charset'] : null;
$params[] = isset($dsninfo['buffers']) ? $dsninfo['buffers'] : null;
$params[] = isset($dsninfo['dialect']) ? $dsninfo['dialect'] : null;
$params[] = isset($dsninfo['role']) ? $dsninfo['role'] : null;
$function = $persistent ? 'ibase_pconnect' : 'ibase_connect';
$connection = @call_user_func_array($function, $params);
if ($connection > 0) {
@ibase_timefmt("%Y-%m-%d %H:%M:%S", IBASE_TIMESTAMP);
@ibase_timefmt("%Y-%m-%d", IBASE_DATE);
return $connection;
}
if (isset($php_errormsg)) {
$error_msg = $php_errormsg;
} else {
$error_msg = 'Could not connect to FireBird/InterBase server';
}
return $this->raiseError(MDB2_ERROR_CONNECT_FAILED, null, null, $error_msg);
}