<<2010-03-09 2010-03-11>>
    Mar 10 00:29
    pietia joined #sequel
    Mar 10 01:09
    JonathanT joined #sequel
    Mar 10 01:22
    dominikh joined #sequel
    spox_ joined #sequel
    Mar 10 02:09
    botanicus joined #sequel
    Mar 10 03:17
    jeremyevans joined #sequel
    Mar 10 04:25
    botanicu_ joined #sequel
    Mar 10 05:26
    merboutpost joined #sequel
    Mar 10 07:56
    j_dana joined #sequel
    s_dana joined #sequel
    Mar 10 08:24
    lec_ joined #sequel
    Mar 10 08:56
    botanicus joined #sequel
    Mar 10 09:27
    Swimming_Bird joined #sequel
    Mar 10 09:53
    botanicus joined #sequel
    Mar 10 11:10
    greg8si joined #sequel
    Mar 10 11:19
    dirtmcgirt joined #sequel
    Mar 10 11:46
    pietia joined #sequel
    mwlang joined #sequel
    Mar 10 12:00
    zoo-zed joined #sequel
    Mar 10 12:31
    hrnt joined #sequel
    Mar 10 12:43
    s_dana joined #sequel
    j_dana joined #sequel
    Mar 10 12:48
    djanowski joined #sequel
    djanowski
    hello all. trying to use sequel with oracle XE, are there any limitations?
    basically the SQL generated for an ALTER TABLE is different from the expected
    soveran joined #sequel
    Mar 10 13:57
    pedrobelo joined #sequel
    Mar 10 14:05
    jeremyevans
    djanowski: I've never tried. I know there are Sequel users using Oracle, but it wouldn't surprise me if not all ALTER TABLE commands work on Oracle.
    djanowski: I don't have access to an Oracle installation, so I can't test it
    djanowski
    jeremyevans: yeah it looks like it's not working. there's a slight difference when you add a column. nevermind, i'll test with the team and hopefully we can come up with a patch
    jeremyevans: a good patch would mean some refactoring on alter_table_sql
    otherwise it's hard to override for a single case
    jeremyevans
    djanowski: In general, you should just have to override it in the shared Oracle adapter
    djanowski: That's what the other adapters do
    djanowski
    jeremyevans: override the whole method?
    jeremyevans
    djanowski: The probability that it requires a change to Sequel core is unlikely
    djanowski: Basically, you just override it to handle the cases that need to be handled differently, and call super for the other cases
    djanowski: Look how it is overridden in the other shared adapters
    djanowski
    jeremyevans: still not very clean, in this case we'd only need to override one part of the `case`, not the whole ALTER TABLE statement
    jeremyevans
    djanowski: Which particular case isn't working?
    djanowski
    jeremyevans: ALTER TABLE "table" ADD COLUMN "foo" INTEGER
    jeremyevans: that's what sequel is trying to execute
    Mar 10 14:10
    jeremyevans
    djanowski: What's the Oracle syntax needed?
    djanowski
    but oracle doesn't want ADD COLUMN but simply ADD
    jeremyevans
    djanowski: So you'd use case, override it for :add_column, and call super in the else
    djanowski: If the ADD/ADD COLUMN distinction affected more than one database, I'd think about supporting it in Sequel core
    djanowski
    jeremyevans: oh, sorry, no, i didn't mean that we'd need to support it
    jeremyevans
    djanowski: However, if it is just for Oracle, it's better just to override the whole add_column case in the adapter
    djanowski
    simply that using the case doesn't look very clean to me in terms of being able to easily override it
    i'd be duplicating the rest of the ALTER TABLE syntax
    s/syntax/statement
    jeremyevans
    djanowski: Yes. A whole line. Wow. :p
    djanowski: Really, it's not that bad
    djanowski
    jeremyevans: i agree, the world has other problems to worry about :)
    but you do agree that it's not super clean, right?
    if that line were doing more things, for example
    jeremyevans
    djanowski: Yes, it could be cleaner, but there's a tradeoff there
    djanowski: If it was more than one line, I might consider a core patch, but in this case, I don't think it is worth it
    Mar 10 14:16
    djanowski
    jeremyevans: ok, no problem, it's good to know beforehand
    jeremyevans: thanks as always
    jeremyevans
    djanowski: No problem :)
    Mar 10 15:34
    djanowski
    jeremyevans: # File lib/sequel/adapters/shared/oracle.rb, line 114
    jeremyevans: at what point does the dataset become associated with a sequence?
    not sure how opts[:sequence] becomes true
    ggelman joined #sequel
    jeremyevans
    djanowski: The sequence method (called manually), see line 129
    Matata10 joined #sequel
    djanowski
    jeremyevans: right, so Sequel::Model never uses it when inserting a new record?
    Mar 10 15:41
    djanowski
    jeremyevans: a bit more `ack`ing shows this: set_dataset dataset.sequence(:seq_albums_id)
    jeremyevans: that did it
    jeremyevans
    djanowski: If using Sequel::Model's with Oracle, I believe you need to set the sequence on the dataset so that the correct primary key value is returned when creating records
    djanowski: This isn't required on most other databases
    djanowski
    jeremyevans: is this something that could be somehow built in? maybe the adapter would be able to set the dataset?
    jeremyevans
    djanowski: If there's a good way to determine the sequence for a given table automatically, I wouldn't be against doing that
    djanowski: That's how the postgres adapter works.
    djanowski: But I don't know how to do it on Oracle, or have any ability to test it, and nobody has contributed any code to do so
    djanowski
    jeremyevans: absolutely
    jeremyevans
    djanowski: So on Oracle, it needs to be set manually
    djanowski
    checking the postgres adapter now
    jeremyevans: would you be interested in getting access to an oracle instance to run all of the sequel suite on it?
    jeremyevans
    djanowski: Sure
    Mar 10 15:46
    merboutpost
    jeremyevans: is there a way how to run migration to see the SQL but not execute the migration?
    jeremyevans
    merboutpost: No
    merboutpost: You'd have to setup a dummy database
    merboutpost: Getting the SQL is easy, just add a logger
    merboutpost: But making it so it doesn't execute is tricky
    merboutpost
    jeremyevans: no problem, just quick reality check :-)
    jeremyevans
    merboutpost: Generally, if you have a test database, just run it on that with a logger
    merboutpost
    jeremyevans: yep that what i do, well I do sequel -E currently
    jeremyevans
    merboutpost: sequel -E just adds a standard output logger :)