Beispiel #1
0
 public function __construct($dsn = '', $username = '', $password = '')
 {
     $file = substr($dsn, 7);
     if (false === strpos($file, DIRECTORY_SEPARATOR)) {
         // no directories involved, store it where we want to store it
         $storage = config('df.db.sqlite_storage');
         if (!is_dir($storage)) {
             // Attempt
             @mkdir($storage);
         }
         if (!is_dir($storage)) {
             logger('Failed to access storage path ' . $storage);
             throw new InternalServerErrorException('Failed to access storage path.');
         }
         $dsn = 'sqlite:' . rtrim($storage, DIRECTORY_SEPARATOR) . DIRECTORY_SEPARATOR . $file;
     }
     parent::__construct($dsn, $username, $password);
 }
Beispiel #2
0
 public function __construct($dsn = '', $username = '', $password = '')
 {
     if (null !== ($dumpLocation = config('df.db.freetds.dump'))) {
         if (!putenv("TDSDUMP={$dumpLocation}")) {
             \Log::alert('Could not write environment variable for TDSDUMP location.');
         }
     }
     if (null !== ($dumpConfLocation = config('df.db.freetds.dumpconfig'))) {
         if (!putenv("TDSDUMPCONFIG={$dumpConfLocation}")) {
             \Log::alert('Could not write environment variable for TDSDUMPCONFIG location.');
         }
     }
     if (null !== ($confLocation = config('df.db.freetds.sqlanywhere'))) {
         if (!putenv("FREETDSCONF={$confLocation}")) {
             \Log::alert('Could not write environment variable for FREETDSCONF location.');
         }
     }
     parent::__construct($dsn, $username, $password);
 }
Beispiel #3
0
 public function __construct($dsn = '', $username = '', $password = '')
 {
     if (substr(PHP_OS, 0, 3) == 'WIN') {
         // MS SQL Server on Windows
         $this->pdoClass = 'DreamFactory\\Core\\Database\\Mssql\\SqlsrvPdoAdapter';
     } else {
         if (null !== ($dumpLocation = config('df.db.freetds.dump'))) {
             if (!putenv("TDSDUMP={$dumpLocation}")) {
                 \Log::alert('Could not write environment variable for TDSDUMP location.');
             }
         }
         if (null !== ($dumpConfLocation = config('df.db.freetds.dumpconfig'))) {
             if (!putenv("TDSDUMPCONFIG={$dumpConfLocation}")) {
                 \Log::alert('Could not write environment variable for TDSDUMPCONFIG location.');
             }
         }
         if (null !== ($confLocation = config('df.db.freetds.sqlsrv'))) {
             if (!putenv("FREETDSCONF={$confLocation}")) {
                 \Log::alert('Could not write environment variable for FREETDSCONF location.');
             }
         }
     }
     parent::__construct($dsn, $username, $password);
 }