Re: Database library recommended

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Thu, Mar 19, 2015 at 7:24 AM, Robert Williams <rewilliams@xxxxxxxxxx>
wrote:

>
> > On Mar 18, 2015, at 08:27, R B <rbpphp@xxxxxxxxx> wrote:
> >
> > I want to know which is the database library currently recommended?
>
> It depends on what you’re building and what database you’re using. If
> you’re talking about MySQL, PHP offers two supported options: mysqli and
> PDO. The former is purpose-built for MySQL, while the latter is a
> cross-database solution that makes it easy to port your code to other
> database systems.
>
> For anything that you expect to really scale up, or where high performance
> is critical, I strongly suggest using Mysqli. The cross-database nature of
> PDO means that there’s an extra abstraction layer between your application
> and the database, and that slows things down. In particular, you can’t
> properly tune queries to the database, which is important because the
> database is the slowest part of most applications. You also can’t properly
> utilize some advanced features that are database-specific.
>

I really recommend PDO. Although there is an overhead, I believe it
outweighs the benefits.  For one, you have the flexibility later to change
your mind, should you choose to try another database software.  Second is
PDO really encourages you to write safer code that is not prone to SQL
injection.


>
> OTOH, if you’re developing a retail application that you expect customers
> to use with a variety of DBMSes, PDO may be the best way to go, at least
> initially. Eventually, as you scale up, I still suggest targeting specific
> databases that you want to support; if done right in terms of code
> architecture, this need not impact your application code too much — mostly,
> making some compromises on the data structures to work well with all of the
> databases rather than being highly optimized for one.
>
> Regardless, you don’t want to use the mysql API (note missing trailing
> ‘i’), as it was long ago deprecated and is no longer supported.
>
> --
> Bob Williams
> Business Unit Information Officer and
> Senior Vice President of Software Development
> Newtek Business Services Corp.
> (602) 263-0300 x12458 | http://www.thesba.com/
>
> Notice: This communication, including attachments, may contain information
> that is confidential. It constitutes non-public information intended to be
> conveyed only to the designated recipient(s). If the reader or recipient of
> this communication is not the intended recipient, an employee or agent of
> the intended recipient who is responsible for delivering it to the intended
> recipient, or if you believe that you have received this communication in
> error, please notify the sender immediately by return e-mail and promptly
> delete this e-mail, including attachments without reading or saving them in
> any manner. The unauthorized use, dissemination, distribution, or
> reproduction of this e-mail, including attachments, is prohibited and may
> be unlawful. If you have received this email in error, please notify us
> immediately by e-mail or telephone and delete the e-mail and the
> attachments (if any).
>



-- 
Marcos | I love PHP, Linux, and Java
<http://javadevnotes.com/java-string-to-long-examples>

[Index of Archives]     [PHP Home]     [Apache Users]     [PHP on Windows]     [Kernel Newbies]     [PHP Install]     [PHP Classes]     [Pear]     [Postgresql]     [Postgresql PHP]     [PHP on Windows]     [PHP Database Programming]     [PHP SOAP]

  Powered by Linux