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

COVERAGE SUMMARY FOR SOURCE FILE [MysqlXADataSource.java]

nameclass, %method, %block, %line, %
MysqlXADataSource.java100% (1/1)75%  (3/4)76%  (29/38)75%  (6/8)

COVERAGE BREAKDOWN BY CLASS AND METHOD

nameclass, %method, %block, %line, %
     
class MysqlXADataSource100% (1/1)75%  (3/4)76%  (29/38)75%  (6/8)
getXAConnection (String, String): XAConnection 0%   (0/1)0%   (0/9)0%   (0/2)
MysqlXADataSource (): void 100% (1/1)100% (3/3)100% (1/1)
getXAConnection (): XAConnection 100% (1/1)100% (7/7)100% (2/2)
wrapConnection (Connection): XAConnection 100% (1/1)100% (19/19)100% (3/3)

1/*
2 Copyright (C) 2005 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.jdbc2.optional;
26 
27import java.sql.Connection;
28import java.sql.SQLException;
29 
30import javax.sql.XAConnection;
31 
32/**
33 * @author mmatthew
34 * 
35 * To change this generated comment edit the template variable "typecomment":
36 * Window>Preferences>Java>Templates. To enable and disable the creation of type
37 * comments go to Window>Preferences>Java>Code Generation.
38 */
39public class MysqlXADataSource extends MysqlDataSource implements
40                javax.sql.XADataSource {
41 
42        /**
43         * @see javax.sql.XADataSource#getXAConnection()
44         */
45        public XAConnection getXAConnection() throws SQLException {
46 
47                Connection conn = getConnection();
48 
49                return wrapConnection(conn);
50        }
51 
52        /**
53         * @see javax.sql.XADataSource#getXAConnection(String, String)
54         */
55        public XAConnection getXAConnection(String user, String password)
56                        throws SQLException {
57 
58                Connection conn = getConnection(user, password);
59 
60                return wrapConnection(conn);
61        }
62 
63        /**
64         * Wraps a connection as a 'fake' XAConnection
65         */
66 
67        private XAConnection wrapConnection(Connection conn) throws SQLException {
68                if (getPinGlobalTxToPhysicalConnection() || 
69                                ((com.mysql.jdbc.Connection)conn).getPinGlobalTxToPhysicalConnection()) {
70                        return new SuspendableXAConnection((com.mysql.jdbc.Connection) conn);
71                }
72                
73                return new MysqlXAConnection((com.mysql.jdbc.Connection) conn);
74        }
75}

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