本文整理汇总了PHP中db_field_exists函数的典型用法代码示例。如果您正苦于以下问题:PHP db_field_exists函数的具体用法?PHP db_field_exists怎么用?PHP db_field_exists使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了db_field_exists函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: hook_update_N
/**
* Additional columns and views need to be added to existing fields.
* Below is an example using the addtional column and view defined above.
* my_new_view_additional_data() is schema defined in
* hook_recline_field_columns.
*/
function hook_update_N(&$sandbox)
{
$ret = array();
$fields = field_info_fields();
foreach ($fields as $field_name => $field) {
if ($field['type'] == 'recline_field' && $field['storage']['type'] == 'field_sql_storage') {
foreach ($field['storage']['details']['sql'] as $type => $table_info) {
foreach ($table_info as $table_name => $columns) {
$column_name = _field_sql_storage_columnname($field_name, 'my_new_view_additional_data');
// Adding my_new_view_additional_data.
if (!db_field_exists($table_name, $column_name)) {
// Calling schema defined in hook_recline_field_column().
$schema = my_new_view_additional_data();
db_add_field($table_name, $column_name, $schema);
}
// Adding my_new_view.
$column_name = _field_sql_storage_columnname($field_name, 'my_new_view');
$schema = recline_field_schema();
if (!db_field_exists($table_name, $column_name)) {
db_add_field($table_name, $column_name, $schema['columns']['my_new_view']);
}
field_cache_clear();
}
}
}
}
return $ret;
}
示例2: upgrade_0_15_9
function upgrade_0_15_9()
{
global $t_project_version_table;
if (!db_field_exists('date_order', $t_project_version_table)) {
$query = "ALTER TABLE {$t_project_version_table} ADD date_order DATETIME DEFAULT '1970-01-01 00:00:01' NOT NULL";
$result = @db_query($query);
if (false == $result) {
return false;
}
}
return true;
}
示例3: remove
function remove($module)
{
global $db, $messageStack;
$error = false;
if (db_field_exists(TABLE_CURRENT_STATUS, 'next_capa_num')) {
$db->Execute("ALTER TABLE " . TABLE_CURRENT_STATUS . " DROP next_capa_num");
}
if (db_field_exists(TABLE_CURRENT_STATUS, 'next_capa_desc')) {
$db->Execute("ALTER TABLE " . TABLE_CURRENT_STATUS . " DROP next_capa_desc");
}
return $error;
}
示例4: upgrade_0_16_13
function upgrade_0_16_13()
{
global $t_user_pref_table;
if (!db_field_exists('project_id', $t_user_pref_table)) {
$query = "ALTER TABLE {$t_user_pref_table} ADD project_id INT(7) UNSIGNED ZEROFILL NOT NULL AFTER user_id";
$result = @db_query($query);
if (false == $result) {
return false;
}
}
return true;
}
示例5: view
/**
* Displays the bean.
*/
public function view($bean, $content, $view_mode = 'default', $langcode = NULL)
{
// Retrieve the terms from the loaded entity.
$active_entity = bean_tax_active_entity_array();
// Check for cached content on this block.
$cache_name = 'bean_tax:listing:' . $bean->delta . ':' . $active_entity['type'] . ':' . $active_entity['ids'][0];
if ($cache = cache_get($cache_name)) {
$content = $cache->data;
} else {
// We need to make sure that the bean is configured correctly.
if ($active_entity['type'] != 'bean' && !empty($bean->filters['vocabulary']) && (isset($active_entity['terms']) && count($active_entity['terms']))) {
// Reformat vocabulary list from machine names to vocabulary vids.
$vids = array();
foreach ($bean->filters['vocabulary'] as $vm) {
$query = new EntityFieldQuery();
$result = $query->entityCondition('entity_type', 'taxonomy_vocabulary');
$query->propertyCondition('machine_name', $vm);
global $language;
if ($language->language != NULL && db_field_exists('taxonomy_vocabulary', 'language')) {
$query->propertyCondition('language', $language->language);
}
$result = $query->execute();
foreach ($result['taxonomy_vocabulary'] as $vocabulary) {
$vids[$vocabulary->vid] = $vocabulary->vid;
}
}
$i = 0;
$content['terms'] = array();
// Parse terms from correct vocabularies, limit list to X results.
foreach ($active_entity['terms'] as $term) {
$term = entity_load_single('taxonomy_term', $term->tid);
if (in_array($term->vid, $vids) && $i < $bean->settings['records_shown']) {
$content['terms'][$term->tid] = entity_view('taxonomy_term', array($term->tid => $term), $bean->settings['term_view_mode']);
$i++;
}
}
cache_set($cache_name, $content, 'cache', time() + 60 * $bean->settings['cache_duration']);
} elseif (isset($active_entity['type']) && $active_entity['type'] == 'bean' && $bean->bid === $active_entity['object']->bid) {
$content['#markup'] = '';
} elseif ($bean->settings['hide_empty'] || !$active_entity['object']) {
return;
} else {
$content['#markup'] = t('No terms.');
}
}
return $content;
}
示例6: update
function update($module)
{
global $db, $messageStack;
$error = false;
if (MODULE_ASSETS_STATUS < 3.1) {
$tab_map = array('0' => '0');
if (db_table_exists(DB_PREFIX . 'assets_tabs')) {
$result = $db->Execute("select * from " . DB_PREFIX . 'assets_tabs');
while (!$result->EOF) {
$updateDB = $db->Execute("insert into " . TABLE_EXTRA_TABS . " set \n\t\t\t module_id = 'assets',\n\t\t\t tab_name = '" . $result->fields['category_name'] . "',\n\t\t\t description = '" . $result->fields['category_description'] . "',\n\t\t\t sort_order = '" . $result->fields['sort_order'] . "'");
$tab_map[$result->fields['category_id']] = db_insert_id();
$result->MoveNext();
}
$db->Execute("DROP TABLE " . DB_PREFIX . "assets_tabs");
}
if (db_table_exists(DB_PREFIX . 'assets_fields')) {
$result = $db->Execute("select * from " . DB_PREFIX . 'assets_fields');
while (!$result->EOF) {
$updateDB = $db->Execute("insert into " . TABLE_EXTRA_FIELDS . " set \n\t\t\t module_id = 'assets',\n\t\t\t tab_id = '" . $tab_map[$result->fields['category_id']] . "',\n\t\t\t entry_type = '" . $result->fields['entry_type'] . "',\n\t\t\t field_name = '" . $result->fields['field_name'] . "',\n\t\t\t description = '" . $result->fields['description'] . "',\n\t\t\t params = '" . $result->fields['params'] . "'");
$result->MoveNext();
}
$db->Execute("DROP TABLE " . DB_PREFIX . "assets_fields");
}
xtra_field_sync_list('assets', TABLE_ASSETS);
}
if (MODULE_ASSETS_STATUS < 3.3) {
if (!db_field_exists(TABLE_ASSETS, 'attachments')) {
$db->Execute("ALTER TABLE " . TABLE_ASSETS . " ADD attachments TEXT NOT NULL AFTER terminal_date");
}
require_once DIR_FS_MODULES . 'phreedom/functions/phreedom.php';
xtra_field_sync_list('assets', TABLE_ASSETS);
}
if (!$error) {
write_configure('MODULE_' . strtoupper($module) . '_STATUS', constant('MODULE_' . strtoupper($module) . '_VERSION'));
$messageStack->add(sprintf(GEN_MODULE_UPDATE_SUCCESS, $module, constant('MODULE_' . strtoupper($module) . '_VERSION')), 'success');
}
return $error;
}
示例7: install
function install($module)
{
global $db;
// add field amazon_confirm
if (!db_field_exists(TABLE_SHIPPING_LOG, 'amazon_confirm')) {
$db->Execute("ALTER TABLE " . TABLE_SHIPPING_LOG . " ADD amazon_confirm ENUM('0', '1') NOT NULL DEFAULT '0'");
}
if (!db_field_exists(TABLE_INVENTORY, 'amazon')) {
// setup new tab in table inventory
$result = $db->Execute("SELECT id FROM " . TABLE_EXTRA_TABS . " WHERE tab_name='Amazon'");
if ($result->RecordCount() == 0) {
$sql_data_array = array('module_id' => 'inventory', 'tab_name' => 'Amazon', 'description' => 'Amazon Inventory Settings', 'sort_order' => '49');
db_perform(TABLE_EXTRA_TABS, $sql_data_array);
$tab_id = db_insert_id();
} else {
$tab_id = $result->fields['id'];
}
// setup extra fields for inventory
$sql_data_array = array('module_id' => 'inventory', 'tab_id' => $tab_id, 'entry_type' => 'check_box', 'field_name' => 'amazon', 'description' => 'Add to Amazon prduct upload feed.', 'sort_order' => 50, 'use_in_inventory_filter' => '1', 'params' => serialize(array('type' => 'check_box', 'select' => '0', 'inventory_type' => 'ai:ci:ds:sf:ma:ia:lb:mb:ms:mi:ns:sa:sr:sv:si:')));
db_perform(TABLE_EXTRA_FIELDS, $sql_data_array);
$db->Execute("ALTER TABLE " . TABLE_INVENTORY . " ADD COLUMN amazon enum('0','1') DEFAULT '0'");
}
}
示例8: install
function install($module)
{
global $db, $messageStack;
$error = false;
if (!db_field_exists(TABLE_CONTACTS, 'bank_account_1')) {
$sql = "select id from " . TABLE_EXTRA_FIELDS . " where module_id = 'contacts' and field_name = 'bank_account'";
$result = $db->Execute($sql);
if ($result->RecordCount() == 0) {
$result = $db->Execute("select id from " . TABLE_EXTRA_TABS . " where module_id='contacts' and tab_name = 'import_banking'");
if ($result->RecordCount() == 0) {
$entry = array('module_id' => 'contacts', 'tab_name' => 'import_banking', 'sort_order' => '100');
db_perform(TABLE_EXTRA_TABS, $entry, 'insert');
$tab_id = $db->insert_ID();
} else {
$tab_id = $result->fields['id'];
}
$entry = array('module_id' => 'contacts', 'tab_id' => $tab_id, 'entry_type' => 'text', 'field_name' => 'bank_account_1', 'description' => 'Bank Account', 'params' => 'a:4:{s:4:"type";s:4:"text";s:12:"contact_type";s:16:"customer:vendor:";s:6:"length";i:32;s:7:"default";s:0:"";}');
db_perform(TABLE_EXTRA_FIELDS, $entry, 'insert');
//$db->Execute("INSERT INTO " . TABLE_EXTRA_FIELDS . " VALUES ('', 'contacts', ". $tab_id .",'text', 'bank_account', 'Bank Account','c:v:', );");
$db->Execute("ALTER TABLE " . TABLE_CONTACTS . " ADD bank_account_1 varchar(32) default NULL");
}
}
return $error;
}
示例9: enum_bug_group
function enum_bug_group($p_enum_string, $p_enum)
{
$t_bug_table = db_get_table('mantis_bug_table');
$t_project_id = helper_get_current_project();
$t_bug_table = db_get_table('mantis_bug_table');
$t_user_id = auth_get_current_user_id();
$t_res_val = config_get('bug_resolved_status_threshold');
$t_clo_val = config_get('bug_closed_status_threshold');
$specific_where = " AND " . helper_project_specific_where($t_project_id, $t_user_id);
if (!db_field_exists($p_enum, $t_bug_table)) {
trigger_error(ERROR_DB_FIELD_NOT_FOUND, ERROR);
}
$t_array_indexed_by_enum_values = MantisEnum::getAssocArrayIndexedByValues($p_enum_string);
$enum_count = count($t_array_indexed_by_enum_values);
foreach ($t_array_indexed_by_enum_values as $t_value => $t_label) {
# Calculates the number of bugs opened and puts the results in a table
$query = "SELECT COUNT(*)\n\t\t\t\t\tFROM {$t_bug_table}\n\t\t\t\t\tWHERE {$p_enum}=" . db_param() . " AND\n\t\t\t\t\t\tstatus<" . db_param() . " {$specific_where}";
$result2 = db_query_bound($query, array($t_value, $t_res_val));
$t_metrics['open'][$t_label] = db_result($result2, 0, 0);
# Calculates the number of bugs closed and puts the results in a table
$query = "SELECT COUNT(*)\n\t\t\t\t\tFROM {$t_bug_table}\n\t\t\t\t\tWHERE {$p_enum}=" . db_param() . " AND\n\t\t\t\t\t\tstatus>=" . db_param() . " {$specific_where}";
$result2 = db_query_bound($query, array($t_value, $t_clo_val));
$t_metrics['closed'][$t_label] = db_result($result2, 0, 0);
# Calculates the number of bugs resolved and puts the results in a table
$query = "SELECT COUNT(*)\n\t\t\t\t\tFROM {$t_bug_table}\n\t\t\t\t\tWHERE {$p_enum}=" . db_param() . " AND\n\t\t\t\t\t\tstatus>=" . db_param() . " AND\n\t\t\t\t\t\tstatus<" . db_param() . " {$specific_where}";
$result2 = db_query_bound($query, array($t_value, $t_res_val, $t_clo_val));
$t_metrics['resolved'][$t_label] = db_result($result2, 0, 0);
}
# ## end for
return $t_metrics;
}
示例10: lostpassword_fix_1
function lostpassword_fix_1()
{
global $t_user_table;
if (!db_field_exists('failed_login_count', $t_user_table)) {
$query = "ALTER TABLE {$t_user_table} ADD failed_login_count INT(2) DEFAULT '0' NOT NULL\r\n\t\t\t\tAFTER login_count";
$result = @db_query($query);
if (false == $result) {
return false;
}
}
if (!db_field_exists('lost_password_in_progress_count', $t_user_table)) {
$query = "ALTER TABLE {$t_user_table} ADD lost_password_in_progress_count INT(2) DEFAULT '0' NOT NULL\r\n\t\t\t\tAFTER login_count";
$result = @db_query($query);
if (false == $result) {
return false;
}
}
return true;
}
示例11: remove
function remove($module)
{
global $db;
$error = false;
if (db_field_exists(TABLE_CURRENT_STATUS, 'next_rma_num')) {
$db->Execute("ALTER TABLE " . TABLE_CURRENT_STATUS . " DROP next_rma_num");
}
return $error;
}
示例12: update
function update($module)
{
global $db, $messageStack;
$error = false;
if (MODULE_ZENCART_STATUS < 3.4) {
write_configure('MODULE_ZENCART_LAST_UPDATE', date('0000-00-00 00:00:00'));
}
$result = $db->Execute("select tab_id from " . TABLE_EXTRA_FIELDS . " where field_name = 'category_id'");
if ($result->RecordCount() == 0) {
$error = $messageStack->add('can not find tab_name ZenCart', 'error');
} else {
$tab_id = $result->fields['tab_id'];
}
if ($error == false && !db_field_exists(TABLE_INVENTORY, 'ProductURL')) {
$sql_data_array = array('module_id' => 'inventory', 'tab_id' => $tab_id, 'entry_type' => 'text', 'field_name' => 'ProductURL', 'description' => ZENCART_CATALOG_URL, 'params' => serialize(array('type' => 'text', 'length' => '64', 'default' => '', 'inventory_type' => 'ai:ci:ds:sf:ma:ia:lb:mb:ms:mi:ns:sa:sr:sv:si:')));
db_perform(TABLE_EXTRA_FIELDS, $sql_data_array);
$db->Execute("alter table " . TABLE_INVENTORY . " add column ProductURL varchar(64) default ''");
}
if ($error == false && !db_field_exists(TABLE_INVENTORY, 'ProductModel')) {
$sql_data_array = array('module_id' => 'inventory', 'tab_id' => $tab_id, 'entry_type' => 'text', 'field_name' => 'ProductModel', 'description' => ZENCART_CATALOG_MODEL, 'params' => serialize(array('type' => 'text', 'length' => '64', 'default' => '', 'inventory_type' => 'ai:ci:ds:sf:ma:ia:lb:mb:ms:mi:ns:sa:sr:sv:si:')));
db_perform(TABLE_EXTRA_FIELDS, $sql_data_array);
$db->Execute("alter table " . TABLE_INVENTORY . " add column ProductModel varchar(64) default ''");
}
if (!$error) {
write_configure('MODULE_' . strtoupper($module) . '_STATUS', constant('MODULE_' . strtoupper($module) . '_VERSION'));
$messageStack->add(sprintf(GEN_MODULE_UPDATE_SUCCESS, $module, constant('MODULE_' . strtoupper($module) . '_VERSION')), 'success');
}
return $error;
}
示例13: gpc_get_string
$f_dir = 'DESC';
}
# Show Disabled
if ( isset( $t_manage_arr[3] ) ) {
$f_show_disabled = $t_manage_arr[3];
}
} else {
$f_sort = gpc_get_string( 'sort', 'username' );
$f_dir = gpc_get_string( 'dir', 'ASC' );
$f_hide_inactive = gpc_get_bool( 'hideinactive' );
$f_show_disabled = gpc_get_bool( 'showdisabled' );
}
# Clean up the form variables
if( !db_field_exists( $f_sort, db_get_table( 'user' ) ) ) {
$c_sort = 'username';
} else {
$c_sort = addslashes( $f_sort );
}
$c_dir = ( $f_dir == 'ASC' ) ? 'ASC' : 'DESC';
# 0 = show inactive users, anything else = hide them
$c_hide_inactive = ( $f_hide_inactive == 0 ) ? 0 : 1;
$t_hide_inactive_filter = '&hideinactive=' . $c_hide_inactive;
# 0 = hide disabled users, anything else = show them
$c_show_disabled = ( $f_show_disabled == 0 ) ? 0 : 1;
$t_show_disabled_filter = '&showdisabled=' . $c_show_disabled;
示例14: file_get_field
/**
* Return the specified field value
* @param integer $p_file_id File identifier.
* @param string $p_field_name Database field name to retrieve.
* @param string $p_table Database table name.
* @return string
*/
function file_get_field($p_file_id, $p_field_name, $p_table = 'bug')
{
$t_bug_file_table = db_get_table($p_table . '_file');
if (!db_field_exists($p_field_name, $t_bug_file_table)) {
trigger_error(ERROR_DB_FIELD_NOT_FOUND, ERROR);
}
$t_query = 'SELECT ' . $p_field_name . ' FROM ' . $t_bug_file_table . ' WHERE id=' . db_param();
$t_result = db_query($t_query, array((int) $p_file_id), 1);
return db_result($t_result);
}
示例15: remove
function remove($module)
{
global $db, $messageStack;
$error = false;
if (db_field_exists(TABLE_CURRENT_STATUS, 'next_cust_id_num')) {
$db->Execute("ALTER TABLE " . TABLE_CURRENT_STATUS . " DROP next_cust_id_num");
}
if (db_field_exists(TABLE_CURRENT_STATUS, 'next_cust_id_desc')) {
$db->Execute("ALTER TABLE " . TABLE_CURRENT_STATUS . " DROP next_cust_id_desc");
}
if (db_field_exists(TABLE_CURRENT_STATUS, 'next_vend_id_num')) {
$db->Execute("ALTER TABLE " . TABLE_CURRENT_STATUS . " DROP next_vend_id_num");
}
if (db_field_exists(TABLE_CURRENT_STATUS, 'next_vend_id_desc')) {
$db->Execute("ALTER TABLE " . TABLE_CURRENT_STATUS . " DROP next_vend_id_desc");
}
$db->Execute("delete from " . TABLE_EXTRA_FIELDS . " where module_id = 'contacts'");
$db->Execute("delete from " . TABLE_EXTRA_TABS . " where module_id = 'contacts'");
return $error;
}