PEAR is discontinued

This is a static archive preserving historical releases and metadata. No new packages or updates will be published. For updates to existing packages, or to publish new packages, please use Composer and Packagist.

Home » Database » MDB2_Driver_mssql » Bug #5507

Squence Emulation don't work for mssql

Details

Submitted2005-09-24 13:17 UTC
Fromlowtzow at gmx dot de
Assigneddavidc
StatusClosed
PackageMDB2_Driver_mssql
PHP Version5.0.4
OSWindows XP
Roadmaps(Not assigned)

Comments

[2005-09-24 13:17 UTC] lowtzow at gmx dot de

Description:
------------
The sequence emulation of MDB2 does not work
with Microsoft SQL-Server 2005 (CTP June 2005),
if IDENTITY_INSERT is set to OFF, which is default.

Test script:
---------------
<?php
require_once 'MDB2.php';
$dsn = "mssql://BALDUIN/test";

$db =& MDB2::connect($dsn);

$id = $db->nextId('avgtest');

echo "<pre>";
print_r($id);
echo "</pre>\n";
?>

Expected result:
----------------
1

Actual result:
--------------
MDB2_Error Object
(
[error_message_prefix] =>
[mode] => 1
[level] => 1024
[code] => -1
[message] => MDB2 Error:
[userinfo] => [Last query: INSERT INTO avgtest_seq (sequence) VALUES (0)]
[Native code: 544]
[Native message: Cannot insert explicit value for identity column in table 'avgtest_seq' when IDENTITY_INSERT is set to OFF.]

[backtrace] => Array
(
[0] => Array
(
[file] => c:\xampp\xampp\php\pear\MDB2.php
[line] => 849
[function] => PEAR_Error
[class] => MDB2_Error
[type] => ->
[args] => Array
(
[0] => MDB2 Error:
[1] => -1
[2] => 1
[3] => 1024
[4] => [Last query: INSERT INTO avgtest_seq (sequence) VALUES (0)]
[Native code: 544]
[Native message: Cannot insert explicit value for identity column in table 'avgtest_seq' when IDENTITY_INSERT is set to OFF.]

)

)

[1] => Array
(
[file] => c:\xampp\xampp\php\pear\PEAR.php
[line] => 536
[function] => MDB2_Error
[class] => MDB2_Error
[type] => ->
[args] => Array
(
[0] =>
[1] => 1
[2] => 1024
[3] => [Last query: INSERT INTO avgtest_seq (sequence) VALUES (0)]
[Native code: 544]
[Native message: Cannot insert explicit value for identity column in table 'avgtest_seq' when IDENTITY_INSERT is set to OFF.]

)

)

[2] => Array
(
[file] => c:\xampp\xampp\php\pear\MDB2.php
[line] => 486
[function] => raiseError
[class] => MDB2_Driver_mssql
[type] => ->
[args] => Array
(
[0] =>
[1] =>
[2] =>
[3] =>
[4] => [Last query: INSERT INTO avgtest_seq (sequence) VALUES (0)]
[Native code: 544]
[Native message: Cannot insert explicit value for identity column in table 'avgtest_seq' when IDENTITY_INSERT is set to OFF.]

[5] => MDB2_Error
[6] => 1
)

)

[3] => Array
(
[file] => c:\xampp\xampp\php\pear\MDB2.php
[line] => 1188
[function] => raiseError
[class] => MDB2_Driver_mssql
[type] => ->
[args] => Array
(
[0] =>
[1] =>
[2] =>
[3] => [Last query: INSERT INTO avgtest_seq (sequence) VALUES (0)]
[Native code: 544]
[Native message: Cannot insert explicit value for identity column in table 'avgtest_seq' when IDENTITY_INSERT is set to OFF.]

)

)

[4] => Array
(
[file] => c:\xampp\xampp\php\pear\MDB2\Driver\mssql.php
[line] => 362
[function] => raiseError
[class] => MDB2_Driver_mssql
[type] => ->
[args] => Array
(
)

)

[5] => Array
(
[file] => c:\xampp\xampp\php\pear\MDB2\Driver\mssql.php
[line] => 412
[function] => _doQuery
[class] => MDB2_Driver_mssql
[type] => ->
[args] => Array
(
[0] => INSERT INTO avgtest_seq (sequence) VALUES (0)
[1] => 1
)

)

[6] => Array
(
[file] => C:\xampp\xampp\htdocs\phptest\squencetest.php
[line] => 7
[function] => nextID
[class] => MDB2_Driver_mssql
[type] => ->
[args] => Array
(
[0] => avgtest
)

)

)

[callback] =>
)