EMMA Coverage Report (generated Sun May 02 20:42:29 CEST 2010)
[all classes][hu.netmind.beankeeper.db.impl]

COVERAGE SUMMARY FOR SOURCE FILE [PostgresDatabaseImpl.java]

nameclass, %method, %block, %line, %
PostgresDatabaseImpl.java100% (1/1)100% (4/4)100% (63/63)100% (13/13)

COVERAGE BREAKDOWN BY CLASS AND METHOD

nameclass, %method, %block, %line, %
     
class PostgresDatabaseImpl100% (1/1)100% (4/4)100% (63/63)100% (13/13)
PostgresDatabaseImpl (): void 100% (1/1)100% (3/3)100% (1/1)
getLimitStatement (String, Limits, List): String 100% (1/1)100% (42/42)100% (6/6)
getSQLType (Class): int 100% (1/1)100% (10/10)100% (3/3)
getSQLTypeName (int): String 100% (1/1)100% (8/8)100% (3/3)

1/**
2 * Copyright (C) 2006 NetMind Consulting Bt.
3 *
4 * This library is free software; you can redistribute it and/or
5 * modify it under the terms of the GNU Lesser General Public
6 * License as published by the Free Software Foundation; either
7 * version 3 of the License, or (at your option) any later version.
8 *
9 * This library is distributed in the hope that it will be useful,
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
12 * Lesser General Public License for more details.
13 *
14 * You should have received a copy of the GNU Lesser General Public
15 * License along with this library; if not, write to the Free Software
16 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
17 */
18 
19package hu.netmind.beankeeper.db.impl;
20 
21import java.sql.Types;
22import java.util.List;
23import hu.netmind.beankeeper.db.*;
24 
25/**
26 * Postgres database implementation.
27 * @author Brautigam Robert
28 * @version CVS Revision: $Revision$
29 */
30public class PostgresDatabaseImpl extends GenericDatabase implements Database
31{
32   /**
33    * Get the limit component of statement, if it can be expressed in
34    * the current database with simple statement part.
35    * @param limits The limits to apply.
36    */
37   protected String getLimitStatement(String statement, Limits limits, List types)
38   {
39      StringBuffer result = new StringBuffer(statement);
40      if ( limits.getLimit() > 0 )
41         result.append(" limit "+limits.getLimit());
42      if ( limits.getOffset() > 0 )
43         result.append(" offset "+limits.getOffset());
44      return result.toString();
45   }
46 
47   /**
48    * Get the sql type for a class.
49    */
50   protected int getSQLType(Class type)
51   {
52      if ( byte[].class.equals(type) )
53         return Types.LONGVARBINARY;
54      return super.getSQLType(type);
55   }
56 
57   /**
58    * Get the class for an sql type. Override for blob type.
59    */
60   protected String getSQLTypeName(int sqltype)
61   {
62      switch ( sqltype )
63      {
64         case Types.BLOB:
65         case Types.BINARY:
66         case Types.VARBINARY:
67         case Types.LONGVARBINARY:
68            return "bytea";
69         default:
70            return super.getSQLTypeName(sqltype);
71      }
72   }
73 
74}
75 
76 
77 

[all classes][hu.netmind.beankeeper.db.impl]
EMMA 2.0.5312debian (C) Vladimir Roubtsov