Skip to content

Commit

Permalink
refactor: rename package to leeqvip
Browse files Browse the repository at this point in the history
  • Loading branch information
leeqvip committed Oct 23, 2022
1 parent d78d2fa commit 89163d7
Show file tree
Hide file tree
Showing 9 changed files with 17 additions and 21 deletions.
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -16,15 +16,15 @@ the current supported databases are:
Use [Composer](https://getcomposer.org/)

```
composer require techone/database
composer require leeqvip/database
```

### Usage

```php
require_once './vendor/autoload.php';

use TechOne\Database\Manager;
use Leeqvip\Database\Manager;

$config = [
'type' => 'mysql', // mysql,pgsql,sqlite,sqlsrv
Expand Down
8 changes: 4 additions & 4 deletions composer.json
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
{
"name": "techone/database",
"name": "leeqvip/database",
"keywords": ["pdo", "database", "orm", "framework"],
"description": "PDO database library",
"authors": [
{
"name": "TechLee",
"email": "techlee@qq.com"
"name": "leeqvip",
"email": "leeqvip@gmail.com"
}
],
"license": "Apache-2.0",
Expand All @@ -15,7 +15,7 @@
},
"autoload": {
"psr-4": {
"TechOne\\Database\\": "src/"
"Leeqvip\\Database\\": "src/"
}
}
}
12 changes: 4 additions & 8 deletions src/Connection.php
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
<?php
namespace TechOne\Database;

namespace Leeqvip\Database;

use InvalidArgumentException;
use PDO;
Expand Down Expand Up @@ -28,12 +29,12 @@ public function __construct(array $config = [])

$connector = ucfirst($connector);

$connector = '\\TechOne\\Database\\Connectors\\' . $connector;
$connector = '\\Leeqvip\\Database\\Connectors\\' . $connector;

if (!class_exists($connector)) {
throw new InvalidArgumentException(sprintf('%s connector not found', $config['type']));
}
$this->connector = new $connector;
$this->connector = new $connector();
}

public function getPdo()
Expand All @@ -52,9 +53,7 @@ public function connect()

public function query($sql, $bind = [])
{

try {

$statement = $this->getPdo()->prepare($sql);

foreach ($bind as $key => $val) {
Expand All @@ -64,7 +63,6 @@ public function query($sql, $bind = [])
$statement->execute();

return $statement->fetchAll(PDO::FETCH_ASSOC);

} catch (\Throwable $e) {
throw $e;
}
Expand All @@ -73,7 +71,6 @@ public function query($sql, $bind = [])
public function execute($sql, $bind = [])
{
try {

$statement = $this->getPdo()->prepare($sql);

foreach ($bind as $key => $val) {
Expand All @@ -84,7 +81,6 @@ public function execute($sql, $bind = [])
$statement->execute();

return $statement->rowCount();

} catch (\Throwable $e) {
throw $e;
}
Expand Down
2 changes: 1 addition & 1 deletion src/Connectors/Connector.php
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
<?php
namespace TechOne\Database\Connectors;
namespace Leeqvip\Database\Connectors;

use PDO;
use PDOException;
Expand Down
2 changes: 1 addition & 1 deletion src/Connectors/Mysql.php
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
<?php
namespace TechOne\Database\Connectors;
namespace Leeqvip\Database\Connectors;

/**
* Mysql Connector
Expand Down
2 changes: 1 addition & 1 deletion src/Connectors/Pgsql.php
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<?php

namespace TechOne\Database\Connectors;
namespace Leeqvip\Database\Connectors;

use PDO;

Expand Down
2 changes: 1 addition & 1 deletion src/Connectors/Sqlite.php
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
<?php
namespace TechOne\Database\Connectors;
namespace Leeqvip\Database\Connectors;

/**
* Sqlite Connector
Expand Down
2 changes: 1 addition & 1 deletion src/Connectors/Sqlsrv.php
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<?php

namespace TechOne\Database\Connectors;
namespace Leeqvip\Database\Connectors;

use PDO;

Expand Down
4 changes: 2 additions & 2 deletions src/Manager.php
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<?php
namespace TechOne\Database;
namespace Leeqvip\Database;

use TechOne\Database;
use Leeqvip\Database;

/**
* Database Manager
Expand Down

0 comments on commit 89163d7

Please sign in to comment.