You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
#### AI description (iteration 1)
#### PR Classification
New feature
#### PR Summary
This pull request adds new connection properties to the `Connection` class and updates the `connect` function to support these properties.
- `mssql_python/connection.py`: Added new parameters to the `Connection` class constructor and implemented methods to handle these parameters.
- `mssql_python/db_connection.py`: Updated the `connect` function to accept and pass new connection parameters.
- `mssql_python/constants.py`: Added new ODBC constants for connection attributes.
- `README.md`: Removed outdated build status badges.
Related work items: #33534
Copy file name to clipboardExpand all lines: README.md
+1-1Lines changed: 1 addition & 1 deletion
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -1,6 +1,6 @@
1
1
# MSSQL-Python
2
2
3
-
This repository contains the source code for the MSSQL-Python project, which provides Python bindings for the Microsoft SQL Server ODBC driver using `pybind11`. The project includes a C++ extension module that wraps the ODBC API and exposes it to Python, allowing for efficient database interactions.
3
+
This repository contains the source code for the MSSQL-Python project, which provides Python bindings for the Microsoft SQL Server driver using `pybind11`. The project includes a C++ extension module that wraps the DDBC API and exposes it to Python, allowing for efficient database interactions.
assert"Server=localhost;"inconn_str, "Connection string should contain 'Server=localhost;'"
38
+
assert"Uid=me;"inconn_str, "Connection string should contain 'Uid=me;'"
39
+
assert"Pwd=mypwd;"inconn_str, "Connection string should contain 'Pwd=mypwd;'"
40
+
assert"Database=mydb;"inconn_str, "Connection string should contain 'Database=mydb;'"
41
+
assert"Encrypt=yes;"inconn_str, "Connection string should contain 'Encrypt=yes;'"
42
+
assert"TrustServerCertificate=yes;"inconn_str, "Connection string should contain 'TrustServerCertificate=yes;'"
43
+
assert"APP=MSSQL-Python"inconn_str, "Connection string should contain 'APP=MSSQL-Python'"
44
+
assert"Driver={ODBC Driver 18 for SQL Server}"inconn_str, "Connection string should contain 'Driver={ODBC Driver 18 for SQL Server}'"
45
+
assert"Driver={ODBC Driver 18 for SQL Server};;APP=MSSQL-Python;Server=localhost;Uid=me;Pwd=mypwd;Database=mydb;Encrypt=yes;TrustServerCertificate=yes;"==conn_str, "Connection string is incorrect"
46
+
33
47
deftest_autocommit_default(db_connection):
34
48
assertdb_connection.autocommitisTrue, "Autocommit should be True by default"
35
49
36
-
# def test_autocommit_property(db_connection):
37
-
# db_connection.autocommit = True
38
-
# assert db_connection.autocommit is True, "Autocommit should be True"
39
-
# # Create a new cursor to check if the autocommit property is set in the server
40
-
# cursor = db_connection.cursor()
41
-
# cursor.execute("DBCC USEROPTIONS;")
42
-
# result = cursor.fetchall()
43
-
# implicit_transactions_status = any(option[0] == 'implicit_transactions' and option[1] == 'SET' for option in result)
44
-
# assert not implicit_transactions_status, "Autocommit failed: Implicit transactions should be off"
45
-
46
-
# db_connection.autocommit = False
47
-
# assert db_connection.autocommit is False, "Autocommit should be False"
48
-
# cursor.execute("DBCC USEROPTIONS;")
49
-
# result = cursor.fetchall()
50
-
# implicit_transactions_status = any(option[0] == 'implicit_transactions' and option[1] == 'SET' for option in result)
51
-
# assert implicit_transactions_status, "Autocommit failed: Implicit transactions should be on"
50
+
deftest_autocommit_setter(db_connection):
51
+
db_connection.autocommit=True
52
+
cursor=db_connection.cursor()
53
+
# Make a transaction and check if it is autocommited
0 commit comments