diff --git a/LICENSE b/LICENSE new file mode 100644 index 0000000..9c7d8d0 --- /dev/null +++ b/LICENSE @@ -0,0 +1,14 @@ +Copyright 2012 Microsoft Corporation + +Licensed under the Apache License, Version 2.0 (the "License"); you +may not use this file except in compliance with the License. You may +obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or +implied. See the License for the specific language governing +permissions and limitations under the License. + diff --git a/LICENSE.txt b/LICENSE.txt deleted file mode 100644 index 7777e50..0000000 --- a/LICENSE.txt +++ /dev/null @@ -1,9 +0,0 @@ -Copyright 2011 Microsoft Corporation - -Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - -Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and -limitations under the License. - diff --git a/README b/README deleted file mode 100644 index 42b1c7d..0000000 --- a/README +++ /dev/null @@ -1,27 +0,0 @@ -Microsoft Driver for Node.js for SQL Server - -To build and use the Microsoft Driver for Node.js for SQL Server, you -will need to: - -1) Install node-gyp. - npm install -g node-gyp - -2) Configure project from the root of node-sqlserver. - node-gyp configure - -3) (If using Visual C++ Express 2010) convert sqlserver.sln to - VC2010. - The default VC2008 projects generated by node-gyp will not - compile with Visual Studio Express because of a missing stdint.h - -4) Build using node-gyp, Visual Studio or msbuild. - node-gyp build or msbuild /p:Configuration=Debug|Release - -5) Copy the sqlserver.node file over to the lib directory. - sqlserver.node will be in build/ (Debug - or Release) directory. - -You can test the build by running the tests as such: - -cd tests -node runtests.js diff --git a/README.md b/README.md new file mode 100644 index 0000000..0d7d7a1 --- /dev/null +++ b/README.md @@ -0,0 +1,78 @@ +# Microsoft Driver for Node.js for SQL Server + +The Microsoft Driver for Node.js for SQL Server allows Node.js applications on +Microsoft Windows and Microsoft Windows Azure to access Microsoft SQL Server +and Microsoft Windows Azure SQL Database. + +This is an initial preview release, and is not production ready. We welcome any +feedback, fixes and contributions from the community at this very early stage. + +## Prerequisites + +The following prerequisites are necessary prior to using the driver: + +* Node.js - use the latest version if possible, but it has been tested on node +0.6.10 and later + +* node-gyp - latest version installed globally (npm install -g node-gyp) + +* python 2.7.x - for node-gyp (make sure it is in the path) + +* Visual C++ 2010 - the Express edition is freely available from +[Microsoft][visualstudio] + +* SQL Server Native Client 11.0 - available as Microsoft SQL Server 2012 +Native Client found in the [SQL Server 2012 Feature Pack][sqlncli] + +## Build + +To build the driver, first node-gyp must configure the appropriate build files. + + node-gyp configure + +Use node-gyp to build the driver: + + node-gyp build + +Or to build the debug version: + + node-gyp build --debug + +Then copy the sqlserver.node file from the build\\(Release|Debug) directory to +the lib directory. If you would like to use Visual C++ to debug the driver, +also copy the sqlserver.pdb file from the same directory. + +## Test + +Included are a few unit tests. They require mocha, async, and assert to be +installed via npm. Also, set the variables in test-config.js, then run the +tests as follows: + + cd test + node runtests.js + +## Known Issues + +We are aware that many features are still not implemented, and are working to +update these. Please visit the [project on Github][project] to view +outstanding [issues][issues]. + +## Usage + +For now, please see the unit tests for usage examples. + +## License + +The Microsoft Driver for Node.js for SQL Server is licensed under the Apache +2.0 license. See the LICENSE file for more details. + +[visualstudio]: http://www.microsoft.com/visualstudio/ + +[sqlncli]: http://www.microsoft.com/en-us/download/details.aspx?id=29065 + +[project]: https://github.com/windowsazure/node-sqlserver + +[issues]: https://github.com/windowsazure/node-sqlserver/issues + + + diff --git a/lib/sql.js b/lib/sql.js index 4e6ecbd..3f9731c 100644 --- a/lib/sql.js +++ b/lib/sql.js @@ -1,3 +1,22 @@ +//--------------------------------------------------------------------------------------------------------------------------------- +// File: sql.js +// Contents: javascript interface to Microsoft Driver for Node.js for SQL Server +// +// Copyright Microsoft Corporation +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// +// You may obtain a copy of the License at: +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +//--------------------------------------------------------------------------------------------------------------------------------- + var sql = require('./sqlserver.node'); var events = require('events'); var util = require('util'); diff --git a/src/Column.h b/src/Column.h index ec2830b..1bfafb1 100644 --- a/src/Column.h +++ b/src/Column.h @@ -1,3 +1,21 @@ +//--------------------------------------------------------------------------------------------------------------------------------- +// File: Column.h +// Contents: Column objects from SQL Server to return as Javascript types +// +// Copyright Microsoft Corporation +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// +// You may obtain a copy of the License at: +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +//--------------------------------------------------------------------------------------------------------------------------------- #pragma once diff --git a/src/Connection.cpp b/src/Connection.cpp index 7b398b1..642964c 100644 --- a/src/Connection.cpp +++ b/src/Connection.cpp @@ -1,3 +1,21 @@ +//--------------------------------------------------------------------------------------------------------------------------------- +// File: Connection.cpp +// Contents: C++ interface to Microsoft Driver for Node.js for SQL Server +// +// Copyright Microsoft Corporation +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// +// You may obtain a copy of the License at: +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +//--------------------------------------------------------------------------------------------------------------------------------- #include "stdafx.h" #include "Connection.h" diff --git a/src/Connection.h b/src/Connection.h index 03fdbe6..633070a 100644 --- a/src/Connection.h +++ b/src/Connection.h @@ -1,3 +1,22 @@ +//--------------------------------------------------------------------------------------------------------------------------------- +// File: Connection.h +// Contents: C++ interface to Microsoft Driver for Node.js for SQL Server +// +// Copyright Microsoft Corporation +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// +// You may obtain a copy of the License at: +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +//--------------------------------------------------------------------------------------------------------------------------------- + #pragma once #include "OdbcConnectionBridge.h" diff --git a/src/OdbcConnection.cpp b/src/OdbcConnection.cpp index e098e7d..0f0b3d1 100644 --- a/src/OdbcConnection.cpp +++ b/src/OdbcConnection.cpp @@ -1,3 +1,21 @@ +//--------------------------------------------------------------------------------------------------------------------------------- +// File: OdbcConnection.cpp +// Contents: Async calls to ODBC done in background thread +// +// Copyright Microsoft Corporation +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// +// You may obtain a copy of the License at: +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +//--------------------------------------------------------------------------------------------------------------------------------- #include "stdafx.h" #include "OdbcConnection.h" diff --git a/src/OdbcConnection.h b/src/OdbcConnection.h index 78fb8ac..1018959 100644 --- a/src/OdbcConnection.h +++ b/src/OdbcConnection.h @@ -1,3 +1,21 @@ +//--------------------------------------------------------------------------------------------------------------------------------- +// File: OdbcConnection.h +// Contents: Async calls to ODBC done in background thread +// +// Copyright Microsoft Corporation +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// +// You may obtain a copy of the License at: +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +//--------------------------------------------------------------------------------------------------------------------------------- #pragma once diff --git a/src/OdbcConnectionBridge.h b/src/OdbcConnectionBridge.h index d383d41..4abb776 100644 --- a/src/OdbcConnectionBridge.h +++ b/src/OdbcConnectionBridge.h @@ -1,3 +1,22 @@ +//--------------------------------------------------------------------------------------------------------------------------------- +// File: OdbcConnectionBridge.h +// Contents: Create (bridge) operations to be completed on background thread queue +// +// Copyright Microsoft Corporation +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// +// You may obtain a copy of the License at: +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +//--------------------------------------------------------------------------------------------------------------------------------- + #pragma once #include "Operation.h" diff --git a/src/OdbcException.cpp b/src/OdbcException.cpp index 8361b35..897a297 100644 --- a/src/OdbcException.cpp +++ b/src/OdbcException.cpp @@ -1,3 +1,21 @@ +//--------------------------------------------------------------------------------------------------------------------------------- +// File: OdbcException.cpp +// Contents: Create exception from ODBC error(s) +// +// Copyright Microsoft Corporation +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// +// You may obtain a copy of the License at: +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +//--------------------------------------------------------------------------------------------------------------------------------- #include "stdafx.h" #include "OdbcException.h" diff --git a/src/OdbcException.h b/src/OdbcException.h index b7d15e7..7cb6692 100644 --- a/src/OdbcException.h +++ b/src/OdbcException.h @@ -1,3 +1,21 @@ +//--------------------------------------------------------------------------------------------------------------------------------- +// File: OdbcException.h +// Contents: Exception created from ODBC error(s) +// +// Copyright Microsoft Corporation +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// +// You may obtain a copy of the License at: +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +//--------------------------------------------------------------------------------------------------------------------------------- #pragma once diff --git a/src/OdbcHandle.h b/src/OdbcHandle.h index ce9ede8..3a0bb7e 100644 --- a/src/OdbcHandle.h +++ b/src/OdbcHandle.h @@ -1,3 +1,21 @@ +//--------------------------------------------------------------------------------------------------------------------------------- +// File: OdbcHandle.h +// Contents: Object to manage ODBC handles +// +// Copyright Microsoft Corporation +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// +// You may obtain a copy of the License at: +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +//--------------------------------------------------------------------------------------------------------------------------------- #pragma once diff --git a/src/OdbcOperation.cpp b/src/OdbcOperation.cpp index 919fb95..a0621b0 100644 --- a/src/OdbcOperation.cpp +++ b/src/OdbcOperation.cpp @@ -1,3 +1,21 @@ +//--------------------------------------------------------------------------------------------------------------------------------- +// File: OdbcOperation.cpp +// Contents: Functions called by thread queue for background ODBC operations +// +// Copyright Microsoft Corporation +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// +// You may obtain a copy of the License at: +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +//--------------------------------------------------------------------------------------------------------------------------------- #include "stdafx.h" #include "OdbcOperation.h" diff --git a/src/OdbcOperation.h b/src/OdbcOperation.h index 57c0a2a..96f32f9 100644 --- a/src/OdbcOperation.h +++ b/src/OdbcOperation.h @@ -1,3 +1,22 @@ +//--------------------------------------------------------------------------------------------------------------------------------- +// File: OdbcOperation.h +// Contents: ODBC Operation objects called on background thread +// +// Copyright Microsoft Corporation +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// +// You may obtain a copy of the License at: +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +//--------------------------------------------------------------------------------------------------------------------------------- + #pragma once #include "Operation.h" diff --git a/src/Operation.h b/src/Operation.h index 2068a35..7006786 100644 --- a/src/Operation.h +++ b/src/Operation.h @@ -1,3 +1,21 @@ +//--------------------------------------------------------------------------------------------------------------------------------- +// File: Operation.h +// Contents: Queue calls to ODBC on background thread +// +// Copyright Microsoft Corporation +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// +// You may obtain a copy of the License at: +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +//--------------------------------------------------------------------------------------------------------------------------------- #pragma once diff --git a/src/ResultSet.cpp b/src/ResultSet.cpp index b28dc48..65ce200 100644 --- a/src/ResultSet.cpp +++ b/src/ResultSet.cpp @@ -1,3 +1,21 @@ +//--------------------------------------------------------------------------------------------------------------------------------- +// File: ResultSet.cpp +// Contents: ResultSet object that holds metadata and current column to return to Javascript +// +// Copyright Microsoft Corporation +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// +// You may obtain a copy of the License at: +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +//--------------------------------------------------------------------------------------------------------------------------------- #include "stdafx.h" #include "ResultSet.h" diff --git a/src/ResultSet.h b/src/ResultSet.h index ad37255..9605960 100644 --- a/src/ResultSet.h +++ b/src/ResultSet.h @@ -1,3 +1,21 @@ +//--------------------------------------------------------------------------------------------------------------------------------- +// File: ResultSet.h +// Contents: ResultSet object that holds metadata and current column to return to Javascript +// +// Copyright Microsoft Corporation +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// +// You may obtain a copy of the License at: +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +//--------------------------------------------------------------------------------------------------------------------------------- #pragma once diff --git a/src/Utility.cpp b/src/Utility.cpp index cd53c9c..428a691 100644 --- a/src/Utility.cpp +++ b/src/Utility.cpp @@ -1,3 +1,22 @@ +//--------------------------------------------------------------------------------------------------------------------------------- +// File: Utility.cpp +// Contents: Utility functions used in Microsoft Driver for Node.js for SQL Server +// +// Copyright Microsoft Corporation +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// +// You may obtain a copy of the License at: +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +//--------------------------------------------------------------------------------------------------------------------------------- + #include "stdafx.h" namespace mssql diff --git a/src/Utility.h b/src/Utility.h index 113ec9e..b3f9cde 100644 --- a/src/Utility.h +++ b/src/Utility.h @@ -1,3 +1,21 @@ +//--------------------------------------------------------------------------------------------------------------------------------- +// File: Utility.h +// Contents: Utility functions used in Microsoft Driver for Node.js for SQL Server +// +// Copyright Microsoft Corporation +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// +// You may obtain a copy of the License at: +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +//--------------------------------------------------------------------------------------------------------------------------------- #pragma once #include diff --git a/src/stdafx.cpp b/src/stdafx.cpp index 0fb604d..0d681c1 100644 --- a/src/stdafx.cpp +++ b/src/stdafx.cpp @@ -1,2 +1,20 @@ +//--------------------------------------------------------------------------------------------------------------------------------- +// File: sfdafx.cpp +// Contents: Precompiled Header +// +// Copyright Microsoft Corporation +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// +// You may obtain a copy of the License at: +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +//--------------------------------------------------------------------------------------------------------------------------------- #include "stdafx.h" \ No newline at end of file diff --git a/src/stdafx.h b/src/stdafx.h index cd77ab7..c85b145 100644 --- a/src/stdafx.h +++ b/src/stdafx.h @@ -1,3 +1,21 @@ +//--------------------------------------------------------------------------------------------------------------------------------- +// File: stdafx.h +// Contents: Precompiled header +// +// Copyright Microsoft Corporation +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// +// You may obtain a copy of the License at: +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +//--------------------------------------------------------------------------------------------------------------------------------- #pragma once