dbxapp 4.1.3
CMS, Shop, Workflows und modulare Geschäftsanwendungen
Loading...
Searching...
No Matches
dbxDD_restore_temporal_test.php
Go to the documentation of this file.
1<?php
2
3require_once dirname(__DIR__, 2) . '/vendor/autoload.php';
4require_once dirname(__DIR__) . '/dbxKernel.php';
5
6dbx()->get_system_obj('dbxDD');
7
9{
10 public function mysqlType(string $type, string $length = ''): string
11 {
12 return $this->map_dd_type_to_sql_type('mysql', $type, $length);
13 }
14
15 public function restoreValue(
16 string $dbType,
17 string $fieldType,
18 mixed $value,
19 string $sourceFieldType = ''
20 ): mixed
21 {
22 return $this->normalize_restore_value($dbType, $fieldType, $value, $sourceFieldType);
23 }
24}
25
27
28if ($probe->mysqlType('datetime', '-1') !== 'DATETIME(6)'
29 || $probe->mysqlType('timestamp', '-1') !== 'TIMESTAMP(6)'
30 || $probe->mysqlType('time', '-1') !== 'TIME(6)'
31) {
32 fwrite(STDERR, "FAIL: MySQL-Zeittypen bewahren keine Mikrosekunden.\n");
33 exit(1);
34}
35
36foreach (['date', 'time', 'datetime', 'timestamp', 'year'] as $type) {
37 if ($probe->restoreValue('mysql', $type, '') !== null) {
38 fwrite(STDERR, "FAIL: Leerer MySQL-Zeitwert wurde fuer {$type} nicht zu NULL normalisiert.\n");
39 exit(2);
40 }
41}
42
43$datetime = '2026-07-24 20:15:16.123456';
44if ($probe->restoreValue('mysql', 'datetime', $datetime) !== $datetime
45 || $probe->restoreValue('sqlite', 'datetime', '') !== ''
46 || $probe->restoreValue('mysql', 'varchar', '') !== ''
47 || $probe->restoreValue('sqlite', 'text', '2026-07-24 20:15:16.123000', 'datetime')
48 !== '2026-07-24 20:15:16.123'
49 || $probe->restoreValue('sqlite', 'text', '2026-07-24 20:15:16.390000', 'datetime')
50 !== '2026-07-24 20:15:16.390'
51 || $probe->restoreValue('sqlite', 'text', '2026-07-24 20:15:16.000000', 'datetime')
52 !== '2026-07-24 20:15:16'
53) {
54 fwrite(STDERR, "FAIL: Unbetroffene Restore-Werte wurden veraendert.\n");
55 exit(3);
56}
57
58echo "OK dbxDD temporal restore\n";
map_dd_type_to_sql_type(string $dbType, string $type, string $length='')
Mappt einen kanonischen DD-Typ auf einen konkreten SQL-Typ des Zielsystems.
normalize_restore_value(string $targetDbType, string $targetFieldType, mixed $value, string $sourceFieldType='')
Normalisiert treiberspezifisch problematische Restore-Werte.
mysqlType(string $type, string $length='')
restoreValue(string $dbType, string $fieldType, mixed $value, string $sourceFieldType='')
if( $created< 0) if($db->connect_db_server($server) !==1) $probe
if( $probe->mysqlType( 'datetime', '-1') !=='DATETIME(6)'||$probe->mysqlType( 'timestamp', '-1') !=='TIMESTAMP(6)'||$probe->mysqlType( 'time', '-1') !=='TIME(6)') foreach(['date', 'time', 'datetime', 'timestamp', 'year'] as $type) $datetime
exit
Definition index.php:146
DBX schema administration.