minus5 / gofreetds

Go Sql Server database driver.
MIT License
113 stars 48 forks source link

Handling allowances for Sybase ASE 12.5 #65

Closed remote-coder closed 6 years ago

remote-coder commented 6 years ago

Handling allowances for Sybase ASE 12.5 when functioning as a driver via sql/sqlx

Using dsn argument Compatibility Mode=Sybase_12_5 instead of Compatibility Mode=Sybase when connecting to a 12.5 system

This is needed for Pre-v15 Sybase ASE because sp_executesql does not exist in the older versions (12.5 being my target server)

ianic commented 6 years ago

Thanks remote-coder.

I'm worried about number of ifs appearing in the code. Can I suggest few refactorings;

Can we add methods in credentials struct; conn.sybaseMode() bool conn.sybase125Mode() bool and use them in the code.

ExecuteSql method in conn.go has now many ifs. Can we split that method into two versions executeSql and executeSqlSybase125 for example. And than have only one decision weather we use first or second.

remote-coder commented 6 years ago

@ianic Thanks for the feedback. I have those changes done, and am in the process of modifying existing tests and writing new ones

remote-coder commented 6 years ago

@ianic Updates are complete and tests have been added. I believe that this is now ready for review, and a merge candidate.

I welcome any additional feedback that you have.