Skip to content

Commit d188da2

Browse files
committed
Update changelog and remove some io:formats
1 parent 1548bee commit d188da2

3 files changed

Lines changed: 78 additions & 100 deletions

File tree

CHANGELOG.md

Lines changed: 77 additions & 43 deletions
Original file line numberDiff line numberDiff line change
@@ -1,79 +1,113 @@
1-
## 0.7.0 (in development)
1+
# SQL Bridge Changelog
22

3-
* The mysql-otp bridge has been reworked to use the mainline
3+
## 0.7.0 (2026-03-04)
4+
5+
- The mysql-otp bridge has been reworked to use the mainline
46
[mysql-otp](https://github.com/mysql-otp/mysql-otp) repo (rather than
5-
@choptastic's fork). This requires
7+
@choptastic's fork). This requires
68
[new functionality](https://github.com/mysql-otp/mysql-otp/pull/194) in
79
mysql-otp.
8-
* The epgsql bridge now relies on mainline
10+
- The epgsql bridge now relies on mainline
911
[epgsql](https://github.com/epgsql/epgsql) (rather than @choptastic's
1012
fork). This ended up requiring migrating @choptastic's epgsql customizations
1113
to become epgsql [custom
1214
codecs](https://github.com/epgsql/epgsql/blob/devel/doc/pluggable_types.md)
1315
and [epgsql_decimal](https://github.com/egobrain/epgsql_decimal).
14-
* Fixed `epgsql`'s decoding of `decimal`/`numeric` types to return a float or
16+
- Added a primary key generator for SQL Bridge to use if the table is not using
17+
its own key generation. This key generator can be completely swapped out if
18+
its conditions are not sufficient for your needs.
19+
- Added `primary_key(Table)` which returns the field name of the primary key of the
20+
provided table
21+
- Added `is_auto_increment(Table, Field)` which returns true if the `Field` in
22+
`Table` is using the RDBMS's auto increment feature for primary key generation
23+
(ala MySQL's `auto_increment` or PostgreSQL's `serial`).
24+
- Added `field_type(Table, Field)` which returns a limited arrangement of terms
25+
usable for key generation (that is, integers, strings, and UUIDs). Other field
26+
types are ignored (floats, dates, etc). This will likely be built out further
27+
eventually, but its current implementation is to go along with the new primary
28+
key generator.
29+
- Fixed `epgsql`'s decoding of `decimal`/`numeric` types to return a float or
1530
integer. (Fixes [Issue #5](https://github.com/choptastic/sql_bridge/issues/5))
16-
* Fixed a crash in the `epgsql` driver
31+
- Fixed a crash in the `epgsql` driver
1732
([Issue #10)](https://github.com/choptastic/sql_bridge/issues/10) (Thanks
1833
@th31nitiate!)
19-
* The above work ensures that sql_bridge is now fully hex compliant and
34+
- The above work ensures that sql_bridge is now fully hex compliant and
2035
available in [hex.pm](https://hex.pm/packages/sql_bridge).
21-
* Fix a big transaction bug in the mysql-otp bridge where transactions were
36+
- Fix a big transaction bug in the mysql-otp bridge where transactions were
2237
mostly unreliable.
23-
* Fix all dialyzer errors
24-
* Added Github CI testing
38+
- Fix all dialyzer errors
39+
- Added Github Actions testing
2540

26-
## 0.6.1
41+
## 0.6.1 (2022-04-13)
2742

28-
* Added support for setting the hostname to a `{Mod,Fun}` tuple that will be
43+
- Added support for setting the hostname to a `{Mod,Fun}` tuple that will be
2944
called to determine which DB server to connect to.
3045

31-
## 0.6.0
46+
## 0.6.0 (2022-03-14)
3247

33-
* Loosen the supervisor failure conditions, so `sql_bridge` doesn't go offline
48+
- Loosen the supervisor failure conditions, so `sql_bridge` doWorking Versione
3449
if the backend DB server goes offline for an extended period.
50+
- Added `field_exists/2` to check for the existance of a field in a table
3551

36-
## 0.5.1
37-
38-
* Added `field_exists/2` to check for the existance of a field in a table
39-
40-
## 0.5.0
52+
## 0.5.0 (2021-11-17)
4153

42-
* **BACKWARDS INCOMPATIBLE CHANGE**: Removed support for emysql
43-
* Configured with rebar3
54+
- **BACKWARDS INCOMPATIBLE CHANGE**: Removed support for emysql
55+
- Configured with rebar3
4456

45-
## v0.4.0
57+
## 0.4.0 (2020-04-14)
4658

47-
* **BACKWARDS INCOMPATIBLE CHANGE**: Renamed `update` and `insert` to `qupdate`
59+
- **BACKWARDS INCOMPATIBLE CHANGE**: Renamed `update` and `insert` to `qupdate`
4860
and `qinsert`.
49-
* Created `update/[2,3]` and `insert/2` which are friendly maps to `plu` and
61+
- Created `update/[2,3]` and `insert/2` which are friendly maps to `plu` and
5062
`pli` respectively.
51-
* Handling nested transactions and nested checkouts (just for mysql-otp right now)
52-
* Give a warning message if query breaks in mysql-otp. Previously just returned
63+
- Handling nested transactions and nested checkouts (just for mysql-otp right now)
64+
- Give a warning message if query breaks in mysql-otp. Previously just returned
5365
`{error, Something}` but this generates an OTP warning as well.
54-
* Fix atom encoding in epgsql
55-
* Branched the module alias system into a new dependency module called `erlias`
56-
* The built-in base64 converter now uses `b64fast`
57-
* Add a timer-based logger. Calling `log_for_time(5)` will log all queries for
66+
- Fix atom encoding in epgsql
67+
- Branched the module alias system into a new dependency module called `erlias`
68+
- The built-in base64 converter now uses `b64fast`
69+
- Add a timer-based logger. Calling `log_for_time(5)` will log all queries for
5870
5 seconds to `sql_bridge.log`
5971

60-
## v0.3.0
72+
## 0.3.0 (2016-04-14)
6173

62-
* Normalize return values for date, time, timestamp, and decimal types.
63-
* Fix `db:save` to properly decompose tables of the `database.tablename`
74+
- Normalize return values for date, time, timestamp, and decimal types.
75+
- Fix `db:save` to properly decompose tables of the `database.tablename`
6476
format.
65-
* Better normalization of `true`, `false` and NULLs to `undefined`
66-
* Add more tests
77+
- Better normalization of `true`, `false` and NULLs to `undefined`
78+
- Add more tests
79+
80+
## 0.2.0 (2016-03-10)
81+
82+
- Add record handling
83+
- Improve stability in mysql-otp driver
84+
85+
## 0.1.1 (2016-01-22)
86+
87+
- Bugfix Release
88+
89+
## 0.1.0 (2016-01-21)
90+
91+
- Renamed SigmaSQL to SQL_Bridge
92+
- Changed the core module from `db.erl` to `sql_bridge.erl`, and implemented
93+
the alias system.
94+
- Add PostgreSQL support
95+
- Add MySQL and PGSQL token replacement methods to be configurable. (`?` and
96+
`$1`, respectively)
97+
- Add support for `mysql_otp` and `epgsql` drivers
98+
- Add battery of tests
99+
100+
## 0.0.4 (2015-10-05)
67101

68-
## v0.2.0
102+
- Unicode Fix
103+
- Working with Erlang 18
69104

70-
* Add record handling
71-
* Improve stability in mysql-otp driver
105+
## 0.0.2 (2014-08-14)
72106

73-
## v0.1.0
107+
- Added Typespecs
108+
- Bug Fixes
109+
- Passing dialyzer
74110

75-
* Add support for mysql-otp and epgsql drivers
76-
* Add battery of tests
111+
## 0.0.1 (2013-09-28)
77112

78-
## Prior Versions
79-
* Supported Emysql driver only.
113+
- Supported Emysql driver only.

src/sql_bridge_mysql_otp.erl

Lines changed: 1 addition & 55 deletions
Original file line numberDiff line numberDiff line change
@@ -241,60 +241,6 @@ encode(Val) ->
241241
mysql:encode(Worker, Val)
242242
end).
243243

244-
%primary_key_with_auto_increment_and_type(DB, Table) ->
245-
% [T1, T2] = sql_bridge_utils:create_placeholders(2),
246-
% SQL = [<<"select column_name
247-
% from information_schema.columns
248-
% where table_schema=">>,T1,
249-
% <<" and table_name=">>,T2,
250-
% <<" and column_key='PRI'
251-
% and extra like '%auto_increment%'">>],
252-
% Res = sql_bridge:list(SQL, [DB, Table]),
253-
% %io:format("Res: ~p~n", [Res]),
254-
% case Res of
255-
% [Field] -> list_to_atom(Field);
256-
% _ -> undefined
257-
% end.
258-
259-
%%auto_increment(DB, Table) ->
260-
%% Field = primary_key(DB, Table),
261-
%% io:format("Primary Key: ~p -> ~p~n", [Table, Field]),
262-
%% ID = case get_field_type(DB, Table, Field) of
263-
%% {uuid, _} ->
264-
%% auto_increment_uuid();
265-
%% {text, MaxLength} ->
266-
%% auto_increment_string(MaxLength);
267-
%% {integer, {Min, Max}} ->
268-
%% auto_increment_integer(Min, Max)
269-
%% end,
270-
%% io:format("Auto-Generated ID: ~p~n",[ID]),
271-
%% FullTable = sql_bridge_utils:to_string(DB) ++ "." ++ sql_bridge_utils:to_string(Table),
272-
%% case sql_bridge:exists(FullTable, Field, ID) of
273-
%% true -> auto_increment(DB, Table);
274-
%% false -> ID
275-
%% end.
276-
%%
277-
%%auto_increment_uuid() ->
278-
%% uuid:uuid_to_string(uuid:get_v4_urandom()).
279-
%%
280-
%%auto_increment_string(MaxLength) ->
281-
%% [rand_char() || _ <- lists:seq(1, MaxLength)].
282-
%%
283-
%%rand_char() ->
284-
%% case rand:uniform(62) of
285-
%% 10 -> $0;
286-
%% X when X < 10 ->
287-
%% X + $0;
288-
%% X when X =< 36 ->
289-
%% X - 11 + $a;
290-
%% X ->
291-
%% X - 37 + $A
292-
%% end.
293-
%%
294-
%%auto_increment_integer(Min, Max) ->
295-
%% Diff = Max - Min,
296-
%% rand:uniform(Diff) + Min.
297-
298244
-spec field_type(DB :: sql_bridge:db(),
299245
Table :: sql_bridge:table(),
300246
Field :: sql_bridge:field()) -> undefined | sql_bridge:field_type().
@@ -306,7 +252,7 @@ field_type(DB, Table, Field) ->
306252
<<" and table_name=">>, T2,
307253
<<" and column_name=">>, T3],
308254
Res = sql_bridge:fffr(SQL, [DB, Table, Field]),
309-
io:format("MySQL - Field Type (~p, ~p, ~p): ~p~n", [DB, Table, Field, Res]),
255+
%io:format("MySQL - Field Type (~p, ~p, ~p): ~p~n", [DB, Table, Field, Res]),
310256
case Res of
311257
not_found ->
312258
undefined;

src/sql_bridge_random_key_generator.erl

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,6 @@ generate(Table) ->
77
generate(Table, Field).
88

99
generate(Table, Field) ->
10-
io:format("(generate) Primary Key: ~p -> ~p~n", [Table, Field]),
1110
ID = case sql_bridge:field_type(Table, Field) of
1211
{uuid, _} ->
1312
auto_increment_uuid();
@@ -16,7 +15,6 @@ generate(Table, Field) ->
1615
{integer, {Min, Max}} ->
1716
auto_increment_integer(Min, Max)
1817
end,
19-
io:format("Auto-Generated ID: ~p~n",[ID]),
2018
case sql_bridge:exists(Table, Field, ID) of
2119
true -> generate(Table, Field);
2220
false -> ID

0 commit comments

Comments
 (0)