Skip to content

Instantly share code, notes, and snippets.

@Eccenux
Created July 23, 2014 11:09
Show Gist options
  • Save Eccenux/28ebf6c4a37d0e4a7c5f to your computer and use it in GitHub Desktop.
Save Eccenux/28ebf6c4a37d0e4a7c5f to your computer and use it in GitHub Desktop.
PHP Bug #47803 test case
<?
include './odbc_sql_test_settings.php';
echo phpversion();
date_default_timezone_set('Europe/Warsaw');
$link = odbc_connect(DB_SETTINGS_DSN, DB_SETTINGS_USER, DB_SETTINGS_PASS);
$upd_params = array(
array('id'=>1, 'name'=>'test 1'),
array('id'=>2, 'name'=>'test 2'),
array('id'=>3, 'name'=>'test 3'),
array('id'=>4, 'name'=>'test 4'),
array('id'=>5, 'name'=>'test 5'),
array('id'=>10, 'name'=>'test 10'),
array('id'=>9, 'name'=>'test 9'),
array('id'=>8, 'name'=>'test 8'),
array('id'=>7, 'name'=>'test 7'),
array('id'=>6, 'name'=>'test 6'),
);
$sql = "UPDATE [PARAM]
SET [PAR_CHR] = ?
WHERE [PAR_ID] = ?";
$result = odbc_prepare($link, $sql);
if (!$result)
{
trigger_error ('[sql] prep: '.$sql, E_USER_ERROR);
}
foreach ($upd_params as &$k)
{
if(!odbc_execute($result, array($k['name'], $k['id'])))
{
trigger_error ('[sql] exec: '."array({$k['name']}, {$k['id']})", E_USER_ERROR);
}
}
?>
CREATE TABLE [PARAM](
[PAR_ID] [int] NOT NULL,
[PAR_INT] [int] NULL,
[PAR_CHR] [varchar](500) NULL
) ON [PRIMARY]
GO
INSERT INTO [PARAM]
([PAR_ID]
,[PAR_INT]
,[PAR_CHR])
VALUES
(1,14,''),
(2,30,''),
(3,7,''),
(4,7,''),
(5,0,''),
(6,0,''),
(7,20130901,''),
(8,20140201,''),
(9,20140201,''),
(10,20140620,''),
(11,221,'')
GO
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment