<commit_before>{-# LANGUAGE ForeignFunctionInterface, DeriveDataTypeable #-}
{-# LANGUAGE OverloadedStrings #-}
{-# LANGUAGE CPP #-}
-- | A port of the direct-sqlite package for dealing directly with
-- 'PersistValue's.
module Database.Sqlite  (
                         Connection,
                         Statement,
                         Error(..),
                         SqliteException(..),
                         StepResult(Row,
                                    Done),
                         Config(ConfigLogFn),
                         LogFunction,
                         SqliteStatus (..),
                         SqliteStatusVerb (..),
                         open,
                         close,
                         prepare,
                         step,
                         stepConn,
                         reset,
                         finalize,
                         bindBlob,
                         bindDouble,
                         bindInt,
                         bindInt64,
                         bindNull,<commit_msg>Add some low level documentation<commit_after>{-# LANGUAGE ForeignFunctionInterface, DeriveDataTypeable #-}
{-# LANGUAGE OverloadedStrings #-}
{-# LANGUAGE CPP #-}
-- | A port of the direct-sqlite package for dealing directly with
-- 'PersistValue's.
module Database.Sqlite  (
                         Connection,
                         Statement,
                         Error(..),
                         SqliteException(..),
                         StepResult(Row,
                                    Done),
                         Config(ConfigLogFn),
                         LogFunction,
                         SqliteStatus (..),
                         SqliteStatusVerb (..),
    -- * Basic usage guide
    -- |
    --
    -- Let's create a small demo sqlite3 database which we will use:
    --
    -- > $ sqlite3 ~/test.db
    -- > sqlite> create table t1(a,b);
    -- > sqlite> insert into t1(a,b) values (1,1);
    -- > sqlite> insert into t1(a,b) values (2,2);
    -- > sqlite> select * from t1;
    -- > 1|1
    -- > 2|2
    --
    -- Now let's write code using the functions in this module to fetch the rows from the table:
    --
    -- > {-#LANGUAGE OverloadedStrings#-}
    -- > 
    -- > import Database.Sqlite
    -- > import Data.Text
    -- > 
    -- > main :: IO ()
    -- > main = do
    -- >   conn <- open "/home/sibi/test.db"
    -- >   smt <- prepare conn "select * from t1;"
    -- >   row1 <- step smt >> columns smt
    -- >   row2 <- step smt >> columns smt
    -- >   print (row1, row2)
    -- >   finalize smt
    -- >   close conn
    --
    -- On executing the above code:
    --
    -- > $ ./demo-program
    -- > $ ([PersistInt64 1,PersistInt64 1],[PersistInt64 2,PersistInt64 2])

                         open,
                         close,
                         prepare,
                         step,
                         stepConn,
                         reset,
                         finalize,
                         bindBlob,
                         bindDouble,
                         bindInt,
                         bindInt64,
                         bindNull,
{'fraction_non_alphanumeric': 0.10273972602739725, 'fraction_numerical': 0.010896637608966376, 'mean_word_length': 0.9011834319526627, 'pattern_counts': {'":': 0, '<': 7, '<?xml version=': 0, '>': 34, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 2, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '6943117', 'n_tokens_mistral': 851, 'n_tokens_neox': 772, 'n_words': 191}