sqlx
sqlx copied to clipboard
Questions about MS SQL connector
After adding support for DateTime2 types, I thought I'd give implementing packet chunking for the MS SQL connector a go. I'm a total noob when it comes to the TDS protocol, so there's two things that caught my attention:
-
When I ran a query through IntelliJ's DB console and captured it in Wireshark, I saw that it sends chunked
SQLBatchpackets. But when running a query through sqlx, it generates "Remote Procedure Call" packets. At first I thought that this is only because I was using a named parameter in my query - but when I got rid of that, it was still returningSome(arguments)from that query, wherein there was only a single, 0-length argument? The issue is that I unfortunately (:see_no_evil:) have to run a very long query and when using RPC instead of SQLBatch, I run into a fixed 8000-character limit for NVarChar arguments so RPC seems to be out of the question. -
I noticed that every call to
MssqlStream#write_packetwas always accompanied by a follow-up call toMssqlStream#flush- except inTransactionManager#start_rollbackwhich only writes to the buffer but doesn't seem to have any correspondingflush()call. This is understandable in that it's referred to from theDropimplementation ofTransaction, which is (infamously) unable to run async code. But it's not clear to me where this buffer would be flushed as theDroptrait for either the connection, stream orBufWriterseem to have any corresponding functionality at first glance.
Any explanation and additional pointers on the subject or on what would need to be done to support very long queries in addition to packet chunking would be appreciated.