Skip to content

Commit f66a902

Browse files
committed
Merge branch 'master' into newmaster
2 parents 8094365 + 9e0d43f commit f66a902

File tree

8 files changed

+576
-491
lines changed

8 files changed

+576
-491
lines changed

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,3 +13,4 @@ build/logs/clover.xml
1313
*.csr
1414
*.key
1515
test.php
16+
build

composer.json

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -27,8 +27,7 @@
2727
"files": ["ez_sql_loader.php"]
2828
},
2929
"require-dev": {
30-
"phpunit/phpunit": ">5.7.0",
31-
"php-coveralls/php-coveralls": "^2.1"
30+
"phpunit/phpunit": ">5.7.0"
3231
},
3332
"scripts": {
3433
"test": "phpunit --bootstrap vendor/autoload.php tests"

lib/ez_sql_pdo.php

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -104,7 +104,11 @@ public static function securePDO(
104104
{
105105
if (\array_key_exists(\strtolower($vendor), \VENDOR)
106106
&& (! \file_exists($path.$cert) || ! \file_exists($path.$key)))
107-
ezQuery::createCertificate();
107+
$path = ezQuery::createCertificate();
108+
elseif ($path == '.'.\_DS) {
109+
$ssl_path = \getcwd();
110+
$path = \preg_replace('/\\\/', \_DS, $ssl_path). \_DS;
111+
}
108112

109113
if (($vendor == 'pgsql') || ($vendor == 'postgresql')) {
110114
self::$secure = "sslmode=require;sslcert=".$path.$cert.";sslkey=".$path.$key.";sslrootcert=".$path.$ca.";";
@@ -114,7 +118,9 @@ public static function securePDO(
114118
\PDO::MYSQL_ATTR_SSL_KEY => $path.$key,
115119
\PDO::MYSQL_ATTR_SSL_CERT => $path.$cert,
116120
\PDO::MYSQL_ATTR_SSL_CA => $path.$ca,
117-
\PDO::MYSQL_ATTR_SSL_VERIFY_SERVER_CERT => false,
121+
\PDO::MYSQL_ATTR_SSL_CAPATH => $path,
122+
\PDO::MYSQL_ATTR_SSL_CIPHER => 'DHE-RSA-AES256-SHA',
123+
\PDO::MYSQL_ATTR_SSL_VERIFY_SERVER_CERT => false
118124
);
119125
} elseif (($vendor == 'sqlserver') || ($vendor == 'mssql') || ($vendor == 'sqlsrv')) {
120126
self::$secure = ";Encrypt=true;TrustServerCertificate=true";

shared/ezFunctions.php

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,10 @@
2929
use ezsql\ezQuery;
3030
use ezsql\ezQueryInterface;
3131

32+
// Error messages
33+
const MISSING_CONFIGURATION ='<b>Fatal Error:</b> Missing configuration details to connect to database';
34+
const CONFIGURATION_REQUIRES = '<b>Fatal Error:</b> ezSQL_mysql requires ezSQLcore (ez_sql_core.php) to be included/loaded before it can be used';
35+
3236
// ezQuery prepare placeholder/positional tag
3337
const _TAG = '__ez__';
3438
// Use to set get_result output as json
@@ -164,6 +168,7 @@
164168
const REFERENCES = 'REFERENCES';
165169

166170
const AUTO = '__autoNumbers__';
171+
const SEQUENCE = '__autoNumbers__';
167172
const AUTO_INCREMENT = 'AUTO_INCREMENT';
168173
const AUTOINCREMENT = 'AUTOINCREMENT';
169174
const IDENTITY = 'IDENTITY';

shared/ezQuery.php

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -53,6 +53,7 @@ public static function clean($string)
5353
* "emailAddress" => ''
5454
* ];
5555
*
56+
* @return string certificate path
5657
*/
5758
public static function createCertificate(
5859
string $privatekeyFile = 'certificate.key',
@@ -63,7 +64,7 @@ public static function createCertificate(
6364
array $details = ["commonName" => "localhost"]
6465
)
6566
{
66-
if (empty($ssl_path) || ! \is_dir($ssl_path)) {
67+
if (empty($ssl_path)) {
6768
$ssl_path = \getcwd();
6869
$ssl_path = \preg_replace('/\\\/', \_DS, $ssl_path). \_DS;
6970
} else
@@ -88,6 +89,8 @@ public static function createCertificate(
8889

8990
// Create a signing request file
9091
\openssl_csr_export_to_file($csr, $ssl_path.$signingFile);
92+
93+
return $ssl_path;
9194
}
9295

9396
/**

shared/ezSchema.php

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -187,6 +187,10 @@ public static function vendor()
187187
* Creates an database column,
188188
* - column, datatype, value/options with the given arguments.
189189
*
190+
* // datatype are global CONSTANTS and can be written out like:
191+
* - VARCHAR, 32, notNULL, PRIMARY, AUTO, ....
192+
* // AUTO constant will replaced with the proper auto sequence for the SQL driver
193+
*
190194
* @param string $column|CONSTRAINT, - column name/CONSTRAINT usage for PRIMARY|FOREIGN KEY
191195
* @param string $type|$constraintName, - data type for column/primary|foreign constraint name
192196
* @param mixed $size|...$primaryForeignKeys,
@@ -213,7 +217,7 @@ public static function column(string $column = null, string $type = null, ...$ar
213217
} elseif (($column == \ADD) || ($column == \DROP) || ($column == \CHANGER)) {
214218
if ($column != \DROP) {
215219
// check for modify placeholder and replace with vendors
216-
$column = \str_replace(\CHANGE, self::CHANGES[$vendor], $column);
220+
$column = \str_replace(\CHANGER, self::CHANGES[$vendor], $column);
217221
$column = $column.' '.$type;
218222
$type2 = \array_shift($args);
219223
$data = self::datatype($type2, ...$args);

0 commit comments

Comments
 (0)