Skip to content

Commit ab51597

Browse files
committed
Rename OpenDB to StormQL
1 parent c5fc8ab commit ab51597

File tree

3 files changed

+49
-43
lines changed

3 files changed

+49
-43
lines changed

README.md

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
# StormQL
2+
3+
The lightweight PHP ORM
4+
5+
StormQL is a minimal database management class, which will help you communicate with
6+
your preferred DBMS in PHP through PDO.

src/OpenDB.php renamed to StormQL/StormQL.php

Lines changed: 41 additions & 41 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
<?php
22

33
/**
4-
* OpenDB - The lightweight PHP ORM
4+
* StormQL - The lightweight PHP ORM
55
*
66
* Permission is hereby granted, free of charge, to any person obtaining a copy
77
* of this software and associated documentation files (the "Software"), to deal
@@ -22,23 +22,23 @@
2222
* SOFTWARE.
2323
*
2424
* @category Library
25-
* @package OpenDB
25+
* @package StormQL
2626
* @author Axel Nana <ax.lnana@outlook.com>
2727
* @copyright 2018 Aliens Group, Inc.
2828
* @license MIT <https://github.com/na2axl/bubble/blob/master/LICENSE>
2929
* @version GIT: 0.0.1
3030
* @link http://opengl.na2axl.tk
3131
*/
3232

33-
namespace OpenDB;
33+
namespace StormQL;
3434

