pg_meta_data_001.phpt 2.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153
  1. --TEST--
  2. PostgreSQL pg_meta_data() - basic test using schema
  3. --SKIPIF--
  4. <?php include("skipif.inc"); ?>
  5. --FILE--
  6. <?php
  7. include('config.inc');
  8. $conn = pg_connect($conn_str);
  9. pg_query('CREATE SCHEMA phptests');
  10. pg_query('CREATE TABLE phptests.foo (id INT, id2 INT)');
  11. pg_query('CREATE TABLE foo (id INT, id3 INT)');
  12. var_dump(pg_meta_data($conn, 'foo'));
  13. var_dump(pg_meta_data($conn, 'phptests.foo'));
  14. var_dump(pg_meta_data($conn, 'phptests.foo', TRUE));
  15. pg_query('DROP TABLE foo');
  16. pg_query('DROP TABLE phptests.foo');
  17. pg_query('DROP SCHEMA phptests');
  18. ?>
  19. --EXPECT--
  20. array(2) {
  21. ["id"]=>
  22. array(7) {
  23. ["num"]=>
  24. int(1)
  25. ["type"]=>
  26. string(4) "int4"
  27. ["len"]=>
  28. int(4)
  29. ["not null"]=>
  30. bool(false)
  31. ["has default"]=>
  32. bool(false)
  33. ["array dims"]=>
  34. int(0)
  35. ["is enum"]=>
  36. bool(false)
  37. }
  38. ["id3"]=>
  39. array(7) {
  40. ["num"]=>
  41. int(2)
  42. ["type"]=>
  43. string(4) "int4"
  44. ["len"]=>
  45. int(4)
  46. ["not null"]=>
  47. bool(false)
  48. ["has default"]=>
  49. bool(false)
  50. ["array dims"]=>
  51. int(0)
  52. ["is enum"]=>
  53. bool(false)
  54. }
  55. }
  56. array(2) {
  57. ["id"]=>
  58. array(7) {
  59. ["num"]=>
  60. int(1)
  61. ["type"]=>
  62. string(4) "int4"
  63. ["len"]=>
  64. int(4)
  65. ["not null"]=>
  66. bool(false)
  67. ["has default"]=>
  68. bool(false)
  69. ["array dims"]=>
  70. int(0)
  71. ["is enum"]=>
  72. bool(false)
  73. }
  74. ["id2"]=>
  75. array(7) {
  76. ["num"]=>
  77. int(2)
  78. ["type"]=>
  79. string(4) "int4"
  80. ["len"]=>
  81. int(4)
  82. ["not null"]=>
  83. bool(false)
  84. ["has default"]=>
  85. bool(false)
  86. ["array dims"]=>
  87. int(0)
  88. ["is enum"]=>
  89. bool(false)
  90. }
  91. }
  92. array(2) {
  93. ["id"]=>
  94. array(11) {
  95. ["num"]=>
  96. int(1)
  97. ["type"]=>
  98. string(4) "int4"
  99. ["len"]=>
  100. int(4)
  101. ["not null"]=>
  102. bool(false)
  103. ["has default"]=>
  104. bool(false)
  105. ["array dims"]=>
  106. int(0)
  107. ["is enum"]=>
  108. bool(false)
  109. ["is base"]=>
  110. bool(true)
  111. ["is composite"]=>
  112. bool(false)
  113. ["is pesudo"]=>
  114. bool(false)
  115. ["description"]=>
  116. string(0) ""
  117. }
  118. ["id2"]=>
  119. array(11) {
  120. ["num"]=>
  121. int(2)
  122. ["type"]=>
  123. string(4) "int4"
  124. ["len"]=>
  125. int(4)
  126. ["not null"]=>
  127. bool(false)
  128. ["has default"]=>
  129. bool(false)
  130. ["array dims"]=>
  131. int(0)
  132. ["is enum"]=>
  133. bool(false)
  134. ["is base"]=>
  135. bool(true)
  136. ["is composite"]=>
  137. bool(false)
  138. ["is pesudo"]=>
  139. bool(false)
  140. ["description"]=>
  141. string(0) ""
  142. }
  143. }