Skip to content
This repository has been archived by the owner on Dec 16, 2019. It is now read-only.

Commit

Permalink
Adding MS SQL Server support
Browse files Browse the repository at this point in the history
  • Loading branch information
buedsmith authored and skyronic committed Feb 11, 2016
1 parent c675d8a commit 8b302dd
Showing 1 changed file with 31 additions and 0 deletions.
31 changes: 31 additions & 0 deletions src/CrudKit/Pages/SQLServerTablePage.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
<?php

namespace CrudKit\Pages;

use CrudKit\Pages\BaseSQLDataPage;
use Doctrine\DBAL\DriverManager;

class SQLServerTablePage extends BaseSQLDataPage {
public function __construct ($id, $user, $pass, $db, $extra = array()) {
$params = array(
'driver' => 'sqlsrv',
'user' => $user,
'password' => $pass,
'dbname' => $db
);

if(isset($extra['host'])) {
$params['host'] = $extra['host'];
}
if(isset($extra['port'])) {
$params['port'] = $extra['port'];
}
if(isset($extra['charset'])) {
$params['charset'] = $extra['charset'];
}
$conn = DriverManager::getConnection($params);
$this->preInit($id, $conn);

return $this;
}
}

0 comments on commit 8b302dd

Please sign in to comment.