#perl
07 November 2007
Total 25 pages. You are browsing page 5/25.
First :: Prev :: [...] [3] [4] [5] [6] [7] [...] :: Next :: Last
04:31 <****> hum
04:32 <****> What's the most elegant way to enact a change all the rows of a database
04:32 <****> usually you want to use SQL
04:32 <****> I'd use update, but maybe that's just me
04:32 <****> ;
04:32 <****> ;)
04:33 <****> wrong. select, delete, insert.
04:33 <****> with autocommit turned on.
04:33 <****> what could go wrong?
04:33 <****> Specifically here I need to read a record, perform a regular expression on one field, and put it back in
04:34 <****> still update
04:34 <****> I could do it in two passes (select, then update) but I'm wondering if there's a more elegant manner
04:34 <****> JDigital: read record, transform, SQL UPDATE
04:34 <****> you shouldn't even need to read it
04:34 <****> I need to read it to find out what it is
04:34 <****> update foo set foo_column = whatever_regex_function(foo_column) where foo_id = 10'
04:35 <****> you can transform it in the update if the SQL engine supports whatever transformation you are trying to do
04:35 <****> but i'm fuzzy on DB-based regex stuff
04:35 <****> Me too, which is why I was thinking of doing it in two passes, as you said
04:36 <****> some stupid spammer has found the contact URL on p3m.org, and is now using it to spam me
04:36 <****> ha
04:40 <****> Somni: sorry about that, didn't know it goes to you!
04:40 <****> if $_ is the 'default variable' what's $_] ?
04:41 <****> the default syntax error?
04:41 <****> perldoc perlvar will tell al!
04:41 * CPAN upload: XML-Bare-0.22 by CODECHILD
04:41 <****> *al
04:41 <****> *all
04:41 <****> you making a horrible typo
04:41 <****> hmm, seems i can't type again
04:41 <****> it happens
04:41 <****> jdv79: thanks - i'll look there
04:43 <****> dad: $_] is a syntax error, if you weren't clear
04:43 <****> there is no such variable
04:43 <****> hmmm
04:43 <****> thanks.
04:43 <****> or not reading the whole line
04:44 <****> oh! crud! i was mis-reading the example - sorry.
04:44 <****> but perldoc is informative, as well...
04:45 <****> but thanks any way.
04:47 <****>fetch()) { /*run update here*/ } ?
04:48 <****> probably depends on your database and driver, so you'd have to read the documentation
04:48 <****> good point.
04:49 <****> JDigital: you should be able to do a sub-select, to get values for an update, with most modern databases, but i'm not sure that's what you want
04:50 <****> he wants to do modifications to the row that are apparently more simply done by doing it in Perl rather than SQL
04:50 <****> Somni: oic.
04:51 <****> I know perl better than regular expressions in mysql
04:51 <****> it's okay, I worked out a way for it to work :)
04:51 <****> hrm does mysql have the equivalent of s///?
04:53 <****> hello! does perl support a switch statement?
04:53 <****> perldoc -q switch
04:53 <****> snarfer: no.
04:54 <****> :(
04:54 <****> in 5.10! actually it's superior to most switch statements so that is still a no
04:54 <****> snarfer: use if elsif else
04:54 <****> ow
04:54 <****> my code
04:54 <****> snarfer: No, but we have ten other ways to do it :D
04:54 <****> way to not tackle a sitation
04:55 <****> postgres has regexp_replace
04:55 <****> Now if I could just remember how to return the number of elements in an array.
04:55 <****> SubStack: too bad I'm using mysql :)
04:55 <****> mysql has quite a few string manipulation functions, I suspect the problem isn't too complicated for them
05:02 <****> enough with the nick changes
05:06 <****> fine
05:06 <****> also, are arrays prefixed with @?
05:06 * Channel6 is new to perl
05:07 <****> say what?
05:08 <****> really?
05:09 <****> ya rly
05:09 <****> i asked a server to reboot itself but it hasn't come back:(
05:09 <****> ut oh
05:10 <****> nicht gut
05:10 <****> jdv79, remote reboot
05:10 <****> hope you arent too drunk to make the drive
05:10 <****> neat, remote reboots without a ip kvm or serial console..
05:10 <****> ah, there it is. thanks the gods!
05:10 <****> just a slow starter i guess
05:10 <****> jdv79, better check the logs
05:10 <****> iank: difficult to make secure
05:10 <****> and check that everything's running okay
05:10 <****> ...
05:10 <****> also, a lot of eggs in one basket. what if that kvm goes down
05:11 <****> that's why I don't do sysadminstration anymore
05:11 <****> I hate those fucking computers
05:11 <****> maybe ill be a dba
05:11 <****> make 100k doing boracle
05:12 <****> maybe
05:12 <****> but it's a shitty job
05:12 <****> its working fine
05:13 <****> imo, Oracle is nice to work with as a developer and hell to work with as a DBA.
05:13 <****> where I was working, we didn't have a DBA but we did hire some DB consultants occasionally, and they all were very bored and boring all the time
05:14 <****> pravus, yeah, that's why they pay you so much to do it
05:14 <****> some people. our DBAs really don't make all that much comparatively.
05:15 <****> regular DBAs are paid more than regular programmers
05:15 <****> furthermore, DBAs in large projects are paid A LOT, while programmers in large projects are paid the same
05:16 <****> can't have the database going down
05:17 <****> JDigital, it's not about up/down, it's about effeciency and optimization
05:17 <****> any asshole can keep a database running
05:17 <****> Good point. I've seen the difference a good database can make, especially on something like a busy web application
Total 25 pages. You are browsing page 5/25.
First :: Prev :: [...] [3] [4] [5] [6] [7] [...] :: Next :: Last
