File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 2121 * - password (or pass)
2222 * - persistent (bool) => try to find a persistent link?
2323 * - resource (resource) => existing connection resource
24+ * - microseconds (bool) => use microseconds in datetime format?
2425 */
2526class OdbcDriver implements Dibi \Driver
2627{
@@ -32,6 +33,9 @@ class OdbcDriver implements Dibi\Driver
3233 /** @var int|null Affected rows */
3334 private $ affectedRows ;
3435
36+ /** @var bool */
37+ private $ microseconds = true ;
38+
3539
3640 /**
3741 * @throws Dibi\NotSupportedException
@@ -62,6 +66,10 @@ public function __construct(array &$config)
6266 if (!is_resource ($ this ->connection )) {
6367 throw new Dibi \DriverException (odbc_errormsg () . ' ' . odbc_error ());
6468 }
69+
70+ if (isset ($ config ['microseconds ' ])) {
71+ $ this ->microseconds = (bool ) $ config ['microseconds ' ];
72+ }
6573 }
6674
6775
@@ -238,7 +246,7 @@ public function escapeDateTime($value): string
238246 if (!$ value instanceof \DateTimeInterface) {
239247 $ value = new Dibi \DateTime ($ value );
240248 }
241- return $ value ->format ('#m/d/Y H:i:s.u# ' );
249+ return $ value ->format ($ this -> microseconds ? '#m/d/Y H:i:s.u# ' : ' #m/d/Y H:i:s # ' );
242250 }
243251
244252
You can’t perform that action at this time.
0 commit comments