In this part of our blog we will be explaning the
implementation of our Course Project done as a part of the OOP Course.
SQL (Structured Query Language) is a way to communicate with
a database that lets
you define a query to modify and control the data. We have
developed the project using C++ so the accessing of SQL functions is done
through SQLite Library.
We have implemented the following functions on a database
of 20 Students (custom made database) with the record consisting of their ID,
Name, Surname, Branch and CGPA :
1. Insert Record
2. Delete Record
3. Search Record
4. Modify Record
5. Order by
6. Group by
A breif insight into the SQLite Library:
SQLite is a self-contained, high-reliability, embedded,
full-featured, public-domain, SQL database engine. It is free for use for any
purpose, commercial or private. Ordinary disk files can be easily read and
written by SQLite because it does not have any separate server like SQL.The
SQLite database file format is cross-platform so that anyone can easily copy a
database between 32-bit and 64-bit systems.
Basic routines in SQLite:
sqlite3_open (const char *filename, sqlite3 **ppDb)
This routine opens a connection to a SQLite database file
and returns a database connection object
for other SQLite programs.
sqlite3_exec(sqlite3*, const char *sql, sqlite_callback,
void *data, char **errmsg)
This routine provides a shortcut to execute SQL commands,
which are provided by the sql
parameter and can consist of multiple SQL commands.
sqlite3_close(sqlite3*)
This routine closes the database connection opened before
calling sqlite3_open(). All connection-
related statements should be completed before the connection
is closed.
The Callback function
The callback function provides a SELECT The way the
statement gets the result.
It is stated as follows:
typedef int (*sqlite3_callback)(
void*, /* Data provided in the 4th argument of
sqlite3_exec() */
int,
/* The number of columns in row */
char**, /* An array of strings representing fields in the
row */
char** /* An array of strings representing column names */
);
If the above callback is in sqlite_exec() As the
third parameter in the program, SQLite will call
this callback function for each record processed in each
SELECT statement executed within the
SQL parameter.
This was a basic introduction of the functionality and use of SQLite in our project.
This was a basic introduction of the functionality and use of SQLite in our project.
The website referred for this part is : https://www.welookups.com/sqlite/sqlite-c-cpp.html
In the upcoming blogs we will be going through the practical
execution of the above mentioned routines to develop the project.
Smruti Khire
K 38
Nice and interesting topic for project
ReplyDeleteThank you!!
DeletePretty informative 👍
ReplyDeleteThank you!!
ReplyDeleteOh my god!... Was it always this easy!... Smruti please be my professor!🙂
ReplyDeleteSure!!
DeleteNice and informative.... Because I rarely used sqlite in c++ ...this is very useful
ReplyDeleteThank you
DeleteNice & very useful
ReplyDeleteThank you
DeleteThank you
ReplyDelete