当前位置: 首页>>代码示例>>PHP>>正文


PHP db_helper_like函数代码示例

本文整理汇总了PHP中db_helper_like函数的典型用法代码示例。如果您正苦于以下问题:PHP db_helper_like函数的具体用法?PHP db_helper_like怎么用?PHP db_helper_like使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。


在下文中一共展示了db_helper_like函数的10个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: category_is_unique

/**
 * Check whether the category is unique within a project
 * @param integer $p_project_id A project identifier.
 * @param string  $p_name       Project name.
 * @return boolean Returns true if the category is unique, false otherwise
 * @access public
 */
function category_is_unique($p_project_id, $p_name)
{
    $t_query = 'SELECT COUNT(*) FROM {category}
					WHERE project_id=' . db_param() . ' AND ' . db_helper_like('name');
    $t_count = db_result(db_query($t_query, array($p_project_id, $p_name)));
    if (0 < $t_count) {
        return false;
    } else {
        return true;
    }
}
开发者ID:gtn,项目名称:mantisbt,代码行数:18,代码来源:category_api.php

示例2: category_is_unique

/**
 * Check whether the category is unique within a project
 * @param int $p_project_id project id
 * @param string $p_name project name
 * @return bool Returns true if the category is unique, false otherwise
 * @access public
 */
function category_is_unique($p_project_id, $p_name)
{
    $c_project_id = db_prepare_int($p_project_id);
    $t_category_table = db_get_table('mantis_category_table');
    $query = "SELECT COUNT(*) FROM {$t_category_table}\n\t\t\t\t\tWHERE project_id=" . db_param() . " AND " . db_helper_like('name');
    $count = db_result(db_query_bound($query, array($c_project_id, $p_name)));
    if (0 < $count) {
        return false;
    } else {
        return true;
    }
}
开发者ID:nourchene-benslimane,项目名称:mantisV0,代码行数:19,代码来源:category_api.php

示例3: filter_get_bug_rows


