@@ -11,14 +11,18 @@
1111 \begin{document}
1212 \section{Introduction}
1313\label{Introduction}
14−This document provides overview on how the library for SQLite works. The code base is written on top of the
14+This document provides overview on how the Idris library for SQLite3 works. The code base is written on top of the
1515SQLite3 C/C++ Interface.
1616This library supports some features of the low-level library, implemented in a higher level basis.
17−The library allows making use of data types as queries. The aim of this library is to avoid
17+The library allows making use of queries as data types. The aim of this library is to avoid
1818SQL injections which are the most common security issues.
1919To avoid this we have defined a datatype which describes queries.
2020The queries are written using these data types and parsed as quoted string
21−while replacing values with indexed question mark to be binded with the statement.
21+while replacing values with \emph{indexed question mark} to be binded with the prepared statement.
22+This prevents the user from preparing the queries inappropriately by not allowing to pass
23+any types of values directly to the prepare function. However this is a design choice, the library
24+does not prevent the user from passing a String directly to the prepare function.
25+
2226\section{Using the library}
2327\label{Using the library}
2428Simple examples have been provided in the \emph{testunit.idr} file.
@@ -47,7 +51,7 @@ filling up the list with the received values. For instance the following is a va
4751let sql = evalSQL [ ] ((SELECT ALL)(TBL ["tbl1"]) (MkCond (MkNULL (VCol "data"))))
4852\newline
4953\newline{This will be parsed as :}
50−\\“SELECT * FROM tbl1 WHERE data IS NULL “
54+\b{“SELECT * FROM tbl1 WHERE data IS NULL “}
5155
5256The evaluator returns a string and a list of indexed values.
5357The string part of the query could be parsed to prepare.
@@ -56,7 +60,8 @@ storing them in the list given to it as an argument.
5660For example:
5761
5862
59−evalSQL [ ] (SELECT (Cols ["data"]) (SELECT (Cols["num","data"]) (TBL ["tbl1"])(MkCond(Equals(VCol "num")(VInt 2))))Empty))
63+evalSQL [ ] (SELECT (Cols ["data"]) (SELECT (Cols["num","data"]) (TBL ["tbl1"])
64+\newline (MkCond(Equals(VCol "num")(VInt 2))))Empty))
6065
6166is passed to prepare as :
6267
@@ -137,8 +142,8 @@ The library includes some wrapper functions such as get\_table
137142and exec\_db. Using these functions mixed with prepare, step or finalize
138143inappropriately could cause segmentation faults.
139144Perhaps these functions could be removed from the library if no longer required in the future
140−since the main purpose of this library is to make use of data types, or perhaps
141−these functionalities could be implemented internally without calling
145+since the main purpose of this library is to make use of data types.
146+However these functionalities could be implemented internally without calling
142147the C Interface wrapper functions.
143148
144149\section{Further improving the library}
@@ -146,4 +151,7 @@ the C Interface wrapper functions.
146151There are many features that could be added to this library. These include adding more useful SQL Commands,
147152extending the SQL datatype to support more complex queries and possibly improving \emph{evalSQL}
148153for a faster performance.
154+Another useful thing to implement is the dot operator(.) which is the member access operator to yield
155+the value of a field in a table. This enables comparing values in different tables and constructing
156+more complex queries.
149157\end{document}