/hphp/test/slow/ext_mysql/mysql_fetch_lengths.php

http://github.com/facebook/hiphop-php · PHP · 29 lines · 23 code · 5 blank · 1 comment · 0 complexity · ed676e837729da7984689f467025b089 MD5 · raw file

  1. <?hh
  2. require_once('connect.inc');
  3. <<__EntryPoint>> function main(): void {
  4. $conn = mysql_connect($host, $user, $passwd);
  5. var_dump(create_test_table('lengths'));
  6. var_dump(mysql_query(
  7. "insert into test_lengths (name) values ('test'),('test2')"));
  8. $res = mysql_query('select * from test_lengths');
  9. $row = mysql_fetch_row($res);
  10. $lengths = mysql_fetch_lengths($res);
  11. print_r($lengths);
  12. // A much more intense test on lengths
  13. mysql_query('drop table testlen');
  14. var_dump(mysql_query("create table testlen (id int not null auto_increment, " .
  15. "d decimal(10,5), t tinyint, i int, b bigint, f float, " .
  16. "db double, y2 year(2), y4 year(4), primary key (id)) " .
  17. "engine=innodb"));
  18. var_dump(mysql_query("insert into testlen(d, t, i, b, f, db, y2, y4) values" .
  19. "(.343, null, 384, -1, 03.44, -03.43892874e101, 00, 0000)"));
  20. $res = mysql_query('select * from testlen');
  21. $row = mysql_fetch_row($res);
  22. $lengths = mysql_fetch_lengths($res);
  23. print_r($lengths);
  24. }