|
Revision 20492, 1.0 kB
(checked in by nowelium, 5 years ago)
|
|
mysql の procedure サポートは終わり。
General error: 2014 Cannot execute queries while other unbuffered queries are active. とかは、PDOのPDO::MYSQL_ATTR_USE_BUFFERED_QUERY をいくら設定してもダメなので、少し逃げ。一端切断すればなんとかなるけど、Datasource設定とかは管理外なので、やらない。
multi rows は 2次元配列で。
|
| Line | |
|---|
| 1 | <?php |
|---|
| 2 | |
|---|
| 3 | |
|---|
| 4 | |
|---|
| 5 | |
|---|
| 6 | class HermitMySqlProcedureParameter extends HermitProcedureParameter { |
|---|
| 7 | public function __construct(HermitProcedureInfo $info, $dbms){ |
|---|
| 8 | parent::__construct($info, $dbms); |
|---|
| 9 | } |
|---|
| 10 | |
|---|
| 11 | |
|---|
| 12 | |
|---|
| 13 | |
|---|
| 14 | public function replace($key, $name, $default){ |
|---|
| 15 | if($this->info->typeofIn($name)){ |
|---|
| 16 | $this->bindKeys[] = $name; |
|---|
| 17 | return ':' . $name; |
|---|
| 18 | } |
|---|
| 19 | if($this->info->typeofOut($name) || $this->info->typeofInOut($name)){ |
|---|
| 20 | $this->bindKeys[] = $name; |
|---|
| 21 | $this->outParams[] = $name; |
|---|
| 22 | return '@' . $name; |
|---|
| 23 | } |
|---|
| 24 | throw new RuntimeException('unknown "' . $name . '" parameter'); |
|---|
| 25 | } |
|---|
| 26 | |
|---|
| 27 | |
|---|
| 28 | |
|---|
| 29 | |
|---|
| 30 | public function bind(PDOStatement $stmt, $value){ |
|---|
| 31 | $param = $value[0]; |
|---|
| 32 | foreach($this->bindKeys as $index => $key){ |
|---|
| 33 | if($this->info->typeofIn($key)){ |
|---|
| 34 | $stmt->bindParam(':' . $key, $param->$key); |
|---|
| 35 | } |
|---|
| 36 | } |
|---|
| 37 | } |
|---|
| 38 | } |
|---|