{"id":20668698,"url":"https://github.com/emalherbi/mymssql","last_synced_at":"2026-05-16T17:11:36.204Z","repository":{"id":56977193,"uuid":"439733383","full_name":"emalherbi/MyMssql","owner":"emalherbi","description":"My Mssql PDO (MSSQL or SQLSRV)","archived":false,"fork":false,"pushed_at":"2022-04-14T17:26:17.000Z","size":6,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-03-10T15:18:42.746Z","etag":null,"topics":["mssql","php","sqlserver","sqlsrv"],"latest_commit_sha":null,"homepage":"","language":"PHP","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/emalherbi.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2021-12-18T23:12:49.000Z","updated_at":"2022-02-11T01:29:35.000Z","dependencies_parsed_at":"2022-08-21T11:20:38.822Z","dependency_job_id":null,"html_url":"https://github.com/emalherbi/MyMssql","commit_stats":null,"previous_names":[],"tags_count":1,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/emalherbi%2FMyMssql","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/emalherbi%2FMyMssql/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/emalherbi%2FMyMssql/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/emalherbi%2FMyMssql/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/emalherbi","download_url":"https://codeload.github.com/emalherbi/MyMssql/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":242873751,"owners_count":20199294,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["mssql","php","sqlserver","sqlsrv"],"created_at":"2024-11-16T20:10:57.367Z","updated_at":"2026-05-16T17:11:36.161Z","avatar_url":"https://github.com/emalherbi.png","language":"PHP","funding_links":[],"categories":[],"sub_categories":[],"readme":"# MyMssql\n\nMy Mssql PDO (MSSQL or SQLSRV)\n\n# Install\n\n```\ncomposer require emalherbi/mymssql\n```\n\n# Usage\n\n```php\nrequire_once 'vendor/autoload.php';\n\ntry {\n    $mssql = new MyMssql\\MyMssql(array(\n        'VERBOSE' =\u003e true,\n        'ADAPTER' =\u003e 'SQLSRV', // or MSSQL\n        'HOSTNAME' =\u003e '192.168.1.100', // or 192.168.1.100\\\\SQL2016\n        'USERNAME' =\u003e 'USERNAME',\n        'PASSWORD' =\u003e 'PASSWORD',\n        'DATABASE' =\u003e 'DATABASE',\n    ), realpath(dirname(__FILE__)), 'UTF-8'); // Ex.: ISO-8859-1\n\n    $mssql-\u003econnect();\n\n    $mssql-\u003edisconnect();\n\n    $result = $mssql-\u003egetAdapter();\n    echo '\u003cpre\u003e';\n    echo print_r($result);\n    echo '\u003c/pre\u003e';\n\n    $result = $mssql-\u003egetIni();\n    echo '\u003cpre\u003e';\n    echo print_r($result);\n    echo '\u003c/pre\u003e';\n\n    $result = $mssql-\u003eisConnect();\n    echo '\u003cpre\u003e';\n    echo print_r($result);\n    echo '\u003c/pre\u003e';\n\n    $result = $mssql-\u003efetchOne('SELECT * FROM CLIENTES');\n    echo '\u003cpre\u003e';\n    echo print_r($result);\n    echo '\u003c/pre\u003e';\n\n    $result = $mssql-\u003efetchRow('SELECT * FROM CLIENTES');\n    echo '\u003cpre\u003e';\n    echo print_r($result);\n    echo '\u003c/pre\u003e';\n\n    $result = $mssql-\u003efetchAll('SELECT TOP 5 * FROM CLIENTES');\n    echo '\u003cpre\u003e';\n    echo print_r($result);\n    echo '\u003c/pre\u003e';\n\n    $result = $mssql-\u003eexec('UPDATE CLIENTES SET NOME = \\'TESTE 123\\' WHERE ID_CLIENTE = 450');\n    echo '\u003cpre\u003e';\n    echo print_r($result);\n    echo '\u003c/pre\u003e';\n\n    // OR\n\n    $result = $mssql-\u003eexecSql('UPDATE CLIENTES SET NOME = \\'TESTE 123\\' WHERE ID_CLIENTE = 450');\n    echo '\u003cpre\u003e';\n    echo print_r($result);\n    echo '\u003c/pre\u003e';\n\n    $mssql-\u003ebegin();\n\n    $result = $mssql-\u003eexec('UPDATE CLIENTES SET NOME = \\'TESTE 456\\' WHERE ID_CLIENTE = 450');\n    echo '\u003cpre\u003e';\n    echo print_r($result);\n    echo '\u003c/pre\u003e';\n\n    $mssql-\u003ecommit();\n\n    $sxName = 'SX_CLIENTES';\n    $params = array(1, 385);\n    $result = $mssql-\u003efetchRowSx($sxName, $params);\n    echo '\u003cpre\u003e';\n    echo print_r($result);\n    echo '\u003c/pre\u003e';\n\n    $sxName = 'SX_CLIENTES';\n    $params = array(2, 385);\n    $result = $mssql-\u003efetchAllSx($sxName, $params);\n    echo '\u003cpre\u003e';\n    echo print_r($result);\n    echo '\u003c/pre\u003e';\n\n    $sxName = 'SX_CLIENTES_SAVE';\n    $params = array(2, '2017-01-01', 385, 0, 0, 0, 0);\n    $result = $mssql-\u003eexecSx($sxName, $params);\n    echo '\u003cpre\u003e';\n    echo print_r($result);\n    echo '\u003c/pre\u003e';\n\n    $result = $mssql-\u003eexec(\"IF OBJECT_ID('USUARIOS') IS NULL\n        BEGIN\n            CREATE TABLE [dbo].[USUARIOS]\n            (\n                [ID_USUARIOS] [INT] IDENTITY(1,1) NOT NULL,\n                [NOME] VARCHAR(100) NOT NULL,\n                PRIMARY KEY CLUSTERED\n            ([ID_USUARIOS] ASC) WITH (PAD_INDEX  = OFF, STATISTICS_NORECOMPUTE  = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS  = ON, ALLOW_PAGE_LOCKS  = ON) ON [PRIMARY]\n            ) ON [PRIMARY]\n        END\");\n    echo '\u003cpre\u003e';\n    echo print_r($result);\n    echo '\u003c/pre\u003e';\n\n    $sql = \" BEGIN DECLARE @REF INT SET @REF = NULL EXEC SX_TESTE @REF OUTPUT SELECT @REF AS REF END \";\n    $result = $mssql-\u003eexecScript($sql);\n    echo '\u003cpre\u003e';\n    echo print_r($result);\n    echo '\u003c/pre\u003e';\n\n    $sql = \" BEGIN DECLARE @REF INT SET @REF = NULL EXEC SX_TESTE @REF OUTPUT SELECT @REF AS REF END \";\n    $isObject = false; // Array or Object Result\n    $result = $mssql-\u003eexecScriptResult($sql, $isObject);\n    echo '\u003cpre\u003e';\n    echo print_r($result);\n    echo '\u003c/pre\u003e';\n\n    echo 'Success...';\n} catch (Exception $e) {\n    $mssql-\u003erollback();\n\n    die(print_r($e-\u003egetMessage()));\n}\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Femalherbi%2Fmymssql","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Femalherbi%2Fmymssql","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Femalherbi%2Fmymssql/lists"}