SQLite
extends Base
in package
Class SQLite
A class to handle SQLite connections and queries
Table of Contents
Properties
- $author : mixed
- $debug_log : mixed
- $debugger : mixed
- $name : mixed
- $url : mixed
- $vars : mixed
- $verbose : mixed
- $version : mixed
Methods
- __construct() : mixed
- clean() : mixed
- res() : array<string|int, mixed>
- sqlite_create_db() : array<string|int, mixed>
- sqlite_create_table() : array<string|int, mixed>
- Create a table in the database.
- sqlite_delete() : bool
- Delete data from a table.
- sqlite_drop_db() : array<string|int, mixed>
- sqlite_drop_table() : array<string|int, mixed>
- Drop a table from the database.
- sqlite_empty_table() : array<string|int, mixed>
- Empty a table in the database.
- sqlite_function() : array<string|int, mixed>
- SQLite function wrapper.
- sqlite_get_columns() : array<string|int, mixed>
- Get a list of columns in a table.
- sqlite_get_dbs() : array<string|int, mixed>
- Get a list of databases in the directory.
- sqlite_get_tables() : array<string|int, mixed>
- Get a list of tables in the database.
- sqlite_insert() : bool
- Insert data into a table.
- sqlite_query() : array<string|int, mixed>
- Execute a query.
- sqlite_select() : array<string|int, mixed>
- Select data from a table.
- sqlite_select_db() : array<string|int, mixed>
- sqlite_table_exists() : bool
- Check if a table exists in the database.
- sqlite_update() : bool
- Update data in a table.
- sqlite_version() : array<string|int, mixed>
- Get the SQLite version.
Properties
$author
public
mixed
$author
= "Darknetzz"
$debug_log
public
mixed
$debug_log
= []
$debugger
public
mixed
$debugger
$name
public
mixed
$name
= "PHPUtils"
$url
public
mixed
$url
= "https://github.com/Darknetzz"
$vars
public
mixed
$vars
$verbose
public
mixed
$verbose
= \true
$version
public
mixed
$version
= "1.0.0"
Methods
__construct()
public
__construct() : mixed
clean()
public
clean(mixed $string) : mixed
Parameters
- $string : mixed
res()
public
res([string $status = "UNKNOWN" ][, mixed $data = "No data." ]) : array<string|int, mixed>
Parameters
- $status : string = "UNKNOWN"
- $data : mixed = "No data."
Return values
array<string|int, mixed>sqlite_create_db()
public
sqlite_create_db([string $dbname = 'database' ]) : array<string|int, mixed>
Parameters
- $dbname : string = 'database'
Return values
array<string|int, mixed>sqlite_create_table()
Create a table in the database.
public
sqlite_create_table(SQLite3 $db, string $table_name[, array<string|int, mixed> $columns = ["column_name" => "column_type"] ]) : array<string|int, mixed>
Parameters
- $db : SQLite3
-
The database connection.
- $table_name : string
-
The name of the table.
- $columns : array<string|int, mixed> = ["column_name" => "column_type"]
-
An associative array of column names and types. The key is the column name, the value is the column type. Example: ["column_name" => "column_type"] You don't need to specify the "id" column, it's automatically created as an INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL.
Return values
array<string|int, mixed>sqlite_delete()
Delete data from a table.
public
sqlite_delete(SQLite3 $db, string $table, string $where, array<string|int, mixed> $params) : bool
Parameters
- $db : SQLite3
-
The database connection.
- $table : string
-
The name of the table.
- $where : string
-
The WHERE clause.
- $params : array<string|int, mixed>
-
An array of parameters to bind to the WHERE clause.
Return values
bool —TRUE on success, FALSE on failure.
sqlite_drop_db()
public
sqlite_drop_db([string $dbname = 'database' ]) : array<string|int, mixed>
Parameters
- $dbname : string = 'database'
Return values
array<string|int, mixed>sqlite_drop_table()
Drop a table from the database.
public
sqlite_drop_table(SQLite3 $db, string $table_name) : array<string|int, mixed>
Parameters
- $db : SQLite3
-
The database connection.
- $table_name : string
-
The name of the table.
Return values
array<string|int, mixed>sqlite_empty_table()
Empty a table in the database.
public
sqlite_empty_table(SQLite3 $db, string $table_name) : array<string|int, mixed>
Parameters
- $db : SQLite3
-
The database connection.
- $table_name : string
-
The name of the table.
Return values
array<string|int, mixed>sqlite_function()
SQLite function wrapper.
public
sqlite_function(mixed $func_name, mixed ...$params) : array<string|int, mixed>
Parameters
- $func_name : mixed
- $params : mixed
Return values
array<string|int, mixed>sqlite_get_columns()
Get a list of columns in a table.
public
sqlite_get_columns(SQLite3 $db, string $table_name) : array<string|int, mixed>
Parameters
- $db : SQLite3
-
The database connection.
- $table_name : string
-
The name of the table.
Return values
array<string|int, mixed> —An array of column names.
sqlite_get_dbs()
Get a list of databases in the directory.
public
sqlite_get_dbs([string $dir = '.' ]) : array<string|int, mixed>
Parameters
- $dir : string = '.'
-
The directory to search.
Return values
array<string|int, mixed> —An array of database names.
sqlite_get_tables()
Get a list of tables in the database.
public
sqlite_get_tables(SQLite3 $db) : array<string|int, mixed>
Parameters
- $db : SQLite3
-
The database connection.
Return values
array<string|int, mixed> —An array of table names.
sqlite_insert()
Insert data into a table.
public
sqlite_insert(SQLite3 $db, string $table, array<string|int, mixed> $data) : bool
Parameters
- $db : SQLite3
-
The database connection.
- $table : string
-
The name of the table.
- $data : array<string|int, mixed>
-
An associative array of column names and values. The key is the column name, the value is the value to insert. Example: ["column_name" => "value"]
Return values
bool —TRUE on success, FALSE on failure.
sqlite_query()
Execute a query.
public
sqlite_query(SQLite3 $db, string $query) : array<string|int, mixed>
Parameters
- $db : SQLite3
-
The database connection.
- $query : string
-
The query to execute.
Return values
array<string|int, mixed>sqlite_select()
Select data from a table.
public
sqlite_select(SQLite3 $db, string $table[, array<string|int, mixed> $columns = ["*"] ][, string $where = "" ][, array<string|int, mixed> $params = [] ][, string $order = "" ][, string $limit = "" ]) : array<string|int, mixed>
Parameters
- $db : SQLite3
-
The database connection.
- $table : string
-
The name of the table.
- $columns : array<string|int, mixed> = ["*"]
-
An array of column names to select.
- $where : string = ""
-
The WHERE clause.
- $params : array<string|int, mixed> = []
-
An array of parameters to bind to the WHERE clause.
- $order : string = ""
-
The ORDER BY clause.
- $limit : string = ""
-
The LIMIT clause.
Return values
array<string|int, mixed>sqlite_select_db()
public
sqlite_select_db([string $dbname = 'database' ]) : array<string|int, mixed>
Parameters
- $dbname : string = 'database'
Return values
array<string|int, mixed>sqlite_table_exists()
Check if a table exists in the database.
public
sqlite_table_exists(SQLite3 $db, string $table_name) : bool
Parameters
- $db : SQLite3
-
The database connection.
- $table_name : string
-
The name of the table.
Return values
bool —TRUE if the table exists, FALSE if it doesn't.
sqlite_update()
Update data in a table.
public
sqlite_update(SQLite3 $db, string $table, array<string|int, mixed> $data, string $where, array<string|int, mixed> $params) : bool
Parameters
- $db : SQLite3
-
The database connection.
- $table : string
-
The name of the table.
- $data : array<string|int, mixed>
-
An associative array of column names and values. The key is the column name, the value is the value to update. Example: ["column_name" => "value"]
- $where : string
-
The WHERE clause.
- $params : array<string|int, mixed>
-
An array of parameters to bind to the WHERE clause.
Return values
bool —TRUE on success, FALSE on failure.
sqlite_version()
Get the SQLite version.
public
sqlite_version([mixed $filter = Null ]) : array<string|int, mixed>
Parameters
- $filter : mixed = Null