{"id":20661386,"url":"https://github.com/erlangbureau/jamdb_oracle","last_synced_at":"2025-04-08T01:39:52.829Z","repository":{"id":20932112,"uuid":"24220314","full_name":"erlangbureau/jamdb_oracle","owner":"erlangbureau","description":"Oracle Database driver for Erlang","archived":false,"fork":false,"pushed_at":"2024-09-29T12:02:51.000Z","size":821,"stargazers_count":107,"open_issues_count":8,"forks_count":52,"subscribers_count":17,"default_branch":"master","last_synced_at":"2025-03-31T23:36:39.260Z","etag":null,"topics":["ecto-adapter","erlang","oracle-database"],"latest_commit_sha":null,"homepage":"","language":"Erlang","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/erlangbureau.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2014-09-19T07:20:37.000Z","updated_at":"2025-03-12T00:27:19.000Z","dependencies_parsed_at":"2023-09-25T23:22:46.354Z","dependency_job_id":"57eed519-4ad6-4b6c-9d9e-a5fb3e92cf1b","html_url":"https://github.com/erlangbureau/jamdb_oracle","commit_stats":null,"previous_names":[],"tags_count":9,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/erlangbureau%2Fjamdb_oracle","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/erlangbureau%2Fjamdb_oracle/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/erlangbureau%2Fjamdb_oracle/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/erlangbureau%2Fjamdb_oracle/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/erlangbureau","download_url":"https://codeload.github.com/erlangbureau/jamdb_oracle/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":247761049,"owners_count":20991532,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["ecto-adapter","erlang","oracle-database"],"created_at":"2024-11-16T19:09:11.312Z","updated_at":"2025-04-08T01:39:52.811Z","avatar_url":"https://github.com/erlangbureau.png","language":"Erlang","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Jamdb.Oracle\n\nErlang driver and Ecto adapter for Oracle Database\n\n## Features\n\n * Using prepared statement functionality, the SQL statement you want\n   to run is precompiled and stored in a database object, and you can run it\n   as many times as required without compiling it every time it is run. If the data in the\n   statement changes, you can use bind variables as placeholders for the data and then \n   provide literal values at run time.\n\n * Using bind variables:\n\n    `{\"insert into tabl values (:1)\", [\u003c\u003c16#E7,16#99,16#BE\u003e\u003e]}`\n* Using named parameters:\n\n    `{\"insert into tabl values (:id, :dat)\", [#{dat =\u003e {2023, 1, 1}, id =\u003e 1}]}`\n * Calling stored procedure:\n\n    `{\"begin proc(:1, :2, :3); end;\"`, `[1.0, 2.0, 3.0]}`\n * Calling stored function:\n\n    `{\"begin :1 := func(:2); end;\"`, `[{:out, :varchar}, \"one hundred\"]}`\n * Using cursor variable:\n\n    `{\"begin open :1 for select * from tabl where dat\u003e:2; end;\"`, `[:cursor, {2016, 8, 1}]}`\n * Using returning clause:\n\n    `{\"insert into tabl values (tablid.nextval, sysdate) return id into :1\"`, `[{:out, :number}]}`\n * Update batching:\n\n    `{:batch, \"insert into tabl values (:1, :2, :3)\"`, `[[1, 2, 3],[4, 5, 6],[7, 8, 9]]}`\n * Row prefetching:\n\n    `{:fetch, \"select * from tabl where id\u003e:1\"`, `[1]}`\n\n    `{:fetch, cursor, row_format, last_row}`\n\n## Options\n\nAdapter options split in different categories described\nbelow. All options can be given via the repository\nconfiguration:\n\n    config :your_app, YourApp.Repo,\n      ...\n\n### Connection options\n\n  * `:hostname` - Server hostname (Name or IP address of the database server)\n  * `:port` - Server port (Number of the port where the server listens for requests)\n  * `:database` - Database (Database service name or SID with colon as prefix)\n  * `:username` - Username (Name for the connecting user)\n  * `:password` - User password (Password for the connecting user)\n  * `:parameters` - Keyword list of connection parameters\n  * `:socket_options` - Options to be given to the underlying socket\n  * `:timeout` - The default timeout to use on queries, defaults to `15000`\n\n### Pool options\n\n  * `:pool` - The connection pool module, defaults to `DBConnection.ConnectionPool`\n  * `:pool_size` - The size of the pool, defaults to `1`\n  * `:idle_interval` - The ping interval to validate an idle connection, defaults to `5000`\t\n\n### Connection parameters\n\n  * `:autocommit` - Mode that issued an automatic COMMIT operation\n  * `:fetch` - Number of rows to fetch from the server\n  * `:sdu` - Size of session data unit\n  * `:read_timeout` - Read timeout while reading from the socket, defaults to `500`\n  * `:role` - Mode that is used in an internal logon\n  * `:prelim` - Mode that is permitted when the database is down\n  * `:newpassword` - User new password (Change password for the connecting user)\n  * `:description` - Connect descriptor\n  * `:charset` - Client character set, defaults to UTF-8\n\n### Output parameters\n\n* Calling stored procedure or function: `[{:out, :number}, {:out, :varchar}]`\n* Using returning clause: `[{:out, :number}, {:out, :date}]`\n\nOracle types                     | Literal syntax in params\n:------------------------------- | :-----------------------\n`NUMBER`,`FLOAT`,`BINARY_FLOAT`  | `:number`, `:integer`, `:float`, `:decimal`\n`CHAR`, `VARCHAR2`, `CLOB`       | `:varchar`, `:char`, `:clob`, `:string`\n`NCHAR`, `NVARCHAR2`, `NCLOB`    | `:nvarchar`, `:nchar`, `:nclob`\n`RAW`, `BLOB`                    | `:raw`, `:blob`, `:binary`, `:hexstring`\n`DATE`                           | `:date`\n`TIMESTAMP`                      | `:timestamp`\n`TIMESTAMP WITH TIME ZONE`       | `:timestamptz`\n`SYS_REFCURSOR`                  | `:cursor`\n\n### Input parameters\n\nUsing query options: `[in: [:number, :binary]]`\n\n### Primitive types\n\nThe primitive types are:\n\nEcto types              | Oracle types                     | Literal syntax in params\n:---------------------- | :------------------------------- | :-----------------------\n`:id`, `:integer`       | `NUMBER (*,0)`, `INTEGER`        | 1, 2, 3\n`:float`                | `NUMBER`,`FLOAT`,`BINARY_FLOAT`  | 1.0, 2.0, 3.0\n`:decimal`              | `NUMBER`,`FLOAT`,`BINARY_FLOAT`  | [`Decimal`](https://hexdocs.pm/decimal)\n`:string`               | `CHAR`, `VARCHAR2`, `CLOB`       | \"one hundred\"\n`:string`               | `NCHAR`, `NVARCHAR2`, `NCLOB`    | \"百元\", \"万円\"\n`:binary`               | `RAW`, `BLOB`                    | \"E799BE\" (base 16 encoded)\n`:binary`               | `RAW`, `BLOB`                    | \u003c\u003c0xE7,0x99,0xBE\u003e\u003e (option [in: [:binary])\n`:binary_id`            | `RAW`, `BLOB`                    | \u003c\u003c231,153,190, ...\u003e\u003e (option [in: [:binary_id])\n`:boolean`              | `CHAR`, `VARCHAR2`, `NUMBER`     | true, false\n`:map`                  | `CLOB`, `NCLOB`                  | %{\"one\" =\u003e 1, \"hundred\" =\u003e \"百\"}\n`:naive_datetime`       | `DATE`, `TIMESTAMP`              | [`NaiveDateTime`](https://hexdocs.pm/elixir)\n`:utc_datetime`         | `TIMESTAMP WITH TIME ZONE`       | [`DateTime`](https://hexdocs.pm/elixir)\n\n### Character sets\n\n[`String`](https://hexdocs.pm/elixir) in Elixir is UTF-8 encoded binary.\n\n`:us7ascii`, `:we8iso8859p1`, `:ee8iso8859p2`, `:nee8iso8859p4`, `:cl8iso8859p5`, `:ar8iso8859p6`,\n`:el8iso8859p7`,`:iw8iso8859p8`, `:we8iso8859p9`, `:ne8iso8859p10`, `:th8tisascii`, `:vn8mswin1258`,\n`:we8iso8859p15`,`:blt8iso8859p13`, `:ee8mswin1250`, `:cl8mswin1251`, `:el8mswin1253`, `:iw8mswin1255`,\n`:tr8mswin1254`,`:we8mswin1252`, `:blt8mswin1257`, `:ar8mswin1256`\n\n`:ja16euc`, `:ja16sjis`, `:ja16euctilde`,`:ja16sjistilde`,`:ko16mswin949`,\n`:zhs16gbk`, `:zht32euc`, `:zht16big5`, `:zht16mswin950`, `:zht16hkscs`\n\n#### Examples\n\n    iex\u003e Ecto.Adapters.SQL.query(YourApp.Repo, \"select 1+:1,sysdate,rowid from dual where 1=:1 \", [1])\n    {:ok, %{num_rows: 1, rows: [[2, ~N[2016-08-01 13:14:15], \"AAAACOAABAAAAWJAAA\"]]}}\n\n    iex\u003e row = [%Ecto.Query.Tagged{value: \u003c\u003c0xE7,0x99,0xBE\u003e\u003e, type: :binary}]\n    iex\u003e Ecto.Adapters.SQL.query(YourApp.Repo, \"insert into tabl values (:1)\", row)\n\n    iex\u003e row = [%Ecto.Query.Tagged{value: %{dat: {2023, 1, 1}, id: 1}, type: :map}]\n    iex\u003e Ecto.Adapters.SQL.query(YourApp.Repo, \"insert into tabl values (:id, :dat)\", row)\n        \n    iex\u003e opts = [batch: true, in: [Ecto.UUID, :number]]\n    iex\u003e row = [Ecto.UUID.bingenerate, 1]\n    iex\u003e Ecto.Adapters.SQL.query(YourApp.Repo, \"insert into tabl values (:1, :2)\",\n    ...\u003e [row, row], opts)\n        \n    iex\u003e opts = [returning: false, out: [:integer]]\n    iex\u003e row = [Date.utc_today]\n    iex\u003e Ecto.Adapters.SQL.query(YourApp.Repo, \"insert into tabl (dat) values (:1) return id into :2\",\n    ...\u003e row, opts)\n\nUsing quoted identifiers:\n\n    defmodule YourApp.Users do\n      use Ecto.Schema\n\n      schema \"\\\\\"USERS\\\\\"\" do\n        field :id, :integer\n        field :uuid, :binary_id\n        field :name, :string, source: :'\"NAME\"'\n        field :namae, :string, source: :'\"名まえ\"'\n      end\n\n    end\n\n    iex\u003e YourApp.Repo.all(from(u in \"\\\\\"USERS\\\\\"\", select: u.'\"NAME\"', where: u.id == 1))\n\n    iex\u003e YourApp.Repo.all(from(u in YourApp.Users, select: u.namae, where: u.id == 1))\n\n    iex\u003e uuid = \"601d74e4-a8d3-4b6e-8365-eddb4c893327\"\n    iex\u003e YourApp.Repo.all(from(u in YourApp.Users, select: u.name,\n    iex\u003e where: u.uuid == type(^uuid, :binary_id)), [in: [:binary_id]])\n\nImagine you have this migration:\n\n    defmodule YourApp.Repo.Migrations.Users do\n      use Ecto.Migration\n\n      def change do\n        create table(:users, comment: \"users table\") do\n          add :name, :string, comment: \"name column\"\n          add :namae, :string, national: true\n          add :custom_id, :uuid\n          timestamps()\n        end\n      end\n\n    end\n\nTo migrate you'd do it normally:\n\n    $ mix ecto.migrate\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ferlangbureau%2Fjamdb_oracle","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Ferlangbureau%2Fjamdb_oracle","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ferlangbureau%2Fjamdb_oracle/lists"}