SQLite

From Team Developer SqlWindows Wiki
Jump to: navigation, search

SQLite


Contents


Pointer2.png SQLite Functional Class Pointer.png


By Alfredo Monasi


The idea of this library is that you can use SQLite on your projects.
It's easy to implement and use, I only probe it with strings and numbers but shouldn't be a problem using dates.


How to use

  • In your current project use tools / .Net Explorer / Choose the assembly file and pick up DB.dll
(you also need in the same directory System.Data.SQLite.dll and System.Data.SQLite.Linq.dll)
  • The proxy classes will be generated and a DB_SQLiteGupta will be able to use in your project.


Note: I had to modify the apl of the proxy class when passing two arrays, when parsing the second array
I had to reset the counter otherwise the second array would travel empty.


Functions

ClearDB Delete all rows of all user tables of the database.
ClearTable Delete all rows of a specific table.
Delete Do a delete sql sentence, need to specify a table, and the where condition.
ExecuteNonQuery Execute a sentence, could be a create table, create index, alter, drop, even insert, delete or update. You need to specify the command, the second parameter return the rows affected in the operation. If successful the operation execute an autocommit else return false.
Execute Scalar Return a String of a sql select command, if command return more than one row only take the first row and the first column.
ExecuteTransaction Receive an Array of sql statements, if everything is correct will commit all the transaction otherwise will be rollback.
Insert Receive one String (the table name) and two arrays, the first one is for the column names and

the other for the values. Internally build the insert statement and execute it.

mostrarError Return the last error message.
SQLiteGupta_Overload1 Specify the path and the database-name and create it or use the database-file.
SQLiteGupta_Overload2 Need two arrays, the first one are parameters of connection and the second array is the value option for each parameter connection supported by SQLite3 implementation, look for documentation. I haven't test this function personally.
SQLiteGupta_Release Dispose all the objects related to the class.
Update Receive one String (the table name), two arrays, the first one is for the column names and the other for the values. Internally build the update statement and execute it. The last parameter is where condition of the update statement.
Update Receive one String (the table name), two arrays, the first one is for the column names and the other for the values. Internally build the update statement and execute it. The next parameter is where condition of the update statement. The last parameter return the number of rows affected by the update.
WriteXMLResult Receive a query statement and if it's valid write a XML in the path specify in the second parameter.


Any bug report, doubt or problems please feel free to write me an email:
Email : Alfredo Monasi


Here to download the archive (version 1.0, TD 6.2):
Down.png SQLite_Monasi.zip