The Cache: Technology Expert's Forum
 
*
Welcome, Guest. Please login or register. October 14, 2019, 07:05:47 PM

Login with username, password and session length


Pages: [1]
  Print  
Author Topic: mysqli_ versus mysql_  (Read 5845 times)
perkiset
Olde World Hacker
Administrator
Lifer
*****
Offline Offline

Posts: 10096



View Profile
« on: July 09, 2008, 03:46:24 PM »

OK, I've been using the mysqli_ functions for a bit now because of phpMyIDE and because I've wanted to see if they are worth it.

Downside: a little more complicated at first than the stock mysql_ functions. The combination of procedural and OO implementations of the functions make me a little dizzy and seem stupid. I keep hearing NBs saying "Man, who wrote this fucked up function set?" which is a generous understatement.

Upside: Of course you can't really do stored procedure work effectively with mysql_, although it can be done. But the mysqli_ funcs are just built for it. And if you can do multi_query() then you're set for a huge increase in speed. The example, which is what prompted me to post, is a conversion routine from an old DB to a new one. Essentially, the old way was to get a row from the old box and insert it into the new box. Instead, I just created an array with all the SQL statements I wanted to execute separated by a semicolon and a \n, then issued the whole thing with multi_query.

MAN OH MAN.

I thought something was wrong it went so fast. I mean, like, a whole new ball game. So I wrote a few tests using a bunch of calls to stored procedures, updates, you name it - across the board, BLAZING.

Net-net: It is worth the pain in the ass to start using the mysqli_ functions. Get over the yuck factor and start refactoring the way you interact with the DB.
You'll be happy.
Logged

It is now believed, that after having lived in one compound with 3 wives and never leaving the house for 5 years, Bin Laden called the U.S. Navy Seals himself.
nutballs
Administrator
Lifer
*****
Offline Offline

Posts: 5627


Back in my day we had 9 planets


View Profile
« Reply #1 on: July 09, 2008, 07:33:18 PM »

this has been on my todo list, but it keeps moving down because i have other items that seem more important. lately i have been trying to figure out how to less programming of large things, and instead doing implementation of those large things with wheels that have already been invented.

but its good to hear that I should stay on my list, and eventually should be gotten to. honestly i never even looked, but I figured, the "next way of doing MySQL" should be worth a look.

<hijack>
but the convolution that you mention makes me annoyed. Thats yet another reason why open source, community built code doesnt 'really' work in the end. too many corners get painted into, and noone will own it and do the hard choice to fix it (at least rarely).
</hijack>
Logged

I could eat a bowl of Alphabet Soup and shit a better argument than that.
perkiset
Olde World Hacker
Administrator
Lifer
*****
Offline Offline

Posts: 10096



View Profile
« Reply #2 on: July 09, 2008, 09:13:15 PM »

I get it. The very opensourceness that makes it cool, makes it awful.

But all that said, it may be ugly but man can it get the job done.
Logged

It is now believed, that after having lived in one compound with 3 wives and never leaving the house for 5 years, Bin Laden called the U.S. Navy Seals himself.
nutballs
Administrator
Lifer
*****
Offline Offline

Posts: 5627


Back in my day we had 9 planets


View Profile
« Reply #3 on: July 10, 2008, 06:34:12 AM »

oh certainly. The same way I can use a corkscrew to open letters, it works, I just get stabbed every once in a while.
Logged

I could eat a bowl of Alphabet Soup and shit a better argument than that.
DangerMouse
Expert
****
Offline Offline

Posts: 244



View Profile
« Reply #4 on: July 10, 2008, 07:54:40 AM »

Is mysqli in the process of being replaced with mysqlnd?

I currently use the PDO extension but I'm unsure whether it uses mysql libs or mysqli. Hoping to start using stored procedures soon so I'd best find out! Getting a little sick of writing mappers, leaving the DB code to the DB sounds better, especially with PHPMyIDE Wink

DM
Logged
perkiset
Olde World Hacker
Administrator
Lifer
*****
Offline Offline

Posts: 10096



View Profile
« Reply #5 on: July 10, 2008, 09:28:35 AM »

I'm pretty sure that the PDO uses mysqli. mysql_ is pretty limited really and I think is getting ready to be deprecated.

@ stored procedures, phpmyide et al - DM I'm using it full time on my projects and it has changed a lot of how I think. Stored procedures and the odd trigger make for some really efficient DB mechanisms and clean up my PHP code considerably. I also really like having DB-specific logic in the DB alone - it just makes so much sense. Rather than throwing update and insert calls, I'm doing a lot of call procName() kind of SQL now - particularly when the logic behind what seems like simple movement is actually either complex or evolutionary and I don't want to have to revisit the PHP code in the future when I extend the DB.
Logged

It is now believed, that after having lived in one compound with 3 wives and never leaving the house for 5 years, Bin Laden called the U.S. Navy Seals himself.
vsloathe
vim ftw!
Global Moderator
Lifer
*****
Offline Offline

Posts: 1669



View Profile
« Reply #6 on: July 10, 2008, 11:45:01 AM »

How do you like PDO? I've been using those on my own for a while.
Logged

hai
perkiset
Olde World Hacker
Administrator
Lifer
*****
Offline Offline

Posts: 10096



View Profile
« Reply #7 on: July 10, 2008, 11:52:32 AM »

I don't use them at all, never even tried them. Sorry mang
Logged

It is now believed, that after having lived in one compound with 3 wives and never leaving the house for 5 years, Bin Laden called the U.S. Navy Seals himself.
vsloathe
vim ftw!
Global Moderator
Lifer
*****
Offline Offline

Posts: 1669



View Profile
« Reply #8 on: July 10, 2008, 11:59:31 AM »

http://us.php.net/PDO

Ever so slightly fewer idiosyncrasies than the mysql libs. No installation of special stuff either.

I hear you're going to need to make the conscious choice to install the mysql libs in PHP6, and they're going to encourage people to start using PDO.
Logged

hai
perkiset
Olde World Hacker
Administrator
Lifer
*****
Offline Offline

Posts: 10096



View Profile
« Reply #9 on: July 10, 2008, 12:20:10 PM »

Argh argh argh.

PDO. ADO. DBO. Whatever the hell that Windows connection hooie was I used to need to install. Hate the middle layer man, I hate it. I understand there are lots of folks that want to write once DB many, but FFS, I know what DB I'm using and am plenty happy to eliminate the middle man layer to get more speed from my DB of choice.

DB drivers are one of the few things in technology that really give me the shits.
Logged

It is now believed, that after having lived in one compound with 3 wives and never leaving the house for 5 years, Bin Laden called the U.S. Navy Seals himself.
Pages: [1]
  Print  
 
Jump to:  

Perkiset's Place Home   Best of The Cache   phpMyIDE: MySQL Stored Procedures, Functions & Triggers
Politics @ Perkiset's   Pinkhat's Perspective   
cache
mart
coder
programmers
ajax
php
javascript
Powered by MySQL Powered by PHP Powered by SMF 1.1.2 | SMF © 2006-2007, Simple Machines LLC
Seo4Smf v0.2 © Webmaster's Talks


Valid XHTML 1.0! Valid CSS!