{"_id":"@aux4/db-mssql","_rev":"2-92402373f866124e62c949c19fca4bae","name":"@aux4/db-mssql","dist-tags":{"latest":"1.0.3"},"versions":{"1.0.1":{"name":"@aux4/db-mssql","version":"1.0.1","keywords":["aux4","database","cli","mssql"],"author":{"name":"Aux4"},"license":"Apache-2.0","_id":"@aux4/db-mssql@1.0.1","maintainers":[{"name":"aux4-dev","email":"contact@aux4.io"}],"homepage":"https://github.com/aux4/db-mssql#readme","bugs":{"url":"https://github.com/aux4/db-mssql/issues"},"dist":{"shasum":"734bca7ed2791a8d02c7b56a482ccdbb37f2a7dc","tarball":"https://registry.npmjs.org/@aux4/db-mssql/-/db-mssql-1.0.1.tgz","fileCount":4,"integrity":"sha512-A6T/zPTg/jbJCX5xONeGPg0DmZbaES2g1P9Y4hxXclrOMbpDhKvWxvnI+fCYHvy9Firb6I0x9Uhca/oQ9+ErHw==","signatures":[{"sig":"MEUCIEUogDZrMvWSTSQ0eKSRHWnVJhlmvWsT8vQNjTo0arbAAiEAimXEu1dVifEU7x8V4t9ak/xBoBN3AsROoGtQks9onvI=","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":15152},"main":"index.js","gitHead":"4f9fb3843f9b4cab8a7fb7f36ff2c10eb33a9722","scripts":{"test":"jest"},"_npmUser":{"name":"aux4-dev","email":"contact@aux4.io"},"repository":{"url":"git+ssh://git@github.com/aux4/db-mssql.git","type":"git"},"_npmVersion":"8.19.4","description":"Database CLI for MSSQL","directories":{},"_nodeVersion":"16.20.0","dependencies":{"merge":"^2.1.1","mssql":"^9.1.1"},"_hasShrinkwrap":false,"_npmOperationalInternal":{"tmp":"tmp/db-mssql_1.0.1_1687228930757_0.03257105488366108","host":"s3://npm-registry-packages"}},"1.0.3":{"name":"@aux4/db-mssql","version":"1.0.3","description":"Database CLI for MSSQL","main":"index.js","scripts":{"test":"jest"},"repository":{"type":"git","url":"git+ssh://git@github.com/aux4/db-mssql.git"},"keywords":["aux4","database","cli","mssql"],"author":{"name":"Aux4"},"license":"Apache-2.0","bugs":{"url":"https://github.com/aux4/db-mssql/issues"},"homepage":"https://github.com/aux4/db-mssql#readme","dependencies":{"merge":"^2.1.1","mssql":"^11.0.1"},"_id":"@aux4/db-mssql@1.0.3","gitHead":"00218f069d07396ccab963af356702d09b19bd4a","_nodeVersion":"20.10.0","_npmVersion":"10.9.2","dist":{"integrity":"sha512-yDGWnaaC9FtileYXScx3WsWaiP0Vnb5zFMjlDV3eelZ4sRgY/sBLgxzBUcwAom6wsbOCINS7y4ZZZNnz8UI+Fg==","shasum":"00a1fa5dad09b67a71c93f72dba06272fa5d11c7","tarball":"https://registry.npmjs.org/@aux4/db-mssql/-/db-mssql-1.0.3.tgz","fileCount":4,"unpackedSize":15153,"signatures":[{"keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U","sig":"MEYCIQDg2Y25JILlQF6rCMoH0JkCch3AsZN8WSK72uHDb/uJfgIhAIbO7EGaeGL4b4ZiGAjBCkTFdsc8sRwdT/K5Bd/9bv1J"}]},"_npmUser":{"name":"aux4-dev","email":"contact@aux4.io"},"directories":{},"maintainers":[{"name":"aux4-dev","email":"contact@aux4.io"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages-npm-production","tmp":"tmp/db-mssql_1.0.3_1743531564528_0.3658196032920753"},"_hasShrinkwrap":false}},"time":{"created":"2023-06-20T02:42:10.651Z","modified":"2025-04-01T18:19:24.867Z","1.0.1":"2023-06-20T02:42:10.912Z","1.0.3":"2025-04-01T18:19:24.698Z"},"bugs":{"url":"https://github.com/aux4/db-mssql/issues"},"author":{"name":"Aux4"},"license":"Apache-2.0","homepage":"https://github.com/aux4/db-mssql#readme","keywords":["aux4","database","cli","mssql"],"repository":{"type":"git","url":"git+ssh://git@github.com/aux4/db-mssql.git"},"description":"Database CLI for MSSQL","maintainers":[{"name":"aux4-dev","email":"contact@aux4.io"}],"readme":"# @aux4/db-mssql\n\n## JavaScript\n\n### Install\n\n```bash\n$ npm install @aux4/db-mssql\n```\n\n### Execute Query\n\n```javascript\nconst Database = require(\"@aux4/db-mssql\");\nconst db = new Database({\n  host: \"localhost\",\n  user: \"sa\",\n  password: \"******\",\n  database: \"master\"\n});\n\n(async () => {\n  await db.open();\n  const { data } = await db.execute(\"select * from table where id = @id\", { id: 1 });\n  console.log(JSON.stringify(data, null, 2));\n  await db.close();\n})();\n```\n\n### Query Stream\n\n```javascript\nconst Database = require(\"@aux4/db-mssql\");\nconst db = new Database({\n  host: \"localhost\",\n  user: \"sa\",\n  password: \"******\",\n  database: \"master\"\n});\n\nconst stream = await db.stream(\"select * from table where id = @id\", { id: 1 });\n\nstream.on(\"data\", row => {\nconsole.log(JSON.stringify(row, null, 2));\n});\n\nstream.on(\"error\", err => {\nconsole.error(err.message);\n});\n\nstream.on(\"close\", async () => {\nawait db.close();\n});\n```\n\n## Command Line\n\n### Install\n\n```bash\n$ npm install --global @aux4/db\n$ npm install --global @aux4/db-mssql\n```\n\n### Usage\n\n#### Execute Query\n\n```bash\n$ db execute --host localhost --port 1434 --user sa --database master --query \"select * from table where id = @id\" --id 1\n```\n\n#### Stream Query\n\n```bash\n$ db stream --host localhost --port 1434 --user sa --database master --query \"select * from table where id = @id\" --id 1\n```\n\n#### Using @aux4/config\n\ncreate `config.yaml`\n\n```yaml\nconfig:\n  dev:\n    mssql:\n      host: localhost\n      port: 1434\n      user: sa\n      password: \"******\"\n      database: master\n```\n\n```bash\n$ db execute --configFile config.yaml --config dev/mssql --query \"select * from table where id = @id\" --id 1\n```\n\n## See Also\n\n* aux4 [website](https://aux4.io) / [npm](https://www.npmjs.com/package/aux4) / [GitHub](https://github.com/aux4/aux4)\n* @aux4/config [npm](https://www.npmjs.com/package/@aux4/config) / [GitHub](https://github.com/aux4/config)\n* @aux4/db [npm](https://www.npmjs.com/package/@aux4/db) / [GitHub](https://github.com/aux4/db)","readmeFilename":"README.md"}