Some notes/comments on ruby-oci8-0.1.3 which I've just been struggling to
install on a Solaris 2.8/Oracle 9.2.0 system - may be helpful to anyone else
attempting the same.

Firstly it was failing to compile as follows:

checking for OCIInitialize()... no
./oraconf.rb:110:in `initialize': cannot compile OCI (RuntimeError)
        from extconf.rb:4:in `new'
        from extconf.rb:4

$ tail -3 mkmf.log
ld: fatal: file /u01/app/oracle/product/9.2.0/lib//libclntsh.so: wrong ELF class: ELFCLASS64
ld: fatal: File processing errors. No output written to conftest
collect2: ld returned 1 exit status

The problem here is one I've come across before: Oracle is looking in
.../lib when it should be looking in .../lib32

I have the linker environment right:

$ crle
  crle -c /var/ld/ld.config -l /usr/lib:/usr/local/lib:/usr/local/ssl/lib:/u01/app/oracle/product/9.2.0/lib32:/u01/app/oracle/product/9.2.0/rdbms/lib32

The solution is to edit src/oraconf.rb, change
'NOKPIC_CCFLAGS=' to 'NOKPIC_CCFLAGS32=' and 'build' to 'build32' in these
two places:

          make_opt += " KPIC_OPTION= NOKPIC_CCFLAGS32="
...
          command = "|make -f #{@oracle_home}/rdbms/demo/demo_rdbms.mk build32 #{make_opt}"

After that it compiles!

The other suggestion I have is a patch for OraDate (part of this has been
submitted already). The attached patch does two things:

- adds a compare (<=>) operator. In particular this allows you to do
     if date1 == date2 ...
  which otherwise fails.

- changes the default to_s format from
         YYYY/MM/DD HH:MM:SS
  to     YYYY-MM-DD HH:MM:SS

  The latter is, I believe, a more accurate ISO date format. It also happens
  to be the same as mysql provides.

Regards,

Brian.
diff -uNr ruby-oci8-0.1.3.orig/src/oradate.c ruby-oci8-0.1.3/src/oradate.c
--- ruby-oci8-0.1.3.orig/src/oradate.c	Thu Sep 12 15:14:16 2002
+++ ruby-oci8-0.1.3/src/oradate.c	Thu May  1 15:11:01 2003
@@ -143,7 +143,7 @@
   char buf[30];
   
   Data_Get_Struct(self, ora_date_t, od);
-  sprintf(buf, "%04d/%02d/%02d %02d:%02d:%02d", Get_year(od), Get_month(od),
+  sprintf(buf, "%04d-%02d-%02d %02d:%02d:%02d", Get_year(od), Get_month(od),
 	  Get_day(od), Get_hour(od), Get_minute(od), Get_second(od));
   return rb_str_new2(buf);
 }
@@ -243,12 +243,10 @@
 --- OraDate#trunc()
 =end
 */
-static VALUE ora_date_trunc(VALUE self, VALUE val)
+static VALUE ora_date_trunc(VALUE self)
 {
   ora_date_t *od;
-  int year;
 
-  year = NUM2INT(val);
   Data_Get_Struct(self, ora_date_t, od);
   od->hour = 1;
   od->minute = 1;
@@ -256,6 +254,33 @@
   return self;
 }
 
+/*
+=begin
+--- OraDate#<=>(other)
+=end
+*/
+static VALUE ora_date_cmp(VALUE self, VALUE val)
+{
+  ora_date_t *od1, *od2;
+  Data_Get_Struct(self, ora_date_t, od1);
+  Data_Get_Struct(val, ora_date_t, od2);
+  if (od1->century < od2->century) return INT2FIX(-1);
+  if (od1->century > od2->century) return INT2FIX(1);
+  if (od1->year < od2->year) return INT2FIX(-1);
+  if (od1->year > od2->year) return INT2FIX(1);
+  if (od1->month < od2->month) return INT2FIX(-1);
+  if (od1->month > od2->month) return INT2FIX(1);
+  if (od1->day < od2->day) return INT2FIX(-1);
+  if (od1->day > od2->day) return INT2FIX(1);
+  if (od1->hour < od2->hour) return INT2FIX(-1);
+  if (od1->hour > od2->hour) return INT2FIX(1);
+  if (od1->minute < od2->minute) return INT2FIX(-1);
+  if (od1->minute > od2->minute) return INT2FIX(1);
+  if (od1->second < od2->second) return INT2FIX(-1);
+  if (od1->second > od2->second) return INT2FIX(1);
+  return INT2FIX(0);
+}
+
 void Init_ora_date(void)
 {
   rb_define_singleton_method(cOraDate, "new", ora_date_s_new, -1);
@@ -282,6 +307,9 @@
   rb_define_method(cOraDate, "second=", ora_date_set_second, 1);
 
   rb_define_method(cOraDate, "trunc", ora_date_trunc, 0);
+
+  rb_define_method(cOraDate, "<=>", ora_date_cmp, 1);
+  rb_include_module(cOraDate, rb_mComparable);
 }
 
 void oci8_set_ora_date(ora_date_t *od, int year, int month, int day, int hour, int minute, int second)
diff -uNr ruby-oci8-0.1.3.orig/test/test_oradate.rb ruby-oci8-0.1.3/test/test_oradate.rb
--- ruby-oci8-0.1.3.orig/test/test_oradate.rb	Thu Sep 12 15:49:31 2002
+++ ruby-oci8-0.1.3/test/test_oradate.rb	Thu May  1 15:10:03 2003
@@ -198,6 +198,12 @@
     end
   end
 
+  def test_equal
+    d1 = OraDate.new(2003,03,15,18,55,35)
+    d2 = OraDate.new(2003,03,15,18,55,35)
+    assert_equal(d1, d2)
+  end
+
   def teardown
     @stmt.free()
     @svc.logoff()