Annotation of embedaddon/php/ext/mysql/tests/mysql_create_db.phpt, revision 1.1.1.1

1.1       misho       1: --TEST--
                      2: mysql_create_db()
                      3: --SKIPIF--
                      4: <?php
                      5: require_once('skipif.inc');
                      6: if (!function_exists('mysql_create_db'))
                      7:        die("Skip mysql_create_db() exists only in old versions of the libmysql.");
                      8: ?>
                      9: --FILE--
                     10: <?php
                     11: include "connect.inc";
                     12: 
                     13: $link   = NULL;
                     14: $tmp    = null;
                     15: 
                     16: if (false !== ($tmp = mysql_create_db()))
                     17:        printf("[001] Expecting boolean/false, got %s/%s\n", gettype($tmp), $tmp);
                     18: 
                     19: if (false !== ($tmp = mysql_create_db($link, $link, $link)))
                     20:        printf("[002] Expecting boolean/false, got %s/%s\n", gettype($tmp), $tmp);
                     21: 
                     22: if ($link = my_mysql_connect($host, $user, $passwd, $db, $port, $socket))
                     23:        printf("[003] Can connect to the server using host=%s, user=%s, passwd=***non_empty, dbname=%s, port=%s, socket=%s\n",
                     24:                $host, $user . 'unknown_really', $db, $port, $socket);
                     25: 
                     26: if (!mysql_query("CREATE DATABASE mysqlcreatedb", $link))
                     27:        die(sprintf("[004] Cannot create database, aborting test, [%d] %s\n", mysql_errno($link), mysql_error($link)));
                     28: 
                     29: if (!mysql_query("DROP DATABASE mysqlcreatedb", $link))
                     30:        printf("[005] [%d] %s\n", mysql_errno($link), mysql_error($link));
                     31: 
                     32: if (true !== ($tmp = mysql_create_db("mysqlcreatedb", $link)))
                     33:        printf("[006] Expecting boolean/true, got %s/%s, [%d] %s\n", gettype($tmp), $tmp, mysql_errno($link), mysql_error($link));
                     34: 
                     35: if (false !== ($tmp = mysql_create_db("mysqlcreatedb", $link)))
                     36:        printf("[007] Expecting boolean/false, got %s/%s, [%d] %s\n", gettype($tmp), $tmp, mysql_errno($link), mysql_error($link));
                     37: 
                     38: if (!mysql_query("DROP DATABASE mysqlcreatedb", $link))
                     39:        printf("[008] [%d] %s\n", mysql_errno($link), mysql_error($link));
                     40: 
                     41: print "done!";
                     42: ?>
                     43: --CLEAN--
                     44: <?php
                     45: require_once('connect.inc');
                     46: if (!$link = my_mysql_connect($host, $user, $passwd, $db, $port, $socket))
                     47:        printf("[c001] Cannot connect to the server using host=%s, user=%s, passwd=***, dbname=%s, port=%s, socket=%s\n",
                     48:                $host, $user, $db, $port, $socket);
                     49: 
                     50: if (!mysql_query("DROP DATABASE IF EXISTS mysqlcreatedb", $link))
                     51:        printf("[c002] [%d] %s\n", mysqli_errno($link), mysqli_error($link));
                     52: 
                     53: mysql_close($link);
                     54: ?>
                     55: --EXPECTF--
                     56: done!

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