OK, I modified the fetch_rows in the oracle.rb.  I made it so that it
test the class of each column and if it is OCI8::CLOB, to read it.

      def fetch_rows(sql, &block)
        execute(sql) do |cursor|
          begin
            @columns = cursor.get_col_names.map {|c|
c.downcase.to_sym}
            while r = cursor.fetch
              row = {}
              r.each_with_index do |v, i|
                puts "CLASS: #{v.class}"
                if v.class == OCI8::CLOB
                  puts "Caught CLOB!"
                  row[columns[i]] = v.read
                else
                  row[columns[i]] = v unless columns[i] == :raw_rnum_
                end
              end

              yield row
            end
          ensure
            cursor.close
          end
        end

I am still getting the same error when I test it in irb.

irb(main):004:0> @logs = DB[:nd_worklog].filter(:ticket_id =>
'ND005327825')
=> #<Sequel::Oracle::Dataset: "SELECT * FROM \"ND_WORKLOG\" WHERE
(\"TICKET_ID\" = 'ND005327825')">
irb(main):005:0> @logs.first
CLASS: String
CLASS: String
CLASS: Bignum
CLASS: String
CLASS: String
CLASS: NilClass
CLASS: String
CLASS: OCI8::CLOB
Caught CLOB!
OCIStillExecuting: Still Executing
        from lob.c:57:in
oci8lib.so

Is there something I need to do to the cursor?

On Nov 19, 5:00 pm, Drunkguy <[EMAIL PROTECTED]> wrote:
> Is there a logger method that I can access from the adapter?
>
> On Nov 19, 3:59 pm, Drunkguy <[EMAIL PROTECTED]> wrote:
>
> > I am assuming this is the right adapter file?
>
> > sequel-2.7.1/lib/sequel_core/adapters/oracle.rb
>
> > I see the fetch_row method in there.  I will play with it and see if I
> > can get it working.  If so, I will send in the fix.
>
> > Thanks, for you help!
>
> > Matt
>
> > On Nov 19, 2:55 pm, Jeremy Evans <[EMAIL PROTECTED]> wrote:
>
> > > On Nov 19, 7:54 am, Drunkguy <[EMAIL PROTECTED]> wrote:
>
> > > > This morning I was setting up a webservice for an oracle table and I
> > > > noticed the results returned one of the columns as an OCI8::CLOB
> > > > object.  I have read the ruby-oci8 
> > > > documentation.http://ruby-oci8.rubyforge.org/en/api_OCI8CLOB.html
>
> > > > Maybe I missed something, but this is the problem that I am having.  I
> > > > am creating a dataset, but one of the columns is being returned as an
> > > > OCI8::CLOB object.  When I call the available? method it returns true,
> > > > but when I call the read() method I get an error.  The error I get is
> > > > "OCIStillExecuting: Still Executing".  If I try to run any other
> > > > methods with that column, I get this one, "OCIError: ORA-03127: no new
> > > > operations allowed until the active operation ends".
>
> > > > Here is my output from an IRB session:
>
> > > > $ irb
> > > > irb(main):001:0> require 'rubygems'
> > > > => true
> > > > irb(main):002:0> require 'sequel'
> > > > => true
> > > > irb(main):003:0> DB = Sequel.connect('oracle://
> > > > ewall000:[EMAIL PROTECTED]:1522/RXRPRD')
> > > > => #<Sequel::Oracle::Database: "oracle://
> > > > ewall000:[EMAIL PROTECTED]:1522/RXRPRD">
> > > > irb(main):004:0> @logs = DB[:nd_worklog].filter(:ticket_id =>
> > > > 'ND005327825')
> > > > => #<Sequel::Oracle::Dataset: "SELECT * FROM \"ND_WORKLOG\" WHERE
> > > > (\"TICKET_ID\" = 'ND005327825')">
> > > > irb(main):005:0> @logs.first[:details].available?
> > > > => true
> > > > irb(main):006:0> details = @logs.first[:details].read()
> > > > OCIStillExecuting: Still Executing
> > > >         from lob.c:57:in oci8lib.so
> > > >         from /usr/lib/ruby/gems/1.8/gems/ruby-oci8-1.0.3/lib/oci8.rb:
> > > > 1013:in `size'
> > > >         from /usr/lib/ruby/gems/1.8/gems/ruby-oci8-1.0.3/lib/oci8.rb:
> > > > 986:in `read'
> > > >         from (irb):6
> > > > irb(main):007:0>
>
> > > > Can someone point me in the right direction or let me know what I am
> > > > doing wrong?
>
> > > This will probably require changes to the Oracle adapter.  In
> > > fetch_rows, it should be calling read on all of the OCI8::CLOB objects
> > > before it yields, so the user never has to do so manually.  Before
> > > fetch_rows exits, the cursor is closed, and attempting to use read
> > > afterward will probably give you an error.  I don't have access to an
> > > Oracle database or really any significant experience with Oracle, so I
> > > can't produce a patch, but hopefully I've given enough information for
> > > you to give it a shot.
>
> > > Jeremy
>
>
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"sequel-talk" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/sequel-talk?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to