Coder Social home page Coder Social logo

ext-mysql-oo's Introduction

#You are Doing It Wrong™

Please, don't use mysql_* functions in new code. They are no longer maintained and are officially deprecated. See the red box? Learn about prepared statements instead, and use PDO or MySQLi - this article will help you decide which. If you choose PDO, here is a good tutorial.


This small library aims to provide a simple, PDO-like wrapper for ext/mysql.

##What it is

It attempts to provide a more OO-friendly interface in those dire times of need, and counters a few of the common user input sanitisation mistakes by providing a very simple prepared statement emulation.

##What it is not

There are several differences between this API and PDO so read the codez, not the manual for a different API.

The API looks like it supports prepared statements - it doesn't. It's just simple string manipulation made more complicated.

The query is not parsed at all, and as a result there are two major limitations, as well as many smaller issues:

  • It only supports :named placeholders. Question marks are not supported.
  • It is basically a glorified (and not very intelligent) search and replace, so putting something that "looks :like a placeholder" in a string literal will cause problems.

Don't use this unless you absolutely have no option but to use ext/mysql. If you do use it, make sure you understand the problems it is attempting to solve before you start.

Requires PHP 5.3+, but only really because of the namespacing. If you remove the namespace declaration from the head of the files and the leading backslashes from exception names, it should work (more or less) on any PHP5 installation.

ext-mysql-oo's People

Contributors

daverandom avatar

Watchers

James Cloos avatar Eugene Belov avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.