Исходный код СУБД RuDB — свободной СУБД с открытым исходным кодом на базе PostgreSQL
rudb
2026-04-30 9f2ef60949ced4fab4d077a7e1c6d913f3620c9b
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
package com.example.proj;
 
import java.sql.SQLException;
import org.postgresql.pljava.annotation.Function;
 
import java.util.logging.Logger;
 
public class TestNullInteger {
    @Function
    public static Integer returnNullIntJava() throws SQLException {
        return null;
    }
 
    @Function
    public static Short returnNullSmallIntJava() throws SQLException {
        return null;
    }
 
    @Function
    public static Long returnNullBigIntJava() throws SQLException {
        return null;
    }
 
    @Function
    public static Integer sumNullArgIntJava(Integer a, Integer b) throws SQLException {
        return (a == null ? 0 : a) + (b == null ? 0 : b);
    }
 
    @Function
    public static Short sumNullArgSmallIntJava(Short a, Short b) throws SQLException {
        return (short)((a == null ? (short)0 : a) + (b == null ? (short)0 : b));
    }
 
    @Function
    public static Long sumNullArgBigIntJava(Long a, Long b) throws SQLException {
        return (long)(a == null ? (long)0 : a) + (b == null ? (long)0 : b);
    }
 
    @Function
    public static Integer checkedSumNullArgIntJava(Integer a, Integer b) throws SQLException {
        if (a == null  || b == null) {
            return null;
        } else {
            return a + b;
        }
    }
 
    @Function
    public static Short checkedSumNullArgSmallIntJava(Short a, Short b) throws SQLException {
        if (a == null  || b == null) {
            return null;
        } else {
            return (short)(a + b);
        }
    }
 
    @Function
    public static Long checkedSumNullArgBigIntJava(Long a, Long b) throws SQLException {
        if (a == null  || b == null) {
            return null;
        } else {
            return (long)(a + b);
        }
    }
 
    @Function
    public static Long checkedSumNullArgMixedJava(Integer a, Short b, Long c) throws SQLException {
        if (a == null  || b == null || c == null) {
            return null;
        } else {
            return (long)a + (long)b + c;
        }
    }
}