File:  [ELWIX - Embedded LightWeight unIX -] / embedaddon / php / ext / sybase_ct / tests / bug43578.phpt
Revision 1.1.1.3 (vendor branch): download - view: text, annotated - select for diffs - revision graph
Mon Oct 14 08:02:42 2013 UTC (11 years, 2 months ago) by misho
Branches: php, MAIN
CVS tags: v5_4_29p0, v5_4_29, v5_4_20p0, v5_4_20, HEAD
v 5.4.20

--TEST--
Sybase-CT bug #43578 (Incurred fault #6 - if returned textfield ist empty)
--SKIPIF--
<?php require('skipif.inc'); ?>
--FILE--
<?php
/* This file is part of PHP test framework for ext/sybase_ct
 *
 * $Id: bug43578.phpt,v 1.1.1.3 2013/10/14 08:02:42 misho Exp $
 */

  require('test.inc');

  $db= sybase_connect_ex();
  
  // Create a temporary table and fill it with test values
  var_dump(sybase_query('
    create table #Resource (
      Resource_ID int,
      DC_Rights text null
    )
  ', $db));
  var_dump(sybase_query('insert into #Resource values (123, NULL)', $db));
  var_dump(sybase_query('insert into #Resource values (124, "")', $db));

  // Select non-existent
  var_dump(sybase_select_ex($db, 'select DC_Rights from #Resource where Resource_ID = 122'));

  // Select null
  var_dump(sybase_select_ex($db, 'select DC_Rights from #Resource where Resource_ID = 123'));

  // Select empty
  var_dump(sybase_select_ex($db, 'select DC_Rights from #Resource where Resource_ID = 124'));
  
  // Clean up and close connection
  var_dump(sybase_query('drop table #Resource', $db));
  sybase_close($db);
?>
--EXPECTF--
bool(true)
bool(true)
bool(true)
>>> Query: select DC_Rights from #Resource where Resource_ID = 122
<<< Return: resource
array(0) {
}
>>> Query: select DC_Rights from #Resource where Resource_ID = 123
<<< Return: resource
array(1) {
  [0]=>
  array(1) {
    ["DC_Rights"]=>
    NULL
  }
}
>>> Query: select DC_Rights from #Resource where Resource_ID = 124
<<< Return: resource
array(1) {
  [0]=>
  array(1) {
    ["DC_Rights"]=>
    string(1) " "
  }
}
bool(true)

FreeBSD-CVSweb <freebsd-cvsweb@FreeBSD.org>