本文整理汇总了PHP中db_is_pgsql函数的典型用法代码示例。如果您正苦于以下问题:PHP db_is_pgsql函数的具体用法?PHP db_is_pgsql怎么用?PHP db_is_pgsql使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了db_is_pgsql函数的10个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: project_hierarchy_add
/**
* Add project to project hierarchy
* @param int $p_child_id Child project ID
* @param int $p_parent_id Parent project ID
* @param bool $p_inherit_parent Whether or not the child project inherits from the parent project
* @return null
*/
function project_hierarchy_add($p_child_id, $p_parent_id, $p_inherit_parent = true)
{
if (in_array($p_parent_id, project_hierarchy_get_all_subprojects($p_child_id))) {
trigger_error(ERROR_PROJECT_RECURSIVE_HIERARCHY, ERROR);
}
$t_project_hierarchy_table = db_get_table('mantis_project_hierarchy_table');
$c_child_id = db_prepare_int($p_child_id);
$c_parent_id = db_prepare_int($p_parent_id);
# Workaround for #14385 - inherit_parent column is wrongly defined as int
if (db_is_pgsql()) {
$c_inherit_parent = db_prepare_int($p_inherit_parent);
} else {
$c_inherit_parent = db_prepare_bool($p_inherit_parent);
}
$query = "INSERT INTO {$t_project_hierarchy_table}\n\t\t ( child_id, parent_id, inherit_parent )\n\t\t\t\t\t\tVALUES\n\t\t\t\t\t\t( " . db_param() . ', ' . db_param() . ', ' . db_param() . ' )';
db_query_bound($query, array($c_child_id, $c_parent_id, $c_inherit_parent));
}
示例2: db_helper_like
/**
* A helper function that generates a case-sensitive or case-insensitive like phrase based on the current db type.
* The field name and value are assumed to be safe to insert in a query (i.e. already cleaned).
* @param string $p_field_name The name of the field to filter on.
* @param bool $p_case_sensitive true: case sensitive, false: case insensitive
* @return string returns (field LIKE 'value') OR (field ILIKE 'value')
*/
function db_helper_like($p_field_name, $p_case_sensitive = false)
{
$t_like_keyword = 'LIKE';
if ($p_case_sensitive === false) {
if (db_is_pgsql()) {
$t_like_keyword = 'ILIKE';
}
}
return "({$p_field_name} {$t_like_keyword} " . db_param() . ')';
}
示例3: filter_get_bug_rows
//.........这里部分代码省略.........
array_push($t_where_clauses, $t_custom_where_clause . ')');
}
}
}
}
# Text search
if (!is_blank($t_filter[FILTER_PROPERTY_SEARCH])) {
# break up search terms by spacing or quoting
preg_match_all("/-?([^'\"\\s]+|\"[^\"]+\"|'[^']+')/", $t_filter[FILTER_PROPERTY_SEARCH], $t_matches, PREG_SET_ORDER);
# organize terms without quoting, paying attention to negation
$t_search_terms = array();
foreach ($t_matches as $t_match) {
$t_search_terms[trim($t_match[1], "\\'\"")] = $t_match[0][0] == '-';
}
# build a big where-clause and param list for all search terms, including negations
$t_first = true;
$t_textsearch_where_clause = '( ';
foreach ($t_search_terms as $t_search_term => $t_negate) {
if (!$t_first) {
$t_textsearch_where_clause .= ' AND ';
}
if ($t_negate) {
$t_textsearch_where_clause .= 'NOT ';
}
$c_search = '%' . $t_search_term . '%';
$t_textsearch_where_clause .= '( ' . db_helper_like('{bug}.summary') . ' OR ' . db_helper_like('{bug_text}.description') . ' OR ' . db_helper_like('{bug_text}.steps_to_reproduce') . ' OR ' . db_helper_like('{bug_text}.additional_information') . ' OR ' . db_helper_like('{bugnote_text}.note');
$t_where_params[] = $c_search;
$t_where_params[] = $c_search;
$t_where_params[] = $c_search;
$t_where_params[] = $c_search;
$t_where_params[] = $c_search;
if (is_numeric($t_search_term)) {
# PostgreSQL on 64-bit OS hack (see #14014)
if (PHP_INT_MAX > 0x7fffffff && db_is_pgsql()) {
$t_search_max = 0x7fffffff;
} else {
$t_search_max = PHP_INT_MAX;
}
# Note: no need to test negative values, '-' sign has been removed
if ($t_search_term <= $t_search_max) {
$c_search_int = (int) $t_search_term;
$t_textsearch_where_clause .= ' OR {bug}.id = ' . db_param();
$t_textsearch_where_clause .= ' OR {bugnote}.id = ' . db_param();
$t_where_params[] = $c_search_int;
$t_where_params[] = $c_search_int;
}
}
$t_textsearch_where_clause .= ' )';
$t_first = false;
}
$t_textsearch_where_clause .= ' )';
# add text query elements to arrays
if (!$t_first) {
$t_join_clauses[] = 'JOIN {bug_text} ON {bug}.bug_text_id = {bug_text}.id';
$t_join_clauses[] = 'LEFT JOIN {bugnote} ON {bug}.id = {bugnote}.bug_id';
# Outer join required otherwise we don't retrieve issues without notes
$t_join_clauses[] = 'LEFT JOIN {bugnote_text} ON {bugnote}.bugnote_text_id = {bugnote_text}.id';
$t_where_clauses[] = $t_textsearch_where_clause;
}
}
# End text search
# Determine join operator
if ($t_filter[FILTER_PROPERTY_MATCH_TYPE] == FILTER_MATCH_ANY) {
$t_join_operator = ' OR ';
} else {
$t_join_operator = ' AND ';
示例4: print_test_row
}
print_test_row('Opening connection to database [' . config_get_global('database_name') . '] on host [' . config_get_global('hostname') . '] with username [' . config_get_global('db_username') . ']', @db_connect(config_get_global('dsn', false), config_get_global('hostname'), config_get_global('db_username'), config_get_global('db_password'), config_get_global('database_name')) != false);
if (!db_is_connected()) {
print_info_row('Database is not connected - Can not continue checks');
}
require_once 'obsolete.php';
if (isset($ADODB_vers)) {
# ADOConnection::Version() is broken as it treats v5.1 the same as v5.10
# Therefore we must extract the correct version ourselves
# Upstream bug report: http://phplens.com/lens/lensforum/msgs.php?id=18320
if (preg_match('/^[Vv]([0-9\\.]+)/', $ADODB_vers, $t_matches) == 1) {
$t_adodb_version_check_ok = version_compare($t_matches[1], '5.10', '>=');
}
}
print_test_warn_row('Checking adodb version...', $t_adodb_version_check_ok, $ADODB_vers);
print_test_row('Checking using bundled adodb with some drivers...', !(db_is_pgsql() || db_is_mssql() || db_is_db2()) || strstr($ADODB_vers, 'MantisBT Version') !== false);
$t_serverinfo = $g_db->ServerInfo();
print_info_row('Database Type (adodb)', $g_db->databaseType);
print_info_row('Database Provider (adodb)', $g_db->dataProvider);
print_info_row('Database Server Description (adodb)', $t_serverinfo['description']);
print_info_row('Database Server Description (version)', $t_serverinfo['version']);
print_test_row('Checking to see if your absolute_path config option has a trailing slash: "' . config_get_global('absolute_path') . '"', "\\" == substr(config_get_global('absolute_path'), -1, 1) || "/" == substr(config_get_global('absolute_path'), -1, 1));
// Windows-only checks
if (is_windows_server()) {
print_test_row('validate_email (if ON) requires php 5.3 on windows...', OFF == config_get_global('validate_email') || ON == config_get_global('validate_email') && version_compare(phpversion(), '5.3.0', '>='));
print_test_row('check_mx_record (if ON) requires php 5.3 on windows...', OFF == config_get_global('check_mx_record') || ON == config_get_global('check_mx_record') && version_compare(phpversion(), '5.3.0', '>='));
}
$t_vars = array('magic_quotes_gpc', 'include_path');
while (list($t_foo, $t_var) = each($t_vars)) {
print_info_row($t_var, ini_get($t_var));
}
示例5: project_update
function project_update($p_project_id, $p_name, $p_description, $p_status, $p_view_state, $p_file_path, $p_enabled, $p_inherit_global)
{
$p_project_id = (int) $p_project_id;
$c_enabled = db_prepare_bool($p_enabled);
# Workaround for #14385 - inherit_global column is wrongly defined as int
if (db_is_pgsql()) {
$c_inherit_global = db_prepare_int($p_inherit_global);
} else {
$c_inherit_global = db_prepare_bool($p_inherit_global);
}
if (is_blank($p_name)) {
trigger_error(ERROR_PROJECT_NAME_INVALID, ERROR);
}
$t_old_name = project_get_field($p_project_id, 'name');
if (strcasecmp($p_name, $t_old_name) != 0) {
project_ensure_name_unique($p_name);
}
if (DATABASE !== config_get('file_upload_method', null, null, $p_project_id)) {
$p_file_path = validate_project_file_path($p_file_path);
}
$t_project_table = db_get_table('mantis_project_table');
$query = "UPDATE {$t_project_table}\n\t\t\t\t SET name=" . db_param() . ",\n\t\t\t\t\tstatus=" . db_param() . ",\n\t\t\t\t\tenabled=" . db_param() . ",\n\t\t\t\t\tview_state=" . db_param() . ",\n\t\t\t\t\tfile_path=" . db_param() . ",\n\t\t\t\t\tdescription=" . db_param() . ",\n\t\t\t\t\tinherit_global=" . db_param() . "\n\t\t\t\t WHERE id=" . db_param();
db_query_bound($query, array($p_name, (int) $p_status, $c_enabled, (int) $p_view_state, $p_file_path, $p_description, $c_inherit_global, $p_project_id));
project_clear_cache($p_project_id);
# db_query errors on failure so:
return true;
}
示例6: htmlentities
false => 'The version of MySQL you are using is ' . htmlentities( $t_database_server_info['version'] ) . '. This version is no longer supported and should not be used as security flaws discovered in this version will not be fixed.'
)
);
check_print_test_warn_row(
'Version of MySQL being used is within the <a href="http://www.mysql.com/about/legal/lifecycle/">MySQL active lifecycle period</a>',
version_compare( $t_database_server_info['version'], '5.1', '>=' ),
array(
true => 'Active lifecycle support ends on 2010-12-31 for MySQL 5.1.',
false => 'The version of MySQL you are using is ' . htmlentities( $t_database_server_info['version'] ) . '. It is recommended you use a newer version of MySQL still within the active lifecycle period.'
)
);
}
if( db_is_pgsql() ) {
check_print_test_row(
'Version of PostgreSQL being used still has <a href="http://wiki.postgresql.org/wiki/PostgreSQL_Release_Support_Policy">release support</a>',
version_compare( $t_database_server_info['version'], '7.4', '>=' ),
array( false => 'The version of PostgreSQL you are using is '. htmlentities( $t_database_server_info['version'] ). '. This version is no longer supported and should not be used as security flaws discovered in this version will not be fixed.' )
);
}
$t_table_prefix = config_get_global( 'db_table_prefix' );
check_print_info_row(
'Prefix added to each MantisBT table name',
htmlentities( $t_table_prefix )
);
示例7: db_insert_id
function db_insert_id($p_table = null)
{
global $g_db;
if (isset($p_table) && db_is_pgsql()) {
$query = "SELECT currval('" . $p_table . "_id_seq')";
$result = db_query($query);
return db_result($result);
}
return $g_db->Insert_ID();
}
示例8: filter_get_bug_rows
//.........这里部分代码省略.........
}
}
$t_custom_where_clause .= '(' . implode(' OR ', $t_filter_array);
}
if (!is_blank($t_custom_where_clause)) {
array_push($t_where_clauses, $t_custom_where_clause . ')');
}
}
}
}
# Text search
if (!is_blank($t_filter[FILTER_PROPERTY_FREE_TEXT])) {
# break up search terms by spacing or quoting
preg_match_all("/-?([^'\"\\s]+|\"[^\"]+\"|'[^']+')/", $t_filter[FILTER_PROPERTY_FREE_TEXT], $t_matches, PREG_SET_ORDER);
# organize terms without quoting, paying attention to negation
$t_search_terms = array();
foreach ($t_matches as $t_match) {
$t_search_terms[trim($t_match[1], "\\'\"")] = $t_match[0][0] == '-';
}
# build a big where-clause and param list for all search terms, including negations
$t_first = true;
$t_textsearch_where_clause = "( ";
foreach ($t_search_terms as $t_search_term => $t_negate) {
if (!$t_first) {
$t_textsearch_where_clause .= ' AND ';
}
if ($t_negate) {
$t_textsearch_where_clause .= 'NOT ';
}
$c_search = '%' . $t_search_term . '%';
$t_textsearch_where_clause .= '( ' . db_helper_like('summary') . ' OR ' . db_helper_like("{$t_bug_text_table}.description") . ' OR ' . db_helper_like("{$t_bug_text_table}.steps_to_reproduce") . ' OR ' . db_helper_like("{$t_bug_text_table}.additional_information") . ' OR ' . db_helper_like("{$t_bugnote_text_table}.note");
$t_where_params[] = $c_search;
$t_where_params[] = $c_search;
$t_where_params[] = $c_search;
$t_where_params[] = $c_search;
$t_where_params[] = $c_search;
if (is_numeric($t_search_term)) {
// PostgreSQL on 64-bit OS hack (see #14014)
if (PHP_INT_MAX > 0x7fffffff && db_is_pgsql()) {
$t_search_max = 0x7fffffff;
} else {
$t_search_max = PHP_INT_MAX;
}
// Note: no need to test negative values, '-' sign has been removed
if ($t_search_term <= $t_search_max) {
$c_search_int = (int) $t_search_term;
$t_textsearch_where_clause .= " OR {$t_bug_table}.id = " . db_param();
$t_textsearch_where_clause .= " OR {$t_bugnote_table}.id = " . db_param();
$t_where_params[] = $c_search_int;
$t_where_params[] = $c_search_int;
}
}
$t_textsearch_where_clause .= ' )';
$t_first = false;
}
$t_textsearch_where_clause .= ' )';
# add text query elements to arrays
if (!$t_first) {
$t_from_clauses[] = "{$t_bug_text_table}";
$t_where_clauses[] = "{$t_bug_table}.bug_text_id = {$t_bug_text_table}.id";
$t_where_clauses[] = $t_textsearch_where_clause;
$t_join_clauses[] = " LEFT JOIN {$t_bugnote_table} ON {$t_bug_table}.id = {$t_bugnote_table}.bug_id";
$t_join_clauses[] = " LEFT JOIN {$t_bugnote_text_table} ON {$t_bugnote_table}.bugnote_text_id = {$t_bugnote_text_table}.id";
}
}
# End text search
$t_from_clauses[] = $t_project_table;
$t_from_clauses[] = $t_bug_table;
$t_query_clauses['select'] = $t_select_clauses;
$t_query_clauses['from'] = $t_from_clauses;
$t_query_clauses['join'] = $t_join_clauses;
$t_query_clauses['where'] = $t_where_clauses;
$t_query_clauses['where_values'] = $t_where_params;
$t_query_clauses = filter_get_query_sort_data($t_filter, $p_show_sticky, $t_query_clauses);
# assigning to $p_* for this function writes the values back in case the caller wants to know
# Get the total number of bugs that meet the criteria.
$p_bug_count = filter_get_bug_count($t_query_clauses);
if (0 == $p_bug_count) {
return array();
}
$p_per_page = filter_per_page($t_filter, $p_bug_count, $p_per_page);
$p_page_count = filter_page_count($p_bug_count, $p_per_page);
$p_page_number = filter_valid_page_number($p_page_number, $p_page_count);
$t_offset = filter_offset($p_page_number, $p_per_page);
$t_query_clauses = filter_unique_query_clauses($t_query_clauses);
$t_select_string = "SELECT DISTINCT " . implode(', ', $t_query_clauses['select']);
$t_from_string = " FROM " . implode(', ', $t_query_clauses['from']);
$t_order_string = " ORDER BY " . implode(', ', $t_query_clauses['order']);
$t_join_string = count($t_query_clauses['join']) > 0 ? implode(' ', $t_query_clauses['join']) : '';
$t_where_string = count($t_query_clauses['where']) > 0 ? 'WHERE ' . implode(' AND ', $t_query_clauses['where']) : '';
$t_result = db_query_bound("{$t_select_string} {$t_from_string} {$t_join_string} {$t_where_string} {$t_order_string}", $t_query_clauses['where_values'], $p_per_page, $t_offset);
$t_row_count = db_num_rows($t_result);
$t_id_array_lastmod = array();
for ($i = 0; $i < $t_row_count; $i++) {
$t_row = db_fetch_array($t_result);
$t_id_array_lastmod[] = (int) $t_row['id'];
$t_rows[] = $t_row;
}
return filter_cache_result($t_rows, $t_id_array_lastmod);
}
示例9: pop
/**
* Pops the previous value of param count from the stack
* This function is called by {@see db_query()} and should not need
* to be executed directly
* @return void
*/
public function pop()
{
global $g_db;
$this->count = (int) array_pop($this->stack);
if (db_is_pgsql()) {
# Manually reset the ADOdb param number to the value we just popped
$g_db->_pnum = $this->count;
}
}
示例10: db_helper_like
function db_helper_like($p_field_name, $p_value, $p_case_sensitive = false)
{
$t_like_keyword = 'LIKE';
if ($p_case_sensitive === false) {
if (db_is_pgsql()) {
$t_like_keyword = 'ILIKE';
}
}
return "({$p_field_name} {$t_like_keyword} '{$p_value}')";
}