DataAction / AdoNetCore.AseClient

AdoNetCore.AseClient - a .NET Core DB Provider for SAP ASE
Apache License 2.0
108 stars 45 forks source link

Implement prepared statements #8

Closed c-j-hughes closed 6 years ago

c-j-hughes commented 6 years ago

The IDbCommand and DbCommand types define a method Prepare that implementers are required to implement.

The intention is that this command instructs the server to compile the query so that repeated executions are faster.

Our current implementation is a no-op. We should consider implementing this.

senseibaka commented 6 years ago

TDS_DYNAMIC and TDS_DYNAMIC2 tokens appear to be what we'd use to prepare/execute prepared statements.

According to the TDS spec, prepared statements have a lifetime of the current client session

senseibaka commented 6 years ago

I implemented Prepare(), but then discovered that the server responds with

Dynamic SQL error - Prepared statement '1' does not exist.

So, I looked to what tokens the .net 4 driver was sending, and discovered that it's not actually preparing the statement at all --rather it just sends a language token (regular token for executing sql) every time we tell the command to execute.

So, I'll park this issue for now. Changes can be located on the prepared-statements branch if anyone wants to take a crack at it.