Reply to All
Show messages
Messages
Inbox
Search
Login
1–10
…
21–30
31–40
41–50
51–60
…
101
PHP Wizards
From: steve
20 Apr 2011 11:15
To: af (CAER)
46 of 101
38393.46
In reply to
38393.44
That looks even more complicated
:$
From: Peter (BOUGHTONP)
20 Apr 2011 11:16
To: af (CAER)
47 of 101
38393.47
In reply to
38393.44
If you don't want to use SQL, don't use a database that runs on SQL! (
:O
)
From: af (CAER)
20 Apr 2011 12:21
To: steve
48 of 101
38393.48
In reply to
38393.46
Than what? I'm not sure what the corresponding SQL would look like but I'm pretty sure it'd be more complicated than that.
From: Peter (BOUGHTONP)
20 Apr 2011 12:57
To: af (CAER)
49 of 101
38393.49
In reply to
38393.48
quote:
I'm pretty sure it'd be more complicated
I'm not...
sql code:
DELETE
Post
WHERE
Creator
=
findUserByEmail
(
'andy@caerphoto.com'
)
From: af (CAER)
20 Apr 2011 13:17
To: Peter (BOUGHTONP)
50 of 101
38393.50
In reply to
38393.49
Will that also trigger any callbacks set up in the Post model, for example if it's the last Post being deleted, also delete the associated Thread?
And what is this 'findUserByEmail' function?
From: Ken (SHIELDSIT)
20 Apr 2011 13:27
To: Peter (BOUGHTONP)
51 of 101
38393.51
In reply to
38393.49
Pete are you up for a complicated question?
From: Peter (BOUGHTONP)
20 Apr 2011 13:36
To: af (CAER)
52 of 101
38393.52
In reply to
38393.50
Yes, of course, (because that's how my imaginary SQL database has been configured to react).
(It's been possible to do triggers with databases for
years
, long before Rails came along. Probably even before Ruby too.)
It's a function (stored procedure), just like your User.findByEmail one. It's automatically generated by another one of those triggers - every time a table is created or altered - so it's faster than doing dynamic lookups with Method Missing.
From: Peter (BOUGHTONP)
20 Apr 2011 13:39
To: Ken (SHIELDSIT)
53 of 101
38393.53
In reply to
38393.51
If it's a quick complicated one... I'm supposed to be finishing something off at the moment, but keep getting distracted by that dastardly Rails fan.
:@
From: af (CAER)
20 Apr 2011 13:40
To: Peter (BOUGHTONP)
54 of 101
38393.54
In reply to
38393.52
Well now, that's interesting.
I'd best not get too involved in this as I really don't know all that much
:$
From: Peter (BOUGHTONP)
20 Apr 2011 13:46
To: af (CAER)
55 of 101
38393.55
In reply to
38393.54
The difference is, nobody has actually created a popular framework for all this stuff (well, not that I'm aware of), but the ability to do it is there.
Very little (if any) of the stuff that Rails (or others) is new - it's all been possible for decades, but either computers were too slow, or it just didn't get used in mainstream until someone actually shouted about it.