Ubiquity
2.5.2
php rapid development framework
Loading...
Searching...
No Matches
SqlCommand.php
Go to the documentation of this file.
1
<?php
2
3
namespace
Ubiquity\db
;
4
5
use
Ubiquity\orm\DAO
;
6
7
class
SqlCommand
{
8
9
public
static
function
executeSQLTransaction
(
string
$activeDbOffset,
string
$sql): bool {
10
$db =
DAO
::getDatabase($activeDbOffset ??
'default'
);
11
if
(! $db->isConnected()) {
12
$db->setDbName(
''
);
13
$db->
connect
();
14
}
15
if
($db->beginTransaction()) {
16
try
{
17
$db->execute($sql);
18
if
($db->inTransaction()) {
19
$db->commit();
20
}
21
return
true
;
22
}
catch
(\Error $e) {
23
if
($db->inTransaction()) {
24
$db->rollBack();
25
}
26
return
false
;
27
}
28
}
else
{
29
$db->execute($sql);
30
return
true
;
31
}
32
}
33
}
Ubiquity\db\SqlCommand
Definition
SqlCommand.php:7
Ubiquity\db\SqlCommand\executeSQLTransaction
static executeSQLTransaction(string $activeDbOffset, string $sql)
Definition
SqlCommand.php:9
Ubiquity\orm\DAO
Gateway class between database and object model.
Definition
DAO.php:33
Ubiquity\orm\DAO\connect
static connect($offset, $wrapper, $dbType, $dbName, $serverName='127.0.0.1', $port='3306', $user='root', $password='', $options=[], $cache=false)
Establishes the connection to the database using the past parameters.
Definition
DAO.php:230
Ubiquity\db
Database implementation.
C:
Users
myadd
Documents
GitHub
ubiquity-doc-api
vendor
phpmv
ubiquity-dev
src
Ubiquity
db
SqlCommand.php
Generated on Sun Dec 10 2023 15:04:07 for
Ubiquity
by
doxygen
1.9.8