Jump to content

Transactions From Php Scripts


chibineku

Recommended Posts

I have several PHP scripts in my site, for example logging, logging out, adding items to your basket, etc. I was wondering what the arguments are in favour of, and against, using stored transactions. On the face of it, it seems like they might make things simpler, but is there any difference from just handwriting the code into a PHP script? Are there security concerns? Are there any real differences at all apart from the rollback feature?

Link to comment
Share on other sites

Yes, that's the one. It all comes under the same chapter heading in the book I have.

Link to comment
Share on other sites

Stored procedures are generally faster because they are compiled and optimized on the database. This is only database code though, you can't mess with the PHP session or read data from $_POST or whatever, it's basically just a function you define on the database to do several things instead of sending one or more queries. But since the database server compiles them they are faster than sending individual queries.

Link to comment
Share on other sites

Ah. Well, every query I make is dependent on variables from the session or POST, so not really any good to me.

Link to comment
Share on other sites

You can still send the data to the SP, a SP is basically like a function on the database server, where you can still send it parameters. So you can't read the session data or post data inside the SP, but you can send that data to the SP through PHP.

Link to comment
Share on other sites

Ah, ok. Given your knowledge, from my many many threads, of my scripts, would you suggest implementing them? I believe for the moment I will leave well enough alone, but once the site is launched I can play around with things to improve efficiency.

Link to comment
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...