Skip to content

Commit f0b0b10

Browse files
committed
Add polyfilling for Pdo subclass methods
1 parent 4fa7faa commit f0b0b10

File tree

2 files changed

+99
-0
lines changed

2 files changed

+99
-0
lines changed

src/Php84/Resources/stubs/Pdo/Pgsql.php

Lines changed: 74 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -32,5 +32,79 @@ public function __construct(
3232
throw new PDOException("Pdo\Pgsql::__construct() cannot be used for connecting to the \"$driver\" driver");
3333
}
3434
}
35+
36+
public function copyFromArray(
37+
string $tableName,
38+
array $rows,
39+
string $separator = "\t",
40+
string $nullAs = "\\\\N",
41+
?string $fields = null
42+
): bool
43+
{
44+
return $this->pgsqlCopyFromArray($tableName, $rows, $separator, $nullAs, $fields);
45+
}
46+
47+
public function copyFromFile(
48+
string $tableName,
49+
string $filename,
50+
string $separator = "\t",
51+
string $nullAs = "\\\\N",
52+
?string $fields = null
53+
): bool
54+
{
55+
return $this->pgsqlCopyFromFile($tableName, $filename, $separator, $nullAs, $fields);
56+
}
57+
58+
/**
59+
* @return array|false
60+
*/
61+
public function copyToArray(
62+
string $tableName,
63+
string $separator = "\t",
64+
string $nullAs = "\\\\N",
65+
?string $fields = null
66+
)
67+
{
68+
return $this->pgsqlCopyToArray($tableName, $separator, $nullAs, $fields);
69+
}
70+
71+
public function copyToFile(
72+
string $tableName,
73+
string $filename,
74+
string $separator = "\t",
75+
string $nullAs = "\\\\N",
76+
?string $fields = null
77+
): bool
78+
{
79+
return $this->pgsqlCopyToFile($tableName, $filename, $separator, $nullAs, $fields);
80+
}
81+
82+
public function getNotify(int $fetchMode = PDO::FETCH_DEFAULT, int $timeoutMilliseconds = 0): array|false
83+
{
84+
return $this->pgsqlGetNotify($fetchMode, $timeoutMilliseconds);
85+
}
86+
87+
public function getPid(): int
88+
{
89+
return $this->pgsqlGetPid();
90+
}
91+
92+
public function lobCreate(): string|false
93+
{
94+
return $this->pgsqlLOBCreate();
95+
}
96+
97+
/**
98+
* @return resource|false
99+
*/
100+
public function lobOpen(string $oid, string $mode = "rb")
101+
{
102+
return $this->pgsqlLOBOpen($oid, $mode);
103+
}
104+
105+
public function lobUnlink(string $oid): bool
106+
{
107+
return $this->pgsqlLOBUnlink($oid);
108+
}
35109
}
36110
}

src/Php84/Resources/stubs/Pdo/Sqlite.php

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -38,5 +38,30 @@ public function __construct(
3838
throw new PDOException("Pdo\Sqlite::__construct() cannot be used for connecting to the \"$driver\" driver");
3939
}
4040
}
41+
42+
public function createAggregate(
43+
string $name,
44+
callable $step,
45+
callable $finalize,
46+
int $numArgs = -1
47+
): bool
48+
{
49+
return $this->sqliteCreateAggregate($name, $step, $finalize, $numArgs);
50+
}
51+
52+
public function createCollation(string $name, callable $callback): bool
53+
{
54+
return $this->sqliteCreateCollation($name, $callback);
55+
}
56+
57+
public function createFunction(
58+
string $function_name,
59+
callable $callback,
60+
int $num_args = -1,
61+
int $flags = 0
62+
): bool
63+
{
64+
return $this->sqliteCreateFunction($function_name, $callback, $num_args, $flags);
65+
}
4166
}
4267
}

0 commit comments

Comments
 (0)