On Fri, 25 Mar 2011 14:40:06 -0600, Alvaro Carrasco wrote:
> Hi Brian,
>
> On Fri, Mar 25, 2011 at 4:08 AM, Brian J. Rogers 
> <[email protected]> wrote:
>> ...
>>  I am looking to move from using mysql_* to using PDO, but I'm 
>> having a
>>  hard time making it abstract. I want something like I have now 
>> where I
>>  create an object, it opens the connection, and then I have a set of
>>  functions to run queries, sanitize input, etc.
>> ...
>
> Why do you feel that PDO by itself is not abstract enough? (not 
> saying
> that it is, just want to know where it fails to be abstract for you)
>
> $con = new PDO('...'); // create connection
> $con->query('...'); // run queries
> $con->quote('...'); // sanitize (use prepared statements if you can)
>
> What sort of API are you looking for?
>
> Alvaro

 I know it is pretty abstract already, but I am looking to replace my 
 MySQL class file. Right now when I create a new object it opens a 
 connection and returns that. Is there a way I can do the same thing with 
 PDO? Something like:

 $db = new Mysql();

 $db->(PDO function)

 Or is that just really not good practice? My goal is to centralize a 
 connection method so that if I decide to change it one day for whatever 
 reason, I can do it once and have the entire website work. Such as now, 
 moving from mysql_(p)connection to PDO.

 I am looking at using PDO because I've heard that it handles resources 
 better, and have a great native sanitation for user input. I am open to 
 hearing that I'm making it too complicated or there is a good method to 
 do this that's already been established and given a link to a tutorial.

 -Brian

_______________________________________________

UPHPU mailing list
[email protected]
http://uphpu.org/mailman/listinfo/uphpu
IRC: #uphpu on irc.freenode.net

Reply via email to