<?php
/*
+--------------------------------------------------------------------+
- | CiviCRM version 4.4 |
+ | CiviCRM version 4.5 |
+--------------------------------------------------------------------+
- | Copyright CiviCRM LLC (c) 2004-2013 |
+ | Copyright CiviCRM LLC (c) 2004-2014 |
+--------------------------------------------------------------------+
| This file is a part of CiviCRM. |
| |
/**
*
* @package CRM
- * @copyright CiviCRM LLC (c) 2004-2013
+ * @copyright CiviCRM LLC (c) 2004-2014
* $Id$
*
*/
$sql .= $prefix;
$sql .= "`{$params['name']}` {$params['type']}";
- if (CRM_Utils_Array::value('required', $params)) {
+ if (!empty($params['required'])) {
$sql .= " NOT NULL";
}
- if (CRM_Utils_Array::value('attributes', $params)) {
+ if (!empty($params['attributes'])) {
$sql .= " {$params['attributes']}";
}
- if (CRM_Utils_Array::value('default', $params) &&
+ if (!empty($params['default']) &&
$params['type'] != 'text'
) {
$sql .= " DEFAULT {$params['default']}";
}
- if (CRM_Utils_Array::value('comment', $params)) {
+ if (!empty($params['comment'])) {
$sql .= " COMMENT '{$params['comment']}'";
}
static function buildPrimaryKeySQL(&$params, $separator, $prefix) {
$sql = NULL;
- if (CRM_Utils_Array::value('primary', $params)) {
+ if (!empty($params['primary'])) {
$sql .= $separator;
$sql .= str_repeat(' ', 8);
$sql .= $prefix;
//create index only for searchable fields during ADD,
//create index only if field is become searchable during MODIFY,
//drop index only if field is no more searchable and index was exist.
- if (CRM_Utils_Array::value('searchable', $params) && !$indexExist) {
+ if (!empty($params['searchable']) && !$indexExist) {
$sql .= $separator;
$sql .= str_repeat(' ', 8);
$sql .= $prefix;
$sql .= "INDEX_{$params['name']} ( {$params['name']} )";
}
- elseif (!CRM_Utils_Array::value('searchable', $params) && $indexExist) {
+ elseif (empty($params['searchable']) && $indexExist) {
$sql .= $separator;
$sql .= str_repeat(' ', 8);
$sql .= "DROP INDEX INDEX_{$params['name']}";
static function buildForeignKeySQL(&$params, $separator, $prefix, $tableName) {
$sql = NULL;
- if (CRM_Utils_Array::value('fk_table_name', $params) &&
- CRM_Utils_Array::value('fk_field_name', $params)
- ) {
+ if (!empty($params['fk_table_name']) && !empty($params['fk_field_name'])) {
$sql .= $separator;
$sql .= str_repeat(' ', 8);
$sql .= $prefix;
case 'delete':
$sql .= " DROP COLUMN `{$params['name']}`";
- if (CRM_Utils_Array::value('primary', $params)) {
+ if (!empty($params['primary'])) {
$sql .= ", DROP PRIMARY KEY";
}
- if (CRM_Utils_Array::value('fk_table_name', $params)) {
+ if (!empty($params['fk_table_name'])) {
$sql .= ", DROP FOREIGN KEY FK_{$params['fkName']}";
}
break;