本文整理匯總了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);
}