Reply to All
Show messages
Messages
Inbox
Search
Login
1–10
…
21–30
31–40
41–50
51–60
…
101
PHP Wizards
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.
From: af (CAER)
20 Apr 2011 13:48
To: Peter (BOUGHTONP)
56 of 101
38393.56
In reply to
38393.55
Hmm. Why's nobody made a popular framework for it? Is that sort of thing possible in SQL? Man I really don't know much about server things
:$
From: Peter (BOUGHTONP)
20 Apr 2011 13:56
To: af (CAER)
57 of 101
38393.57
In reply to
38393.56
Well it's not pure SQL at that point, it's getting into database-specific programming languages.
And I guess, especially compared to more general programming languages, they're a bit crappy - they're static typing, still needs some form of front-end to be useful, and stuff.
From: Ken (SHIELDSIT)
20 Apr 2011 14:01
To: Peter (BOUGHTONP)
58 of 101
38393.58
In reply to
38393.53
I don't think it's going to be quick, so I'll wait to post it.