Skip to content

Commit

Permalink
* 1.11 2019-oct-01 1.10 Added compatibility with php 5.6
Browse files Browse the repository at this point in the history
  • Loading branch information
jorgecc committed Oct 2, 2019
1 parent 501625e commit a33756e
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 7 deletions.
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -662,6 +662,7 @@ PdoOne adds a bit of ovehead over PDO, however it is simple a wrapper to pdo.

## Changelist

* 1.1 2019-oct-01 1.11 It is still compatible with php 5.6.Added to composer.json
* 1.10 2019-oct-01 1.10 Added method dateConvert(). Added trace to the throw.
* 1.9 2019-aug-10 1.8 republished
* 1.8 2019-aug-10 Added a date format. Methods dateSql2Text() and dateText2Sql()
Expand Down
3 changes: 2 additions & 1 deletion composer.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"name": "eftec/pdoone",
"description": "Procedural PDO Data access class in a single Class",
"version": "1.9",
"version": "1.11",
"type": "library",
"keywords": [
"dao",
Expand All @@ -27,6 +27,7 @@
}
},
"require": {
"php": ">=5.6",
"ext-json": "*",
"ext-openssl": "*",
"ext-pdo": "*"
Expand Down
15 changes: 9 additions & 6 deletions lib/PdoOne.php
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
<?php /** @noinspection SqlDialectInspection */
<?php /** @noinspection PhpUnused */
/** @noinspection SqlDialectInspection */
/** @noinspection SqlWithoutWhere */
/** @noinspection SqlResolve */
/** @noinspection SqlNoDataSourceInspection */
Expand All @@ -15,7 +16,7 @@
* Class PdoOne
* This class wrappes PDO but it could be used for another framework/library.
*
* @version 1.10 20191001
* @version 1.11 20191001
* @package eftec
* @author Jorge Castro Castillo
* @copyright (c) Jorge Castro C. MIT License https://github.com/EFTEC/PdoOne
Expand Down Expand Up @@ -61,7 +62,7 @@ class PdoOne
/** @var bool If true (default), then it throws an error if happens an error. If false, then the execution continues */
var $throwOnError = true;

/** @var \PDO */
/** @var PDO */
var $conn1;
//</editor-fold>
/** @var bool */
Expand Down Expand Up @@ -650,11 +651,12 @@ public function foreignKeyTable($tableName)
* @param null $primaryKey
* @param string $extra
*
* @return array|bool|\PDOStatement
* @return array|bool|PDOStatement
* @throws Exception
*/
public function createTable($tableName, $definition, $primaryKey = null, $extra = '')
{
$sql=null;
switch ($this->databaseType) {
case 'mysql':
$sql = "CREATE TABLE `{$tableName}` (";
Expand Down Expand Up @@ -700,6 +702,7 @@ public function createTable($tableName, $definition, $primaryKey = null, $extra
*/
public function createSequence()
{
$sql='';
switch ($this->databaseType) {
case 'mysql':
$sql = "CREATE TABLE `{$this->tableSequence}` (
Expand Down Expand Up @@ -885,7 +888,7 @@ public static function dateTimeSql2PHP($sqlField, &$hasTime = false)
//2018-02-06 05:06:07.123
// Y-m-d H:i:s.v
$hasTime = true;
$x = DateTime::createFromFormat("Y-m-d H:i:s.u", "2018-02-06 05:06:07.1234");
//$x = DateTime::createFromFormat("Y-m-d H:i:s.u", "2018-02-06 05:06:07.1234");
return DateTime::createFromFormat(self::$isoDateTimeMs, $sqlField);
} else {
if (strpos($sqlField, ':')) {
Expand Down Expand Up @@ -1026,7 +1029,7 @@ public static function dateConvert($sqlField, $inputFormat, $outputFormat)
*
* @return string
*/
public static function dateText2Sql(string $textDate, $hasTime = true)
public static function dateText2Sql($textDate, $hasTime = true)
{
$tmpFormat = (($hasTime)
? (strpos($textDate, '.') === false
Expand Down

0 comments on commit a33756e

Please sign in to comment.