convert mysql classes to mssql classes on php 5.3 version -


In my project, we use mysql but now I want to use the client mssql, I search PDO or Use SQLRV classes. But I can not decide what is appropriate for our project or can easily change the structure of this web application?

My code example

  class sql {public $ oci; Public $ rupee; Public $ temp; Public function __ composition () {$ this- & gt; Oc = new mysquilli (DBHost, DBS, DBPASS, DBNM); $ This- & gt; Oci-> set_charset ('UTF8'); If (mysqli_connect_errno ()) {printf ('Sql arbitrage ± shorunu. Hata kodu:'. Mysqli_connect_errno ()); Go out(); }} Public celebration closeOCI () {$ this-> oci- & gt; Close (); } Public Function Query ($ query) {$ this- & gt; RS = $ it- & gt; OC- & gt; Query ($ query); }   

and login class extends the SQL class

  class login provides SQL {public function loginControl ($ user, $ pass) {$ dbHandle = New sql ($ dbhost, $ dbUserName, $ dbPassWord, $ dbCntDBName); // resonance "SELECT level, Username by name WHERE uName = '$ user' and pWord = '$ pass' limit 0,1"; $ DbHandle- & gt; Query ("selection level, UN name with username, '$ user' and pWord = '$ pass' limit 0,1"); $ Result = $ dbHandle- & gt; RS- & gt; Fetch_assoc (); Return result; }   

}

Which drivers can I use or easily replace them? Thanx Advide

This is what is meant by database abstraction like PDO. If you need to support many DB platforms, then you should consider using such an abstract.

Alternatively, you can create your own abstraction, which for example can use different classes based on mysql or mssql, which can be obtained from a common interface or a normal parent class it happens.

Comments

Popular posts from this blog

Java - Error: no suitable method found for add(int, java.lang.String) -

java - JPA TypedQuery: Parameter value element did not match expected type -

c++ - static template member variable has internal linkage but is not defined -