3535
/**
36-
* OpenDB - Database Manager Class
36+
* StormQL - Database Manager Class
3737
*
38-
* @package OpenDB
38+
* @package StormQL
3939
* @author Nana Axel <ax.lnana@outlook.com>
4040
*/
41-
class OpenDB
41+
class StormQL
4242
{
4343
/**
4444
* Registered SQL operators.
@@ -373,9 +373,9 @@ public function getQueryString(): string
373373
*
374374
* @param string $table The table's name
375375
*
376-
* @return OpenDB
376+
* @return StormQL
377377
*/
378-
public function from($table): OpenDB
378+
public function from($table): StormQL
379379
{
380380
$this->table = $table;
381381
return $this;
@@ -386,9 +386,9 @@ public function from($table): OpenDB
386386
*
387387
* @param string|array $condition
388388
*
389-
* @return OpenDB
389+
* @return StormQL
390390
*/
391-
public function where($condition): OpenDB
391+
public function where($condition): StormQL
392392
{
393393
// where(array('field1'=>'value', 'field2'=>'value'))
394394
$this->where = (NULL !== $this->where) ? "{$this->where} OR (" : "(";
@@ -425,9 +425,9 @@ public function where($condition): OpenDB
425425
* @param string $field
426426
* @param string $mode
427427
*
428-
* @return OpenDB
428+
* @return StormQL
429429
*/
430-
public function order($field, $mode = "ASC"): OpenDB
430+
public function order($field, $mode = "ASC"): StormQL
431431
{
432432
$this->order = " ORDER BY {$field} {$mode} ";
433433
return $this;
@@ -439,9 +439,9 @@ public function order($field, $mode = "ASC"): OpenDB
439439
* @param int $offset
440440
* @param int $count
441441
*
442-
* @return OpenDB
442+
* @return StormQL
443443
*/
444-
public function limit($offset, $count): OpenDB
444+
public function limit($offset, $count): StormQL
445445
{
446446
$this->limit = " LIMIT {$offset}, {$count} ";
447447
return $this;
@@ -452,9 +452,9 @@ public function limit($offset, $count): OpenDB
452452
*
453453
* @param string $field The field used to group results
454454
*
455-
* @return OpenDB
455+
* @return StormQL
456456
*/
457-
public function groupBy($field): OpenDB
457+
public function groupBy($field): StormQL
458458
{
459459
$this->group = $field;
460460
return $this;
@@ -463,9 +463,9 @@ public function groupBy($field): OpenDB
463463
/**
464464
* Add a distinct clause.
465465
*
466-
* @return OpenDB
466+
* @return StormQL
467467
*/
468-
public function distinct(): OpenDB
468+
public function distinct(): StormQL
469469
{
470470
$this->distinct = TRUE;
471471
return $this;
@@ -477,7 +477,7 @@ public function distinct(): OpenDB
477477
* @param mixed $fields The fields to select. This value can be an array of fields,
478478
* or a string of fields (according to the SELECT SQL query syntax).
479479
*
480-
* @throws OpenDBException
480+
* @throws StormQLException
481481
*
482482
* @return \PDOStatement
483483
*/
@@ -492,7 +492,7 @@ public function select($fields = "*"): \PDOStatement
492492
* @param mixed $fields The fields to select. This value can be an array of fields,
493493
* or a string of fields (according to the SELECT SQL query syntax).
494494
*
495-
* @throws OpenDBException
495+
* @throws StormQLException
496496
*
497497
* @return \PDOStatement
498498
*/
@@ -521,7 +521,7 @@ protected function _select($fields): \PDOStatement
521521
$this->_reset_clauses();
522522
return $getFieldsData;
523523
} else {
524-
throw new OpenDBException($getFieldsData->errorInfo()[2]);
524+
throw new StormQLException($getFieldsData->errorInfo()[2]);
525525
}
526526
}
527527

@@ -560,7 +560,7 @@ protected function _reset_clauses()
560560
* @param mixed $fields The fields to select. This value can be an array of fields,
561561
* or a string of fields (according to the SELECT SQL query syntax).
562562
*
563-
* @throws OpenDBException
563+
* @throws StormQLException
564564
*
565565
* @return array
566566
*/
@@ -580,7 +580,7 @@ public function select_first($fields = "*"): array
580580
* @param mixed $fields The fields to select. This value can be an array of fields,
581581
* or a string of fields (according to the SELECT SQL query syntax).
582582
*
583-
* @throws OpenDBException
583+
* @throws StormQLException
584584
*
585585
* @return array
586586
*/
@@ -602,7 +602,7 @@ public function select_array($fields = "*"): array
602602
* @param mixed $fields The fields to select. This value can be an array of fields,
603603
* or a string of fields (according to the SELECT SQL query syntax).
604604
*
605-
* @throws OpenDBException
605+
* @throws StormQLException
606606
*
607607
* @return array
608608
*/
@@ -625,7 +625,7 @@ public function select_object($fields = "*"): array
625625
* or a string of fields (according to the SELECT SQL query syntax).
626626
* @param mixed $params The information used for jointures.
627627
*
628-
* @throws OpenDBException
628+
* @throws StormQLException
629629
*
630630
* @return \PDOStatement
631631
*/
@@ -641,7 +641,7 @@ public function join($fields, $params): \PDOStatement
641641
* or a string of fields (according to the SELECT SQL query syntax).
642642
* @param string|array $params The information used for jointures.
643643
*
644-
* @throws OpenDBException
644+
* @throws StormQLException
645645
*
646646
* @return \PDOStatement
647647
*/
@@ -667,7 +667,7 @@ private function _join($fields, $params): \PDOStatement
667667
$this->_reset_clauses();
668668
return $getFieldsData;
669669
} else {
670-
throw new OpenDBException($getFieldsData->errorInfo()[2]);
670+
throw new StormQLException($getFieldsData->errorInfo()[2]);
671671
}
672672
}
673673

@@ -678,7 +678,7 @@ private function _join($fields, $params): \PDOStatement
678678
* or a string of fields (according to the SELECT SQL query syntax).
679679
* @param mixed $params The information used for jointures.
680680
*
681-
* @throws OpenDBException
681+
* @throws StormQLException
682682
*
683683
* @return array
684684
*/
@@ -701,7 +701,7 @@ public function join_array($fields, $params): array
701701
* or a string of fields (according to the SELECT SQL query syntax).
702702
* @param mixed $params The information used for jointures.
703703
*
704-
* @throws OpenDBException
704+
* @throws StormQLException
705705
*
706706
* @return array
707707
*/
@@ -723,7 +723,7 @@ public function join_object($fields, $params): array
723723
* @param string|array $fields The fields to select. This value can be an array of fields,
724724
* or a string of fields (according to the SELECT SQL query syntax).
725725
*
726-
* @throws OpenDBException
726+
* @throws StormQLException
727727
*
728728
* @return int|array
729729
*/
@@ -733,25 +733,25 @@ public function count($fields = "*")
733733
$field = implode(",", $fields);
734734
}
735735

736-
$this->queryString = "SELECT" . ((NULL !== $this->group) ? "{$this->group}," : " ") . "COUNT(" . ((isset($field)) ? $field : $fields) . ") AS opendb_count FROM {$this->table}" . ((NULL !== $this->where) ? " WHERE {$this->where}" : " ") . ((NULL !== $this->limit) ? $this->limit : " ") . ((NULL !== $this->group) ? "GROUP BY {$this->group}" : " ");
736+
$this->queryString = "SELECT" . ((NULL !== $this->group) ? "{$this->group}," : " ") . "COUNT(" . ((isset($field)) ? $field : $fields) . ") AS stormql_count FROM {$this->table}" . ((NULL !== $this->where) ? " WHERE {$this->where}" : " ") . ((NULL !== $this->limit) ? $this->limit : " ") . ((NULL !== $this->group) ? "GROUP BY {$this->group}" : " ");
737737

738738
$getFieldsData = $this->prepare($this->queryString);
739739

740740
if ($getFieldsData->execute() !== FALSE) {
741741
if (NULL === $this->group) {
742742
$this->_reset_clauses();
743743
$data = $getFieldsData->fetch();
744-
return (int)$data['opendb_count'];
744+
return (int)$data['stormql_count'];
745745
}
746746

747747
$this->_reset_clauses();
748748
$res = array();
749749
while ($data = $getFieldsData->fetch()) {
750-
$res[$data[$this->group]] = $data['opendb_count'];
750+
$res[$data[$this->group]] = $data['stormql_count'];
751751
}
752752
return $res;
753753
} else {
754-
throw new OpenDBException($getFieldsData->errorInfo()[2]);
754+
throw new StormQLException($getFieldsData->errorInfo()[2]);
755755
}
756756
}
757757

@@ -760,7 +760,7 @@ public function count($fields = "*")
760760
*
761761
* @param array $fieldsAndValues The fields and the associated values to insert.
762762
*
763-
* @throws OpenDBException
763+
* @throws StormQLException
764764
*
765765
* @return boolean
766766
*/
@@ -785,7 +785,7 @@ public function insert($fieldsAndValues): bool
785785
$this->_reset_clauses();
786786
return TRUE;
787787
} else {
788-
throw new OpenDBException($getFieldsData->errorInfo()[2]);
788+
throw new StormQLException($getFieldsData->errorInfo()[2]);
789789
}
790790
}
791791

