Skip to content

Commit 325af09

Browse files
committed
Add polyfilling for Pdo subclass methods
1 parent fde14c5 commit 325af09

File tree

2 files changed

+96
-0
lines changed

2 files changed

+96
-0
lines changed

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

Lines changed: 71 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -32,5 +32,76 @@ 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+
public function copyToArray(
59+
string $tableName,
60+
string $separator = "\t",
61+
string $nullAs = "\\\\N",
62+
?string $fields = null
63+
): array|false
64+
{
65+
return $this->pgsqlCopyToArray($tableName, $separator, $nullAs, $fields);
66+
}
67+
68+
public function copyToFile(
69+
string $tableName,
70+
string $filename,
71+
string $separator = "\t",
72+
string $nullAs = "\\\\N",
73+
?string $fields = null
74+
): bool
75+
{
76+
return $this->pgsqlCopyToFile($tableName, $filename, $separator, $nullAs, $fields);
77+
}
78+
79+
public function getNotify(int $fetchMode = PDO::FETCH_DEFAULT, int $timeoutMilliseconds = 0): array|false
80+
{
81+
return $this->pgsqlGetNotify($fetchMode, $timeoutMilliseconds);
82+
}
83+
84+
public function getPid(): int
85+
{
86+
return $this->pgsqlGetPid();
87+
}
88+
89+
public function lobCreate(): string|false
90+
{
91+
return $this->pgsqlLOBCreate();
92+
}
93+
94+
/**
95+
* @return resource|false
96+
*/
97+
public function lobOpen(string $oid, string $mode = "rb")
98+
{
99+
return $this->pgsqlLOBOpen($oid, $mode);
100+
}
101+
102+
public function lobUnlink(string $oid): bool
103+
{
104+
return $this->pgsqlLOBUnlink($oid);
105+
}
35106
}
36107
}

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)