Conversation
cfe56a4 to
730a621
Compare
There was a problem hiding this comment.
SQLDriverConnect implementation
There was a problem hiding this comment.
Can you check if disconnect() does proper clean-up of the connection? It should closes and drop statements on the connection and end any transactions.
There was a problem hiding this comment.
Yes, disconnect() doesn't close statements directly, but the destructor of all ODBCStatement objects from to the connection will be called after the m_statements.clear(); line. m_statements should contain all statements/transactions.
The implementation:
void ODBCConnection::disconnect() {
if (m_isConnected) {
// Ensure that all statements (and corresponding SPI statements) get cleaned
// up before terminating the SPI connection in case they need to be de-allocated in
// the reverse of the allocation order.
m_statements.clear();
m_spiConnection->Close();
m_isConnected = false;
}
}
...src/arrow/flight/sql/odbc/odbcabstraction/include/odbcabstraction/odbc_impl/encoding_utils.h
Outdated
Show resolved
Hide resolved
...src/arrow/flight/sql/odbc/odbcabstraction/include/odbcabstraction/odbc_impl/encoding_utils.h
Outdated
Show resolved
Hide resolved
...src/arrow/flight/sql/odbc/odbcabstraction/include/odbcabstraction/odbc_impl/encoding_utils.h
Outdated
Show resolved
Hide resolved
...src/arrow/flight/sql/odbc/odbcabstraction/include/odbcabstraction/odbc_impl/encoding_utils.h
Outdated
Show resolved
Hide resolved
...rc/arrow/flight/sql/odbc/odbcabstraction/include/odbcabstraction/odbc_impl/odbc_connection.h
Outdated
Show resolved
Hide resolved
...rc/arrow/flight/sql/odbc/odbcabstraction/include/odbcabstraction/odbc_impl/odbc_connection.h
Outdated
Show resolved
Hide resolved
There was a problem hiding this comment.
This should prompt the dialog based on the driverCompletion variable. Maybe leave integrating the actual dialog to a separate PR but setup the infrastructure and leave TODOs here.
ccea21f to
a2c2cb5
Compare
There was a problem hiding this comment.
Fixed an issue where ExecuteWithDiagnostics attempts to get diagnostics from conn after conn is freed, and results in a seg fault error.
a2c2cb5 to
5dbdcbe
Compare
00d2e3a to
4fd1fe8
Compare
cpp/src/arrow/flight/sql/odbc/flight_sql/config/configuration.cc
Outdated
Show resolved
Hide resolved
There was a problem hiding this comment.
Catch as const DriverException& if possible
There was a problem hiding this comment.
added const, since this is the only usage of DriverException in the file, I will leave the prefix driver::odbcabstraction as is
There was a problem hiding this comment.
Micro-optimization. Add a move-version of config.Set() (eg Set(const std::string& key, std::string&& value)) and call it Emplace(). Then use config.Emplace(key, std::move(value)) to avoid copying.
There was a problem hiding this comment.
Added Emplace and switched to use it
There was a problem hiding this comment.
Can you check if disconnect() does proper clean-up of the connection? It should closes and drop statements on the connection and end any transactions.
There was a problem hiding this comment.
This might need to be conditional based on driver manager. Also, this can be a string_view (and GetStringAttribute should probably be reworked to take in string_views?)
There was a problem hiding this comment.
I can use string_view here but will just keep using 3.80 as it works
There was a problem hiding this comment.
Updated code to make GetStringAttribute take string_views
eb16ca1 to
9672af8
Compare
cpp/src/arrow/flight/sql/odbc/flight_sql/config/configuration.cc
Outdated
Show resolved
Hide resolved
There was a problem hiding this comment.
added const, since this is the only usage of DriverException in the file, I will leave the prefix driver::odbcabstraction as is
There was a problem hiding this comment.
Added Emplace and switched to use it
There was a problem hiding this comment.
Yes, disconnect() doesn't close statements directly, but the destructor of all ODBCStatement objects from to the connection will be called after the m_statements.clear(); line. m_statements should contain all statements/transactions.
The implementation:
void ODBCConnection::disconnect() {
if (m_isConnected) {
// Ensure that all statements (and corresponding SPI statements) get cleaned
// up before terminating the SPI connection in case they need to be de-allocated in
// the reverse of the allocation order.
m_statements.clear();
m_spiConnection->Close();
m_isConnected = false;
}
}
There was a problem hiding this comment.
Updated code to make GetStringAttribute take string_views
There was a problem hiding this comment.
copy holds a copy of the value, we still need to construct a std::string copy for key
There was a problem hiding this comment.
Use properties.emplace(std::move(copy), value))
There was a problem hiding this comment.
I misunderstood usage of emplace before, I have fixed this now. In SQLConnect, uid and pwd specified in DSN will take precedence
a7d8803 to
ef337f6
Compare
There was a problem hiding this comment.
Shouldn't we be using the execute with diagnostics wrapper here?
There was a problem hiding this comment.
There was a bug that I ran into and had to remove the wrapper. The issue is that ExecuteWithDiagnostics calls GetDiagnostics().HasError() at the end of lambda function execution, and it will assume that conn is still a valid pointer. But GetDiagnostics() will fail because conn has been destructed. I didn't find any exceptions to be thrown inside releaseConnection call so it should be ok
ab159f4 to
2779187
Compare
There was a problem hiding this comment.
Minor nit picking, but might be clearer to be passing in connection pointer instead of conn, even thought is pointing to same data.
There was a problem hiding this comment.
Good catch, I have moved the connection pointer creation code to be inside the ExecuteWithDiagnostics call so conn can still be passed
Implement stubs for SQLGetInfo, SQLGetDiagField and SQLGetDiagRec Separate RegisterDsn and UnregisterDsn from windows build Update code to save driver value from connection string Add ReadMes for ODBC and tests Fix test issues with string_view Address code reviews Update entry_points.cc to fix build issue Remove Dremio references Use emplace properly Address comment from Rob and add SQLDisconnect test case
c98f368 to
ce4a14e
Compare
|
All comments have been addressed. |
Implements SQLDriverConnect