~ubuntu-branches/ubuntu/gutsy/libpgjava/gutsy

« back to all changes in this revision

Viewing changes to src/interfaces/jdbc/org/postgresql/util/PGmoney.java

  • Committer: Bazaar Package Importer
  • Author(s): Arnaud Vandyck
  • Date: 2005-04-21 14:25:11 UTC
  • mfrom: (1.2.1 upstream) (2.1.1 warty)
  • Revision ID: james.westby@ubuntu.com-20050421142511-wibh5vc31fkrorx7
Tags: 7.4.7-3
Built with sources...

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
/*-------------------------------------------------------------------------
 
2
 *
 
3
 * PGmoney.java
 
4
 *     This implements a class that handles the PostgreSQL money and cash types
 
5
 *
 
6
 * Copyright (c) 2003, PostgreSQL Global Development Group
 
7
 *
 
8
 * IDENTIFICATION
 
9
 *        $Header: /cvsroot/pgsql/src/interfaces/jdbc/org/postgresql/util/Attic/PGmoney.java,v 1.6 2003/09/13 04:02:16 barry Exp $
 
10
 *
 
11
 *-------------------------------------------------------------------------
 
12
 */
1
13
package org.postgresql.util;
2
14
 
3
 
import java.io.*;
4
 
import java.sql.*;
5
 
 
6
 
/*
7
 
 * This implements a class that handles the PostgreSQL money and cash types
8
 
 */
 
15
 
 
16
import java.io.Serializable;
 
17
import java.sql.SQLException;
 
18
 
9
19
public class PGmoney extends PGobject implements Serializable, Cloneable
10
20
{
11
21
        /*
22
32
                val = value;
23
33
        }
24
34
 
25
 
        /*
26
 
         * This is called mainly from the other geometric types, when a
27
 
         * point is imbeded within their definition.
28
 
         *
29
 
         * @param value Definition of this point in PostgreSQL's syntax
30
 
         */
31
35
        public PGmoney(String value) throws SQLException
32
36
        {
33
37
                this();
42
46
                setType("money");
43
47
        }
44
48
 
45
 
        /*
46
 
         * @param s Definition of this point in PostgreSQL's syntax
47
 
         * @exception SQLException on conversion failure
48
 
         */
49
49
        public void setValue(String s) throws SQLException
50
50
        {
51
51
                try
72
72
                }
73
73
                catch (NumberFormatException e)
74
74
                {
75
 
                        throw new PSQLException("postgresql.money", e);
 
75
                        throw new PSQLException("postgresql.money", PSQLState.NUMERIC_CONSTANT_OUT_OF_RANGE, e);
76
76
                }
77
77
        }
78
78
 
79
 
        /*
80
 
         * @param obj Object to compare with
81
 
         * @return true if the two boxes are identical
82
 
         */
83
79
        public boolean equals(Object obj)
84
80
        {
85
81
                if (obj instanceof PGmoney)
98
94
                return new PGmoney(val);
99
95
        }
100
96
 
101
 
        /*
102
 
         * @return the PGpoint in the syntax expected by org.postgresql
103
 
         */
104
97
        public String getValue()
105
98
        {
106
99
                if (val < 0)