File:  [ELWIX - Embedded LightWeight unIX -] / embedaddon / php / ext / sybase_ct / tests / test_long.phpt
Revision 1.1.1.2 (vendor branch): download - view: text, annotated - select for diffs - revision graph
Tue May 29 12:34:45 2012 UTC (12 years, 7 months ago) by misho
Branches: php, MAIN
CVS tags: v5_4_3elwix, v5_4_29p0, v5_4_29, v5_4_20p0, v5_4_20, v5_4_17p0, v5_4_17, HEAD
php 5.4.3+patches

--TEST--
Sybase-CT select LONG_MAX / LONG_MIN
--SKIPIF--
<?php require('skipif.inc'); ?>
--FILE--
<?php
/* This file is part of PHP test framework for ext/sybase_ct
 *
 * $Id: test_long.phpt,v 1.1.1.2 2012/05/29 12:34:45 misho Exp $ 
 */

  require('test.inc');

  define('LONG_MAX', is_int(2147483648) ? 9223372036854775807 : 2147483647);
  define('LONG_MIN', -LONG_MAX - 1);

  $db= sybase_connect_ex();
  var_dump(sybase_select_db(TEMPDB, $db));
  
  // Create table and insert some values
  var_dump(sybase_query('create table test_long (value numeric(20, 0))'));
  var_dump(sybase_query('insert test_long values ('.(LONG_MAX - 1).')'));
  var_dump(sybase_query('insert test_long values ('.(LONG_MAX).')'));
  var_dump(sybase_query('insert test_long values ('.(LONG_MAX + 1).')'));
  var_dump(sybase_query('insert test_long values ('.(LONG_MIN + 1).')'));
  var_dump(sybase_query('insert test_long values ('.(LONG_MIN).')'));
  var_dump(sybase_query('insert test_long values ('.(LONG_MIN - 1).')'));
  
  // Select values
  var_dump(sybase_select_ex($db, 'select value from test_long'));
  
  // Drop table
  var_dump(sybase_query('drop table test_long'));
          
  sybase_close($db);
?>
--EXPECTF--
bool(true)
bool(true)
bool(true)
bool(true)
bool(true)
bool(true)
bool(true)
bool(true)
>>> Query: select value from test_long
<<< Return: resource
array(6) {
  [0]=>
  array(1) {
    ["value"]=>
    int(%s)
  }
  [1]=>
  array(1) {
    ["value"]=>
    int(%s)
  }
  [2]=>
  array(1) {
    ["value"]=>
    float(%s)
  }
  [3]=>
  array(1) {
    ["value"]=>
    int(-%s)
  }
  [4]=>
  array(1) {
    ["value"]=>
    int(-%s)
  }
  [5]=>
  array(1) {
    ["value"]=>
    float(-%s)
  }
}
bool(true)

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