⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 common.php

📁 This is the script which used on 10minutemail.com for temporary email.
💻 PHP
📖 第 1 页 / 共 4 页
字号:
                ) {                    $field['default'] = ' ';                }            }            $default = ' DEFAULT '.$this->quote($field['default'], $field['type']);        } elseif (empty($field['notnull'])) {            $default = ' DEFAULT NULL';        }        $charset = empty($field['charset']) ? '' :            ' '.$this->_getCharsetFieldDeclaration($field['charset']);                $collation = empty($field['collation']) ? '' :            ' '.$this->_getCollationFieldDeclaration($field['collation']);                $notnull = empty($field['notnull']) ? '' : ' NOT NULL';        $name = $db->quoteIdentifier($name, true);        return $name.' '.$this->getTypeDeclaration($field).$charset.$default.$notnull.$collation;    }    // }}}    // {{{ _getCharsetFieldDeclaration()        /**     * Obtain DBMS specific SQL code portion needed to set the CHARACTER SET     * of a field declaration to be used in statements like CREATE TABLE.     *     * @param string $charset   name of the charset     * @return string  DBMS specific SQL code portion needed to set the CHARACTER SET     *                 of a field declaration.     */    function _getCharsetFieldDeclaration($charset)    {        return '';    }    // }}}    // {{{ _getCollationFieldDeclaration()    /**     * Obtain DBMS specific SQL code portion needed to set the COLLATION     * of a field declaration to be used in statements like CREATE TABLE.     *     * @param string $collation   name of the collation     * @return string  DBMS specific SQL code portion needed to set the COLLATION     *                 of a field declaration.     */    function _getCollationFieldDeclaration($collation)    {        return '';    }    // }}}    // {{{ _getIntegerDeclaration()    /**     * Obtain DBMS specific SQL code portion needed to declare an integer type     * field to be used in statements like CREATE TABLE.     *     * @param string $name name the field to be declared.     * @param array $field associative array with the name of the properties     *       of the field being declared as array indexes. Currently, the types     *       of supported field properties are as follows:     *     *       unsigned     *           Boolean flag that indicates whether the field should be     *           declared as unsigned integer if possible.     *     *       default     *           Integer value to be used as default for this field.     *     *       notnull     *           Boolean flag that indicates whether this field is constrained     *           to not be set to null.     * @return string DBMS specific SQL code portion that should be used to     *       declare the specified field.     * @access protected     */    function _getIntegerDeclaration($name, $field)    {        if (!empty($field['unsigned'])) {            $db =& $this->getDBInstance();            if (PEAR::isError($db)) {                return $db;            }            $db->warnings[] = "unsigned integer field \"$name\" is being declared as signed integer";        }        return $this->_getDeclaration($name, $field);    }    // }}}    // {{{ _getTextDeclaration()    /**     * Obtain DBMS specific SQL code portion needed to declare an text type     * field to be used in statements like CREATE TABLE.     *     * @param string $name name the field to be declared.     * @param array $field associative array with the name of the properties     *       of the field being declared as array indexes. Currently, the types     *       of supported field properties are as follows:     *     *       length     *           Integer value that determines the maximum length of the text     *           field. If this argument is missing the field should be     *           declared to have the longest length allowed by the DBMS.     *     *       default     *           Text value to be used as default for this field.     *     *       notnull     *           Boolean flag that indicates whether this field is constrained     *           to not be set to null.     * @return string DBMS specific SQL code portion that should be used to     *       declare the specified field.     * @access protected     */    function _getTextDeclaration($name, $field)    {        return $this->_getDeclaration($name, $field);    }    // }}}    // {{{ _getCLOBDeclaration()    /**     * Obtain DBMS specific SQL code portion needed to declare an character     * large object type field to be used in statements like CREATE TABLE.     *     * @param string $name name the field to be declared.     * @param array $field associative array with the name of the properties     *        of the field being declared as array indexes. Currently, the types     *        of supported field properties are as follows:     *     *        length     *            Integer value that determines the maximum length of the large     *            object field. If this argument is missing the field should be     *            declared to have the longest length allowed by the DBMS.     *     *        notnull     *            Boolean flag that indicates whether this field is constrained     *            to not be set to null.     * @return string DBMS specific SQL code portion that should be used to     *        declare the specified field.     * @access public     */    function _getCLOBDeclaration($name, $field)    {        $db =& $this->getDBInstance();        if (PEAR::isError($db)) {            return $db;        }        $notnull = empty($field['notnull']) ? '' : ' NOT NULL';        $name = $db->quoteIdentifier($name, true);        return $name.' '.$this->getTypeDeclaration($field).$notnull;    }    // }}}    // {{{ _getBLOBDeclaration()    /**     * Obtain DBMS specific SQL code portion needed to declare an binary large     * object type field to be used in statements like CREATE TABLE.     *     * @param string $name name the field to be declared.     * @param array $field associative array with the name of the properties     *        of the field being declared as array indexes. Currently, the types     *        of supported field properties are as follows:     *     *        length     *            Integer value that determines the maximum length of the large     *            object field. If this argument is missing the field should be     *            declared to have the longest length allowed by the DBMS.     *     *        notnull     *            Boolean flag that indicates whether this field is constrained     *            to not be set to null.     * @return string DBMS specific SQL code portion that should be used to     *        declare the specified field.     * @access protected     */    function _getBLOBDeclaration($name, $field)    {        $db =& $this->getDBInstance();        if (PEAR::isError($db)) {            return $db;        }        $notnull = empty($field['notnull']) ? '' : ' NOT NULL';        $name = $db->quoteIdentifier($name, true);        return $name.' '.$this->getTypeDeclaration($field).$notnull;    }    // }}}    // {{{ _getBooleanDeclaration()    /**     * Obtain DBMS specific SQL code portion needed to declare a boolean type     * field to be used in statements like CREATE TABLE.     *     * @param string $name name the field to be declared.     * @param array $field associative array with the name of the properties     *       of the field being declared as array indexes. Currently, the types     *       of supported field properties are as follows:     *     *       default     *           Boolean value to be used as default for this field.     *     *       notnullL     *           Boolean flag that indicates whether this field is constrained     *           to not be set to null.     * @return string DBMS specific SQL code portion that should be used to     *       declare the specified field.     * @access protected     */    function _getBooleanDeclaration($name, $field)    {        return $this->_getDeclaration($name, $field);    }    // }}}    // {{{ _getDateDeclaration()    /**     * Obtain DBMS specific SQL code portion needed to declare a date type     * field to be used in statements like CREATE TABLE.     *     * @param string $name name the field to be declared.     * @param array $field associative array with the name of the properties     *       of the field being declared as array indexes. Currently, the types     *       of supported field properties are as follows:     *     *       default     *           Date value to be used as default for this field.     *     *       notnull     *           Boolean flag that indicates whether this field is constrained     *           to not be set to null.     * @return string DBMS specific SQL code portion that should be used to     *       declare the specified field.     * @access protected     */    function _getDateDeclaration($name, $field)    {        return $this->_getDeclaration($name, $field);    }    // }}}    // {{{ _getTimestampDeclaration()    /**     * Obtain DBMS specific SQL code portion needed to declare a timestamp     * field to be used in statements like CREATE TABLE.     *     * @param string $name name the field to be declared.     * @param array $field associative array with the name of the properties     *       of the field being declared as array indexes. Currently, the types     *       of supported field properties are as follows:     *     *       default     *           Timestamp value to be used as default for this field.     *     *       notnull     *           Boolean flag that indicates whether this field is constrained     *           to not be set to null.     * @return string DBMS specific SQL code portion that should be used to     *       declare the specified field.     * @access protected     */    function _getTimestampDeclaration($name, $field)    {        return $this->_getDeclaration($name, $field);    }    // }}}    // {{{ _getTimeDeclaration()    /**     * Obtain DBMS specific SQL code portion needed to declare a time     * field to be used in statements like CREATE TABLE.     *     * @param string $name name the field to be declared.     * @param array $field associative array with the name of the properties     *       of the field being declared as array indexes. Currently, the types     *       of supported field properties are as follows:     *     *       default     *           Time value to be used as default for this field.     *     *       notnull     *           Boolean flag that indicates whether this field is constrained     *           to not be set to null.     * @return string DBMS specific SQL code portion that should be used to     *       declare the specified field.     * @access protected     */    function _getTimeDeclaration($name, $field)    {        return $this->_getDeclaration($name, $field);    }    // }}}    // {{{ _getFloatDeclaration()    /**     * Obtain DBMS specific SQL code portion needed to declare a float type     * field to be used in statements like CREATE TABLE.     *     * @param string $name name the field to be declared.     * @param array $field associative array with the name of the properties     *       of the field being declared as array indexes. Currently, the types     *       of supported field properties are as follows:     *     *       default     *           Float value to be used as default for this field.     *     *       notnull     *           Boolean flag that indicates whether this field is constrained     *           to not be set to null.     * @return string DBMS specific SQL code portion that should be used to     *       declare the specified field.     * @access protected     */    function _getFloatDeclaration($name, $field)    {        return $this->_getDeclaration($name, $field);    }    // }}}    // {{{ _getDecimalDeclaration()    /**     * Obtain DBMS specific SQL code portion needed to declare a decimal type     * field to be used in statements like CREATE TABLE.     *     * @param string $name name the field to be declared.     * @param array $field associative array with the name of the properties     *       of the field being declared as array indexes. Currently, the types     *       of supported field properties are as follows:     *     *       default     *           Decimal value to be used as default for this field.     *     *       notnull     *           Boolean flag that indicates whether this field is constrained     *           to not be set to null.     * @return string DBMS specific SQL code portion that should be used to     *       declare the specified field.     * @access protected     */    function _getDecimalDeclaration($name, $field)    {        return $this->_getDeclaration($name, $field);    }    // }}}    // {{{ compareDefinition()    /**     * Obtain an array of changes that may need to applied     *     * @param array $current new definition     * @param array  $previous old definition     * @return array  containing all changes that will need to be applied     * @access public     */    function compareDefinition($current, $previous)    {        $type = !empty($current['type']) ? $current['type'] : null;        if (!method_exists($this, "_compare{$type}Definition")) {            $db =& $this->getDBInstance();            if (PEAR::isError($db)) {                return $db;            }            return $db->raiseError(MDB2_ERROR_UNSUPPORTED, null, null,                'type "'.$current['type'].'" is not yet supported', __FUNCTION__);        }        if (empty($previous['type']) || $previous['type'] != $type) {            return $current;        }        $change = $this->{"_compare{$type}Definition"}($current, $previous);        if ($previous['type'] != $type) {            $change['type'] = true;        }        $previous_notnull = !empty($previous['notnull']) ? $previous['notnull'] : false;        $notnull = !empty($current['notnull']) ? $current['notnull'] : false;        if ($previous_notnull != $notnull) {            $change['notnull'] = true;        }        $previous_default = array_key_exists('default', $previous) ? $previous['default'] :            ($previous_notnull ? '' : null);        $default = array_key_exists('default', $current) ? $current['default'] :            ($notnull ? '' : null);        if ($previous_default !== $default) {            $change['default'] = true;        }        return $change;    }    // }}}    // {{{ _compareIntegerDefinition()    /**     * Obtain an array of changes that may need to applied to an integer field     *     * @param array $current new definition     * @param array  $previous old definition     * @return array  containing all changes that will need to be applied     * @access protected     */    function _compareIntegerDefinition($current, $previous)    {        $change = array();        $previous_unsigned = !empty($previous['unsigned']) ? $previous['unsigned'] : false;        $unsigned = !empty($current['unsigned']) ? $current['unsigned'] : false;        if ($previous_unsigned != $unsigned) {            $change['unsigned'] = true;        }        $previous_autoincrement = !empty($previous['autoincrement']) ? $previous['autoincrement'] : false;

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -