From 5ba28817a82e9c762ce741cd6475d41cdf8d8135 Mon Sep 17 00:00:00 2001 From: Shish Date: Sun, 17 Jan 2010 09:43:49 +0000 Subject: [PATCH] try to recognise the DB engine *before* trying to connect... --- install.php | 27 ++++++++++++++------------- 1 file changed, 14 insertions(+), 13 deletions(-) diff --git a/install.php b/install.php index 4216031e..66e501f3 100644 --- a/install.php +++ b/install.php @@ -164,24 +164,25 @@ function install_process($database_dsn) { // {{{ header("Location: index.php"); } // }}} function create_tables($dsn) { // {{{ + if(substr($dsn, 0, 5) == "mysql") { + $engine = new MySQL(); + } + else if(substr($dsn, 0, 5) == "pgsql") { + $engine = new PostgreSQL(); + } + else if(substr($dsn, 0, 6) == "sqlite") { + $engine = new SQLite(); + } + else { + die("Unknown database engine; Shimmie currently officially supports MySQL + (mysql://), with hacks for Postgres (pgsql://) and SQLite (sqlite://)"); + } + $db = NewADOConnection($dsn); if(!$db) { die("Couldn't connect to \"$dsn\""); } else { - if(substr($dsn, 0, 5) == "mysql") { - $engine = new MySQL(); - } - else if(substr($dsn, 0, 5) == "pgsql") { - $engine = new PostgreSQL(); - } - else if(substr($dsn, 0, 6) == "sqlite") { - $engine = new SQLite(); - } - else { - die("Unknown database engine; Shimmie currently officially supports MySQL - (mysql://), with hacks for Postgres (pgsql://) and SQLite (sqlite://)"); - } $engine->init($db); $db->execute($engine->create_table_sql("aliases", "