forked from ddossot/erlyweb
-
Notifications
You must be signed in to change notification settings - Fork 1
/
CHANGELOG.txt
391 lines (250 loc) · 19.2 KB
/
CHANGELOG.txt
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
v0.7
- Added yaws_arg:add_to_opaque/2, yaws_arg:add_all_to_opaque/2, and
yaws_arg:get_opaque_val/2 to simplify accessing the 'opaque' field of the
Yaws arg record.
- Added support for multiple databases. More information is in the
documentation. (yariv)
- When a controller function returns a {replace, Ewc} tuple, ErlyWeb no longer
treats Ewc as a sub-component if it's returned from a main component.
This lets the component referred by Ewc to
return any value that a main component function can return
(e.g. phased_vars, ewr, etc). (yariv)
- Set a 3-second threshold on auto compilation to avoid excessive
directory scans when loading pages that trigger multiple requests
(for example, due to img/script/css tags). (yariv)
- Changed the arity of the 'phased' function to 3 from 2. ErlyWeb 0.7 expects
the last parameter to be a list of variables passed from the controller
function. The variables are passed using the {phased_vars, Vars} return
value, e.g.
index(A) ->
{response, [{phased_vars, [{title, <<"sample page title">>}]},
{body, Body}]}.
The app controller's hook/1 function can now be implemented as follows:
hook(A) ->
{phased, {ewc,A}, fun(Ewc, Data, PhasedVars) ->
{ewc, html_container, [A, {data, Data},
proplists:get_value(title, PhasedVars)]}}.
This tells ErlyWeb to pass the value of the 'title' property as the last
parameter to html_container. (yariv)
- Added the {last_compile_time, auto} compilation option, which tells ErlyWeb
to only compile the files that have changed since the last compilation.
(ketralnis)
- Added an automatic check for the existence of expected foreign key fields
in related modules during compilation. This can be disabled by adding the
{skip_fk_checks, true} compilation option. (yariv)
- erlydb_base:save() now avoids setting 'null' values of properties when
executing INSERT statements. (yariv)
- Added the ability to override the join table names and use aliases for
related modules in many-to-many relations. E.g.
person.erl:
relations() ->
[{many_to_many,
[{painting, [{relation_table, creation_person},
{alias, creation}]}]}].
Then you can get the related paintings for a 'person' record as follows:
person:creations(Person).
This uses the 'creation_person' table to look up the related creations. (yariv)
- {encoding, charset_atom} in Options list of erlydb:start/2 that turns on
charset support over mysql connections. This allows us to support utf8,
for example. The default is to have no explicit encoding spec at all
(mysql server chooses latin1 by default.) (haoboy)
- {pool_size, N} in Options list of erlydb:start/2 that starts N mysql
processes in the process pool. The default value is to start only one.
(haoboy)
- erlyweb:create_component now takes options in the form of proplists, to
allow choice between on/off for magic, model and ErlTL files. (cowmoo)
- Added the {erlydb_timeout, Timout} compilation option to set the timeout
for SQL queries (currently only works with MySQL). (yariv)
- A bunch of bug fixes. (yariv)
v0.6.2
- Fixed the app controller hook/1 return value handling, letting you return
the {response, Elems} tuple just like regular controller functions. You can
even use {response, Elems} as the Ewc element in {phased, Ewc, Fun}. (yariv)
- Fixed the action paths in erlyweb_view. NOTE: the behavior of
erlyweb:get_app_root() has changed. It used to return "/" when
the appmod was set to "/", but now it just returns an empty string. (yariv)
- Added the optional catch_all/2 function to controllers. catch_all()
is called when the client request a function that doesn't exist.
Also, deprecated erlyweb_util:indexify().
- Added methods in smerl so that for_module/2 works for dynamically inserted
modules as well. Note that if we don't have debug_info, we have to retrieve
module information by epp:parse_file, the module contents are not updated,
hence they do not contain dynamically inserted information from erlydb_base.erl.
This is the best we can do in this situation, and giving partial information
is better than giving nothing. (haoboy)
- Added option {logfun, LogFun} to erlydb_mysql:start() so that we can pass in
a LogFun option to control mysql driver's logging. In production mode, this
allows us to pass in a dummy logger so that all database logging is disabled. (haoboy)
- Added a catch all when converting binaries in to/from mnesia (matthew.pflueger)
v0.6.1
- Fixed erlyweb_magic.
- Added compiling option: {auto_compile_exclude, Val}, where 'Val' is a
folder in docroot (or a URL path). This is useful when erlyweb is mapped
to '/' and there are a lots of static files in that excluded folder.
Example: {auto_compile_exclude, "/static"}.
- Added after_render/3 controller hook. This allows to access the
an iolist of the rendered output.
- Added the possibliy of using ErlTl templates for non-HTML. Any MIME
type can be specified with {response, [{body, MimeType, Body}]} as
return value for controller functions.
- regenerated documentation and added docs / cleandocs option to Makefile
- fixed a bug in erlydb_psl (typo in SQL statement for Metadata)
- added transient fields, to use the feature one needs to overwrite in the
model the fields/0 function with the complete list of persistent fields plus
the transient fields in any desired order (which will be effective in the
generated model functions), e.g.:
fields() -> [mydbfield, {mytransientfield, [transient]}, mydbfield2].
- tweaked the default printing and parsing of date/time values
- duplicates are now removed from the result of fields/0 in ErlyDB models
- added support for erlyweb_magic in models.
v0.6
- Added support for read-only fields and setting for arbitrary user-defined
attributes in erlydb_field instances. In ErlyDB modules, the fields/0 function
can now retun instead of an atom for each name, a tuple of the form
{Name, Attributes}, where Attributes is an arbitrary list of terms. The
Attributes list is embedded in the corresponding auto-generated erlydb_field
structure, and it can be retrieved using erlydb_field:attributes/1.
If Attributes includes the atom 'read_only', the field is excluded in the
SQL statements generated erlydb_base:save/1.
- Fixed a bug in the handling of before_call hooks.
- Fixed a bug in the generation of SELECT statements for many-to-many
relations where the modules define table names whose alphabetical ordering
is different from that of the module names'.
- Added erlydb_base:is_related/3 to check if two records are related
in a many-to-many relation.
- The ErlyWeb request tokenizer now stops when encountering the first '?'
symbol in the URL. This lets you include GET parameters that contain forward
slashes in URLs.
- Removed the NULL checks in erlydb_base:new_from_strings/2. This function no
longer calls exit({null_value, Field}) when one of its non-null fields is set
to 'undefined'.
- Fixed erlydb_base:field_to_iolist/2 to ensure that single-digit time values
are padded with a leading zero.
- Added the {replace, Ewc} return value for controller functions.
This tuple tells ErlyWeb to render the subcomponent (which must be
represented by a single 'ewc' tuple) without sending the result to the
view function of the current component. The behavior is more or less like an
internal redirect, and is useful for implementing generic error error pages,
for instance.
- The list of parameters in 'ewr' tuples can now contain iolists
(not just strings).
- Added erlydb_base:increment() and erlydb_base:decrement().
- Implemented more informative error messages, including complete stack trace,
when ErlyWeb encounters an error during auto-compilation.
- Ensured that MaxLength is converted to a list in erlyweb_html:input().
- Added content_type/1 and content_type/2 to yaws_headers.erl.
- Fixed the handling of includes in ErlTL.
- Fixed some documentation bugs related to erlydb_mysql.
- Added erlydb_mnesia driver. The driver passes all tests defined in erlydb_test (some modifications
were made to erlydb_test to explicitly order results). The erlydb_mnesia relies on a table called
counter for auto-incrementing ids. The first field in a mnesia table is always the primary key
and if this field is named id then the id will be auto-incremented.
By default, the erlydb_mnesia driver stores all fields as binary unless the field name ends with
id and in that case the field is treated as an integer. This can be customized by utilizing the
user_properties for a mnesia table. The erlydb_mnesia driver will do a limited amount of type
conversion utilizing these properties. The driver will recognize user_properties for a field
if defined in the following format:
{Field, {Type, Modifier}, Null, Key, Default, Extra, MnesiaType}
where Field is an atom and must be the same as the field name,
Type through Extra is are as defined in erlydb_field:new/6
MnesiaType is the type to store the field as in mnesia. Currently, only the following values
for MnesiaType are recognized:
atom,
list,
binary,
integer,
undefined
If the MnesiaType has a value of undefined then no type conversion is attempted for the field.
See test/erlydb/erlydb_mnesia_schema for an example of how to create mnesia tables with user_properties.
- Fixed a bug that caused ErlyWeb to expect the docroot directory to be a
direct descendant of the app root directory in auto compilation.
- Made erlyweb_magic(on). extensible (thanks, Jouneski). You can now
replace 'on' with an arbitrary module name and ErlyWeb will use it as the
base module for extending the given component file instead of
erlyweb_view or erlyweb_controller.
- Added erlydb_psql driver. The driver passes all tests defined in erlydb_test. The driver
is based on an Erlang-Consulting development snapshot (slightly modified to handle nested
transactions) added to erlyweb repository via SVN external.
erlydb_psql introduced the following change to eryldb:
DriverModule:get_last_insert_id/1 is now Driver:get_last_insert_id/2 (because Postgres
needs the tablename), this change affected erlydb.erl, erlydb_mysql.erl and erlydb_mnesia.erl.
To use postgresql, define database details in src/erlang-psql-driver/psql.app.src
and run "make app".
- Added an optional error handler to the app controller. If ErlyWeb catches an exit when rendering a component, it tries to pass it to the app controller's error handler. The error handler has the form error(A, Ewc, Err), where A is the arg, Ewc is the top-level component, and Err is the second element of the {'EXIT', Err} tuple.
- Erlyweb no longer tries to compile files that begin with a period.
v0.5
- erlyweb:compile() now obey relative include paths passed as {i, Path} options. It treats the base directory as [AppDir]/src. Absolute paths also work now.
- Fixed the SELECT statement generation for self-referencing many-to-many relations when find_related_many_to_many() includes a custom Where clause (this is a fix in erlsql.erl, which didn't add enough parens around the conditions).
- Removed the if_saved() checks in erlydb_base.erl for the following functions: find_related_many_to_many(), aggregate_related_many_to_many(), find_related_many_to_one(), aggregate_related_many_to_one(), remove_related_many_to_many(), and delete(). This means these functions no longer call exit({no_such_record, Rec}) if is_new(Rec) returns true.
- Changed the return value of erlydb_base:delete/1 to return the number of rows deleted. Previously, if the number of rows deleted was zero or greater than one, this function crashed.
- Related to the last item, erlydb_base:after_delete/1 changed from "after_delete(Rec) -> ok." to "after_delete({Rec, NumDeleted}) -> NumDeleted.".
- Fixed a bug in the accumulation of rendered iolists and other response elements for components having multiple subcomponents.
- Fixed a bug in the auto-compilation feature causing an internal data-structure to grow indefinitely upon automatic recompilations.
- Introduced a new return type, 'ewr', to redirect to the application's root url.
- Introduced a new return type, {ewc, ControllerModule, ViewModule, Func, Params} to enable fine-grained control over ErlyWeb's rendering of components.
- Exposed 2 new functions: erlyweb:get_ewc/2 and erlyweb:get_initial_ewc/2. These functions are useful primarily in the app controller for expanding an {ewc, A} tuple to its full representation, i.e. {ewc, ControllerModule, ViewModule, Func, Param}.
- Optimized the generated code for mapping incoming requests and nested components to their controller/view modules.
- Removed the before_return() and module_info() functions from the list of controller functions exposed to incoming requests.
- Made a few internal optimizations.
- Updated the documentation.
- Removed support for app views and component views' render() function. Their functionality is now attained with containers.
- Added the {phased, Ewc, Fun(ExpandedEwc, Data)} response tuple to the app controller to support conditional containers.
- Refactored the compilation logic to a new file called 'erlyweb_compile.erl'.
- Added the get_cookie/2 function to erlyweb_util.
- Fixed the include paths support for files compiled with ErlyDB.
- Added support for USING clauses in DELETE statmenets in ErlSQL
- Added the remove_related_many_to_many_all function to erlydb_base together with new a few variants in generated modules. Some of those variants are capable of automatically generating proper USING clauses when provided WHERE expressions.
- Added is_new/2 to erlydb_base.
- erlydb_base:remove_related_many_to_many() and erlydb_base:add_related_many_to_many() now return NumRowsDeleted::integer() instead of 'ok' or crashing if the number of rows deleted isn't 1.
- ErlTL enhacement: expressions in <% .. %> tags are now treated as a single block, which means you can write multiple expressions separated by commas and the value of the last expression will be returned.
- Made a fix in the handling of nested calls to mysql:transaction() in the MySQL driver.
- erlydb_base:add_related_many_to_many now accepts a list of related records to add in a single SQL statement for efficiency.
- Made a fix in the handling of self-referencing many-to-many relations for tables with multiple primary keys.
- Added the client_ip_port field to yaws_arg.erl.
- Added the function erlydb_base:insert/1, which lets you insert a list of records into the database in a single statement.
- Added erlydb_base:update/2 and erlydb_base:update/3 to simplify executing hand-crafted UPDATE statements against the model's table.
- Added erlyweb_util:indexify/2 to translate requests such as "/foo/bar/" to "/foo/index/bar".
- Added erlyweb_html:a/3, which adds additional attributes to anchor tags.
- Removed support for {parens, Expr} in ErlSQL expressions. Instead, use {list, [Expr]}.
- Added support for using complete expressions rather than just constants in the RHS of ErlSQL UPDATE statements.
- Added compile_file/5 to the erlyweb_compile export list.
- Added a default html field type to the 'decimal' data type in erlydb_field.
- Optimized the code generated by smerl:embed_params() and smerl:curry().
- Updated the code generated by erlyweb:create_app() to use the new container approach involving phased rendering.
- Made internal improvements in erlydb_base.
- Added a few functions in mysql.erl to start the dispatcher without linking.
- Added erlydb:start_link() and changed erlydb:start() to make it call
mysql:start() instead of mysql:start_link(). This should prevent the MySQL
dispatcher from dying every time the interactive shell traps an exit. Just
remember to call erlydb:start_link() instead of erlydb_start() if you want
to link to the MySQL dispatcher.
- Created the 'erlyweb_forms' module, with a few functions useful for form POST processing.
- Added support for the optional 'before_call/2' function in controllers. This function takes the name of the requested function and its parameters and returns {NewFucnName, NewParams}.
- Made a couple of SQL statement generation fixes in erlsql.erl.
v0.4.1
- Added compiler debug_info to ebin files.
- Added a make script for Windows.
- Fixed a bug that where ErlyDB was using module names instead of table
names to construct queries for self-referencing many-to-many relations.
- Fixed a bug preventing an ErlyDB module for defining a single field which
is also the 'identity' primary key field.
v0.4
- Added support for arbitrary primary key fields. ErlyDB now gets its primary key information from the database and everything 'just works.' Note that foreign key fields now have a more general naming convention: instead of [TableName]_id, they are called [TableName]_[PrimaryKeyField].
- Added support for self-referencing many-to-many relations. A module can now define a many-to-many relation to itself, and ErlyDB would use special database querying logic to handle this case. Relation tables in such scenarios have a different field naming convention. For more information, read the documentation at the top of erlydb.erl (it will be published when v0.4 is released).
- Fix: Database updates in add_related_many_to_many() and remove_related_many_to_many() are now in done in transactions.
- Fix: Foreign key field names and many-to-many relation table names are now derived from a module's database table's name, not the module's name (note: this only affects modules that override the table() function).
- Fix: Proper handling of -include() directives in Smerl (Smerl now automatically searches the source file's directory for header files).
- {ewr, Name} now triggers a redirect to the component with the given name, not the function with the given name in the same component. This is a more logical behavior (and it also matches the documentation :) ).
- Fix: You can now use 'ewr' tuples in {response, Elems}
- erlydb_field:extras/1 now returns 'undefined' instead of 'none'.
- erlydb_field:key/1 now returns 'undefined' instead of 'none'.
- In ErlyDB, functions ending with '_first' (e.g. language:projects_first(Erlang)), which return the first record of a related module, now return either the related record or 'undefined' instead of a list that may be empty or contain the one related record. This is to be consistent with the behavior of Module:find_first().
- Some functions in erlydb_base used to call exit({error, {no_such_record, Rec}}}) if they were passed a record(s) that hadn't been saved in the database. To be consistent with other errors, these functions now call exit({no_such_record, Rec}).
- Fixed a documentation bug referring to 'allow_unsafe_sql' instead of 'allow_unsafe_statements'
- Fixed a bug in where a call to Model:save/1 inside Model:transaction/1 would cause a crash when it results in an UPDATE statement.
- Removed the "Skipping compilation of..." debug statement.
- Made several documentation updates.
- Updated the ErlyDB test code.
- Added the debug_info flag to ErlyWeb app compilation.
- Added a make script and a create app script.
- Added the MySQL driver code as an external repository resource.