<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">My use of the term ".import",
is in reference to the SQLite3 database dot command.</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: connection
function: (define db1 (sqlite3-connect ...</p>
<p style="margin-bottom:0in">I can use Racket's 'system' function,
to 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">Use the Racket: connection function:
(define db1 (sqlite3-connect ...</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:merits of 2
different methods of interfacing Racket to a database</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">THANKS.<br>
</p>
<div class="filter-settings-button">Filter settings</div>