Merge branch 'newpc92timings' of /scm/spider into newpc92timings
[spider.git] / perl / DXSql.pm
index fcf4e4ce5608dd5fc4068f4adb2c19924278483f..437f3bbf5e22a34eba9022a115bb805eaf5bc245 100644 (file)
@@ -1,7 +1,7 @@
 #
 # The master SQL module
 #
-# $Id$
+#
 #
 # Copyright (c) 2006 Dirk Koopman G1TLH
 #
@@ -10,18 +10,17 @@ package DXSql;
 
 use strict;
 
+use DXSql::SQLite;
+use DXSql::mysql;
 use DXDebug;
 
-use vars qw($VERSION $BRANCH);
-$VERSION = sprintf( "%d.%03d", q$Revision$ =~ /(\d+)\.(\d+)/ );
-$BRANCH = sprintf( "%d.%03d", q$Revision$ =~ /\d+\.\d+\.(\d+)\.(\d+)/  || (0,0));
-$main::build += $VERSION;
-$main::branch += $BRANCH;
-
-our $active = 0;
+use vars qw($active);
+$active = 0;
 
 sub init
 {
+       my $dsn = shift;
+       return unless $dsn;
        return $active if $active;
        
        eval { 
@@ -31,6 +30,7 @@ sub init
                import DBI;
                $active++;
        }
+       undef $@;
        return $active;
 } 
 
@@ -170,7 +170,7 @@ sub spot_search
                $expr =~ s/\$f9/spotcq/g;
                $expr =~ s/\|\|/ or /g;
                $expr =~ s/\&\&/ and /g;
-               $expr =~ s/=~\s+m\{\^([\w]+)[^\}]*\}/ like '$1%'/g;
+               $expr =~ s/=~\s+m\{\^([%\w]+)[^\}]*\}/ like '$1'/g;
        } else {
                $expr = '';
        }