<style type="text/css">
        <!--
                @page { margin: 0.79in }
                P { margin-bottom: 0.08in }
        -->
        </style>
<p style="margin-bottom:0in">Please comment on the merits of 2
different methods of interfacing Racket to a database.</p>
<p style="margin-bottom:0in">
</p>
<p style="margin-bottom:0in">Is Method B preferable to Method A? If
so, why?</p>
<p style="margin-bottom:0in">
</p>
<p style="margin-bottom:0in">Method A</p>
<p style="margin-bottom:0in">Instead of using the Racket fn:</p>
<p style="margin-bottom:0in">(query-exec db1 "create temporary
table table1 (...</p>
<p style="margin-bottom:0in">I can use Racket's 'system' function,
to issue SQLite3 sql command: create table table1(...
</p>
<p style="margin-bottom:0in">and then issue SQLite3 dot commands
such as '.import' to load a million lines of data from a file into a
new SQLite db.</p>
<p style="margin-bottom:0in">I can then proceed to use Racket's SQL
db access commands to insert or select data.
</p>
<p style="margin-bottom:0in">
</p>
<p style="margin-bottom:0in">OR</p>
<p style="margin-bottom:0in">
</p>
<p style="margin-bottom:0in">Method B</p>
<p style="margin-bottom:0in">Racket fn:</p>
<p style="margin-bottom:0in">(query-exec db1 "create temporary
table table1 (...</p>
<p style="margin-bottom:0in">Racket does not implement SQLite dot
commands, so either:</p>
<p style="margin-bottom:0in">a) write a million Racket SQL commands
such as:
</p>
<p style="margin-bottom:0in"> (query-exec db1 "insert into
table1 values ('a1', 'b2' 'c3')")</p>
<p style="margin-bottom:0in"> (query-exec db1 "insert into
table1 values ('aaa', 'bbb' 'ccc')")</p>
<p style="margin-bottom:0in">etc.</p>
<p style="margin-bottom:0in">
</p>
<p style="margin-bottom:0in">OR</p>
<p style="margin-bottom:0in">
</p>
<p style="margin-bottom:0in">b) write a function:</p>
<p style="margin-bottom:0in"> (query-exec db1 "insert into
table1 values (list-loop)")</p>
<p style="margin-bottom:0in">where:</p>
<p style="margin-bottom:0in">(list-loop) is a function that loops
through each of the million lines in a data file that are intended
for the database: db1.</p>
<p style="margin-bottom:0in">
</p>
<p style="margin-bottom:0in">-----</p>
<p style="margin-bottom:0in">I understand that creating a temporary
table means that the table will be disk based rather than memory
based. Creating a table via a system call would also create a disk
based db.</p><p style="margin-bottom:0in">Thanks again.<br></p>
<div class="filter-settings-button">Filter settings</div>