Welcome Guest, Not a member yet? Register   Sign In
Active Record Class -> question
#3

[eluser]seba22[/eluser]
Hello,
Thank You for reply,

Hmm, sounds good, but i'm still worried.

I'm just afraid of that kinds of hacks.

I will show You and example what im talking about.

Few months ago, i was doing a project (quite large) many functions, class, etc... and i got error.

The was actually no error, but inserted data in mysql went crazy.
The user_id of creator of insert was from outer space... just like magic puff 123312 <- no representation in real live.
It was blowing my head, i spend few days!!! to figure out what's happened ( i was trying show error to 0 ect) nothing.

The answer was, $dbh (PDO connection) and last_inset_id().


I got part of code and inside something like this

//
$dbh -- insert into XYZ bla bla

if(dbh last insert id > 0) { do more stuff }

Inset fail, because of duplicate key error... but last insert id was containing last insert id, before that above insert what fail ;-) Something from previous... from example from inserting logs...

That was the day, when i go very very carefully when i'm doing something with common data...


I'm afraid with Active Class Record for example, by my mistake i will have few function and inside one i will have if(something) {$this->db->from('blogs');} and it will be hard to debug... I know i can search mysql logs, and then search source for that string but... it will be easier to just write db->clean();


I had same issue with "phpmailer" ;-)
But there was option $phpmailer->ClearAddress(); what remove everything previously added...


So last question, is driver data will be clear if query fail (maybe by syntax, or by dropped connection by mysql) ? <- i will try double check my code, but what about that kind of situation what can be caused not by my fault ?

Regards





Messages In This Thread
Active Record Class -> question - by El Forum - 07-29-2012, 08:44 AM
Active Record Class -> question - by El Forum - 07-29-2012, 10:11 AM
Active Record Class -> question - by El Forum - 07-29-2012, 10:42 AM
Active Record Class -> question - by El Forum - 07-30-2012, 07:36 AM
Active Record Class -> question - by El Forum - 07-30-2012, 11:47 PM
Active Record Class -> question - by El Forum - 07-31-2012, 11:29 AM



Theme © iAndrew 2016 - Forum software by © MyBB