wonderix / crystal-tds

MIT License
11 stars 2 forks source link

Conflicts with PG driver when both are used in same app #19

Closed cobraste closed 4 months ago

cobraste commented 4 months ago

I am trying to pass data between SQL Server and Postgres. I can use the respective connections in individual apps but not in one.

both_safe.cr.txt

If I comment out the PG code and driver, then the TDS code runs. If I comment out the TDS code then the PG code runs. If I have them both open then I get

In lib/tds/src/tds/prepared_statement.cr:70:20 70 | connection.sp_unprepare handle.value.as(Int32) ^----------- Error: undefined method 'sp_unprepare' for PG::Connection (compile-time type is DB::Connection+)

which suggests to me that the PG code is being passed to the TDS driver, but I don't understand why.

Any ideas as to how to make this work?

Thanks!

cobraste commented 4 months ago

Thanks! Sorry to be thick, but how do I integrate the change and recompile?

lachlan commented 4 months ago

We have to wait for @wonderix to merge my pull request into the driver and release a new version, and then you would update your shard.yml file with the new version (if you've specified a version) and then run shards update to update the driver to the latest release.

While you wait for an official release, you could test the fix by updating your shard.yml file to depend on my fork of the driver and the commit of the fix, then run shards update to update the tds driver, recompile, and run your solution to test the fix works for you, and then come back here and give feedback on whether your issue is fixed or not:

dependencies:
  tds:
    github: lachlan/crystal-tds
    commit: a371a4e9755be6ec481181472aa1e7083beaec3c

Then once a new version of the driver is released, you'd update your shard.yml to point back to this repo, then run shards update again to depend on the released version:

dependencies:
  tds:
    github: wonderix/crystal-tds
    version: "~> 0.3" # or whatever version spec makes sense
cobraste commented 4 months ago

Thanks! I’ll test and let you know.

Best, Marc

On Sun, May 12, 2024 at 5:46 PM Lachlan Dowding @.***> wrote:

We have to wait for @wonderix https://github.com/wonderix to merge my pull request into the driver and release a new version, and then you would update your shard.yml file with the new version (if you've specified a version) and then run shards update to update the driver to the latest release.

While you wait for an official release, you could test the fix by updating your shard.yml file to depend on my fork of the driver and the commit of the fix, then run shards update to update the tds driver, recompile, and run your solution to test the fix works for you, and then come back here and give feedback on whether your issue is fixed or not.:

dependencies: tds: github: lachlan/crystal-tds commit: a371a4e9755be6ec481181472aa1e7083beaec3c

Then once a new version of the driver is released, you'd update your shard.yml to point back to this repo, then run shards update again to depend on the released version:

dependencies: tds: github: wonderix/crystal-tds version: "~> 0.3" # or whatever version spec makes sense

— Reply to this email directly, view it on GitHub https://github.com/wonderix/crystal-tds/issues/19#issuecomment-2106383843, or unsubscribe https://github.com/notifications/unsubscribe-auth/BGWZ3B5SMTPQF5IQ3MUYZGTZB7PKFAVCNFSM6AAAAABHSEB3QOVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMZDCMBWGM4DGOBUGM . You are receiving this because you authored the thread.Message ID: @.***>

wonderix commented 4 months ago

Hi @cobraste,

I integrated the PR proposed by @lachlan and created a new release 0.3.2-