Unstoppable Domains

Mysql OOP

Spaceship Spaceship
Watch

Do you use MySql OPP?

  • This poll is still running and the standings may change.
  • Yes

    votes
    72.7%
  • No

    vote
    9.1%
  • No Need

    vote
    9.1%
  • Yes, Looks cool!

    vote
    9.1%
  • OOP / Mysql? What?

    votes
    0.0%
  • This poll is still running and the standings may change.

Hitch

Established Member
Impact
74
Hey,

I use OOP (Object Orientated Programming), for my own Classes and functions, formatting, security etc...


However, why do people use it for MySql?
Is there really a need, the MySql functions are short enough already...they don't need a new fancy name, in my opinion.

So, why do you use OOP for MySql?
Reasons posted below would be great. :tu:

Am i missing something. :lol:

Adrian
 
0
•••
The views expressed on this page by users and staff are their own, not those of NamePros.
.US domains.US domains
I use to to keep the code tidier mainly but it has also come in handy for things such as adding a "standardised" way of error handling (if that makes sense) and also makes it easier to keep things like link idetifiers without having to type it in manually all the time.

Another use would be to add a detructor or shutdown function to it to close the connection. (as i did in the example mysql class posted in the sub forum).

In my own class i have incorporated my error handler with it, which is also another handy use.

I can see a for and against but personally I'm for :)
 
0
•••
if you create a class with functions like $db->doQuery() and all it does is call mysql_query and that's about it, then it's redundant.

I've created my own classes in the past, but now i'm a big user/fan of PEAR :: MDB2
 
0
•••
I use it for a few reasons.

1. It allows me to support multiple database drivers. Change servers don't have to re-write your code.

2. Security, I don't have to write the same sanitization routines over and over.

But in the end its just because I like having everything orgainized.
 
0
•••
as baxter points out it is extremely handy for being able to support multiple database engines. If you can be confident you will only use mysql great then it is of no use to you but if you can envisage having the need to change over to sqlite of postgresql it will make the job all the easier having a single class doing the work.
 
0
•••
I also use it to count up MySQL queries made easily so i can just call db_query('returnformat','query') each time, with my classes i use them to also sort out the results into rows, objects or associative rows. Tis also good for security :D
 
0
•••
Another good feature of a mysql class is to hold shutdown queries that don't need to be loaded prior to the output. like updates and inserts. Then in your registered shutdown function process those queries before closing the database connection.

I know theres more reasons but can't think of any others. :D
 
0
•••
I use it for a few reasons. I use it so I only have to have one mysql connection open, and I can pass it through as many files as I want. I also use it, so if a little skiddie gets a hold of my script with the intentions to null it or whatever they call it, they'll at least be stumped for 12 seconds. But, my main use is to make it easier. In my mysql class (I use the same for all my scripts), I have functions such as easy_get_rows(). I pass it a query, and it returns an array of data. It makes it a lot simpler for me.
 
0
•••
Dynadot — .com Registration $8.99Dynadot — .com Registration $8.99
Appraise.net

We're social

Unstoppable Domains
Domain Recover
DomainEasy — Live Options
  • The sidebar remains visible by scrolling at a speed relative to the page’s height.
Back