Want to alter the fewest modules.
Some modules have been modified that are not mentioned below.
These are changes that turned out to be unnecessary, such as
changing fetchrow_hashref() to fetchrow_hashref('NAME_lc').

Problems:
=========

Database connection is different
--handled in  Bio::EnsEMBL::DBSQL::DBAdaptor
  perl/EnsWeb.pm
  perl/contigview

Stuff unique to MySQL queries:
IF, STRAIGHT_JOIN, use of "" around strings
	- handled by Bio::EnsEMBL::DBSQL::SQL::prepare()

Stuff unique to Oracle queries:
    '--' = the rest of the line is a comment
	- handled by Bio::EnsEMBL::DBSQL::SQL::prepare()


Use of  LIMIT  in some queries
--not yet addressed

Case of column names:
    $sth=$dbh->prepare("select MyCol from MyTable where id=1");
    $sth->execute;
    $result=$sth->fetchrow_hashref();
    $mycol=$result->{'MyCol'};
The query is done ok - the case of the columns is ignored.
But MySQL returns the results with the column names in the same case as
given and Oracle has the column names all capitals.  (So you would have
to say $result->{'MYCOL'} for Oracle.)
In order to get around this, we have a statement handle type,
Bio::EnsEMBL::DBSQL::SQL::StatementHandle
which has its own fetchrow_hasref that returns a hash tied to 
Bio::EnsEMBL::DBSQL::SQL::Orowhash -- a case-insensitive hash.


Three of the column names used in EnsEMBL are not allowed in Oracle:
'sequence', 'start', and 'synonym'
prepare() changes these to 'ORCL_sequence', etc.
And Orowhash changes them back.


The static golden path type 'UCSC' is hard-coded in several places.
I changed this to 'CUGI' in some of them. 
I plan to make it a parameter.


MEDIUMTEXT columns
These are too long for VARCHAR2, so in Oracle they have to be
LONG or CLOB.
String functions such as LENGTH() or SUBSTR() cannot be used on LONGs
or CLOBs in SQL.
Fortunately there is only MEDIUMTEXT in EnsEMBL:
dna.sequence, which we make  ORCL_Sequence.
And fortunately, this field is only used in 
Bio::EnsEMBL::DBSQL::DBPrimarySeq.pm
and
Bio::EnsEMBL::DBSQL::DBAdaptor.pm

Right now it is a LONG, but it will soon be changed to a CLOB, and a
length field added for convenience.

Queries which use length(sequence) or substr(sequence,  ,  ) are changed
to fetch the whole sequence. Then we  use the perl length() or substr().
Yes this is inefficient, but it works.
When sequence is a CLOB, we can use PL/SQL to get length and substr.

Bio::EnsEMBL::DBSQL::DBAdaptor::_insert_sequence() will also need to be
modified if we want to use it.


Some queries have "" around numeric values - values that numeric fields 
are compared to.  MySQL tolerates this, but Oracle doesn't.  Oracle
won't allow single quotes either.



==========
By Module:
==========


ensembl/modules/Bio/EnsEMBL:

DBSQL/SQL/StatementHandle.pm
added fetchrow_hashref() method which does the fetchrow_hashref,
but returns a hash tied to Bio::EnsEMBL::DBSQL::SQL::Orowhash 
for case insensitivity and removing 'ORCL_' from the beginning of
column names.


DBSQL/SQL/Orowhash.pm
Case insensitive hash which also removes 'ORCL_' from the beginning of
keys.


DBSQL/DBAdaptor.pm
Static Golden Path type 'UCSC' changed to 'CUGI'
Uses  DRIVER  value:
    Connect String is different for Oracle
    Oracle does not default port to 3306  (Should probably be default
	to 3306 only for MySQL)
    For Oracle database handle is a Bio::EnsEMBL::DBSQL::SQL object
    Save DRIVER as $self->driver .
prepare() does a cluck( first argument) so the log has a stack backtrace for
    every query -- very useful in debugging

DBSQL/DBPrimarySeq.pm
Can't use SQL  LENGTH(), SUBSTR() on sequence, so 
sub subseq -fetch the whole sequence and then do substr() on the result
sub length -fetch the whole sequence and then do length() on the result

DBSQL/RawContig.pm
Two queries of contig contained  
    where internal_id = "..."
These quotes were removed (internal_id is numeric).

DBSQL/SQL.pm
new() Database connect: set LongReadLen => 16777215  (size of MySQL MEDIUMTEXT)
to allow reading  sequence  (This applies to both LONG & CLOB in DBI)
prepare()
    Fix up the parts of the query not contained in single quotes:
         prefix 'ORCL_' to 'sequence','start', and 'synonym'
	 remove 'straight_join' (a MySQL optimization hint)
	 change '--' to '- -'   ( '--' means a comment in Oracle.  In the
	        EnsEMBL code it comes from subtracting a negative value.)
         change IF(w=x,y,z) to DECODE(w,x,y,z)
	       ( IF(p,q,r) in MySQL  means  p?q:r
	         DECODE in Oracle is a kind of case statement:
		    DECODE (a,b1,c1,b2,c2,...,bn,cn,e) 
		       = c1 if a==b1, ..., cn if a==bn, e otherwise 
		 Queries that use IF where the first argument is not an equality
		 would probably have to be rewritten by hand.)
         change non-escaped pairs of Double quotes to single quotes  
    Warn if Double quotes remain.


================


These modules had part of the DRIVER changes made to DBAdaptor done to them.
Probably that is not enough.
They may not all be used:
DBSQL/Obj.pm
ExternalData/EXONERATESQL/DBAdaptor.pm
ExternalData/SNPSQL/WebSNPAdaptor.pm
ExternalData/TCORESQL/DBAdaptor.pm
Map/DBSQL/Obj.pm


================

perl/EnsWeb.pm
get_locator()
    set driver  from SiteDefs.pm $ENSEMBL_DRIVER
    set environment variables  (hard-coded for now)
     	ORACLE_HOME
	TWO_TASK

perl/contigview
static_golden_path_type  'UCSC' -> 'CUGI'
Don't   add "chr" before chromosome name if it doesn't begin with it.

(Pointless at present:)
    pass  $ENSEMBL_DRIVER and $ENSEMBL_DBPASS
	 to DBAdaptor for $ENSEMBL_EMBL and WebSNPAdaptor
