1--TEST--
2mysql_create_db()
3--SKIPIF--
4<?php
5require_once('skipif.inc');
6if (!function_exists('mysql_create_db'))
7	die("Skip mysql_create_db() exists only in old versions of the libmysql.");
8?>
9--FILE--
10<?php
11include "connect.inc";
12
13$link   = NULL;
14$tmp    = null;
15
16if (false !== ($tmp = mysql_create_db()))
17	printf("[001] Expecting boolean/false, got %s/%s\n", gettype($tmp), $tmp);
18
19if (false !== ($tmp = mysql_create_db($link, $link, $link)))
20	printf("[002] Expecting boolean/false, got %s/%s\n", gettype($tmp), $tmp);
21
22if ($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
26if (!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
29if (!mysql_query("DROP DATABASE mysqlcreatedb", $link))
30	printf("[005] [%d] %s\n", mysql_errno($link), mysql_error($link));
31
32if (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
35if (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
38if (!mysql_query("DROP DATABASE mysqlcreatedb", $link))
39	printf("[008] [%d] %s\n", mysql_errno($link), mysql_error($link));
40
41print "done!";
42?>
43--CLEAN--
44<?php
45require_once('connect.inc');
46if (!$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
50if (!mysql_query("DROP DATABASE IF EXISTS mysqlcreatedb", $link))
51	printf("[c002] [%d] %s\n", mysqli_errno($link), mysqli_error($link));
52
53mysql_close($link);
54?>
55--EXPECTF--
56Deprecated: mysql_connect(): The mysql extension is deprecated and will be removed in the future: use mysqli or PDO instead in %s on line %d
57
58Deprecated: mysql_connect(): The mysql extension is deprecated and will be removed in the future: use mysqli or PDO instead in %s on line %d
59done!
60