You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

308 lines
3.9 KiB

20 years ago
20 years ago
20 years ago
20 years ago
  1. --TEST--
  2. oci_fetch_array()
  3. --SKIPIF--
  4. <?php if (!extension_loaded('oci8')) die("skip no oci8 extension"); ?>
  5. --FILE--
  6. <?php
  7. require dirname(__FILE__)."/connect.inc";
  8. require dirname(__FILE__).'/create_table.inc';
  9. $insert_sql = "INSERT INTO ".$schema."".$table_name." (id, value) VALUES (1,1)";
  10. if (!($s = oci_parse($c, $insert_sql))) {
  11. die("oci_parse(insert) failed!\n");
  12. }
  13. for ($i = 0; $i<3; $i++) {
  14. if (!oci_execute($s)) {
  15. die("oci_execute(insert) failed!\n");
  16. }
  17. }
  18. if (!oci_commit($c)) {
  19. die("oci_commit() failed!\n");
  20. }
  21. $select_sql = "SELECT * FROM ".$schema."".$table_name."";
  22. if (!($s = oci_parse($c, $select_sql))) {
  23. die("oci_parse(select) failed!\n");
  24. }
  25. if (!oci_execute($s)) {
  26. die("oci_execute(select) failed!\n");
  27. }
  28. while ($row = oci_fetch_array($s)) {
  29. var_dump($row);
  30. }
  31. if (!oci_execute($s)) {
  32. die("oci_execute(select) failed!\n");
  33. }
  34. while ($row = oci_fetch_array($s, OCI_NUM)) {
  35. var_dump($row);
  36. }
  37. if (!oci_execute($s)) {
  38. die("oci_execute(select) failed!\n");
  39. }
  40. while ($row = oci_fetch_array($s, OCI_ASSOC)) {
  41. var_dump($row);
  42. }
  43. if (!oci_execute($s)) {
  44. die("oci_execute(select) failed!\n");
  45. }
  46. while ($row = oci_fetch_array($s, OCI_BOTH)) {
  47. var_dump($row);
  48. }
  49. if (!oci_execute($s)) {
  50. die("oci_execute(select) failed!\n");
  51. }
  52. while ($row = oci_fetch_array($s, OCI_RETURN_LOBS)) {
  53. var_dump($row);
  54. }
  55. if (!oci_execute($s)) {
  56. die("oci_execute(select) failed!\n");
  57. }
  58. while ($row = oci_fetch_array($s, OCI_RETURN_NULLS)) {
  59. var_dump($row);
  60. }
  61. require dirname(__FILE__).'/drop_table.inc';
  62. echo "Done\n";
  63. ?>
  64. --EXPECT--
  65. array(10) {
  66. [0]=>
  67. string(1) "1"
  68. ["ID"]=>
  69. string(1) "1"
  70. [1]=>
  71. string(1) "1"
  72. ["VALUE"]=>
  73. string(1) "1"
  74. [2]=>
  75. NULL
  76. ["BLOB"]=>
  77. NULL
  78. [3]=>
  79. NULL
  80. ["CLOB"]=>
  81. NULL
  82. [4]=>
  83. NULL
  84. ["STRING"]=>
  85. NULL
  86. }
  87. array(10) {
  88. [0]=>
  89. string(1) "1"
  90. ["ID"]=>
  91. string(1) "1"
  92. [1]=>
  93. string(1) "1"
  94. ["VALUE"]=>
  95. string(1) "1"
  96. [2]=>
  97. NULL
  98. ["BLOB"]=>
  99. NULL
  100. [3]=>
  101. NULL
  102. ["CLOB"]=>
  103. NULL
  104. [4]=>
  105. NULL
  106. ["STRING"]=>
  107. NULL
  108. }
  109. array(10) {
  110. [0]=>
  111. string(1) "1"
  112. ["ID"]=>
  113. string(1) "1"
  114. [1]=>
  115. string(1) "1"
  116. ["VALUE"]=>
  117. string(1) "1"
  118. [2]=>
  119. NULL
  120. ["BLOB"]=>
  121. NULL
  122. [3]=>
  123. NULL
  124. ["CLOB"]=>
  125. NULL
  126. [4]=>
  127. NULL
  128. ["STRING"]=>
  129. NULL
  130. }
  131. array(2) {
  132. [0]=>
  133. string(1) "1"
  134. [1]=>
  135. string(1) "1"
  136. }
  137. array(2) {
  138. [0]=>
  139. string(1) "1"
  140. [1]=>
  141. string(1) "1"
  142. }
  143. array(2) {
  144. [0]=>
  145. string(1) "1"
  146. [1]=>
  147. string(1) "1"
  148. }
  149. array(2) {
  150. ["ID"]=>
  151. string(1) "1"
  152. ["VALUE"]=>
  153. string(1) "1"
  154. }
  155. array(2) {
  156. ["ID"]=>
  157. string(1) "1"
  158. ["VALUE"]=>
  159. string(1) "1"
  160. }
  161. array(2) {
  162. ["ID"]=>
  163. string(1) "1"
  164. ["VALUE"]=>
  165. string(1) "1"
  166. }
  167. array(4) {
  168. [0]=>
  169. string(1) "1"
  170. ["ID"]=>
  171. string(1) "1"
  172. [1]=>
  173. string(1) "1"
  174. ["VALUE"]=>
  175. string(1) "1"
  176. }
  177. array(4) {
  178. [0]=>
  179. string(1) "1"
  180. ["ID"]=>
  181. string(1) "1"
  182. [1]=>
  183. string(1) "1"
  184. ["VALUE"]=>
  185. string(1) "1"
  186. }
  187. array(4) {
  188. [0]=>
  189. string(1) "1"
  190. ["ID"]=>
  191. string(1) "1"
  192. [1]=>
  193. string(1) "1"
  194. ["VALUE"]=>
  195. string(1) "1"
  196. }
  197. array(4) {
  198. [0]=>
  199. string(1) "1"
  200. ["ID"]=>
  201. string(1) "1"
  202. [1]=>
  203. string(1) "1"
  204. ["VALUE"]=>
  205. string(1) "1"
  206. }
  207. array(4) {
  208. [0]=>
  209. string(1) "1"
  210. ["ID"]=>
  211. string(1) "1"
  212. [1]=>
  213. string(1) "1"
  214. ["VALUE"]=>
  215. string(1) "1"
  216. }
  217. array(4) {
  218. [0]=>
  219. string(1) "1"
  220. ["ID"]=>
  221. string(1) "1"
  222. [1]=>
  223. string(1) "1"
  224. ["VALUE"]=>
  225. string(1) "1"
  226. }
  227. array(10) {
  228. [0]=>
  229. string(1) "1"
  230. ["ID"]=>
  231. string(1) "1"
  232. [1]=>
  233. string(1) "1"
  234. ["VALUE"]=>
  235. string(1) "1"
  236. [2]=>
  237. NULL
  238. ["BLOB"]=>
  239. NULL
  240. [3]=>
  241. NULL
  242. ["CLOB"]=>
  243. NULL
  244. [4]=>
  245. NULL
  246. ["STRING"]=>
  247. NULL
  248. }
  249. array(10) {
  250. [0]=>
  251. string(1) "1"
  252. ["ID"]=>
  253. string(1) "1"
  254. [1]=>
  255. string(1) "1"
  256. ["VALUE"]=>
  257. string(1) "1"
  258. [2]=>
  259. NULL
  260. ["BLOB"]=>
  261. NULL
  262. [3]=>
  263. NULL
  264. ["CLOB"]=>
  265. NULL
  266. [4]=>
  267. NULL
  268. ["STRING"]=>
  269. NULL
  270. }
  271. array(10) {
  272. [0]=>
  273. string(1) "1"
  274. ["ID"]=>
  275. string(1) "1"
  276. [1]=>
  277. string(1) "1"
  278. ["VALUE"]=>
  279. string(1) "1"
  280. [2]=>
  281. NULL
  282. ["BLOB"]=>
  283. NULL
  284. [3]=>
  285. NULL
  286. ["CLOB"]=>
  287. NULL
  288. [4]=>
  289. NULL
  290. ["STRING"]=>
  291. NULL
  292. }
  293. Done