Skip to content

Commit b17a424

Browse files
committed
Refactor database connection paths and remove unused files
1 parent dd0ea0e commit b17a424

File tree

8 files changed

+11
-21
lines changed

8 files changed

+11
-21
lines changed

examples/pagination.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
require_once '../../../autoload.php';
77

88
// register the database connection settings
9-
require_once '../connect/db-connect.php';
9+
require_once '../src/connect/db-connect.php';
1010

1111
// create a new PdoSelectParams object with the parameters for the query
1212
$from = 'customers';

examples/select.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
require_once '../../../autoload.php';
66

77
// register the database connection settings
8-
require_once '../connect/db-connect.php';
8+
require_once '../src/connect/db-connect.php';
99

1010
// connect, then test the connection and retrieve the error if the database is not connected
1111
$db = new Db();

src/database/DB.php renamed to src/Db.php

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -7,26 +7,26 @@
77
use PDO;
88

99
/**
10-
* DB class - PDO Database abstraction layer class
10+
* Db class - PDO Database abstraction layer class
1111
*
12-
* The DB class is a database abstraction layer that provides a simple, consistent interface
12+
* The Db class is a database abstraction layer that provides a simple, consistent interface
1313
* for interacting with different types of databases. It handles connection management, query execution,
1414
* pagination and result processing, allowing developers to focus on the business logic of their application.
1515
*
1616
* Full documentation with code examples is available here: {@link [https://www.phpformbuilder.pro/documentation/php-pdo-database-class.php] [https://www.phpformbuilder.pro/documentation/php-pdo-database-class.php]}
1717
*
18-
* The DB class is designed to be flexible and extensible, allowing developers to easily customize it
18+
* The Db class is designed to be flexible and extensible, allowing developers to easily customize it
1919
* to meet their specific needs. It supports multiple database types, including MySQL, PostgreSQL, Firebird,
2020
* and Oracle, and can be easily extended to support additional databases.
2121
22-
* The DB class is designed to be easy to use and understand. It provides a set of simple, intuitive methods
22+
* The Db class is designed to be easy to use and understand. It provides a set of simple, intuitive methods
2323
* for executing queries and retrieving data, and it automatically handles error handling and debugging.
2424
* This makes it easy for developers to quickly get up and running with the class, without having to worry
2525
* about low-level details such as database connections and query execution.
2626
27-
* In addition, the DB class is designed to be highly efficient and fast. It uses the latest database features
27+
* In addition, the Db class is designed to be highly efficient and fast. It uses the latest database features
2828
* and optimization techniques to ensure that queries are executed quickly and efficiently, without sacrificing
29-
* performance. This means that applications built using the DB class can scale easily and perform well under
29+
* performance. This means that applications built using the Db class can scale easily and perform well under
3030
* load, even with large amounts of data.
3131
*
3232
* @api

src/database/Pagination.php renamed to src/Pagination.php

Lines changed: 1 addition & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -58,7 +58,7 @@
5858
* - `rewrite_transition`: This is the character that is used to indicate the start of the querystring parameters in the URL (for example, `-` for `example.com/page-1-2.html`).
5959
* - `rewrite_extension`: This is the extension that is added to the end of the URL when the links are being rewritten (for example, `.html`).
6060
*/
61-
class Pagination extends DB
61+
class Pagination extends Db
6262
{
6363
public string $pagine = '';
6464
private PdoSelectParams|PdoQueryParams $pdo_params;
@@ -97,16 +97,6 @@ public function __construct(mixed $pdo_params, mixed $user_options = [])
9797
parent::__construct();
9898
}
9999

100-
/**
101-
* Checks if the database connection is established.
102-
*
103-
* @return bool Returns true if the database connection is established, false otherwise.
104-
*/
105-
public function isConnected(): bool
106-
{
107-
return parent::isConnected();
108-
}
109-
110100
/**
111101
* Build pagination
112102
*

src/database/PdoQueryParams.php renamed to src/PdoQueryParams.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ class PdoQueryParams
77
/**
88
* Class PdoQueryParams
99
* Represents the parameters of a PDO query.
10-
* PdoQueryParams are used in the Pagination class constructor to set the PDO parameters for the DB::Query function
10+
* PdoQueryParams are used in the Pagination class constructor to set the PDO parameters for the Db::Query function
1111
*
1212
* Example of use:
1313
*

src/database/PdoSelectParams.php renamed to src/PdoSelectParams.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ class PdoSelectParams
77
/**
88
* Class PdoSelectParams
99
* Represents the parameters for a PDO select query.
10-
* PdoSelectParams are used in the Pagination class constructor to set the PDO parameters for the DB::Select function
10+
* PdoSelectParams are used in the Pagination class constructor to set the PDO parameters for the Db::Select function
1111
*
1212
* Example of use:
1313
*
File renamed without changes.
File renamed without changes.

0 commit comments

Comments
 (0)