php txtsql 说明,PHP学习笔记(2)txtSQL文档错误
PHP學習筆記(2)txtSQL文檔錯誤
次閱讀
在使用txtSQL的過程中,發(fā)現(xiàn)一處幫助文檔錯誤。
在使用altertable命令改變表名稱時,發(fā)現(xiàn)如果按照幫助文檔所說,使用如下代碼無法改變表的名稱:
$sql->altertable(array('db'=>$db_name,'table'=>$table_name,'name'=>$table_name,'action'=>'rename table','value'=>array('name'=>$table_rename_name))
后來查閱范例程序,才發(fā)現(xiàn)如果修改表名必須使用如下代碼才可以,也就是說,第三個參數(shù)“name”的值應該是新的表名。不需要設定第五個參數(shù)“value”:
$sql->altertable(array('db'=>$db_name,'table'=>$table_name,'name'=>$table_rename_name,'action'=>'rename table')
以下是幫助文檔中的描述:
altertable
Purpose: To alter a txtSQL-table's column definitions txtSQL >= 2.2.2 RC2
void altertable ( array ('table' => $table, 'action' => $action, 'name' => $column, 'values' => $values [, 'after' => $afterColumn [, 'db' => $db]]) )
This function will alter a txtSQL-$table's column defintions. It will only work with the specified column, which is $column. The $action can be either
insert- Inserts a new column, $column, and if specified, after the column $afterColumn
modify- Modifies an existing $column
drop- Drops an existing $column
rename col- Renames a $column. Expects array('name' => $newcolname) in the $values
//此句錯誤
rename table- Renames a $table. Expects array('name' => $newTableName) in the $values
addkey- Sets $column as the primary key ( must be integer and auto_increment ). Expects array('name' => $colName) in the $values
dropkey- Does opposite of 'addkey'
The $values element is an array containing information about the column, it must be in the following format
array( [$colType => $value]... ) unless otherwise noted above
總結
以上是生活随笔為你收集整理的php txtsql 说明,PHP学习笔记(2)txtSQL文档错误的全部內容,希望文章能夠幫你解決所遇到的問題。
- 上一篇: vba读取csv文件到excel_利用V
- 下一篇: 排队问题解题思路_高考文科数学是最“拉分