home *** CD-ROM | disk | FTP | other *** search
/ Enter 2004 June / ENTER.ISO / files / xampp-win32-1.4.5-installer.exe / xampp / 16tableinfo.phpt < prev    next >
Encoding:
Text File  |  2004-03-24  |  22.2 KB  |  867 lines

  1. --TEST--
  2. DB_driver::tableInfo
  3. --SKIPIF--
  4. <?php
  5.  
  6. /**
  7.  * Calls tableInfo() in various ways and checks to see that the output
  8.  * matches what's expected.
  9.  *
  10.  * These tests account for each DBMS using different column types and
  11.  * reporting back different information.  These differences are accounted
  12.  * for in the <var>$quirks</var> array, which has the following format:
  13.  *
  14.  * <pre>
  15.  * 'driver' => array(
  16.  *     'clob' => DBMS's column type for creating CLOB fields
  17.  *     'date' => DBMS's column type for creating DATE fields
  18.  *     'finds_table' => Can this DBMS determine table names from queries?
  19.  *     'commands' => array(
  20.  *         Extra commands to be passed to PHP's eval() function
  21.  *     )
  22.  *     0 => array(
  23.  *         //  Info expected to be reported for phptest_fk.a
  24.  *         'type' => Column type reported by the DBMS
  25.  *         'len' => Column size reported by the DBMS
  26.  *         'flags' => Flags reported by the DBMS
  27.  *     )
  28.  *     1 => array()  Info expected to be reported for phptest_fk.fk
  29.  *     2 => array()  Info expected to be reported for phptest_fk.c
  30.  *     3 => array()  Info expected to be reported for phptest_fk.d
  31.  *     4 => array()  Info expected to be reported for phptest_fk.e
  32.  *     5 => array()  Info expected to be reported for phptest_fk.f
  33.  *     9 => array()  Info expected to be reported for phptest.d
  34.  * )
  35.  * </pre>
  36.  *
  37.  * @see      DB_common::tableInfo()
  38.  * 
  39.  * @package  DB
  40.  * @version  $Id: 16tableinfo.phpt,v 1.20 2004/02/19 07:45:50 danielc Exp $
  41.  * @category Database
  42.  * @author   Daniel Convissor <danielc@analysisandsolutions.com>
  43.  * @internal
  44.  */
  45.  
  46. chdir(dirname(__FILE__));
  47. require_once './skipif.inc';
  48. $tableInfo = $db->tableInfo('ajkdslfajoijkadie');
  49. if (DB::isError($tableInfo) && $tableInfo->code == DB_ERROR_NOT_CAPABLE) {
  50.     die("skip $tableInfo->message");
  51. }
  52.  
  53. ?>
  54. --FILE--
  55. <?php
  56.  
  57. //  $Id: 16tableinfo.phpt,v 1.20 2004/02/19 07:45:50 danielc Exp $
  58.  
  59. /**
  60.  * Connect to the database and make the phptest table.
  61.  */
  62. require_once './mktable.inc';
  63.  
  64. /**
  65.  * Local error callback handler.
  66.  *
  67.  * Prints out an error message and kills the process.
  68.  *
  69.  * @param object  $o  PEAR error object automatically passed to this method
  70.  * @return void
  71.  * @see PEAR::setErrorHandling()
  72.  */
  73. function pe($o){
  74.     global $dbh;
  75.  
  76.     if ($o->getMessage() == "DB Error: can't distinguish duplicate field names") {
  77.         print "NOTICE: $dbh->phptype can't distinguish duplicate field names";
  78.         return;
  79.     }
  80.  
  81.     $dbh->setErrorHandling(PEAR_ERROR_RETURN);
  82.     $dbh->query('DROP TABLE phptest');
  83.     $dbh->query('DROP TABLE phptest_fk');
  84.  
  85.     die($o->toString());
  86. }
  87.  
  88. /**
  89.  * Loop through an array returned from tableInfo(), compare the actual
  90.  * contents to the expected contents and print out what is found.
  91.  *
  92.  * @param array   $array  the array to be examined
  93.  * @param string  $field  field index number of $quriks and table
  94.  * @param boolean $query  true if array is from a query or false if array
  95.  *                        is tableInfo()
  96.  * @return void
  97.  */
  98. function examineArrayData($array, $field = false, $query = true) {
  99.     global $dbh, $quirks;
  100.  
  101.     if (!is_array($array)) {
  102.         print "This DMBS didn't produce proper results\n\n\n\n\n";
  103.         return;
  104.     }
  105.  
  106.     foreach ($array as $key => $value) {
  107.         if ($field !== false &&
  108.             isset($quirks[$dbh->phptype][$field][$key]))
  109.         {
  110.             if ($key == 'flags' && $value == '' && $query &&
  111.                 !$quirks[$dbh->phptype]['finds_table'])
  112.             {
  113.                 print "$key ... matched expected value\n";
  114.             } else {
  115.                 if ($quirks[$dbh->phptype][$field][$key] == $value) {
  116.                     print "$key ... matched expected value\n";
  117.                 } else {
  118.                     print "$key ... was '$value' but we expected ";
  119.                     print "'{$quirks[$dbh->phptype][$field][$key]}'\n";
  120.                 }
  121.             }
  122.         } else {
  123.             if ($key == 'table') {
  124.                 if ($field <= 5) {
  125.                     if ($value == 'phptest_fk') {
  126.                         print "$key ... matched expected value\n";
  127.                     } else {
  128.                         if ($value == '' && $query &&
  129.                             !$quirks[$dbh->phptype]['finds_table'])
  130.                         {
  131.                             print "$key ... matched expected value\n";
  132.                         } else {
  133.                             print "$key ... was '$value' but we expected 'phptest_fk'\n";
  134.                         }
  135.                     }
  136.                 } else {
  137.                     if ($value == 'phptest') {
  138.                         print "$key ... matched expected value\n";
  139.                     } else {
  140.                         if ($value == '' && $query &&
  141.                             !$quirks[$dbh->phptype]['finds_table'])
  142.                         {
  143.                             print "$key ... matched expected value\n";
  144.                         } else {
  145.                             print "$key ... was '$value' but we expected 'phptest_fk'\n";
  146.                         }
  147.                     }
  148.                 }
  149.             } else {
  150.                 print "$key => $value\n";
  151.             }
  152.         }
  153.     }
  154. }
  155.  
  156. /**
  157.  * Loop through an array of table info data and return the results.
  158.  *
  159.  * @param array  $array  the array to be examined
  160.  * @return string
  161.  */
  162. function returnArrayData($array) {
  163.     $out = '';
  164.     foreach ($array as $key => $value) {
  165.         $out .= "$key => $value\n";
  166.     }
  167.     return $out;
  168. }
  169.  
  170.  
  171. $dbh->setErrorHandling(PEAR_ERROR_CALLBACK, 'pe');
  172.  
  173.  
  174. $quirks = array(
  175.     'ibase' => array(
  176.         'clob' => 'VARCHAR(50)',
  177.         'date' => 'DATE',
  178.         'finds_table' => false,
  179.         'commands' => array(
  180.         ),
  181.         0 => array(
  182.             'type' => 'INTEGER',
  183.             'len' => 4,
  184.             'flags' => 'unique_key not_null',
  185.         ),
  186.         1 => array(
  187.             'type' => 'INTEGER',
  188.             'len' => 4,
  189.             'flags' => 'primary_key not_null',
  190.         ),
  191.         2 => array(
  192.             'type' => 'VARCHAR',
  193.             'len' => 50,
  194.             'flags' => '',
  195.         ),
  196.         3 => array(
  197.             'type' => 'DATE',
  198.             'len' => 4,
  199.             'flags' => 'unique_key not_null',
  200.         ),
  201.         4 => array(
  202.             'type' => 'CHAR',
  203.             'len' => 4,
  204.             'flags' => 'not_null default',
  205.         ),
  206.         5 => array(
  207.             'type' => 'NUMERIC(9,1)',
  208.             'len' => 4,
  209.             'flags' => '',
  210.         ),
  211.         9 => array(
  212.             'type' => 'VARCHAR',
  213.             'len' => 20,
  214.             'flags' => '',
  215.         ),
  216.     ),
  217.  
  218.     'ifx' => array(
  219.         'clob' => 'CHAR(29)',
  220.         'date' => 'CHAR(10)',
  221.         'finds_table' => false,
  222.         'commands' => array(
  223.         ),
  224.         0 => array(
  225.             'type' => 'SQLINT',
  226.             'len' => 4,
  227.             'flags' => 'not_null',
  228.         ),
  229.         1 => array(
  230.             'type' => 'SQLINT',
  231.             'len' => 4,
  232.             'flags' => 'not_null',
  233.         ),
  234.         2 => array(
  235.             'type' => 'SQLCHAR',
  236.             'len' => 29,
  237.             'flags' => '',
  238.         ),
  239.         3 => array(
  240.             'type' => 'SQLCHAR',
  241.             'len' => 10,
  242.             'flags' => 'not_null',
  243.         ),
  244.         4 => array(
  245.             'type' => 'SQLCHAR',
  246.             'len' => 4,
  247.             'flags' => 'not_null',
  248.         ),
  249.         5 => array(
  250.             'type' => 'SQLDECIMAL',
  251.             'len' => 513,
  252.             'flags' => '',
  253.         ),
  254.         9 => array(
  255.             'type' => 'SQLCHAR',
  256.             'len' => 20,
  257.             'flags' => '',
  258.         ),
  259.     ),
  260.  
  261.     'mssql' => array(
  262.         'clob' => 'TEXT',
  263.         'date' => 'SMALLDATETIME',
  264.         'finds_table' => false,
  265.         'commands' => array(
  266.             'ini_set("mssql.datetimeconvert", "Off");',
  267.             '$dbh->query("SET DATEFORMAT ymd");',
  268.         ),
  269.         0 => array(
  270.             'type' => 'int',
  271.             'len' => 4,
  272.             'flags' => 'multiple_key unique_key not_null',
  273.         ),
  274.         1 => array(
  275.             'type' => 'int',
  276.             'len' => 4,
  277.             'flags' => 'primary_key not_null',
  278.         ),
  279.         2 => array(
  280.             'type' => 'text',
  281.             'len' => 4096,
  282.             'flags' => '',
  283.         ),
  284.         3 => array(
  285.             'type' => 'datetime',
  286.             'len' => 4,
  287.             'flags' => 'multiple_key unique_key not_null',
  288.         ),
  289.         4 => array(
  290.             'type' => 'char',
  291.             'len' => 4,
  292.             'flags' => 'not_null',
  293.         ),
  294.         5 => array(
  295.             'type' => 'real',
  296.             'len' => 19,
  297.             'flags' => '',
  298.         ),
  299.         9 => array(
  300.             'type' => 'char',
  301.             'len' => 20,
  302.             'flags' => '',
  303.         ),
  304.     ),
  305.  
  306.     'mysql' => array(
  307.         'clob' => 'TEXT',
  308.         'date' => 'DATE',
  309.         'finds_table' => true,
  310.         'commands' => array(
  311.         ),
  312.         0 => array(
  313.             'type' => 'int',
  314.             'len' => 11,
  315.             'flags' => 'not_null multiple_key',
  316.         ),
  317.         1 => array(
  318.             'type' => 'int',
  319.             'len' => 11,
  320.             'flags' => 'not_null primary_key',
  321.         ),
  322.         2 => array(
  323.             'type' => 'blob',
  324.             'len' => 65535,
  325.             'flags' => 'blob',
  326.         ),
  327.         3 => array(
  328.             'type' => 'date',
  329.             'len' => 10,
  330.             'flags' => 'not_null multiple_key',
  331.         ),
  332.         4 => array(
  333.             'type' => 'string',
  334.             'len' => 4,
  335.             'flags' => 'not_null',
  336.         ),
  337.         5 => array(
  338.             'type' => 'real',
  339.             'len' => 4,
  340.             'flags' => '',
  341.         ),
  342.         9 => array(
  343.             'type' => 'string',
  344.             'len' => 20,
  345.             'flags' => '',
  346.         ),
  347.     ),
  348.  
  349.     'oci8' => array(
  350.         'clob' => 'CLOB',
  351.         'date' => 'DATE',
  352.         'finds_table' => false,
  353.         'commands' => array(
  354.             '$dbh->query("ALTER SESSION SET NLS_DATE_FORMAT = \'YYYY-MM-DD\'");',
  355.         ),
  356.         0 => array(
  357.             'type' => 'NUMBER',
  358.             'len' => 22,
  359.             'flags' => 'not_null',
  360.         ),
  361.         1 => array(
  362.             'type' => 'NUMBER',
  363.             'len' => 22,
  364.             'flags' => 'not_null',
  365.         ),
  366.         2 => array(
  367.             'type' => 'CLOB',
  368.             'len' => 4000,
  369.             'flags' => '',
  370.         ),
  371.         3 => array(
  372.             'type' => 'DATE',
  373.             'len' => 7,
  374.             'flags' => 'not_null',
  375.         ),
  376.         4 => array(
  377.             'type' => 'CHAR',
  378.             'len' => 4,
  379.             'flags' => 'not_null',
  380.         ),
  381.         5 => array(
  382.             'type' => 'NUMBER',
  383.             'len' => 22,
  384.             'flags' => '',
  385.         ),
  386.         9 => array(
  387.             'type' => 'VARCHAR',
  388.             'len' => 20,
  389.             'flags' => '',
  390.         ),
  391.     ),
  392.  
  393.     'pgsql' => array(
  394.         'clob' => 'TEXT',
  395.         'date' => 'DATE',
  396.         'finds_table' => false,
  397.         'commands' => array(
  398.             '$dbh->query("SET DATESTYLE = ISO");',
  399.         ),
  400.         0 => array(
  401.             'type' => 'int4',
  402.             'len' => 4,
  403.             'flags' => 'not_null unique_key multiple_key',
  404.         ),
  405.         1 => array(
  406.             'type' => 'int4',
  407.             'len' => 4,
  408.             'flags' => 'not_null primary_key',
  409.         ),
  410.         2 => array(
  411.             'type' => 'text',
  412.             'len' => -1,
  413.             'flags' => '',
  414.         ),
  415.         3 => array(
  416.             'type' => 'date',
  417.             'len' => 4,
  418.             'flags' => 'not_null unique_key multiple_key',
  419.         ),
  420.         4 => array(
  421.             'type' => 'bpchar',
  422.             'len' => -1,
  423.             'flags' => 'not_null default_df%20t',
  424.         ),
  425.         5 => array(
  426.             'type' => 'numeric',
  427.             'len' => -1,
  428.             'flags' => '',
  429.         ),
  430.         9 => array(
  431.             'type' => 'varchar',
  432.             'len' => -1,
  433.             'flags' => '',
  434.         ),
  435.     ),
  436.  
  437.     'sybase' => array(
  438.         'clob' => 'TEXT',
  439.         'date' => 'SMALLDATETIME',
  440.         'finds_table' => false,
  441.         'commands' => array(
  442.             '$dbh->query("SET DATEFORMAT ymd");',
  443.         ),
  444.         0 => array(
  445.             'type' => 'int',
  446.             'len' => 11,
  447.             'flags' => 'multiple_key unique_key',
  448.         ),
  449.         1 => array(
  450.             'type' => 'int',
  451.             'len' => 11,
  452.             'flags' => 'unique_key',
  453.         ),
  454.         2 => array(
  455.             'type' => 'string',
  456.             'len' => 32768,
  457.             'flags' => '',
  458.         ),
  459.         3 => array(
  460.             'type' => 'datetime',
  461.             'len' => 29,
  462.             'flags' => 'multiple_key unique_key',
  463.         ),
  464.         4 => array(
  465.             'type' => 'string',
  466.             'len' => 4,
  467.             'flags' => '',
  468.         ),
  469.         5 => array(
  470.             'type' => 'real',
  471.             'len' => 4,
  472.             'flags' => '',
  473.         ),
  474.         9 => array(
  475.             'type' => 'string',
  476.             'len' => 20,
  477.             'flags' => '',
  478.         ),
  479.     ),
  480. );
  481.  
  482.  
  483. if (!isset($quirks[$dbh->phptype])) {
  484.     die("This test does not yet support $dbh->phptype");
  485. }
  486.  
  487. if (count($quirks[$dbh->phptype]['commands'])) {
  488.     foreach ($quirks[$dbh->phptype]['commands'] as $value) {
  489.         eval($value);
  490.     }
  491. }
  492.  
  493.  
  494. $dbh->query('DELETE FROM phptest');
  495. $dbh->query("INSERT INTO phptest VALUES (1, 'one', 'One', '2001-02-16')");
  496. $dbh->query("INSERT INTO phptest VALUES (2, 'two', 'Two', '2001-02-15')");
  497. $dbh->query("INSERT INTO phptest VALUES (3, 'three', 'Three', '2001-02-14')");
  498.  
  499.  
  500. $dbh->setErrorHandling(PEAR_ERROR_RETURN);
  501. $dbh->query('DROP TABLE phptest_fk');
  502. $dbh->setErrorHandling(PEAR_ERROR_CALLBACK, 'pe');
  503.  
  504.  
  505. // $null is set in mktable.inc
  506.  
  507. $dbh->query("
  508.     CREATE TABLE phptest_fk (
  509.         a INTEGER NOT NULL,
  510.         fk INTEGER NOT NULL,
  511.         c {$quirks[$dbh->phptype]['clob']} $null,
  512.         d {$quirks[$dbh->phptype]['date']} NOT NULL,
  513.         e CHAR(4) DEFAULT 'df t' NOT NULL,
  514.         f DECIMAL(2,1) $null,
  515.         PRIMARY KEY (fk),
  516.         UNIQUE (a, d)
  517.     )
  518. ");
  519. $dbh->query("CREATE INDEX thedidx ON phptest_fk (d)");
  520. $dbh->query("INSERT INTO phptest_fk VALUES (10, 1, 'One', '2001-02-16',  'c1', 1.1)");
  521. $dbh->query("INSERT INTO phptest_fk VALUES (20, 2, 'Two', '2001-02-15', 'c2', 2.2)");
  522. $dbh->query("INSERT INTO phptest_fk VALUES (30, 3, 'Three', '2001-02-14', 'c3', 3.3)");
  523.  
  524.  
  525. $resultobj =& $dbh->query('SELECT phptest_fk.a, phptest_fk.fk,
  526.         phptest_fk.c, phptest_fk.d, phptest_fk.e, phptest_fk.f,
  527.         phptest.a, phptest.b, phptest.c, phptest.d
  528.         FROM phptest_fk, phptest WHERE phptest.a = phptest_fk.fk');
  529.  
  530.  
  531.  
  532. print "\n==========================================\n";
  533. print "Passing result OBJECT to method in DB_<type>.\n";
  534. print "Output = default.\n";
  535. print "------------------------------------------\n";
  536. $array = $dbh->tableInfo($resultobj);
  537.  
  538. print "\nfirst field:\n";
  539. examineArrayData($array[0], 0);
  540.  
  541. print "\ntenth field:\n";
  542. examineArrayData($array[9], 9);
  543.  
  544.  
  545.  
  546. print "\n==========================================\n";
  547. print "Passing result ID to method in DB_<type>.\n";
  548. print "Output = DB_TABLEINFO_ORDER.\n";
  549. print "------------------------------------------\n";
  550. $array = $dbh->tableInfo($resultobj->result, DB_TABLEINFO_ORDER);
  551.  
  552. print "\nfirst field:\n";
  553. examineArrayData($array[0], 0);
  554.  
  555. print "\nfourth field:\n";
  556. examineArrayData($array[3], 3);
  557.  
  558. print "\nnum_fields:\n";
  559. print "{$array['num_fields']}\n";
  560.  
  561. print "\norder:\n";
  562. if (is_array($array['order'])) {
  563.     ksort($array['order']);
  564.     examineArrayData($array['order']);
  565. } else {
  566.     print "This DMBS didn't produce proper results\n\n\n\n\n\n\n";
  567. }
  568.  
  569.  
  570.  
  571. print "\n==========================================\n";
  572. print "Passing DB_TABLEINFO_ORDERTABLE to method in DB_result.\n";
  573. print "Output = DB_TABLEINFO_ORDERTABLE.\n";
  574. print "------------------------------------------\n";
  575. $array = $resultobj->tableInfo(DB_TABLEINFO_ORDERTABLE);
  576. // Free this to keep interbase happy.
  577. $resultobj->free();
  578.  
  579. print "\nfirst field:\n";
  580. examineArrayData($array[0], 0);
  581.  
  582. print "\nfourth field:\n";
  583. examineArrayData($array[3], 3);
  584.  
  585. print "\nnum_fields:\n";
  586. print "{$array['num_fields']}\n";
  587.  
  588.  
  589. print "\nordertable[phptest]:\n";
  590. $expected = 'a => 6
  591. b => 7
  592. c => 8
  593. d => 9
  594. ';
  595. if (isset($array['ordertable']['phptest'])) {
  596.     $actual = returnArrayData($array['ordertable']['phptest']);
  597. } else {
  598.     $actual = '';
  599. }
  600. if ($actual == $expected) {
  601.     print "matched expected values\n";
  602. } else {
  603.     if ($quirks[$dbh->phptype]['finds_table'] === false && $actual == '') {
  604.         print "matched expected values\n";
  605.     } else {
  606.         print "DIDN'T match expected values...\n";
  607.         print "~~~~~~~~\nExpected:\n$expected\n";
  608.         print "~~~~\nActual:\n$actual\n~~~~~~~~\n\n";
  609.     }
  610. }
  611.  
  612.  
  613. print "\nordertable[phptest_fk]:\n";
  614. $expected = 'a => 0
  615. fk => 1
  616. c => 2
  617. d => 3
  618. e => 4
  619. f => 5
  620. ';
  621. if (isset($array['ordertable']['phptest_fk'])) {
  622.     $actual = returnArrayData($array['ordertable']['phptest_fk']);
  623. } else {
  624.     $actual = '';
  625. }
  626. if ($actual == $expected) {
  627.     print "matched expected values\n";
  628. } else {
  629.     if ($quirks[$dbh->phptype]['finds_table'] === false && $actual == '') {
  630.         print "matched expected values\n";
  631.     } else {
  632.         print "DIDN'T match expected values...\n";
  633.         print "~~~~~~~~\nExpected:\n$expected\n";
  634.         print "~~~~\nActual:\n$actual\n~~~~~~~~\n\n";
  635.     }
  636. }
  637.  
  638.  
  639. print "\n==========================================\n";
  640. print "Passing TABLE NAME 'phptest_fk' to method in DB_<driver>.\n";
  641. print "Output = default.\n";
  642. print "------------------------------------------\n";
  643. $array = $dbh->tableInfo('phptest_fk');
  644.  
  645. print "\nfirst field:\n";
  646. examineArrayData($array[0], 0, false);
  647.  
  648. print "\nsecond field:\n";
  649. examineArrayData($array[1], 1, false);
  650.  
  651. print "\nthird field:\n";
  652. examineArrayData($array[2], 2, false);
  653.  
  654. print "\nfourth field:\n";
  655. examineArrayData($array[3], 3, false);
  656.  
  657. print "\nfifth field:\n";
  658. examineArrayData($array[4], 4, false);
  659.  
  660. print "\nsixth field:\n";
  661. examineArrayData($array[5], 5, false);
  662.  
  663.  
  664. print "\n==========================================\n";
  665. print "Passing TABLE NAME 'phptest_fk' to method in DB_<driver>.\n";
  666. print "Output = DB_TABLEINFO_FULL.\n";
  667. print "------------------------------------------\n";
  668. $array = $dbh->tableInfo('phptest_fk', DB_TABLEINFO_FULL);
  669.  
  670. print "\nfirst field:\n";
  671. examineArrayData($array[0], 0, false);
  672.  
  673. print "\norder:\n";
  674. examineArrayData($array['order'], false);
  675.  
  676. print "\nordertable[phptest_fk]:\n";
  677. examineArrayData($array['ordertable']['phptest_fk']);
  678.  
  679.  
  680.  
  681. print "\n==========================================\n";
  682. print "Passing TABLE NAME 'phptest_fk' to method in DB_<driver> AGAIN.\n";
  683. print "Output = DB_TABLEINFO_FULL, lowercasing turned off.\n";
  684. print "------------------------------------------\n";
  685. $dbh->setOption('portability', DB_PORTABILITY_ALL ^ DB_PORTABILITY_LOWERCASE);
  686. $array = $dbh->tableInfo('phptest_fk', DB_TABLEINFO_FULL);
  687.  
  688. // testing non-lowercasing above to ensure program doesn't die.
  689. // lowercase the names here to ensure test uniformity.
  690. $array[0]['table'] = strtolower($array[0]['table']);
  691. $array[0]['name'] = strtolower($array[0]['name']);
  692.  
  693. print "\nfirst field:\n";
  694. examineArrayData($array[0], 0, false);
  695.  
  696.  
  697. $dbh->setErrorHandling(PEAR_ERROR_RETURN);
  698. $dbh->query('DROP TABLE phptest');
  699. $dbh->query('DROP TABLE phptest_fk');
  700.  
  701. ?>
  702. --EXPECT--
  703. ==========================================
  704. Passing result OBJECT to method in DB_<type>.
  705. Output = default.
  706. ------------------------------------------
  707.  
  708. first field:
  709. table ... matched expected value
  710. name => a
  711. type ... matched expected value
  712. len ... matched expected value
  713. flags ... matched expected value
  714.  
  715. tenth field:
  716. table ... matched expected value
  717. name => d
  718. type ... matched expected value
  719. len ... matched expected value
  720. flags ... matched expected value
  721.  
  722. ==========================================
  723. Passing result ID to method in DB_<type>.
  724. Output = DB_TABLEINFO_ORDER.
  725. ------------------------------------------
  726.  
  727. first field:
  728. table ... matched expected value
  729. name => a
  730. type ... matched expected value
  731. len ... matched expected value
  732. flags ... matched expected value
  733.  
  734. fourth field:
  735. table ... matched expected value
  736. name => d
  737. type ... matched expected value
  738. len ... matched expected value
  739. flags ... matched expected value
  740.  
  741. num_fields:
  742. 10
  743.  
  744. order:
  745. a => 6
  746. b => 7
  747. c => 8
  748. d => 9
  749. e => 4
  750. f => 5
  751. fk => 1
  752.  
  753. ==========================================
  754. Passing DB_TABLEINFO_ORDERTABLE to method in DB_result.
  755. Output = DB_TABLEINFO_ORDERTABLE.
  756. ------------------------------------------
  757.  
  758. first field:
  759. table ... matched expected value
  760. name => a
  761. type ... matched expected value
  762. len ... matched expected value
  763. flags ... matched expected value
  764.  
  765. fourth field:
  766. table ... matched expected value
  767. name => d
  768. type ... matched expected value
  769. len ... matched expected value
  770. flags ... matched expected value
  771.  
  772. num_fields:
  773. 10
  774.  
  775. ordertable[phptest]:
  776. matched expected values
  777.  
  778. ordertable[phptest_fk]:
  779. matched expected values
  780.  
  781. ==========================================
  782. Passing TABLE NAME 'phptest_fk' to method in DB_<driver>.
  783. Output = default.
  784. ------------------------------------------
  785.  
  786. first field:
  787. table ... matched expected value
  788. name => a
  789. type ... matched expected value
  790. len ... matched expected value
  791. flags ... matched expected value
  792.  
  793. second field:
  794. table ... matched expected value
  795. name => fk
  796. type ... matched expected value
  797. len ... matched expected value
  798. flags ... matched expected value
  799.  
  800. third field:
  801. table ... matched expected value
  802. name => c
  803. type ... matched expected value
  804. len ... matched expected value
  805. flags ... matched expected value
  806.  
  807. fourth field:
  808. table ... matched expected value
  809. name => d
  810. type ... matched expected value
  811. len ... matched expected value
  812. flags ... matched expected value
  813.  
  814. fifth field:
  815. table ... matched expected value
  816. name => e
  817. type ... matched expected value
  818. len ... matched expected value
  819. flags ... matched expected value
  820.  
  821. sixth field:
  822. table ... matched expected value
  823. name => f
  824. type ... matched expected value
  825. len ... matched expected value
  826. flags ... matched expected value
  827.  
  828. ==========================================
  829. Passing TABLE NAME 'phptest_fk' to method in DB_<driver>.
  830. Output = DB_TABLEINFO_FULL.
  831. ------------------------------------------
  832.  
  833. first field:
  834. table ... matched expected value
  835. name => a
  836. type ... matched expected value
  837. len ... matched expected value
  838. flags ... matched expected value
  839.  
  840. order:
  841. a => 0
  842. fk => 1
  843. c => 2
  844. d => 3
  845. e => 4
  846. f => 5
  847.  
  848. ordertable[phptest_fk]:
  849. a => 0
  850. fk => 1
  851. c => 2
  852. d => 3
  853. e => 4
  854. f => 5
  855.  
  856. ==========================================
  857. Passing TABLE NAME 'phptest_fk' to method in DB_<driver> AGAIN.
  858. Output = DB_TABLEINFO_FULL, lowercasing turned off.
  859. ------------------------------------------
  860.  
  861. first field:
  862. table ... matched expected value
  863. name => a
  864. type ... matched expected value
  865. len ... matched expected value
  866. flags ... matched expected value
  867.