当前位置: 首页 > 工具软件 > txtSQL > 使用案例 >

php txtsql 说明,PHP学习笔记(2)txtSQL文档错误

鲁涵意
2023-12-01

PHP学习笔记(2)txtSQL文档错误

次阅读

在使用txtSQL的过程中,发现一处帮助文档错误。

在使用altertable命令改变表名称时,发现如果按照帮助文档所说,使用如下代码无法改变表的名称:

$sql->altertable(array('db'=>$db_name,'table'=>$table_name,'name'=>$table_name,'action'=>'rename table','value'=>array('name'=>$table_rename_name))

后来查阅范例程序,才发现如果修改表名必须使用如下代码才可以,也就是说,第三个参数“name”的值应该是新的表名。不需要设定第五个参数“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

 类似资料: