MSSQL database driver for the Tina4 PHP framework.
composer require tina4stack/tina4php-mssql- PHP >= 8.1
- ext-sqlsrv
- tina4stack/tina4php-database ^2.0
// Connection format: host/port:database
$DBA = new \Tina4\DataMSSQL("localhost/1433:database", "sa", "password");
// Execute queries
$DBA->exec("create table users (id integer primary key, name varchar(200))");
$DBA->commit();
// Insert with parameters
$DBA->exec("insert into users (id, name) values (?, ?)", 1, "Alice");
// Fetch records
$result = $DBA->fetch("select * from users");
$records = $result->asArray();
// Fetch with limit and offset
$result = $DBA->fetch("select * from users", 10, 0);
// Fetch single record
$record = $DBA->fetchOne("select * from users where id = 1");
// Check if table exists
$exists = $DBA->tableExists("users");
// Get database metadata
$metadata = $DBA->getDatabase();docker compose up -d
composer testMIT - see LICENSE
Sponsored with 🩵 by Code Infinity
Supporting open source communities • Innovate • Code • Empower