//.........这里部分代码省略.........
                            break;
                        case CUSTOM_FIELD_DATE_NONE:
                            array_push($t_join_clauses, $t_cf_join_clause);
                            $t_custom_where_clause = '( ' . $t_table_name . '.bug_id is null OR ' . $t_value_field . ' = 0 ';
                            break;
                        case CUSTOM_FIELD_DATE_BEFORE:
                            array_push($t_join_clauses, $t_cf_join_clause);
                            $t_custom_where_clause = '( ' . $t_value_field . ' != 0 AND ' . $t_value_field . ' < ' . $t_field[2];
                            break;
                        case CUSTOM_FIELD_DATE_AFTER:
                            array_push($t_join_clauses, $t_cf_join_clause);
                            $t_custom_where_clause = '( ' . $t_value_field . ' > ' . ($t_field[1] + 1);
                            break;
                        default:
                            array_push($t_join_clauses, $t_cf_join_clause);
                            $t_custom_where_clause = '( ' . $t_value_field . ' BETWEEN ' . $t_field[1] . ' AND ' . $t_field[2];
                            break;
                    }
                } else {
                    array_push($t_join_clauses, $t_cf_join_clause);
                    $t_filter_array = array();
                    foreach ($t_field as $t_filter_member) {
                        $t_filter_member = stripslashes($t_filter_member);
                        if (filter_field_is_none($t_filter_member)) {
                            # coerce filter value if selecting META_FILTER_NONE so it will match empty fields
                            $t_filter_member = '';
                            # but also add those _not_ present in the custom field string table
                            array_push($t_filter_array, '{bug}.id NOT IN (SELECT bug_id FROM {custom_field_string} WHERE field_id=' . $t_cfid . ')');
                        }
                        switch ($t_def['type']) {
                            case CUSTOM_FIELD_TYPE_CHECKBOX:
                            case CUSTOM_FIELD_TYPE_MULTILIST:
                                $t_where_params[] = '%|' . $t_filter_member . '|%';
                                array_push($t_filter_array, db_helper_like($t_table_name . '.value'));
                                break;
                            case CUSTOM_FIELD_TYPE_TEXTAREA:
                                $t_where_params[] = '%' . $t_filter_member . '%';
                                array_push($t_filter_array, db_helper_like($t_table_name . '.text'));
                                break;
                            default:
                                $t_where_params[] = $t_filter_member;
                                array_push($t_filter_array, $t_table_name . '.value = ' . db_param());
                        }
                    }
                    $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_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) {
开发者ID:vipjaven,项目名称:mantisbt,代码行数:67,代码来源:filter_api.php

示例4: tag_get_by_name

/**
 * Return a tag row for the given name.
 * @param string Tag name
 * @return Tag row
 */
function tag_get_by_name($p_name)
{
    $t_tag_table = db_get_table('tag');
    $query = "SELECT * FROM {$t_tag_table}\n\t\t\t\t\tWHERE " . db_helper_like('name');
    $result = db_query_bound($query, array($p_name));
    if (0 == db_num_rows($result)) {
        return false;
    }
    $row = db_fetch_array($result);
    return $row;
}
开发者ID:Kirill,项目名称:mantisbt,代码行数:16,代码来源:tag_api.php

示例5: AND

    echo '</li>';
}
echo '</ul>';
echo '</div>';
$t_where_params = null;
if ($f_filter === 'ALL') {
    $t_where = '(1 = 1)';
} else {
    if ($f_filter === 'UNUSED') {
        $t_where = '(login_count = 0) AND ( date_created = last_visit )';
    } else {
        if ($f_filter === 'NEW') {
            $t_where = db_helper_compare_days("" . db_now() . "", "date_created", "<= {$t_days_old}");
        } else {
            $t_where_params[] = $f_filter . '%';
            $t_where = db_helper_like('UPPER(username)');
        }
    }
}
$p_per_page = 50;
$t_offset = ($f_page_number - 1) * $p_per_page;
$t_total_user_count = 0;
# Get the user data in $c_sort order
$t_result = '';
if (1 == $c_show_disabled) {
    $t_show_disabled_cond = '';
} else {
    $t_show_disabled_cond = ' AND enabled = ' . db_prepare_bool(true);
}
if (0 == $c_hide_inactive) {
    $t_query = "SELECT count(*) as user_count FROM {$t_user_table} WHERE {$t_where} {$t_show_disabled_cond}";
开发者ID:N0ctrnl,项目名称:mantisbt,代码行数:31,代码来源:manage_user_page.php

示例6: tag_get_by_name

/**
 * Return a tag row for the given name.
 * @param string Tag name
 * @return Tag row
 */
function tag_get_by_name($p_name)
{
    $c_name = db_prepare_string($p_name);
    $t_tag_table = config_get('mantis_tag_table');
    $query = "SELECT * FROM {$t_tag_table}\r\n\t\t\t\t\tWHERE " . db_helper_like('name', $c_name);
    $result = db_query($query);
    if (0 == db_num_rows($result)) {
        return false;
    }
    $row = db_fetch_array($result);
    return $row;
}
开发者ID:amjadtbssm,项目名称:website,代码行数:17,代码来源:tag_api.php

示例7: filter_get_bug_rows


//.........这里部分代码省略.........
                        case CUSTOM_FIELD_DATE_ANY:
                            break;
                        case CUSTOM_FIELD_DATE_NONE:
                            array_push($t_join_clauses, $t_cf_join_clause);
                            $t_custom_where_clause = '(( ' . $t_table_name . '.bug_id is null) OR ( ' . $t_table_name . '.value = 0)';
                            break;
                        case CUSTOM_FIELD_DATE_BEFORE:
                            array_push($t_join_clauses, $t_cf_join_clause);
                            $t_custom_where_clause = '(( ' . $t_table_name . '.value != 0 AND (' . $t_table_name . '.value+0) < ' . $t_filter['custom_fields'][$t_cfid][2] . ')';
                            break;
                        case CUSTOM_FIELD_DATE_AFTER:
                            array_push($t_join_clauses, $t_cf_join_clause);
                            $t_custom_where_clause = '( (' . $t_table_name . '.value+0) > ' . ($t_filter['custom_fields'][$t_cfid][1] + 1);
                            break;
                        default:
                            array_push($t_join_clauses, $t_cf_join_clause);
                            $t_custom_where_clause = '( (' . $t_table_name . '.value+0) BETWEEN ' . $t_filter['custom_fields'][$t_cfid][1] . ' AND ' . $t_filter['custom_fields'][$t_cfid][2];
                            break;
                    }
                } else {
                    array_push($t_join_clauses, $t_cf_join_clause);
                    $t_filter_array = array();
                    foreach ($t_filter['custom_fields'][$t_cfid] as $t_filter_member) {
                        $t_filter_member = stripslashes($t_filter_member);
                        if (META_FILTER_NONE == $t_filter_member) {
                            # coerce filter value if selecting META_FILTER_NONE so it will match empty fields
                            $t_filter_member = '';
                            # but also add those _not_ present in the custom field string table
                            array_push($t_filter_array, "{$t_bug_table}.id NOT IN (SELECT bug_id FROM {$t_custom_field_string_table} WHERE field_id={$t_cfid})");
                        }
                        switch ($t_def['type']) {
                            case CUSTOM_FIELD_TYPE_MULTILIST:
                            case CUSTOM_FIELD_TYPE_CHECKBOX:
                                array_push($t_filter_array, db_helper_like("{$t_table_name}.value", '%|' . db_prepare_string($t_filter_member) . '|%'));
                                break;
                            default:
                                array_push($t_filter_array, "{$t_table_name}.value = '" . db_prepare_string($t_filter_member) . "'");
                        }
                    }
                    $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 . ')');
                }
            }
        }
    }
    $t_textsearch_where_clause = '';
    $t_textsearch_wherejoin_clause = '';
    # Simple Text Search - Thanks to Alan Knowles
    if (!is_blank($t_filter['search'])) {
        $c_search = db_prepare_string($t_filter['search']);
        $c_search_int = db_prepare_int($t_filter['search']);
        $t_textsearch_where_clause = '(' . db_helper_like('summary', "%{$c_search}%") . ' OR ' . db_helper_like("{$t_bug_text_table}.description", "%{$c_search}%") . ' OR ' . db_helper_like("{$t_bug_text_table}.steps_to_reproduce", "%{$c_search}%") . ' OR ' . db_helper_like("{$t_bug_text_table}.additional_information", "%{$c_search}%") . " OR ( {$t_bug_table}.id = '{$c_search_int}' ) )";
        $t_textsearch_wherejoin_clause = '(' . db_helper_like('summary', "%{$c_search}%") . ' OR ' . db_helper_like("{$t_bug_text_table}.description", "%{$c_search}%") . ' OR ' . db_helper_like("{$t_bug_text_table}.steps_to_reproduce", "%{$c_search}%") . ' OR ' . db_helper_like("{$t_bug_text_table}.additional_information", "%{$c_search}%") . ' OR ' . db_helper_like("{$t_bug_table}.id", "%{$c_search}%") . ' OR ' . db_helper_like("{$t_bugnote_text_table}.note", "%{$c_search}%") . ' )';
        array_push($t_where_clauses, "({$t_bug_text_table}.id = {$t_bug_table}.bug_text_id)");
        $t_from_clauses = array($t_bug_text_table, $t_project_table, $t_bug_table);
    } else {
        $t_from_clauses = array($t_project_table, $t_bug_table);
    }
    $t_select = implode(', ', array_unique($t_select_clauses));
    $t_from = 'FROM ' . implode(', ', array_unique($t_from_clauses));
    $t_join = implode(' ', $t_join_clauses);
    if (count($t_where_clauses) > 0) {
        $t_where = 'WHERE ' . implode(' AND ', $t_where_clauses);
    } else {
开发者ID:amjadtbssm,项目名称:website,代码行数:67,代码来源:filter_api.php

示例8: tag_get_by_name

/**
 * Return a tag row for the given name.
 * @param string $p_name The tag name to retrieve from the database.
 * @return array|boolean Tag row
 */
function tag_get_by_name($p_name)
{
    $t_query = 'SELECT * FROM {tag} WHERE ' . db_helper_like('name');
    $t_result = db_query($t_query, array($p_name));
    $t_row = db_fetch_array($t_result);
    if (!$t_row) {
        return false;
    }
    return $t_row;
}
开发者ID:gtn,项目名称:mantisbt,代码行数:15,代码来源:tag_api.php

示例9: filter_get_bug_rows


//.........这里部分代码省略.........
                            $t_custom_where_clause = '(( ' . $t_table_name . '.bug_id is null) OR ( ' . $t_table_name . '.value = 0)';
                            break;
                        case CUSTOM_FIELD_DATE_BEFORE:
                            array_push($t_join_clauses, $t_cf_join_clause);
                            $t_custom_where_clause = '(( ' . $t_table_name . '.value != 0 AND (' . $t_table_name . '.value+0) < ' . $t_filter['custom_fields'][$t_cfid][2] . ')';
                            break;
                        case CUSTOM_FIELD_DATE_AFTER:
                            array_push($t_join_clauses, $t_cf_join_clause);
                            $t_custom_where_clause = '( (' . $t_table_name . '.value+0) > ' . ($t_filter['custom_fields'][$t_cfid][1] + 1);
                            break;
                        default:
                            array_push($t_join_clauses, $t_cf_join_clause);
                            $t_custom_where_clause = '( (' . $t_table_name . '.value+0) BETWEEN ' . $t_filter['custom_fields'][$t_cfid][1] . ' AND ' . $t_filter['custom_fields'][$t_cfid][2];
                            break;
                    }
                } else {
                    array_push($t_join_clauses, $t_cf_join_clause);
                    $t_filter_array = array();
                    foreach ($t_filter['custom_fields'][$t_cfid] as $t_filter_member) {
                        $t_filter_member = stripslashes($t_filter_member);
                        if (filter_field_is_none($t_filter_member)) {
                            # coerce filter value if selecting META_FILTER_NONE so it will match empty fields
                            $t_filter_member = '';
                            # but also add those _not_ present in the custom field string table
                            array_push($t_filter_array, "{$t_bug_table}.id NOT IN (SELECT bug_id FROM {$t_custom_field_string_table} WHERE field_id={$t_cfid})");
                        }
                        switch ($t_def['type']) {
                            case CUSTOM_FIELD_TYPE_CHECKBOX:
                            case CUSTOM_FIELD_TYPE_MULTILIST:
                                if ($t_filter_member != '') {
                                    $t_filter_member = '%|' . $t_filter_member . '|%';
                                }
                                $t_where_params[] = $t_filter_member;
                                array_push($t_filter_array, db_helper_like("{$t_table_name}.value"));
                                break;
                            default:
                                $t_where_params[] = $t_filter_member;
                                array_push($t_filter_array, "{$t_table_name}.value = " . db_param());
                        }
                    }
                    $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 ';
开发者ID:nourchene-benslimane,项目名称:mantisV0,代码行数:67,代码来源:filter_api.php

示例10: array

        $t_caption = $t_prefix;
    }
    if ($t_prefix == $f_filter) {
        $t_link = "<strong>{$t_caption}</strong>";
    } else {
        $t_link = '<a href="manage_tags_page.php?filter=' . $t_prefix . '">' . $t_caption . '</a>';
    }
    echo '<td>' . $t_link . '</td>';
}
echo '</tr></table>';
$t_where_params = array();
if ($f_filter === 'ALL') {
    $t_where = '';
} else {
    $t_where_params[] = $f_filter . '%';
    $t_where = 'WHERE ' . db_helper_like('name');
}
# Set the number of Tags per page.
$t_per_page = 20;
$t_offset = ($f_page_number - 1) * $t_per_page;
# Determine number of tags in tag table
$t_total_tag_count = 0;
$t_result = '';
$t_query = "SELECT count(*)\n\t\t\tFROM {$t_tag_table}\n\t\t\t{$t_where}";
$t_result = db_query_bound($t_query, $t_where_params);
$t_row = db_fetch_array($t_result);
$t_total_tag_count = (int) db_result($t_result);
#Number of pages from result
$t_page_count = ceil($t_total_tag_count / $t_per_page);
if ($t_page_count < 1) {
    $t_page_count = 1;
开发者ID:kaos,项目名称:mantisbt,代码行数:31,代码来源:manage_tags_page.php


注:本文中的db_helper_like函数示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。