Last active
August 29, 2023 23:55
-
-
Save mdnmdn/c06feb1fc77cfbf0a8912203b34fe751 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Mix.install([ | |
{:postgrex, "~> 0.15.0"} | |
]) | |
{defmodule MyMod do | |
def main do | |
{:ok, pid} = | |
Tds.start_link( | |
hostname: "localhost", | |
username: "sa", | |
password: "io", | |
database: "master", | |
port: 1443 | |
) | |
# IO.inspect(Tds.query!(pid, "SELECT * from information_schema.tables ", [])) | |
# IO.inspect(Tds.query!(pid, "SELECT * from information_schema.tables where table_catalog = @1 ", ["master"])) | |
IO.inspect( | |
Tds.query!(pid, "SELECT * from information_schema.tables where table_catalog = @tbl ", [ | |
%Tds.Parameter{name: "@tbl", value: "master"} | |
]) | |
) | |
end | |
end | |
MyMod.main() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Mix.install([ | |
{:tds, "~> 2.0"} | |
]) | |
# alias Tds.Parameter | |
{:ok, pid} = | |
Tds.start_link( | |
hostname: "localhost", | |
username: "sa", | |
password: "io", | |
database: "master", | |
port: 1443 | |
) | |
# IO.inspect(Tds.query!(pid, "SELECT * from information_schema.tables ", [])) | |
# IO.inspect(Tds.query!(pid, "SELECT * from information_schema.tables where table_catalog = @1 ", ["master"])) | |
IO.inspect( | |
Tds.query!(pid, "SELECT * from information_schema.tables where table_catalog = @tbl ", [ | |
%Tds.Parameter{name: "tbl", value: "master"} | |
]) | |
) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment