EMMA Coverage Report (generated Tue Jul 25 14:15:05 CDT 2006)
[all classes][com.mysql.jdbc]

COVERAGE SUMMARY FOR SOURCE FILE [MiniAdmin.java]

nameclass, %method, %block, %line, %
MiniAdmin.java100% (1/1)50%  (2/4)42%  (19/45)36%  (5/14)

COVERAGE BREAKDOWN BY CLASS AND METHOD

nameclass, %method, %block, %line, %
     
class MiniAdmin100% (1/1)50%  (2/4)42%  (19/45)36%  (5/14)
MiniAdmin (Connection): void 0%   (0/1)0%   (0/22)0%   (0/7)
shutdown (): void 0%   (0/1)0%   (0/4)0%   (0/2)
MiniAdmin (String): void 100% (1/1)100% (7/7)100% (2/2)
MiniAdmin (String, Properties): void 100% (1/1)100% (12/12)100% (3/3)

1/*
2 Copyright (C) 2002-2004 MySQL AB
3 
4 This program is free software; you can redistribute it and/or modify
5 it under the terms of version 2 of the GNU General Public License as 
6 published by the Free Software Foundation.
7 
8 There are special exceptions to the terms and conditions of the GPL 
9 as it is applied to this software. View the full text of the 
10 exception in file EXCEPTIONS-CONNECTOR-J in the directory of this 
11 software distribution.
12 
13 This program is distributed in the hope that it will be useful,
14 but WITHOUT ANY WARRANTY; without even the implied warranty of
15 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
16 GNU General Public License for more details.
17 
18 You should have received a copy of the GNU General Public License
19 along with this program; if not, write to the Free Software
20 Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
21 
22 
23 
24 */
25package com.mysql.jdbc;
26 
27import java.sql.SQLException;
28 
29import java.util.Properties;
30 
31/**
32 * Utility functions for admin functionality from Java.
33 * 
34 * @author Mark Matthews
35 */
36public class MiniAdmin {
37        // ~ Instance fields
38        // --------------------------------------------------------
39 
40        private Connection conn;
41 
42        // ~ Constructors
43        // -----------------------------------------------------------
44 
45        /**
46         * Create a new MiniAdmin using the given connection
47         * 
48         * @param conn
49         *            the existing connection to use.
50         * 
51         * @throws SQLException
52         *             if an error occurs
53         */
54        public MiniAdmin(java.sql.Connection conn) throws SQLException {
55                if (conn == null) {
56                        throw SQLError.createSQLException(
57                                        Messages.getString("MiniAdmin.0"), SQLError.SQL_STATE_GENERAL_ERROR); //$NON-NLS-1$
58                }
59 
60                if (!(conn instanceof Connection)) {
61                        throw SQLError.createSQLException(Messages.getString("MiniAdmin.1"), //$NON-NLS-1$
62                                        SQLError.SQL_STATE_GENERAL_ERROR);
63                }
64 
65                this.conn = (Connection) conn;
66        }
67 
68        /**
69         * Create a new MiniAdmin, connecting using the given JDBC URL.
70         * 
71         * @param jdbcUrl
72         *            the JDBC URL to use
73         * 
74         * @throws SQLException
75         *             if an error occurs
76         */
77        public MiniAdmin(String jdbcUrl) throws SQLException {
78                this(jdbcUrl, new Properties());
79        }
80 
81        /**
82         * Create a new MiniAdmin, connecting using the given JDBC URL and
83         * properties
84         * 
85         * @param jdbcUrl
86         *            the JDBC URL to use
87         * @param props
88         *            the properties to use when connecting
89         * 
90         * @throws SQLException
91         *             if an error occurs
92         */
93        public MiniAdmin(String jdbcUrl, Properties props) throws SQLException {
94                this.conn = (Connection) (new Driver().connect(jdbcUrl, props));
95        }
96 
97        // ~ Methods
98        // ----------------------------------------------------------------
99 
100        /**
101         * Shuts down the MySQL server at the other end of the connection that this
102         * MiniAdmin was created from/for.
103         * 
104         * @throws SQLException
105         *             if an error occurs
106         */
107        public void shutdown() throws SQLException {
108                this.conn.shutdownServer();
109        }
110}

[all classes][com.mysql.jdbc]
EMMA 2.0.4217 (C) Vladimir Roubtsov