-
-
Notifications
You must be signed in to change notification settings - Fork 11
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Support DateTime instances #231
base: master
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -97,4 +97,27 @@ public function getSchema(): SchemaInterface | |
|
||
return $this->schema; | ||
} | ||
|
||
/** | ||
* Initializes the DB connection and sets default date and time format. | ||
* | ||
* This method is invoked right after the DB connection is established. | ||
* | ||
* The default implementation turns on `PDO::ATTR_EMULATE_PREPARES`, if {@see getEmulatePrepare()} is `true`. | ||
*/ | ||
protected function initConnection(): void | ||
{ | ||
parent::initConnection(); | ||
|
||
$this->pdo->exec( | ||
<<<SQL | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. What benefits in changes settings of db? What about cases with default settings? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. When getting datetime values from Oracle they are returned in a specific format that is not suitable for proper parsing by |
||
ALTER SESSION SET | ||
NLS_TIMESTAMP_FORMAT = 'YYYY-MM-DD HH24:MI:SSXFF' | ||
NLS_TIMESTAMP_TZ_FORMAT = 'YYYY-MM-DD HH24:MI:SSXFFTZH:TZM' | ||
NLS_DATE_FORMAT = 'YYYY-MM-DD' | ||
NLS_TIME_FORMAT = 'HH24:MI:SSXFF' | ||
NLS_TIME_TZ_FORMAT = 'HH24:MI:SSXFFTZH:TZM' | ||
SQL | ||
); | ||
} | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Need have a tests for public functions
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
ColumnSchema::hasTimezone()
can be replaced with two new abstract typesSchemaInterface::TYPE_TIMESTAMPTZ
andSchemaInterface::TYPE_TIMETZ
Tests will be added after review this option in
yiisoft/db
#736