Skip to content

Commit

Permalink
* 3.1.6
Browse files Browse the repository at this point in the history
  • Loading branch information
jorgecc-business-account committed Jun 25, 2022
1 parent 4919e01 commit 39e55a4
Show file tree
Hide file tree
Showing 4 changed files with 32 additions and 8 deletions.
3 changes: 3 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -2035,6 +2035,9 @@ In a nutshell:
>
> Every decimal version means that it patches/fixes/refactoring a previous functionality i.e. 1.5.0 -> 1.5.1 (fix)
* 3.1.6 2022-06-024
* [CLI] solved a problem with the conversion per type of column
* [_BasePdoOneRepo] Fixed a problem with the conversion of the end results.
* 3.1.5 2022-06-23
* [PdoOneQuery] Solved a bug when the cache is invalidated when insert(),update(), etc.
* 3.1.4 2022-06-21
Expand Down
4 changes: 2 additions & 2 deletions lib/PdoOne.php
Original file line number Diff line number Diff line change
Expand Up @@ -25,11 +25,11 @@
* @package eftec
* @author Jorge Castro Castillo
* @copyright (c) Jorge Castro C. Dual Licence: MIT and Commercial License https://github.com/EFTEC/PdoOne
* @version 3.1.5
* @version 3.1.6
*/
class PdoOne
{
public const VERSION = '3.1.5';
public const VERSION = '3.1.6';
/** @var int We need this value because null and false could be a valid value. */
public const NULL = PHP_INT_MAX;
/** @var string Prefix of the tables */
Expand Down
23 changes: 17 additions & 6 deletions lib/PdoOneCli.php
Original file line number Diff line number Diff line change
Expand Up @@ -70,13 +70,21 @@ public function __construct()
{
$this->cli = new CliOne();
$this->cli->setErrorType();
$this->conversion= $this->convertReset();
}

public function getCli(): CliOne
{
return $this->cli;
}

public function convertReset():array {
return ["bigint"=> null, "blob"=> null, "char"=> null, "date"=> null, "datetime"=> null,
"decimal"=> null, "double"=> null, "enum"=> null, "float"=> null, "geometry"=> null,
"int"=> null, "json"=> null, "longblob"=> null, "mediumint"=> null, "mediumtext"=> null,
"set"=> null, "smallint"=> null, "text"=> null, "time"=> null, "timestamp"=> null,
"tinyint"=> null, "varbinary"=> null, "varchar"=> null, "year"=> null];
}

/***
* It finds the vendor path (where composer is located).
Expand Down Expand Up @@ -349,7 +357,9 @@ public function cliEngine(): void
$this->tablexclass = $data['tablexclass'] ?? [];
$this->columnsTable = $data['columnsTable'] ?? [];
$this->columnsAlias = $data['columnsAlias'] ?? [];
$this->conversion = $data['conversion'] ?? [];
$this->conversion = ($data['conversion']===null || count($data['conversion'])===0)
? $this->convertReset()
: $data['conversion'];
$this->alias = $data['alias'] ?? [];
$this->extracolumn = $data['extracolumn'] ?? [];
$this->removecolumn = $config['removecolumn'] ?? [];
Expand Down Expand Up @@ -771,11 +781,12 @@ protected function databaseConfigureRemove($ktable): void
$this->cli->downLevel();
}

protected function databaseConvertXType(): void
protected function databaseConfigureXType(): void
{
$this->cli->upLevel('convertxtype');
$this->cli->upLevel('configuretype');
while (true) {
$this->cli->setColor(['byellow'])->showBread();

$this->cli->getParameter('convertionselected')
->setInput(true, 'option3', $this->conversion);
$convertionselected = $this->cli->evalParam('convertionselected', true);
Expand Down Expand Up @@ -903,7 +914,7 @@ protected function runCliGenerationParams(): void
'scan' => 'Scan for changes to the database. It adds or removes tables and classes',
'select' => 'Select or de-select the tables to work',
'detail' => 'Configure each table and columns separately',
'convertxtype' => 'Configure all columns per type of data',
'configuretype' => 'Configure all columns per type of data',
'save' => 'Save the current configuration',
'convert' => 'Convert and exit (in non-interactive mode is done automatically)'])
->add();
Expand Down Expand Up @@ -1073,8 +1084,8 @@ protected function runCliGeneration(): void
case 'save':
$this->databaseSave();
break;
case 'convertxtype':
$this->databaseConvertXType();
case 'configuretype':
$this->databaseConfigureXType();
break;
case 'select':
$this->databaseSelect($tablesmarked, $tables);
Expand Down
10 changes: 10 additions & 0 deletions lib/_BasePdoOneRepo.php
Original file line number Diff line number Diff line change
Expand Up @@ -679,6 +679,16 @@ public static function executePlan0(PdoOneQuery $currentQuery, ?array $condition
$usingCacheFamily = '';
}
$rowc = self::executePlan($currentQuery, '', $conditions, $currentQuery->getRecursive(), $first);
/** @var CustomerRepo $cls */
$cls=self::class;
if($first) {
$cls::convertOutputVal($rowc);
} else {
foreach($rowc as $k=>$v) {
$cls::convertOutputVal($rowc[$k]);
}
}

if ($rowc !== false && $usingCache !== false) {
$currentQuery->parent->getCacheService()->setCache(static::$uid, $usingCacheFamily, $rowc, $usingCache);
}
Expand Down

0 comments on commit 39e55a4

Please sign in to comment.