mysql.php
来自「视频监控网络部分的协议ddns,的模块的实现代码,请大家大胆指正.」· PHP 代码 · 共 1,557 行 · 第 1/4 页
PHP
1,557 行
} // }}} // {{{ fetchClob() /** * fetch a clob value from a result set * * @param resource $result result identifier * @param int $row number of the row where the data can be found * @param int $field field number where the data can be found * @return mixed content of the specified data cell, a MDB error on failure, * a MDB error on failure * @access public */ function fetchClob($result, $row, $field) { return($this->fetchLob($result, $row, $field)); } // }}} // {{{ fetchBlob() /** * fetch a blob value from a result set * * @param resource $result result identifier * @param int $row number of the row where the data can be found * @param int $field field number where the data can be found * @return mixed content of the specified data cell, a MDB error on failure * @access public */ function fetchBlob($result, $row, $field) { return($this->fetchLob($result, $row, $field)); } // }}} // {{{ convertResult() /** * convert a value to a RDBMS indepdenant MDB type * * @param mixed $value value to be converted * @param int $type constant that specifies which type to convert to * @return mixed converted value * @access public */ function convertResult($value, $type) { switch($type) { case MDB_TYPE_DECIMAL: return(sprintf('%.'.$this->decimal_places.'f', doubleval($value)/$this->decimal_factor)); default: return($this->_baseConvertResult($value, $type)); } } // }}} // {{{ numRows() /** * returns the number of rows in a result object * * @param ressource $result a valid result ressouce pointer * @return mixed MDB_Error or the number of rows * @access public */ function numRows($result) { return(@mysql_num_rows($result)); } // }}} // {{{ freeResult() /** * Free the internal resources associated with $result. * * @param $result result identifier * @return boolean TRUE on success, FALSE if $result is invalid * @access public */ function freeResult($result) { $result_value = intval($result); if(isset($this->highest_fetched_row[$result_value])) { unset($this->highest_fetched_row[$result_value]); } if(isset($this->columns[$result_value])) { unset($this->columns[$result_value]); } if(isset($this->result_types[$result_value])) { unset($this->result_types[$result_value]); } return(@mysql_free_result($result)); } // }}} // {{{ 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 string $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 public */ function getIntegerDeclaration($name, $field) { return("$name INT". (isset($field['unsigned']) ? ' UNSIGNED' : ''). (isset($field['default']) ? ' DEFAULT '.$field['default'] : ''). (isset($field['notnull']) ? ' NOT NULL' : '') ); } // }}} // {{{ 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 string $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) { if (isset($field['length'])) { $length = $field['length']; if ($length <= 255) { $type = 'TINYTEXT'; } else { if ($length <= 65535) { $type = 'TEXT'; } else { if ($length <= 16777215) { $type = 'MEDIUMTEXT'; } else { $type = 'LONGTEXT'; } } } } else { $type = 'LONGTEXT'; } return("$name $type". (isset($field['notnull']) ? ' NOT NULL' : '')); } // }}} // {{{ 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 string $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 getBlobDeclaration($name, $field) { if (isset($field['length'])) { $length = $field['length']; if ($length <= 255) { $type = 'TINYBLOB'; } else { if ($length <= 65535) { $type = 'BLOB'; } else { if ($length <= 16777215) { $type = 'MEDIUMBLOB'; } else { $type = 'LONGBLOB'; } } } } else { $type = 'LONGBLOB'; } return("$name $type". (isset($field['notnull']) ? ' NOT NULL' : '')); } // }}} // {{{ getDateDeclaration() /** * Obtain DBMS specific SQL code portion needed to declare an date type * field to be used in statements like CREATE TABLE. * * @param string $name name the field to be declared. * @param string $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 public */ function getDateDeclaration($name, $field) { return("$name DATE". (isset($field['default']) ? " DEFAULT '".$field['default']."'" : ''). (isset($field['notnull']) ? ' NOT NULL' : '') ); } // }}} // {{{ getTimestampDeclaration() /** * Obtain DBMS specific SQL code portion needed to declare an timestamp * type field to be used in statements like CREATE TABLE. * * @param string $name name the field to be declared. * @param string $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 stamp 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 public */ function getTimestampDeclaration($name, $field) { return("$name DATETIME". (isset($field['default']) ? " DEFAULT '".$field['default']."'" : ''). (isset($field['notnull']) ? ' NOT NULL' : '') ); } // }}} // {{{ getTimeDeclaration() /** * Obtain DBMS specific SQL code portion needed to declare an time type * field to be used in statements like CREATE TABLE. * * @param string $name name the field to be declared. * @param string $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 public */ function getTimeDeclaration($name, $field) { return("$name TIME". (isset($field['default']) ? " DEFAULT '".$field['default']."'" : ''). (isset($field['notnull']) ? ' NOT NULL' : '') ); } // }}} // {{{ getFloatDeclaration() /** * Obtain DBMS specific SQL code portion needed to declare an float type * field to be used in statements like CREATE TABLE. * * @param string $name name the field to be declared. * @param string $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 * 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 public */ function getFloatDeclaration($name, $field) { if (isset($this->options['fixedfloat'])) { $this->fixed_float = $this->options['fixedfloat']; } else { if ($this->connection == 0) { // XXX needs more checking $this->connect(); } } return("$name DOUBLE". ($this->fixed_float ? '('.($this->fixed_float + 2).','.$this->fixed_float.')' : ''). (isset($field['default']) ? ' DEFAULT '.$this->getFloatValue($field['default']) : ''). (isset($field['notnull']) ? ' NOT NULL' : '') ); } // }}} // {{{ getDecimalDeclaration() /** * Obtain DBMS specific SQL code portion needed to declare an decimal type * field to be used in statements like CREATE TABLE. * * @param string $name name the field to be declared. * @param string $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 * Integer value to be used as default for this * field.
⌨️ 快捷键说明
复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?