By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
459,460 Members | 1,167 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 459,460 IT Pros & Developers. It's quick & easy.

Best Database Class

code green
Expert 100+
P: 1,726
Upto now I have used my own Database class.
It employs an Abstract base class with common functionality and most public functions.
Inheriting this class are three classes that contain specific functionality for MySQL, SQL Server (mssql) and Access.

I now find I need the SQL Server functionality of Transactions: BEGIN, COMMIT, ROLLBACK.

Should I write my own functions with these fairly simple queries or switch to using PDO.
ADODB seems to carry a bit more overhead. benchmark
Please don't recommend PEAR as it does not keep up with PHP versions and abandons functions at a whim causing huge problems with legacy code.

PDO looks good, or can this also cause similar problems I have experienced with PEAR
May 17 '10 #1
Share this Question
Share on Google+
4 Replies


chathura86
100+
P: 227
well im using PDO and still seems ok (both portability and performance)

now im using Doctrine ORM which is very cool
(Doctrine also uses PDO)

Regards
Chathura Bamunusinghe
May 17 '10 #2

code green
Expert 100+
P: 1,726
PDO doesn't look look that promising with MsSQL.
PDO_DBLIB is not recommended, but PDO_ODBC is.
ODBC is old school and may not be convenient, particuarly for remote servers
May 17 '10 #3

dlite922
Expert 100+
P: 1,584
Write your own function.

I just extended my DAO class to have these functions in them that run the simple queries. Been working great for me so far. Backwards compatible, portable, easy to use.



Dan
May 17 '10 #4

code green
Expert 100+
P: 1,726
Tried using PDO and the current driver PDO_DBLIB does not support transactions, so no use to me.

Apparently. Microsoft have released a better driver in Apr 2010 that fully supports PDO, but only a Beta version.

I have written my own Transaction functions, that simply contain the queries
Expand|Select|Wrap|Line Numbers
  1. BEGIN TRAN 
  2. COMMIT TRAN 
  3. ROLLBACK TRAN
and they work fine.
May 18 '10 #5

Post your reply

Sign in to post your reply or Sign up for a free account.