229
<section><title>Common data types</title>
231
<list type="bulleted">
232
<item><p><c>QueryCursor = {qlc_cursor, term()}</c></p>
234
<item><p><c>QueryHandle = {qlc_handle, term()}</c></p>
236
<item><p><c>QueryHandleOrList = QueryHandle | list()</c></p>
238
<item><p><c>Answers = [Answer]</c></p>
240
<item><p><c>Answer = term()</c></p>
242
<item><p><c>AbstractExpression = </c> - parse trees
243
for Erlang expressions, see the <seealso
244
marker="erts:absform">abstract format</seealso>
245
documentation in the ERTS User's Guide -</p>
247
<item><p><c>MatchExpression = </c>
248
- match specifications, see the <seealso
249
marker="erts:match_spec">match specification</seealso>
250
documentation in the ERTS User's Guide and <seealso
251
marker="ms_transform">ms_transform(3)</seealso> -</p>
253
<item><p><c>SpawnOptions = default | spawn_options()</c></p>
255
<item><p><c>SortOptions = [SortOption] | SortOption</c></p>
257
<item><p><c>SortOption = {compressed, bool()}
258
| {no_files, NoFiles}
261
| {tmpdir, TempDirectory}
262
| {unique, bool()} </c>
264
marker="file_sorter">file_sorter(3)</seealso> -</p>
266
<item><p><c>Order = ascending | descending | OrderFun</c></p>
268
<item><p><c>OrderFun = fun(term(), term()) -> bool()</c></p>
270
<item><p><c>TempDirectory = "" | filename()</c></p>
272
<item><p><c>Size = int() > 0</c></p>
274
<item><p><c>NoFiles = int() > 1</c></p>
276
<item><p><c>KeyPos = int() > 0 | [int() > 0]</c></p>
278
<item><p><c>MaxListSize = int() >= 0</c></p>
280
<item><p><c>bool() = true | false</c></p>
282
<item><p><c>Cache = ets | list | no</c></p>
284
<item><p><c>TmpFileUsage = allowed | not_allowed | info_msg
285
| warning_msg | error_msg</c></p>
287
<item><p><c>filename() = </c> - see <seealso
288
marker="filename">filename(3)</seealso> -</p>
290
<item><p><c>spawn_options() = </c> - see <seealso
291
marker="erts:erlang">erlang(3)</seealso> -</p>
298
233
<section><title>Getting started</title>
300
235
<p><marker id="getting_started"></marker> As already mentioned
619
<name name="abstract_expr"></name>
620
<desc><p>Parse trees for Erlang expression, see the <seealso
621
marker="erts:absform">abstract format</seealso>
622
documentation in the ERTS User's Guide.</p></desc>
625
<name name="answer"></name>
628
<name name="answers"></name>
631
<name name="cache"></name>
634
<name name="match_expression"></name>
635
<desc><p>Match specification, see the <seealso
636
marker="erts:match_spec">match specification</seealso>
637
documentation in the ERTS User's Guide and <seealso
638
marker="ms_transform">ms_transform(3).</seealso></p></desc>
641
<name name="no_files"></name>
642
<desc><p>Actually an integer > 1.</p></desc>
645
<name name="key_pos"></name>
648
<name name="max_list_size"></name>
651
<name name="order"></name>
654
<name name="order_fun"></name>
657
<name name="query_cursor"></name>
658
<desc><p>A <seealso marker="#query_cursor">query cursor</seealso>.</p>
662
<name name="query_handle"></name>
663
<desc><p>A <seealso marker="#query_handle">query handle</seealso>.</p>
667
<name name="query_handle_or_list"></name>
670
<name name="query_list_comprehension"></name>
672
<seealso marker="#query_list_comprehension">query
673
list comprehension</seealso>.</p></desc>
676
<name name="spawn_options"></name>
679
<name name="sort_options"></name>
682
<name name="sort_option"></name>
683
<desc><p>See <seealso
684
marker="file_sorter">file_sorter(3)</seealso>.</p></desc>
687
<name name="tmp_directory"></name>
690
<name name="tmp_file_usage"></name>
685
<name>append(QHL) -> QH</name>
697
<name name="append" arity="1"/>
686
698
<fsummary>Return a query handle.</fsummary>
688
<v>QHL = [QueryHandleOrList]</v>
689
<v>QH = QueryHandle</v>
692
700
<p>Returns a query handle. When evaluating the query handle
693
<c>QH</c> all answers to the first query handle in
694
<c>QHL</c> is returned followed by all answers to the rest
695
of the query handles in <c>QHL</c>.</p>
701
<c><anno>QH</anno></c> all answers to the first query handle in
702
<c><anno>QHL</anno></c> are returned followed by all answers
703
to the rest of the query handles in <c><anno>QHL</anno></c>.</p>
700
<name>append(QH1, QH2) -> QH3</name>
708
<name name="append" arity="2"/>
701
709
<fsummary>Return a query handle.</fsummary>
703
<v>QH1 = QH2 = QueryHandleOrList</v>
704
<v>QH3 = QueryHandle</v>
707
711
<p>Returns a query handle. When evaluating the query handle
708
<c>QH3</c> all answers to <c>QH1</c> are returned followed
709
by all answers to <c>QH2</c>.</p>
712
<c><anno>QH3</anno></c> all answers to
713
<c><anno>QH1</anno></c> are returned followed by all answers
714
to <c><anno>QH2</anno></c>.</p>
711
716
<p><c>append(QH1, QH2)</c> is equivalent to
712
717
<c>append([QH1, QH2])</c>.</p>
780
771
1> <input>QH = qlc:q([{X,Y} || X <- [a,b], Y <- [1,2]]),</input>
781
772
<input>qlc:eval(QH).</input>
782
773
[{a,1},{a,2},{b,1},{b,2}]</pre>
774
<p><c>eval(<anno>QH</anno>)</c> is equivalent to
775
<c>eval(<anno>QH</anno>, [])</c>.</p>
787
<name>fold(Function, Acc0, QueryHandleOrList [, Options]) ->
780
<name name="fold" arity="3"/>
781
<name name="fold" arity="4"/>
789
782
<fsummary>Fold a function over the answers to a query.</fsummary>
791
<v>Function = fun(Answer, AccIn) -> AccOut</v>
792
<v>Acc0 = Acc1 = AccIn = AccOut = term()</v>
793
<v>Options = [Option] | Option</v>
794
<v>Option = {cache_all, Cache} | cache_all
795
| {max_list_size, MaxListSize}
796
| {tmpdir_usage, TmpFileUsage}
797
| {tmpdir, TempDirectory}
798
| {unique_all, bool()} | unique_all</v>
799
<v>Error = {error, module(), Reason}</v>
800
<v>Reason = - as returned by file_sorter(3) -</v>
803
<p>Calls <c>Function</c> on successive answers to the query
804
handle together with an extra argument <c>AccIn</c>. The
805
query handle and the function are evaluated in the calling
806
process. <c>Function</c> must return a new accumulator which
807
is passed to the next call. <c>Acc0</c> is returned if there
808
are no answers to the query handle.</p>
784
<p>Calls <c><anno>Function</anno></c> on successive answers to
785
the query handle together with an extra argument
786
<c><anno>AccIn</anno></c>. The query handle and the function
787
are evaluated in the calling process.
788
<c><anno>Function</anno></c> must return a new accumulator
789
which is passed to the next call.
790
<c><anno>Acc0</anno></c> is returned if there are no answers
791
to the query handle.</p>
811
794
1> <input>QH = [1,2,3,4,5,6],</input>
812
795
<input>qlc:fold(fun(X, Sum) -> X + Sum end, 0, QH).</input>
797
<p><c>fold(<anno>Function</anno>, <anno>Acc0</anno>,
798
<anno>QH</anno>)</c> is equivalent to
799
<c>fold(<anno>Function</anno>, <anno>Acc0</anno>,
800
<anno>QH</anno>, [])</c>.</p>
818
<name>format_error(Error) -> Chars</name>
805
<name name="format_error" arity="1"/>
819
806
<fsummary>Return an English description of a an error tuple.</fsummary>
821
<v>Error = {error, module(), term()}</v>
822
<v>Chars = [char() | Chars]</v>
825
808
<p>Returns a descriptive string in English of an error tuple
826
809
returned by some of the functions of the <c>qlc</c> module
936
903
method chosen. A convention is used for lookup join: the
937
904
first generator (<c>G2</c>) is the one traversed, the second
938
905
one (<c>G1</c>) is the table where constants are looked up.</p>
907
<p><c>info(<anno>QH</anno>)</c> is equivalent to
908
<c>info(<anno>QH</anno>, [])</c>.</p>
943
<name>keysort(KeyPos, QH1 [, SortOptions]) -> QH2</name>
913
<name name="keysort" arity="2"/>
914
<name name="keysort" arity="3"/>
944
915
<fsummary>Return a query handle.</fsummary>
946
<v>QH1 = QueryHandleOrList</v>
947
<v>QH2 = QueryHandle</v>
950
917
<p>Returns a query handle. When evaluating the query handle
951
<c>QH2</c> the answers to the query handle <c>QH1</c> are
918
<c><anno>QH2</anno></c> the answers to the query handle
919
<c><anno>QH1</anno></c> are sorted by <seealso
953
920
marker="file_sorter">file_sorter:keysort/4</seealso>
954
921
according to the options.</p>
956
<p>The sorter will use temporary files only if <c>QH1</c> does
957
not evaluate to a list and the size of the binary
958
representation of the answers exceeds <c>Size</c> bytes,
959
where <c>Size</c> is the value of the <c>size</c> option.</p>
923
<p>The sorter will use temporary files only if
924
<c><anno>QH1</anno></c> does not evaluate to a list and the
925
size of the binary representation of the answers exceeds
926
<c>Size</c> bytes, where <c>Size</c> is the value of the
927
<c>size</c> option.</p>
929
<p><c>keysort(<anno>KeyPos</anno>, <anno>QH1</anno>)</c>
931
<c>keysort(<anno>KeyPos</anno>, <anno>QH1</anno>, [])</c>.</p>
964
<name>next_answers(QueryCursor [, NumberOfAnswers]) ->
965
Answers | Error</name>
936
<name name="next_answers" arity="1"/>
937
<name name="next_answers" arity="2"/>
966
938
<fsummary>Return some or all answers to a query.</fsummary>
968
<v>NumberOfAnswers = all_remaining | int() > 0</v>
969
<v>Error = {error, module(), Reason}</v>
970
<v>Reason = - as returned by file_sorter(3) -</v>
973
940
<p>Returns some or all of the remaining answers to a query
974
cursor. Only the owner of <c>Cursor</c> can retrieve
941
cursor. Only the owner of <c><anno>QueryCursor</anno></c> can
942
retrieve answers.</p>
977
943
<p>The optional argument <c>NumberOfAnswers</c>determines the
978
944
maximum number of answers returned. The default value is
979
945
<c>10</c>. If less than the requested number of answers is
1201
<name>sort(QH1 [, SortOptions]) -> QH2</name>
1158
<name name="sort" arity="1"/>
1159
<name name="sort" arity="2"/>
1202
1160
<fsummary>Return a query handle.</fsummary>
1204
<v>QH1 = QueryHandleOrList</v>
1205
<v>QH2 = QueryHandle</v>
1208
1162
<p>Returns a query handle. When evaluating the query handle
1209
<c>QH2</c> the answers to the query handle <c>QH1</c> are
1163
<c><anno>QH2</anno></c> the answers to the query handle
1164
<c><anno>QH1</anno></c> are sorted by <seealso
1211
1165
marker="file_sorter">file_sorter:sort/3</seealso> according
1212
1166
to the options.</p>
1214
<p>The sorter will use temporary files only if <c>QH1</c> does
1215
not evaluate to a list and the size of the binary
1216
representation of the answers exceeds <c>Size</c> bytes,
1217
where <c>Size</c> is the value of the <c>size</c> option.</p>
1168
<p>The sorter will use temporary files only if
1169
<c><anno>QH1</anno></c> does not evaluate to a list and the
1170
size of the binary representation of the answers exceeds
1171
<c>Size</c> bytes, where <c>Size</c> is the value of the
1172
<c>size</c> option.</p>
1174
<p><c>sort(<anno>QH1</anno>)</c> is equivalent to
1175
<c>sort(<anno>QH1</anno>, [])</c>.</p>
1222
<name>string_to_handle(QueryString [, Options [, Bindings]]) ->
1223
QueryHandle | Error</name>
1181
<name name="string_to_handle" arity="1"/>
1182
<name name="string_to_handle" arity="2"/>
1183
<name name="string_to_handle" arity="3"/>
1224
1184
<fsummary>Return a handle for a query list comprehension.</fsummary>
1226
<v>QueryString = string()</v>
1227
<v>Options = [Option] | Option</v>
1228
<v>Option = {max_lookup, MaxLookup}
1229
| {cache, Cache} | cache
1232
| {unique, bool()} | unique</v>
1233
<v>MaxLookup = int() >= 0 | infinity</v>
1234
<v>Join = any | lookup | merge | nested_loop</v>
1235
<v>Lookup = bool() | any</v>
1236
<v>Bindings = - as returned by
1237
erl_eval:bindings/1 -</v>
1238
<v>Error = {error, module(), Reason}</v>
1239
<v>Reason = - ErrorInfo as returned by
1240
erl_scan:string/1 or erl_parse:parse_exprs/1 -</v>
1243
1186
<p>A string version of <c>qlc:q/1,2</c>. When the query handle
1244
1187
is evaluated the fun created by the parse transform is
1253
1196
<input>qlc:eval(QH).</input>
1199
<p><c>string_to_handle(<anno>QueryString</anno>)</c>
1201
<c>string_to_handle(<anno>QueryString</anno>, [])</c>.</p>
1203
<p><c>string_to_handle(<anno>QueryString</anno>,
1204
<anno>Options</anno>)</c>
1206
<c>string_to_handle(<anno>QueryString</anno>,
1207
<anno>Options</anno>, erl_eval:new_bindings())</c>.</p>
1256
1209
<p>This function is probably useful mostly when called from
1257
1210
outside of Erlang, for instance from a driver written in C.</p>
1262
<name>table(TraverseFun, Options) -> QueryHandle</name>
1215
<name name="table" arity="2"/>
1263
1216
<fsummary>Return a query handle for a table.</fsummary>
1265
<v>TraverseFun = TraverseFun0 | TraverseFun1</v>
1266
<v>TraverseFun0 = fun() -> TraverseResult</v>
1267
<v>TraverseFun1 = fun(MatchExpression) -> TraverseResult</v>
1268
<v>TraverseResult = Objects | term()</v>
1269
<v>Objects = [] | [term() | ObjectList]</v>
1270
<v>ObjectList = TraverseFun0 | Objects</v>
1271
<v>Options = [Option] | Option</v>
1272
<v>Option = {format_fun, FormatFun}
1273
| {info_fun, InfoFun}
1274
| {lookup_fun, LookupFun}
1275
| {parent_fun, ParentFun}
1276
| {post_fun, PostFun}
1278
| {key_equality, KeyComparison}</v>
1279
<v>FormatFun = undefined | fun(SelectedObjects) -> FormatedTable</v>
1280
<v>SelectedObjects = all
1281
| {all, NElements, DepthFun}
1282
| {match_spec, MatchExpression}
1283
| {lookup, Position, Keys}
1284
| {lookup, Position, Keys, NElements, DepthFun}</v>
1285
<v>NElements = infinity | int() > 0</v>
1286
<v>DepthFun = fun(term()) -> term()</v>
1287
<v>FormatedTable = {Mod, Fun, Args}
1288
| AbstractExpression
1289
| character_list()</v>
1290
<v>InfoFun = undefined | fun(InfoTag) -> InfoValue</v>
1291
<v>InfoTag = indices | is_unique_objects | keypos | num_of_objects</v>
1292
<v>InfoValue = undefined | term()</v>
1293
<v>LookupFun = undefined | fun(Position, Keys) -> LookupResult</v>
1294
<v>LookupResult = [term()] | term()</v>
1295
<v>ParentFun = undefined | fun() -> ParentFunValue</v>
1296
<v>PostFun = undefined | fun() -> void()</v>
1297
<v>PreFun = undefined | fun([PreArg]) -> void()</v>
1298
<v>PreArg = {parent_value, ParentFunValue} | {stop_fun, StopFun}</v>
1299
<v>ParentFunValue = undefined | term()</v>
1300
<v>StopFun = undefined | fun() -> void()</v>
1301
<v>KeyComparison = '=:=' | '=='</v>
1302
<v>Position = int() > 0</v>
1303
<v>Keys = [term()]</v>
1304
<v>Mod = Fun = atom()</v>
1305
<v>Args = [term()]</v>
1308
1218
<p><marker id="table"></marker>Returns a query handle for a
1309
1219
QLC table. In Erlang/OTP there is support for ETS, Dets and
1315
1225
as well as properties of the table are handled by callback
1316
1226
functions provided as options to <c>qlc:table/2</c>.</p>
1318
<p>The callback function <c>TraverseFun</c> is used for
1319
traversing the table. It is to return a list of objects
1320
terminated by either <c>[]</c> or a nullary fun to be used
1321
for traversing the not yet traversed objects of the table.
1322
Any other return value is immediately returned as value of
1323
the query evaluation. Unary <c>TraverseFun</c>s are to
1324
accept a match specification as argument. The match
1325
specification is created by the parse transform by analyzing
1326
the pattern of the generator calling <c>qlc:table/2</c> and
1327
filters using variables introduced in the pattern. If the
1328
parse transform cannot find a match specification equivalent
1329
to the pattern and filters, <c>TraverseFun</c> will be
1330
called with a match specification returning every object.
1331
Modules that can utilize match specifications for optimized
1228
<p>The callback function <c><anno>TraverseFun</anno></c> is
1229
used for traversing the table. It is to return a list of
1230
objects terminated by either <c>[]</c> or a nullary fun to
1231
be used for traversing the not yet traversed objects of the
1232
table. Any other return value is immediately returned as
1233
value of the query evaluation. Unary
1234
<c><anno>TraverseFun</anno></c>s are to accept a match
1235
specification as argument. The match specification is
1236
created by the parse transform by analyzing the pattern of
1237
the generator calling <c>qlc:table/2</c> and filters using
1238
variables introduced in the pattern. If the parse transform
1239
cannot find a match specification equivalent to the pattern
1240
and filters, <c><anno>TraverseFun</anno></c> will be called
1241
with a match specification returning every object. Modules
1242
that can utilize match specifications for optimized
1332
1243
traversal of tables should call <c>qlc:table/2</c> with a
1333
unary <c>TraverseFun</c> while other modules can provide a
1334
nullary <c>TraverseFun</c>. <c>ets:table/2</c> is an example
1335
of the former; <c>gb_table:table/1</c> in the <seealso
1336
marker="#implementing_a_qlc_table">Implementing a QLC
1337
table</seealso> section is an example of the latter.</p>
1245
<c><anno>TraverseFun</anno></c> while other modules can
1247
<c><anno>TraverseFun</anno></c>. <c>ets:table/2</c> is an
1248
example of the former; <c>gb_table:table/1</c> in the
1249
<seealso marker="#implementing_a_qlc_table">Implementing a
1250
QLC table</seealso> section is an example of the latter.</p>
1339
<p><c>PreFun</c> is a unary callback function that is called
1340
once before the table is read for the first time. If the
1341
call fails, the query evaluation fails. Similarly, the
1342
nullary callback function <c>PostFun</c> is called once
1343
after the table was last read. The return value, which is
1344
caught, is ignored. If <c>PreFun</c> has been called for a
1345
table, <c>PostFun</c> is guaranteed to be called for that
1346
table, even if the evaluation of the query fails for some
1347
reason. The order in which pre (post) functions for
1252
<p><c><anno>PreFun</anno></c> is a unary callback function
1253
that is called once before the table is read for the first
1254
time. If the call fails, the query evaluation fails.
1255
Similarly, the nullary callback function
1256
<c><anno>PostFun</anno></c> is called once after the table
1257
was last read. The return value, which is caught, is
1258
ignored. If <c><anno>PreFun</anno></c> has been called for a
1260
<c><anno>PostFun</anno></c> is guaranteed to be called for
1261
that table, even if the evaluation of the query fails for
1262
some reason. The order in which pre (post) functions for
1348
1263
different tables are evaluated is not specified. Other table
1349
access than reading, such as calling <c>InfoFun</c>, is
1350
assumed to be OK at any time. The argument <c>PreArgs</c> is
1351
a list of tagged values. Currently there are two tags,
1264
access than reading, such as calling
1265
<c><anno>InfoFun</anno></c>, is assumed to be OK at any
1266
time. The argument <c><anno>PreArgs</anno></c> is a list of
1267
tagged values. Currently there are two tags,
1352
1268
<c>parent_value</c> and <c>stop_fun</c>, used by Mnesia for
1353
1269
managing transactions. The value of <c>parent_value</c> is
1354
the value returned by <c>ParentFun</c>, or <c>undefined</c>
1355
if there is no <c>ParentFun</c>. <c>ParentFun</c> is called
1356
once just before the call of <c>PreFun</c> in the context of
1357
the process calling <c>eval</c>, <c>fold</c>, or
1270
the value returned by <c><anno>ParentFun</anno></c>, or
1271
<c>undefined</c> if there is no <c>ParentFun</c>.
1272
<c><anno>ParentFun</anno></c> is called once just before the
1274
<c><anno>PreFun</anno></c> in the context of the process
1276
<c>eval</c>, <c>fold</c>, or
1358
1277
<c>cursor</c>. The value of <c>stop_fun</c> is a nullary fun
1359
1278
that deletes the cursor if called from the parent, or
1360
1279
<c>undefined</c> if there is no cursor.</p>
1362
1281
<p><marker id="lookup_fun"></marker>The binary callback
1363
function <c>LookupFun</c> is used for looking up objects in
1364
the table. The first argument <c>Position</c> is the key
1365
position or an indexed position and the second argument
1366
<c>Keys</c> is a sorted list of unique values. The return
1367
value is to be a list of all objects (tuples) such that the
1368
element at <c>Position</c> is a member of <c>Keys</c>. Any
1369
other return value is immediately returned as value of the
1370
query evaluation. <c>LookupFun</c> is called instead of
1282
function <c><anno>LookupFun</anno></c> is used for looking
1283
up objects in the table. The first argument
1284
<c><anno>Position</anno></c> is the key position or an
1285
indexed position and the second argument
1286
<c><anno>Keys</anno></c> is a sorted list of unique values.
1287
The return value is to be a list of all objects (tuples)
1288
such that the element at <c>Position</c> is a member of
1289
<c><anno>Keys</anno></c>. Any other return value is
1290
immediately returned as value of the query evaluation.
1291
<c><anno>LookupFun</anno></c> is called instead of
1371
1292
traversing the table if the parse transform at compile time
1372
1293
can find out that the filters match and compare the element
1373
at <c>Position</c> in such a way that only <c>Keys</c> need
1374
to be looked up in order to find all potential answers. The
1375
key position is obtained by calling <c>InfoFun(keypos)</c>
1376
and the indexed positions by calling
1377
<c>InfoFun(indices)</c>. If the key position can be used for
1378
lookup it is always chosen, otherwise the indexed position
1379
requiring the least number of lookups is chosen. If there is
1380
a tie between two indexed positions the one occurring first
1381
in the list returned by <c>InfoFun</c> is chosen. Positions
1382
requiring more than <seealso
1383
marker="#max_lookup">max_lookup</seealso> lookups are
1294
at <c><anno>Position</anno></c> in such a way that only
1295
<c><anno>Keys</anno></c> need to be looked up in order to
1296
find all potential answers. The key position is obtained by
1298
<c><anno>InfoFun</anno>(keypos)</c> and the indexed
1299
positions by calling
1300
<c><anno>InfoFun</anno>(indices)</c>. If the key position
1301
can be used for lookup it is always chosen, otherwise the
1302
indexed position requiring the least number of lookups is
1303
chosen. If there is a tie between two indexed positions the
1304
one occurring first in the list returned by
1305
<c><anno>InfoFun</anno></c> is chosen. Positions requiring
1306
more than <seealso marker="#max_lookup">max_lookup</seealso>
1307
lookups are ignored.</p>
1386
<p>The unary callback function <c>InfoFun</c> is to return
1387
information about the table. <c>undefined</c> should be
1388
returned if the value of some tag is unknown:</p>
1309
<p>The unary callback function <c><anno>InfoFun</anno></c> is
1310
to return information about the table. <c>undefined</c>
1311
should be returned if the value of some tag is unknown:</p>
1390
1313
<list type="bulleted">
1391
1314
<item><c>indices</c>. Returns a list of indexed
1409
<p>The unary callback function <c>FormatFun</c> is used by
1410
<seealso marker="#info">qlc:info/1,2</seealso> for
1411
displaying the call that created the table's query handle.
1412
The default value, <c>undefined</c>, means that
1332
<p>The unary callback function <c><anno>FormatFun</anno></c>
1333
is used by <seealso marker="#info">qlc:info/1,2</seealso>
1334
for displaying the call that created the table's query
1335
handle. The default value, <c>undefined</c>, means that
1413
1336
<c>info/1,2</c> displays a call to <c>'$MOD':'$FUN'/0</c>.
1414
It is up to <c>FormatFun</c> to present the selected objects
1415
of the table in a suitable way. However, if a character list
1416
is chosen for presentation it must be an Erlang expression
1417
that can be scanned and parsed (a trailing dot will be added
1418
by <c>qlc:info</c> though). <c>FormatFun</c> is called with
1419
an argument that describes the selected objects based on
1420
optimizations done as a result of analyzing the filters of
1421
the QLC where the call to <c>qlc:table/2</c> occurs. The
1422
possible values of the argument are:</p>
1337
It is up to <c><anno>FormatFun</anno></c> to present the
1338
selected objects of the table in a suitable way. However, if
1339
a character list is chosen for presentation it must be an
1340
Erlang expression that can be scanned and parsed (a trailing
1341
dot will be added by <c>qlc:info</c> though).
1342
<c><anno>FormatFun</anno></c> is called with an argument
1343
that describes the selected objects based on optimizations
1344
done as a result of analyzing the filters of the QLC where
1346
<c>qlc:table/2</c> occurs. The possible values of the
1424
1349
<list type="bulleted">
1425
1350
<item><c>{lookup, Position, Keys, NElements, DepthFun}</c>.