[Koha-devel] SQL Dtabase Flavour Alternate Routines and Identifier Quoting Proposal

Thomas D koha at alinto.com
Sat Feb 4 08:42:05 CET 2006


Oops, I left out an enclosing if clause for one part of the code at the end
of this section.  This is one thing need to prevent failure in the present
usual case where db_scheme may not be included in the koha.conf.

# At the top of any C4 modules or $KOHA/admin/ 
# scripts requiring SQL database access:
# Obtain a value for the SQL database implementation type (flavour)
my $sqlDBType = C4::Context->config("sqlDBType");
my $nonMySQLDBType = $sqlDBType;
if ($nonMySQLDBType) {
    if ($nonMySQLDBType =~ /mysql/i) {$nonMySQLDBType = undef;}
}


Thomas D


Quoting Thomas D <koha at alinto.com> :
> ---------------- Beginning of the original message ------------------
> 

[snip]

> PROPOSED CODE FOR GUIDELINE
> 
> # Modification for Context.pm
>         # Quick hack for allowing databases name in full text
>         # from authorised value list
>         if ( $1 eq "db_scheme" ) {
>             $retval{sqlDBType} = $2; # add virtual config
> variable
>             $value = db_scheme2dbi($2);
>         } else {
>             $value = $2;
>         }
>         $retval->{$1} = $value;
> 
> 
> 
> # At the top of any C4 modules or $KOHA/admin/ 
> # scripts requiring SQL database access:
> # Obtain a value for the SQL database implementation type
> (flavour)
> $my $sqlDBType = C4::Context->config("sqlDBType");
> my $nonMySQLDBType = $sqlDBType;
> if ($nonMySQLDBType =~ /mysql/i) {$nonMySQLDBType = undef;}
> 
> 
> # Alternate routines or routine placeholders for various SQL
> database types
> if ($nonMySQLDBType) {
> 
>     if ($nonMySQLDBType eq 'postgres7') {
>         # Postgres 7 specific code
>     } elsif ($nonMySQLDBType eq 'postgres8') {
>         # Postgres 8 specific code
>     } elsif ($nonMySQLDBType eq 'oracle') {
>         # Oracle specific code
>     } else {
>         # ANSI code
>     }
> 
> } else {
>     # MySQL specific code
> }
> 
> 

[snip]

---------------------------------------------
Alinto wishes you a happy new year 2006 http://www.alinto.com





More information about the Koha-devel mailing list