@@ -794,7 +794,7 @@ public function insert($fieldsAndValues): bool
794794
*
795795
* @param array $fieldsAndValues The fields and the associated values to update.
796796
*
797-
* @throws OpenDBException
797+
* @throws StormQLException
798798
*
799799
* @return boolean
800800
*/
@@ -821,14 +821,14 @@ public function update($fieldsAndValues): bool
821821
$this->_reset_clauses();
822822
return TRUE;
823823
} else {
824-
throw new OpenDBException($getFieldsData->errorInfo()[2]);
824+
throw new StormQLException($getFieldsData->errorInfo()[2]);
825825
}
826826
}
827827

828828
/**
829829
* Deletes data in table.
830830
*
831-
* @throws OpenDBException
831+
* @throws StormQLException
832832
*
833833
* @return boolean
834834
*/
@@ -842,7 +842,7 @@ public function delete(): bool
842842
$this->_reset_clauses();
843843
return TRUE;
844844
} else {
845-
throw new OpenDBException($getFieldsData->errorInfo()[2]);
845+
throw new StormQLException($getFieldsData->errorInfo()[2]);
846846
}
847847
}
848848

@@ -879,6 +879,6 @@ public function quote($value): string
879879
/**
880880
* Dummy class used to throw exceptions
881881
*/
882-
class OpenDBException extends \Exception
882+
class StormQLException extends \Exception
883883
{
884884
}

composer.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
{
2-
"name": "na2axl/opendb",
2+
"name": "aliensgroup/stormql",
33
"description": "The lightweight PHP ORM",
44
"type": "library",
55
"require-dev": {
@@ -22,7 +22,7 @@
2222
],
2323
"autoload": {
2424
"psr-4": {
25-
"OpenDB\\": "src/"
25+
"StormQL\\": "src/"
2626
}
2727
}
2828
}

0 commit comments

Comments
 (0)