Annotation of embedaddon/php/ext/sybase_ct/tests/test_fields.phpt, revision 1.1.1.1

1.1       misho       1: --TEST--
                      2: Sybase-CT sybase_field_* functions
                      3: --SKIPIF--
                      4: <?php require('skipif.inc'); ?>
                      5: --FILE--
                      6: <?php
                      7: /* This file is part of PHP test framework for ext/sybase_ct
                      8:  *
                      9:  * $Id: test_fields.phpt 231839 2007-03-14 11:44:24Z thekid $ 
                     10:  */
                     11: 
                     12:   require('test.inc');
                     13: 
                     14:   $db= sybase_connect_ex();
                     15: 
                     16:   // Issue a query
                     17:   $q= sybase_unbuffered_query('select
                     18:     1 as "id",
                     19:     "Hello" as "caption",
                     20:     "timm" as "author",
                     21:     getdate() as "lastchange"
                     22:   ', $db, FALSE);
                     23:   var_dump($q);
                     24: 
                     25:   var_dump(sybase_num_fields($q));
                     26: 
                     27:   // Go through each field, dumping it
                     28:   while ($field= sybase_fetch_field($q)) {
                     29:     var_export($field); echo "\n";
                     30:   }
                     31:   
                     32:   // Seek to the second field and fetch it
                     33:  var_dump(sybase_field_seek($q, 1));
                     34:  var_export(sybase_fetch_field($q)); echo "\n";
                     35: 
                     36:  sybase_close($db);
                     37: ?>
                     38: --EXPECTF--
                     39: resource(%d) of type (sybase-ct result)
                     40: int(4)
                     41: stdClass::__set_state(array(
                     42:    'name' => 'id',
                     43:    'max_length' => 11,
                     44:    'column_source' => '',
                     45:    'numeric' => 1,
                     46:    'type' => 'int',
                     47: ))
                     48: stdClass::__set_state(array(
                     49:    'name' => 'caption',
                     50:    'max_length' => 5,
                     51:    'column_source' => '',
                     52:    'numeric' => 0,
                     53:    'type' => 'string',
                     54: ))
                     55: stdClass::__set_state(array(
                     56:    'name' => 'author',
                     57:    'max_length' => 4,
                     58:    'column_source' => '',
                     59:    'numeric' => 0,
                     60:    'type' => 'string',
                     61: ))
                     62: stdClass::__set_state(array(
                     63:    'name' => 'lastchange',
                     64:    'max_length' => 29,
                     65:    'column_source' => '',
                     66:    'numeric' => 0,
                     67:    'type' => 'datetime',
                     68: ))
                     69: bool(true)
                     70: stdClass::__set_state(array(
                     71:    'name' => 'caption',
                     72:    'max_length' => 5,
                     73:    'column_source' => '',
                     74:    'numeric' => 0,
                     75:    'type' => 'string',
                     76: ))

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