Skip to content

Commit

Permalink
Jet Core
Browse files Browse the repository at this point in the history
------------
* ORM DataModel: Bug fix (fatal error): DateTime->onOnlyDate was ignored. This made it impossible to create queries with only date and not time.
  • Loading branch information
mirekmarek committed Jul 5, 2024
1 parent 9a7c275 commit 1c094f1
Show file tree
Hide file tree
Showing 4 changed files with 16 additions and 7 deletions.
5 changes: 4 additions & 1 deletion library/Jet/DataModel/Backend/MSSQL.php
Original file line number Diff line number Diff line change
Expand Up @@ -390,7 +390,10 @@ protected function _getValue( mixed $value ): float|int|string
}

if( $value instanceof Data_DateTime ) {
$value = $value->format( 'Y-m-d H:i:s' );
$value = $value->isOnlyDate() ?
$value->format( 'Y-m-d' )
:
$value->format( 'Y-m-d H:i:s' );
}

if(
Expand Down
5 changes: 4 additions & 1 deletion library/Jet/DataModel/Backend/MySQL.php
Original file line number Diff line number Diff line change
Expand Up @@ -389,7 +389,10 @@ protected function _getValue( mixed $value ): float|int|string
}

if( $value instanceof Data_DateTime ) {
$value = $value->format( 'Y-m-d H:i:s' );
$value = $value->isOnlyDate() ?
$value->format( 'Y-m-d' )
:
$value->format( 'Y-m-d H:i:s' );
}

if(
Expand Down
8 changes: 4 additions & 4 deletions library/Jet/DataModel/Backend/PgSQL.php
Original file line number Diff line number Diff line change
Expand Up @@ -388,7 +388,10 @@ protected function _getValue( mixed $value ): float|int|string
}

if( $value instanceof Data_DateTime ) {
$value = $value->format( 'Y-m-d H:i:s' );
$value = $value->isOnlyDate() ?
$value->format( 'Y-m-d' )
:
$value->format( 'Y-m-d H:i:s' );
}

if(
Expand Down Expand Up @@ -548,7 +551,6 @@ protected function _getRecord( DataModel_RecordData $record, bool $quote = true,
*/
public function transactionStart(): void
{
//TODO:
/*
$this->getDbWrite()->beginTransaction();
*/
Expand All @@ -560,7 +562,6 @@ public function transactionStart(): void
*/
public function transactionRollback(): void
{
//TODO:
/*
if( $this->getDbWrite()->inTransaction() ) {
$this->getDbWrite()->rollBack();
Expand All @@ -573,7 +574,6 @@ public function transactionRollback(): void
*/
public function transactionCommit(): void
{
//TODO:
/*
if( $this->getDbWrite()->inTransaction() ) {
$this->getDbWrite()->commit();
Expand Down
5 changes: 4 additions & 1 deletion library/Jet/DataModel/Backend/SQLite.php
Original file line number Diff line number Diff line change
Expand Up @@ -490,7 +490,10 @@ protected function _getValue( mixed $value ): float|int|string
}

if( $value instanceof Data_DateTime ) {
$value = $value->format( 'Y-m-d H:i:s' );
$value = $value->isOnlyDate() ?
$value->format( 'Y-m-d' )
:
$value->format( 'Y-m-d H:i:s' );
}

if( is_array( $value ) ) {
Expand Down

0 comments on commit 1c094f1

Please sign in to comment.