Sphider can work with databases other than MySQL
Posted: Fri May 26, 2017 4:06 am
While the PDO version of Sphider was created for users whose host does not support MySQLnd, it has another advantage.
By modifying the database.php file, Sphider can utilize databases other than MySQL. By changing the DSN (Data Source Name), Sphider can operate with:
MySQL
PostgreSQL
SQLite
Microsoft SQL Server
Sybase
Interbase
ODBC
Informix
SEE THE UPDATES BELOW...
There may be others I am not aware of.
No other code changes should be necessary as PDO is supposed to be portable.
UPDATE - 8 July 2017
"No other code changes should be necessary..." HA! Famous last words!
I have been fooling with SQLite, and guess what? It looks like there ARE changes necessary. I finally got the install script kind of running... At least the tables are being created. The query to show the database tables had to be rewritten. Now to trouble shoot all the other problems that are popping up. Now whether or not this is a SQLite specific issue or if it is endemic to all databases is unknown. Admittedly, SQLite IS a very basic database lacking some of the finer points of more sophisticated databases, so that may be the sticking point. We shall see...
UPDATE - 10 July 2017
By making a few code improvements in PDO Sphider and removing MySQL specific instances of coding with functional equivalent code (for example, a couple instances of sql statements used "&&" instead of the standard "AND", using PHP to get the current date/time instead of relying on MySQL's NOW() function), MOST of the code indeed IS portable! The exceptions are certain pieces of code which, out of necessity, have to be database specific. At his point, that looks like install.php, db_main.php, and db_backup.php. Update_rollup.php MIGHT be affected. At his point, except for the backup and restore functions (which are progressing), PDO is working with SQLite. It is very possible that with a bit more work, small packages may be provided to make PDO Sphider compatible with SQLite and PostgreSQL. Beyond that, we shall see.
By modifying the database.php file, Sphider can utilize databases other than MySQL. By changing the DSN (Data Source Name), Sphider can operate with:
MySQL
PostgreSQL
SQLite
Microsoft SQL Server
Sybase
Interbase
ODBC
Informix
SEE THE UPDATES BELOW...
There may be others I am not aware of.
No other code changes should be necessary as PDO is supposed to be portable.
UPDATE - 8 July 2017
"No other code changes should be necessary..." HA! Famous last words!
I have been fooling with SQLite, and guess what? It looks like there ARE changes necessary. I finally got the install script kind of running... At least the tables are being created. The query to show the database tables had to be rewritten. Now to trouble shoot all the other problems that are popping up. Now whether or not this is a SQLite specific issue or if it is endemic to all databases is unknown. Admittedly, SQLite IS a very basic database lacking some of the finer points of more sophisticated databases, so that may be the sticking point. We shall see...
UPDATE - 10 July 2017
By making a few code improvements in PDO Sphider and removing MySQL specific instances of coding with functional equivalent code (for example, a couple instances of sql statements used "&&" instead of the standard "AND", using PHP to get the current date/time instead of relying on MySQL's NOW() function), MOST of the code indeed IS portable! The exceptions are certain pieces of code which, out of necessity, have to be database specific. At his point, that looks like install.php, db_main.php, and db_backup.php. Update_rollup.php MIGHT be affected. At his point, except for the backup and restore functions (which are progressing), PDO is working with SQLite. It is very possible that with a bit more work, small packages may be provided to make PDO Sphider compatible with SQLite and PostgreSQL. Beyond that, we shall see.