forked from galette/galette
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathzend-db-php7.2.patch
More file actions
97 lines (88 loc) · 5.11 KB
/
Copy pathzend-db-php7.2.patch
File metadata and controls
97 lines (88 loc) · 5.11 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
diff --git a/src/Metadata/Source/AbstractSource.php b/src/Metadata/Source/AbstractSource.php
index 5c3c4d0..209be55 100644
--- a/src/Metadata/Source/AbstractSource.php
+++ b/src/Metadata/Source/AbstractSource.php
@@ -11,7 +11,12 @@ namespace Zend\Db\Metadata\Source;
use Zend\Db\Adapter\Adapter;
use Zend\Db\Metadata\MetadataInterface;
-use Zend\Db\Metadata\Object;
+use Zend\Db\Metadata\Object\TableObject;
+use Zend\Db\Metadata\Object\ViewObject;
+use Zend\Db\Metadata\Object\ColumnObject;
+use Zend\Db\Metadata\Object\ConstraintObject;
+use Zend\Db\Metadata\Object\ConstraintKeyObject;
+use Zend\Db\Metadata\Object\TriggerObject;
abstract class AbstractSource implements MetadataInterface
{
@@ -115,10 +120,10 @@ abstract class AbstractSource implements MetadataInterface
$data = $this->data['table_names'][$schema][$tableName];
switch ($data['table_type']) {
case 'BASE TABLE':
- $table = new Object\TableObject($tableName);
+ $table = new TableObject($tableName);
break;
case 'VIEW':
- $table = new Object\ViewObject($tableName);
+ $table = new ViewObject($tableName);
$table->setViewDefinition($data['view_definition']);
$table->setCheckOption($data['check_option']);
$table->setIsUpdatable($data['is_updatable']);
@@ -238,7 +243,7 @@ abstract class AbstractSource implements MetadataInterface
$info = $this->data['columns'][$schema][$table][$columnName];
- $column = new Object\ColumnObject($columnName, $table, $schema);
+ $column = new ColumnObject($columnName, $table, $schema);
$props = [
'ordinal_position', 'column_default', 'is_nullable',
'data_type', 'character_maximum_length', 'character_octet_length',
@@ -300,7 +305,7 @@ abstract class AbstractSource implements MetadataInterface
}
$info = $this->data['constraints'][$schema][$table][$constraintName];
- $constraint = new Object\ConstraintObject($constraintName, $table, $schema);
+ $constraint = new ConstraintObject($constraintName, $table, $schema);
foreach ([
'constraint_type' => 'setType',
@@ -345,7 +350,7 @@ abstract class AbstractSource implements MetadataInterface
$keys = [];
foreach ($this->data['constraint_keys'][$schema] as $constraintKeyInfo) {
if ($constraintKeyInfo['table_name'] == $table && $constraintKeyInfo['constraint_name'] === $constraint) {
- $keys[] = $key = new Object\ConstraintKeyObject($constraintKeyInfo['column_name']);
+ $keys[] = $key = new ConstraintKeyObject($constraintKeyInfo['column_name']);
$key->setOrdinalPosition($constraintKeyInfo['ordinal_position']);
if (isset($references[$constraint])) {
//$key->setReferencedTableSchema($constraintKeyInfo['referenced_table_schema']);
@@ -408,7 +413,7 @@ abstract class AbstractSource implements MetadataInterface
$info = $this->data['triggers'][$schema][$triggerName];
- $trigger = new Object\TriggerObject();
+ $trigger = new TriggerObject();
$trigger->setName($triggerName);
$trigger->setEventManipulation($info['event_manipulation']);
diff --git a/src/Sql/AbstractSql.php b/src/Sql/AbstractSql.php
index 1c5c8b6..2035267 100644
--- a/src/Sql/AbstractSql.php
+++ b/src/Sql/AbstractSql.php
@@ -241,14 +241,18 @@ abstract class AbstractSql implements SqlInterface
if (isset($paramSpecs[$position]['combinedby'])) {
$multiParamValues = [];
foreach ($paramsForPosition as $multiParamsForPosition) {
- $ppCount = count($multiParamsForPosition);
- if (!isset($paramSpecs[$position][$ppCount])) {
- throw new Exception\RuntimeException(sprintf(
- 'A number of parameters (%d) was found that is not supported by this specification',
- $ppCount
- ));
+ if (!is_array($multiParamsForPosition) && !$multiParamsForPosition instanceof Countable) {
+ $multiParamValues[] = $multiParamsForPosition;
+ } else {
+ $ppCount = count($multiParamsForPosition);
+ if (!isset($paramSpecs[$position][$ppCount])) {
+ throw new Exception\RuntimeException(sprintf(
+ 'A number of parameters (%d) was found that is not supported by this specification',
+ $ppCount
+ ));
+ }
+ $multiParamValues[] = vsprintf($paramSpecs[$position][$ppCount], $multiParamsForPosition);
}
- $multiParamValues[] = vsprintf($paramSpecs[$position][$ppCount], $multiParamsForPosition);
}
$topParameters[] = implode($paramSpecs[$position]['combinedby'], $multiParamValues);
} elseif ($paramSpecs[$position] !== null) {