mssql.php
来自「视频监控网络部分的协议ddns,的模块的实现代码,请大家大胆指正.」· PHP 代码 · 共 1,425 行 · 第 1/4 页
PHP
1,425 行
* 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) { if (isset($field['unsigned'])) { $this->warnings[] = "unsigned integer field \"$name\" is being declared as signed integer"; } return("$name INT".(isset($field["default"]) ? " DEFAULT ".$field["default"] : "").(isset($field["notnull"]) ? " NOT NULL" : " NULL")); } // }}} // {{{ 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 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 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 public */ function getTextDeclaration($name, $field) { return((isset($field["length"]) ? "$name VARCHAR (".$field["length"].")" : "$name TEXT").(isset($field["default"]) ? " DEFAULT ".$this->GetTextValue($field["default"]) : "").(isset($field["notnull"]) ? " NOT NULL" : " 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 <= 8000) { $type = "VARCHAR($length)"; } else { $type = "TEXT"; } } else { $type = "TEXT"; } return("$name $type".(isset($field["notnull"]) ? " NOT NULL" : " 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 <= 8000) { $type = "VARBINARY($length)"; } else { $type = "IMAGE"; } } else { $type = "IMAGE"; } return("$name $type".(isset($field["notnull"]) ? " NOT NULL" : " NULL")); } // }}} // {{{ 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 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 * 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 public */ function getBooleanDeclaration($name, $field) { return("$name BIT".(isset($field["default"]) ? " DEFAULT ".$field["default"] : "").(isset($field["notnull"]) ? " NOT NULL" : " 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 CHAR (".strlen("YYYY-MM-DD").")".(isset($field["default"]) ? " DEFAULT ".$this->getDateValue($field["default"]) : "").(isset($field["notnull"]) ? " NOT NULL" : " 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 CHAR (".strlen("YYYY-MM-DD HH:MM:SS").")".(isset($field["default"]) ? " DEFAULT ".$this->getTimestampValue($field["default"]) : "").(isset($field["notnull"]) ? " NOT NULL" : " 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 CHAR (".strlen("HH:MM:SS").")".(isset($field["default"]) ? " DEFAULT ".$this->getTimeValue($field["default"]) : "").(isset($field["notnull"]) ? " NOT NULL" : " 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) { return("$name FLOAT".(isset($field["default"]) ? " DEFAULT ".$field["default"] : "").(isset($field["notnull"]) ? " NOT NULL" : " 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. * * 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 getDecimalDeclaration($name, $field) { return("$name DECIMAL(18,".$this->decimal_places.")".(isset($field["default"]) ? " DEFAULT ".$this->getDecimalValue($field["default"]) : "").(isset($field["notnull"]) ? " NOT NULL" : " NULL")); } // }}} // {{{ getClobValue() /** * Convert a text value into a DBMS specific format that is suitable to * compose query statements. * * @param resource $prepared_query query handle from prepare() * @param $parameter * @param $clob * @return string text string that represents the given argument value in * a DBMS specific format. * @access public */ function getClobValue($prepared_query, $parameter, $clob) { $value="'"; while(!$this->endOfLob($clob)) { if (MDB::isError($result = $this->readLob($clob, $data, $this->options['lob_buffer_length']))) { return($result); } $value .= $this->_quote($data); } $value .= "'"; return($value); } // }}} // {{{ freeClobValue() /** * free a character large object * * @param resource $prepared_query query handle from prepare() * @param string $clob * @return MDB_OK * @access public */ function freeClobValue($prepared_query, $clob) { unset($this->lobs[$clob]); return(MDB_OK); }
⌨️ 快捷键说明
复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?