Home » Database » DB » Bug #1317
tableInfo for SQLite (includes fix)
Details
| Request #1317 | tableInfo for SQLite (includes fix) |
|---|---|
| Submitted | 2004-04-30 03:24 UTC |
| From | xiangweizhuo at hotmail dot com |
| Assigned | danielc |
| Status | Closed |
| Package | DB |
| PHP Version | 4.2.0 |
| OS | Windows |
| Roadmaps | (Not assigned) |
Comments
[2004-04-30 03:24 UTC] xiangweizhuo at hotmail dot com
Description:
------------
Need some table info from the SQLite database in sqlite.php
possible solution
function tableInfo($table, $mode = null)
{
$tableStruct = sqlite_array_query(
$this->connection, "PRAGMA table_info('$table');",
SQLITE_ASSOC);
for($i = 0; $i < count($tableStruct); $i++)
{
$tableStruct[$i]['flags'] = '';
$tableStruct[$i]['len'] = '';
//primary key
if($tableStruct[$i]['pk'] == 1)
{
$tableStruct[$i]['flags'] .= 'primary_key,';
//integer primary key, it will auto increment
if($tableStruct[$i]['type'] == 'INTEGER')
$tableStruct[$i]['flags'] .= 'auto_increment,';
}
}
//var_dump($tableStruct);
return $tableStruct;
}