Skip to content

Commit

Permalink
feat: basic sqlsrv support
Browse files Browse the repository at this point in the history
  • Loading branch information
joostfaassen committed Oct 30, 2020
1 parent a687299 commit 2fb5929
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 0 deletions.
5 changes: 5 additions & 0 deletions src/Config.php
Expand Up @@ -161,6 +161,11 @@ public function validate()
break;
case 'sqlite':
break;
case 'sqlsrv':
if (!$this->getAddress()) {
throw new RuntimeException("Missing address");
}
break;
default:
throw new RuntimeException("Unsupported driver: " . $this->getDriver());
}
Expand Down
3 changes: 3 additions & 0 deletions src/Connector.php
Expand Up @@ -92,6 +92,9 @@ public function getPdoDsn(Config $config, $mode = 'db')
case 'sqlite':
$pdoDsn .= $config->getFileName();
break;
case 'sqlsrv':
$pdoDsn .= 'Server=' . $config->getAddress() . ';Database=' . $config->getName();
break;
default:
throw new RuntimeException("Unsupported driver: " . $config->getDriver());
}
Expand Down

0 comments on commit 2fb5929

Please sign in to comment.