Skip to content

Commit 32dd3f4

Browse files
authored
Merge branch 'main' into fix-exception-not-foud
2 parents 511cf2a + 419cd14 commit 32dd3f4

File tree

6 files changed

+27
-10
lines changed

6 files changed

+27
-10
lines changed

.github/workflows/publish.yml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -40,9 +40,9 @@ jobs:
4040
PATCH=$((PATCH+1));
4141
fi;
4242
echo "<?php
43-
const MAJOR = "$MAJOR";
44-
const MINOR = "$MINOR";
45-
const PATCH = "$PATCH";
43+
const MAJOR = \"$MAJOR\";
44+
const MINOR = \"$MINOR\";
45+
const PATCH = \"$PATCH\";
4646
" >> $VERSION_FILE.tmp
4747
mv $VERSION_FILE.tmp $VERSION_FILE;
4848
git add $VERSION_FILE;

CHANGELOG.md

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,17 @@
1+
## 1.9.0
2+
3+
* added microseconds in Timestamp type
4+
5+
## 1.8.2
16

27
* fixed discovery on exception
38
* fixed logger in EnvironCredentials
49

5-
# 1.8.1
10+
## 1.8.1
611

712
* fixed bug, when function Retry::backoffType always return SlowBackoff
813

9-
# 1.8.0
14+
## 1.8.0
1015

1116
* update destructor in MemorySessionPool
1217
* fixed exception on re-create server nodes

src/QueryResult.php

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -194,7 +194,13 @@ protected function fillRows($rows)
194194
break;
195195

196196
case 'TIMESTAMP':
197-
$_row[$column['name']] = is_numeric($value) ? date('Y-m-d H:i:s', $value/1000000) : $value;
197+
if(is_numeric($value)){
198+
$value = number_format($value/1000000,6,'.','');
199+
$date = DateTime::createFromFormat('U.u', $value);
200+
$_row[$column['name']] = $date->format('Y-m-d H:i:s.u');
201+
} else {
202+
$_row[$column['name']] = $value;
203+
}
198204
break;
199205

200206
case 'DATETIME':

src/Types/TimestampType.php

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,10 @@
77

88
class TimestampType extends DatetimeType
99
{
10+
/**
11+
* @var string
12+
*/
13+
protected static $datetime_format = 'Y-m-d\TH:i:s.u\Z';
1014

1115
protected $ydb_key_name = "uint64_value";
1216

@@ -25,6 +29,6 @@ protected function getYqlString()
2529
protected function getYdbValue()
2630
{
2731
$value = new DateTime($this->value);
28-
return $value->getTimestamp() * 1000000;
32+
return $value->format("U.u") * 1000000;
2933
}
3034
}

src/Version.php

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
<?php
22
const MAJOR = "1";
3-
const MINOR = "8";
4-
const PATCH = "1";
3+
const MINOR = "9";
4+
const PATCH = "0";
5+

tests/CheckTypeTest.php

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -146,7 +146,8 @@ public function test(){
146146
"Timestamp" => [
147147
"class" => TimestampType::class,
148148
"values" => [
149-
"2023-06-14 17:12:15"
149+
"2023-06-14 17:12:15.023476",
150+
"2023-06-14 17:12:15.000000"
150151
]
151152
]
152153
];

0 commit comments

Comments
 (0)