本文整理汇总了PHP中Sqlite::getColumnTypes方法的典型用法代码示例。如果您正苦于以下问题:PHP Sqlite::getColumnTypes方法的具体用法?PHP Sqlite::getColumnTypes怎么用?PHP Sqlite::getColumnTypes使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Sqlite
的用法示例。
在下文中一共展示了Sqlite::getColumnTypes方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: updateDatabaseProperly
function updateDatabaseProperly()
{
$var = parse_sql_data();
foreach ($var as $table => $content) {
$__db = new Sqlite(null, $table);
$res = $__db->getColumnTypes();
if ($res) {
//dprint("Table $table Already exists\n");
updateTableProperly($__db, $table, $res, $content);
} else {
dprint("Adding table {$table} \n");
create_table($__db, $table, $var[$table]);
}
}
}
示例2: dropcolumn
function dropcolumn($tbl_name, $column)
{
dprint("Dropping Column...............\n");
$db = new Sqlite($tbl_name);
$columnold = $db->getColumnTypes();
$oldcolumns = array_keys($columnold);
foreach ($oldcolumns as $key => $l) {
$t = array_search(trim($l), $column);
if (!empty($t)) {
dprint("value {$oldcolumns[$key]} has deleted\n");
unset($oldcolumns[$key]);
} else {
$newcollist[] = $l;
}
}
$newfields = implode(",", $newcollist);
dprint("New fields are \n");
$query = "select " . $newfields . " from" . " " . $tbl_name;
$res = $db->rawQuery($query);
changeValues($res, $tbl_name, $db, $newfields);
}