Skip to content

Commit 8b0a91b

Browse files
committed
Merge pull request #11 from xp-framework/bugfix/sp-return-status
Add support for 0x79 tokens - stored procedure return status
2 parents 128c686 + 3766024 commit 8b0a91b

File tree

3 files changed

+21
-0
lines changed

3 files changed

+21
-0
lines changed

src/main/php/rdbms/tds/TdsV5Protocol.class.php

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -269,6 +269,9 @@ public function query($sql) {
269269
} else if ("\xE3" === $token) { // ENVCHANGE, e.g. from "use [db]" queries
270270
$this->envchange();
271271
return null;
272+
} else if ("\x79" === $token) { // RETURN_STATUS (eg. from stored procedures), ignore for the moment
273+
$this->stream->getLong();
274+
$token= $this->stream->getToken();
272275
} else {
273276
throw new TdsProtocolException(
274277
sprintf('Unexpected token 0x%02X', ord($token)),

src/main/php/rdbms/tds/TdsV7Protocol.class.php

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -252,6 +252,9 @@ public function query($sql) {
252252
} else if ("\xE3" === $token) { // ENVCHANGE, e.g. from "use [db]" queries
253253
$this->envchange();
254254
return null;
255+
} else if ("\x79" === $token) { // RETURN_STATUS (eg. from stored procedures), ignore for the moment
256+
$this->stream->getLong();
257+
$token= $this->stream->getToken();
255258
} else {
256259
throw new TdsProtocolException(
257260
sprintf('Unexpected token 0x%02X', ord($token)),

src/test/php/rdbms/unittest/integration/SybaseIntegrationTest.class.php

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -203,4 +203,19 @@ public function repeated_extend_errors() {
203203
}
204204
$this->assertEquals([0 => ['working' => 1]], $conn->select('1 as working'));
205205
}
206+
207+
#[@test]
208+
public function sp_helpconstraint() {
209+
$this->assertTrue($this->db()->query('sp_helpconstraint %c', $this->tableName()));
210+
}
211+
212+
#[@test]
213+
public function sp_helpconstraint_and_query() {
214+
$q= $this->db()->query('
215+
sp_helpconstraint %c
216+
select 1 as "result"',
217+
$this->tableName()
218+
);
219+
$this->assertEquals(1, $q->next('result'));
220+
}
206221
}

0 commit comments

Comments
 (0)