=UTF-8
8 |
--------------------------------------------------------------------------------
/.settings/org.eclipse.jdt.ui.prefs:
--------------------------------------------------------------------------------
1 | eclipse.preferences.version=1
2 | formatter_profile=_DataNucleus Conventions
3 | formatter_settings_version=12
4 |
--------------------------------------------------------------------------------
/.settings/org.eclipse.m2e.core.prefs:
--------------------------------------------------------------------------------
1 | activeProfiles=
2 | eclipse.preferences.version=1
3 | resolveWorkspaceProjects=true
4 | version=1
5 |
--------------------------------------------------------------------------------
/.settings/org.eclipse.mylyn.tasks.ui.prefs:
--------------------------------------------------------------------------------
1 | #Mon Nov 26 19:21:20 CET 2007
2 | eclipse.preferences.version=1
3 | project.repository.kind=jira
4 | project.repository.url=http\://www.jpox.org/servlet/jira
5 |
--------------------------------------------------------------------------------
/.settings/org.eclipse.pde.core.prefs:
--------------------------------------------------------------------------------
1 | BUNDLE_ROOT_PATH=target/classes
2 | eclipse.preferences.version=1
3 |
--------------------------------------------------------------------------------
/.settings/org.eclipse.wst.common.component:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
--------------------------------------------------------------------------------
/.settings/org.eclipse.wst.common.project.facet.core.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
--------------------------------------------------------------------------------
/.settings/org.eclipse.wst.validation.prefs:
--------------------------------------------------------------------------------
1 | disabled=06target
2 | eclipse.preferences.version=1
3 |
--------------------------------------------------------------------------------
/docs/README.md:
--------------------------------------------------------------------------------
1 | # datanucleus-rdbms JDBC Information
2 |
3 |
4 | This directory contains information relating to the capabilities of the various RDBMS supported.
5 | This is the output from SchemaTool __dbinfo__.
6 |
7 | The filename is as follows
8 | {datastore}-{version}-{driver-type}-{driver-version}.txt
9 | e.g mysql-4.1.12-jdbc-3.0.16.txt
10 |
11 |
12 |
13 |
14 |
--------------------------------------------------------------------------------
/src/main/java/org/datanucleus/store/rdbms/ConcurrentFixedCache.java:
--------------------------------------------------------------------------------
1 | package org.datanucleus.store.rdbms;
2 |
3 | import java.util.Collections;
4 | import java.util.HashMap;
5 | import java.util.Map;
6 | import java.util.function.Function;
7 |
8 | /**
9 | * When we know that there is a finite number of keys, so we get just "cache" everything.
10 | *
11 | * {@link #factory} may be called multiple times in case multiple threads try to init the same
12 | * key at once.
13 | */
14 | public final class ConcurrentFixedCache
15 | {
16 | private final Function factory;
17 | private volatile Map immutable = Collections.emptyMap();
18 |
19 | public ConcurrentFixedCache(Function factory)
20 | {
21 | this.factory = factory;
22 | }
23 |
24 | public V get(K key)
25 | {
26 | V value = immutable.get(key);
27 | if (value == null) {
28 | Map copy = new HashMap<>(immutable);
29 | value = factory.apply(key);
30 | copy.put(key, value);
31 | immutable = copy;
32 | }
33 | return value;
34 | }
35 | }
36 |
--------------------------------------------------------------------------------
/src/main/java/org/datanucleus/store/rdbms/ManagedConnectionWithExecutionContext.java:
--------------------------------------------------------------------------------
1 | package org.datanucleus.store.rdbms;
2 |
3 | import org.datanucleus.ExecutionContext;
4 | import org.datanucleus.store.connection.ManagedConnection;
5 |
6 | /**
7 | * Managed connection that knows its execution context.
8 | */
9 | public interface ManagedConnectionWithExecutionContext extends ManagedConnection
10 | {
11 | /**
12 | * Get execution context of connection
13 | * @return execution context.
14 | */
15 | ExecutionContext getExecutionContext();
16 | }
17 |
--------------------------------------------------------------------------------
/src/main/java/org/datanucleus/store/rdbms/adapter/DerbySQLFunction.java:
--------------------------------------------------------------------------------
1 | /**********************************************************************
2 | Copyright (c) 2005 Erik Bengtson and others. All rights reserved.
3 | Licensed under the Apache License, Version 2.0 (the "License");
4 | you may not use this file except in compliance with the License.
5 | You may obtain a copy of the License at
6 |
7 | http://www.apache.org/licenses/LICENSE-2.0
8 |
9 | Unless required by applicable law or agreed to in writing, software
10 | distributed under the License is distributed on an "AS IS" BASIS,
11 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12 | See the License for the specific language governing permissions and
13 | limitations under the License.
14 |
15 |
16 | Contributors:
17 | ...
18 | **********************************************************************/
19 | package org.datanucleus.store.rdbms.adapter;
20 |
21 | /**
22 | * Java Functions that are called by the database
23 | */
24 | public class DerbySQLFunction
25 | {
26 | private DerbySQLFunction(){}
27 | /**
28 | * ASCII code.
29 | * @param code The code
30 | * @return The ascii character
31 | */
32 | public static int ascii(String code)
33 | {
34 | return code.charAt(0);
35 | }
36 |
37 | /**
38 | * Matches code.
39 | * @param text The text
40 | * @param pattern the pattern
41 | * @return 1 if true according to String.matches rules, 0 otherwise
42 | */
43 | public static int matches(String text, String pattern)
44 | {
45 | return text.matches(pattern)?1:0;
46 | }
47 | }
--------------------------------------------------------------------------------
/src/main/java/org/datanucleus/store/rdbms/adapter/DerbyTypeInfo.java:
--------------------------------------------------------------------------------
1 | /**********************************************************************
2 | Copyright (c) 2008 Andy Jefferson and others. All rights reserved.
3 | Licensed under the Apache License, Version 2.0 (the "License");
4 | you may not use this file except in compliance with the License.
5 | You may obtain a copy of the License at
6 |
7 | http://www.apache.org/licenses/LICENSE-2.0
8 |
9 | Unless required by applicable law or agreed to in writing, software
10 | distributed under the License is distributed on an "AS IS" BASIS,
11 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12 | See the License for the specific language governing permissions and
13 | limitations under the License.
14 |
15 | Contributors:
16 | ...
17 | **********************************************************************/
18 | package org.datanucleus.store.rdbms.adapter;
19 |
20 | import java.sql.ResultSet;
21 |
22 | import org.datanucleus.store.rdbms.schema.SQLTypeInfo;
23 |
24 | /**
25 | * SQL Type info for Derby datastores.
26 | */
27 | public class DerbyTypeInfo extends SQLTypeInfo
28 | {
29 | /**
30 | * Constructs a type information object from the current row of the given result set.
31 | * @param rs The result set returned from DatabaseMetaData.getTypeInfo().
32 | */
33 | public DerbyTypeInfo(ResultSet rs)
34 | {
35 | super(rs);
36 | if (typeName.equalsIgnoreCase("DOUBLE"))
37 | {
38 | allowsPrecisionSpec = false;
39 | }
40 | }
41 | }
--------------------------------------------------------------------------------
/src/main/java/org/datanucleus/store/rdbms/adapter/FirebirdTypeInfo.java:
--------------------------------------------------------------------------------
1 | /**********************************************************************
2 | Copyright (c) 2008 Andy Jefferson and others. All rights reserved.
3 | Licensed under the Apache License, Version 2.0 (the "License");
4 | you may not use this file except in compliance with the License.
5 | You may obtain a copy of the License at
6 |
7 | http://www.apache.org/licenses/LICENSE-2.0
8 |
9 | Unless required by applicable law or agreed to in writing, software
10 | distributed under the License is distributed on an "AS IS" BASIS,
11 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12 | See the License for the specific language governing permissions and
13 | limitations under the License.
14 |
15 | Contributors:
16 | ...
17 | **********************************************************************/
18 | package org.datanucleus.store.rdbms.adapter;
19 |
20 | import java.sql.ResultSet;
21 |
22 | import org.datanucleus.store.rdbms.schema.SQLTypeInfo;
23 |
24 | /**
25 | * SQL Type info for Firebird datastores.
26 | */
27 | public class FirebirdTypeInfo extends SQLTypeInfo
28 | {
29 | /** The maximum precision we allow for DECIMAL. */
30 | public static final int MAX_PRECISION_DECIMAL = 18;
31 |
32 | /**
33 | * Constructs a type information object from the current row of the given result set.
34 | * @param rs The result set returned from DatabaseMetaData.getTypeInfo().
35 | */
36 | public FirebirdTypeInfo(ResultSet rs)
37 | {
38 | super(rs);
39 | if (typeName.equalsIgnoreCase("decimal"))
40 | {
41 | precision = MAX_PRECISION_DECIMAL;
42 | }
43 | }
44 | }
--------------------------------------------------------------------------------
/src/main/java/org/datanucleus/store/rdbms/adapter/NuoDBTypeInfo.java:
--------------------------------------------------------------------------------
1 | /**********************************************************************
2 | Copyright (c) 2014 Andy Jefferson and others. All rights reserved.
3 | Licensed under the Apache License, Version 2.0 (the "License");
4 | you may not use this file except in compliance with the License.
5 | You may obtain a copy of the License at
6 |
7 | http://www.apache.org/licenses/LICENSE-2.0
8 |
9 | Unless required by applicable law or agreed to in writing, software
10 | distributed under the License is distributed on an "AS IS" BASIS,
11 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12 | See the License for the specific language governing permissions and
13 | limitations under the License.
14 |
15 | Contributors:
16 | ...
17 | **********************************************************************/
18 | package org.datanucleus.store.rdbms.adapter;
19 |
20 | import java.sql.ResultSet;
21 |
22 | import org.datanucleus.store.rdbms.schema.SQLTypeInfo;
23 |
24 | /**
25 | * Type info for NuoDB.
26 | */
27 | public class NuoDBTypeInfo extends SQLTypeInfo
28 | {
29 | public NuoDBTypeInfo(String typeName, short dataType, int precision, String literalPrefix, String literalSuffix, String createParams,
30 | int nullable, boolean caseSensitive, short searchable, boolean unsignedAttribute, boolean fixedPrecScale,
31 | boolean autoIncrement, String localTypeName, short minimumScale, short maximumScale, int numPrecRadix)
32 | {
33 | super(typeName, dataType, precision, literalPrefix, literalSuffix, createParams, nullable, caseSensitive, searchable,
34 | unsignedAttribute, fixedPrecScale, autoIncrement, localTypeName, minimumScale, maximumScale, numPrecRadix);
35 | }
36 |
37 | public NuoDBTypeInfo(ResultSet rs)
38 | {
39 | super(rs);
40 | }
41 | }
--------------------------------------------------------------------------------
/src/main/java/org/datanucleus/store/rdbms/adapter/VirtuosoTypeInfo.java:
--------------------------------------------------------------------------------
1 | /**********************************************************************
2 | Copyright (c) 2013 Emmanuel Poitier. All rights reserved.
3 | Licensed under the Apache License, Version 2.0 (the "License");
4 | you may not use this file except in compliance with the License.
5 | You may obtain a copy of the License at
6 |
7 | http://www.apache.org/licenses/LICENSE-2.0
8 |
9 | Unless required by applicable law or agreed to in writing, software
10 | distributed under the License is distributed on an "AS IS" BASIS,
11 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12 | See the License for the specific language governing permissions and
13 | limitations under the License.
14 |
15 | Contributors:
16 | ...
17 | **********************************************************************/
18 | package org.datanucleus.store.rdbms.adapter;
19 |
20 | import java.sql.ResultSet;
21 |
22 | import org.datanucleus.store.rdbms.schema.SQLTypeInfo;
23 |
24 | /**
25 | * SQL Type info for Virtuoso datastores.
26 | */
27 | public class VirtuosoTypeInfo extends SQLTypeInfo
28 | {
29 | /**
30 | * Constructs a type information object from the current row of the given result set.
31 | * @param rs The result set returned from DatabaseMetaData.getTypeInfo().
32 | */
33 | public VirtuosoTypeInfo(ResultSet rs)
34 | {
35 | super(rs);
36 | }
37 | }
38 |
--------------------------------------------------------------------------------
/src/main/java/org/datanucleus/store/rdbms/adapter/package.html:
--------------------------------------------------------------------------------
1 |
2 | Provides mappings of all supported databases to aspects of the database that determines the SQL generation.
3 |
4 |
--------------------------------------------------------------------------------
/src/main/java/org/datanucleus/store/rdbms/autostart/package.html:
--------------------------------------------------------------------------------
1 |
2 | Package providing additional implementation(s) for the auto-start mechanism for RDBMS datastores.
3 |
4 |
--------------------------------------------------------------------------------
/src/main/java/org/datanucleus/store/rdbms/connectionpool/ConnectionPool.java:
--------------------------------------------------------------------------------
1 | /**********************************************************************
2 | Copyright (c) 2013 Andy Jefferson and others. All rights reserved.
3 | Licensed under the Apache License, Version 2.0 (the "License");
4 | you may not use this file except in compliance with the License.
5 | You may obtain a copy of the License at
6 |
7 | http://www.apache.org/licenses/LICENSE-2.0
8 |
9 | Unless required by applicable law or agreed to in writing, software
10 | distributed under the License is distributed on an "AS IS" BASIS,
11 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12 | See the License for the specific language governing permissions and
13 | limitations under the License.
14 |
15 | Contributors:
16 | ...
17 | **********************************************************************/
18 | package org.datanucleus.store.rdbms.connectionpool;
19 |
20 | import javax.sql.DataSource;
21 |
22 | /**
23 | * Wrapper for a connection pool.
24 | */
25 | public interface ConnectionPool
26 | {
27 | /**
28 | * Method to call when closing the StoreManager down, and consequently to close the pool.
29 | */
30 | void close();
31 |
32 | /**
33 | * Accessor for the pooled DataSource.
34 | * @return The DataSource
35 | */
36 | DataSource getDataSource();
37 | }
38 |
--------------------------------------------------------------------------------
/src/main/java/org/datanucleus/store/rdbms/connectionpool/ConnectionPoolFactory.java:
--------------------------------------------------------------------------------
1 | /**********************************************************************
2 | Copyright (c) 2013 Andy Jefferson and others. All rights reserved.
3 | Licensed under the Apache License, Version 2.0 (the "License");
4 | you may not use this file except in compliance with the License.
5 | You may obtain a copy of the License at
6 |
7 | http://www.apache.org/licenses/LICENSE-2.0
8 |
9 | Unless required by applicable law or agreed to in writing, software
10 | distributed under the License is distributed on an "AS IS" BASIS,
11 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12 | See the License for the specific language governing permissions and
13 | limitations under the License.
14 |
15 | Contributors:
16 | ...
17 | **********************************************************************/
18 | package org.datanucleus.store.rdbms.connectionpool;
19 |
20 | import org.datanucleus.store.StoreManager;
21 |
22 | /**
23 | * Factory for making ConnectionPools.
24 | */
25 | public interface ConnectionPoolFactory
26 | {
27 | /**
28 | * Method to return a new ConnectionPool
29 | * @param storeMgr StoreManager that this will be used with
30 | * @return The ConnectionPool
31 | */
32 | ConnectionPool createConnectionPool(StoreManager storeMgr);
33 | }
--------------------------------------------------------------------------------
/src/main/java/org/datanucleus/store/rdbms/connectionpool/DatastoreDriverNotFoundException.java:
--------------------------------------------------------------------------------
1 | /**********************************************************************
2 | Copyright (c) 2006 Andy Jefferson and others. All rights reserved.
3 | Licensed under the Apache License, Version 2.0 (the "License");
4 | you may not use this file except in compliance with the License.
5 | You may obtain a copy of the License at
6 |
7 | http://www.apache.org/licenses/LICENSE-2.0
8 |
9 | Unless required by applicable law or agreed to in writing, software
10 | distributed under the License is distributed on an "AS IS" BASIS,
11 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12 | See the License for the specific language governing permissions and
13 | limitations under the License.
14 |
15 | Contributors:
16 | ...
17 | **********************************************************************/
18 | package org.datanucleus.store.rdbms.connectionpool;
19 |
20 | import org.datanucleus.exceptions.NucleusException;
21 | import org.datanucleus.util.Localiser;
22 |
23 | /**
24 | * Exception thrown when a datastore driver class (e.g JDBC driver) is not found.
25 | */
26 | public class DatastoreDriverNotFoundException extends NucleusException
27 | {
28 | private static final long serialVersionUID = 2004483035679438362L;
29 |
30 | /**
31 | * Constructor.
32 | * @param driverClassName Class name for the datastore driver
33 | */
34 | public DatastoreDriverNotFoundException(String driverClassName)
35 | {
36 | super(Localiser.msg("047000", driverClassName));
37 | }
38 | }
--------------------------------------------------------------------------------
/src/main/java/org/datanucleus/store/rdbms/connectionpool/DatastorePoolException.java:
--------------------------------------------------------------------------------
1 | /**********************************************************************
2 | Copyright (c) 2006 Andy Jefferson and others. All rights reserved.
3 | Licensed under the Apache License, Version 2.0 (the "License");
4 | you may not use this file except in compliance with the License.
5 | You may obtain a copy of the License at
6 |
7 | http://www.apache.org/licenses/LICENSE-2.0
8 |
9 | Unless required by applicable law or agreed to in writing, software
10 | distributed under the License is distributed on an "AS IS" BASIS,
11 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12 | See the License for the specific language governing permissions and
13 | limitations under the License.
14 |
15 | Contributors:
16 | ...
17 | **********************************************************************/
18 | package org.datanucleus.store.rdbms.connectionpool;
19 |
20 | import org.datanucleus.exceptions.NucleusException;
21 | import org.datanucleus.util.Localiser;
22 |
23 | /**
24 | * Exception thrown when encountering an error creating a data source pool.
25 | */
26 | public class DatastorePoolException extends NucleusException
27 | {
28 | private static final long serialVersionUID = -7936864514567835075L;
29 |
30 | /**
31 | * Constructor.
32 | * @param poolName Name of the connection pool
33 | * @param driverName Name of the driver
34 | * @param url URL for the datastore
35 | * @param nested The root exception
36 | */
37 | public DatastorePoolException(String poolName, String driverName, String url, Exception nested)
38 | {
39 | super(Localiser.msg("047002", poolName, driverName, url, nested.getMessage()), nested);
40 | }
41 | }
--------------------------------------------------------------------------------
/src/main/java/org/datanucleus/store/rdbms/connectionpool/package.html:
--------------------------------------------------------------------------------
1 |
2 | Package providing support for all major Connection Pools.
3 |
4 |
--------------------------------------------------------------------------------
/src/main/java/org/datanucleus/store/rdbms/datasource/dbcp2/ConnectionFactory.java:
--------------------------------------------------------------------------------
1 | /*
2 | * Licensed to the Apache Software Foundation (ASF) under one or more
3 | * contributor license agreements. See the NOTICE file distributed with
4 | * this work for additional information regarding copyright ownership.
5 | * The ASF licenses this file to You under the Apache License, Version 2.0
6 | * (the "License"); you may not use this file except in compliance with
7 | * the License. You may obtain a copy of the License at
8 | *
9 | * http://www.apache.org/licenses/LICENSE-2.0
10 | *
11 | * Unless required by applicable law or agreed to in writing, software
12 | * distributed under the License is distributed on an "AS IS" BASIS,
13 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14 | * See the License for the specific language governing permissions and
15 | * limitations under the License.
16 | */
17 | package org.datanucleus.store.rdbms.datasource.dbcp2;
18 |
19 | import java.sql.Connection;
20 | import java.sql.SQLException;
21 |
22 | /**
23 | * Abstract factory interface for creating {@link java.sql.Connection}s.
24 | *
25 | * @since 2.0
26 | */
27 | public interface ConnectionFactory {
28 | /**
29 | * Create a new {@link java.sql.Connection} in an implementation specific fashion.
30 | *
31 | * @return a new {@link java.sql.Connection}
32 | * @throws SQLException
33 | * if a database error occurs creating the connection
34 | */
35 | Connection createConnection() throws SQLException;
36 | }
37 |
--------------------------------------------------------------------------------
/src/main/java/org/datanucleus/store/rdbms/datasource/dbcp2/Constants.java:
--------------------------------------------------------------------------------
1 | /*
2 | * Licensed to the Apache Software Foundation (ASF) under one or more
3 | * contributor license agreements. See the NOTICE file distributed with
4 | * this work for additional information regarding copyright ownership.
5 | * The ASF licenses this file to You under the Apache License, Version 2.0
6 | * (the "License"); you may not use this file except in compliance with
7 | * the License. You may obtain a copy of the License at
8 | *
9 | * http://www.apache.org/licenses/LICENSE-2.0
10 | *
11 | * Unless required by applicable law or agreed to in writing, software
12 | * distributed under the License is distributed on an "AS IS" BASIS,
13 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14 | * See the License for the specific language governing permissions and
15 | * limitations under the License.
16 | */
17 | package org.datanucleus.store.rdbms.datasource.dbcp2;
18 |
19 | /**
20 | * Constants for use with JMX.
21 | *
22 | * @since 2.0
23 | */
24 | public class Constants {
25 |
26 | public static final String JMX_CONNECTION_POOL_BASE_EXT = ",connectionpool=";
27 | public static final String JMX_CONNECTION_POOL_PREFIX = "connections";
28 |
29 | public static final String JMX_CONNECTION_BASE_EXT = JMX_CONNECTION_POOL_BASE_EXT + JMX_CONNECTION_POOL_PREFIX
30 | + ",connection=";
31 |
32 | public static final String JMX_STATEMENT_POOL_BASE_EXT = JMX_CONNECTION_BASE_EXT;
33 | public static final String JMX_STATEMENT_POOL_PREFIX = ",statementpool=statements";
34 | }
35 |
--------------------------------------------------------------------------------
/src/main/java/org/datanucleus/store/rdbms/datasource/dbcp2/LifetimeExceededException.java:
--------------------------------------------------------------------------------
1 | /*
2 | * Licensed to the Apache Software Foundation (ASF) under one or more
3 | * contributor license agreements. See the NOTICE file distributed with
4 | * this work for additional information regarding copyright ownership.
5 | * The ASF licenses this file to You under the Apache License, Version 2.0
6 | * (the "License"); you may not use this file except in compliance with
7 | * the License. You may obtain a copy of the License at
8 | *
9 | * http://www.apache.org/licenses/LICENSE-2.0
10 | *
11 | * Unless required by applicable law or agreed to in writing, software
12 | * distributed under the License is distributed on an "AS IS" BASIS,
13 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14 | * See the License for the specific language governing permissions and
15 | * limitations under the License.
16 | */
17 | package org.datanucleus.store.rdbms.datasource.dbcp2;
18 |
19 | /**
20 | * Exception thrown when a connection's maximum lifetime has been exceeded.
21 | *
22 | * @since 2.1
23 | */
24 | class LifetimeExceededException extends Exception {
25 |
26 | private static final long serialVersionUID = -3783783104516492659L;
27 |
28 | /**
29 | * Create a LifetimeExceededException.
30 | */
31 | public LifetimeExceededException() {
32 | super();
33 | }
34 |
35 | /**
36 | * Create a LifetimeExceededException with the given message.
37 | *
38 | * @param message
39 | * The message with which to create the exception
40 | */
41 | public LifetimeExceededException(final String message) {
42 | super(message);
43 | }
44 | }
45 |
--------------------------------------------------------------------------------
/src/main/java/org/datanucleus/store/rdbms/datasource/dbcp2/cpdsadapter/package.html:
--------------------------------------------------------------------------------
1 |
2 | This is a repackaged Apache Commons DBCP v2.7.0 and Apache Commons Pool v2.8.0.
3 | We have omitted the packages "org/apache/commons/dbcp2/managed" and "org/apache/commons/pool2/proxy" since they are not needed and pull in other dependencies.
4 | We have changed the Apache Commons logging to use NucleusLogger.CONNECTION instead.
5 | Note that there is a file under "src/main/resources/org/datanucleus/store/rdbms/datasource/dbcp2" also.
6 |
7 |
--------------------------------------------------------------------------------
/src/main/java/org/datanucleus/store/rdbms/datasource/dbcp2/datasources/package.html:
--------------------------------------------------------------------------------
1 |
2 | This is a repackaged Apache Commons DBCP v2.7.0 and Apache Commons Pool v2.8.0.
3 | We have omitted the packages "org/apache/commons/dbcp2/managed" and "org/apache/commons/pool2/proxy" since they are not needed and pull in other dependencies.
4 | We have changed the Apache Commons logging to use NucleusLogger.CONNECTION instead.
5 | Note that there is a file under "src/main/resources/org/datanucleus/store/rdbms/datasource/dbcp2" also.
6 |
7 |
--------------------------------------------------------------------------------
/src/main/java/org/datanucleus/store/rdbms/datasource/dbcp2/package.html:
--------------------------------------------------------------------------------
1 |
2 | This is a repackaged Apache Commons DBCP v2.7.0 and Apache Commons Pool v2.8.0.
3 | We have omitted the packages "org/apache/commons/dbcp2/managed" and "org/apache/commons/pool2/proxy" since they are not needed and pull in other dependencies.
4 | We have changed the Apache Commons logging to use NucleusLogger.CONNECTION instead.
5 | Note that there is a file under "src/main/resources/org/datanucleus/store/rdbms/datasource/dbcp2" also.
6 |
7 |
--------------------------------------------------------------------------------
/src/main/java/org/datanucleus/store/rdbms/datasource/dbcp2/pool2/BaseObject.java:
--------------------------------------------------------------------------------
1 | /*
2 | * Licensed to the Apache Software Foundation (ASF) under one or more
3 | * contributor license agreements. See the NOTICE file distributed with
4 | * this work for additional information regarding copyright ownership.
5 | * The ASF licenses this file to You under the Apache License, Version 2.0
6 | * (the "License"); you may not use this file except in compliance with
7 | * the License. You may obtain a copy of the License at
8 | *
9 | * http://www.apache.org/licenses/LICENSE-2.0
10 | *
11 | * Unless required by applicable law or agreed to in writing, software
12 | * distributed under the License is distributed on an "AS IS" BASIS,
13 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14 | * See the License for the specific language governing permissions and
15 | * limitations under the License.
16 | */
17 | package org.datanucleus.store.rdbms.datasource.dbcp2.pool2;
18 |
19 | /**
20 | * A base class for common functionality.
21 | *
22 | * @since 2.4.3
23 | */
24 | public abstract class BaseObject {
25 |
26 | @Override
27 | public String toString() {
28 | final StringBuilder builder = new StringBuilder();
29 | builder.append(getClass().getSimpleName());
30 | builder.append(" [");
31 | toStringAppendFields(builder);
32 | builder.append("]");
33 | return builder.toString();
34 | }
35 |
36 | /**
37 | * Used by sub-classes to include the fields defined by the sub-class in the
38 | * {@link #toString()} output.
39 | *
40 | * @param builder Field names and values are appended to this object
41 | */
42 | protected void toStringAppendFields(final StringBuilder builder) {
43 | // do nothing by default, needed for b/w compatibility.
44 | }
45 | }
46 |
--------------------------------------------------------------------------------
/src/main/java/org/datanucleus/store/rdbms/datasource/dbcp2/pool2/SwallowedExceptionListener.java:
--------------------------------------------------------------------------------
1 | /*
2 | * Licensed to the Apache Software Foundation (ASF) under one or more
3 | * contributor license agreements. See the NOTICE file distributed with
4 | * this work for additional information regarding copyright ownership.
5 | * The ASF licenses this file to You under the Apache License, Version 2.0
6 | * (the "License"); you may not use this file except in compliance with
7 | * the License. You may obtain a copy of the License at
8 | *
9 | * http://www.apache.org/licenses/LICENSE-2.0
10 | *
11 | * Unless required by applicable law or agreed to in writing, software
12 | * distributed under the License is distributed on an "AS IS" BASIS,
13 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14 | * See the License for the specific language governing permissions and
15 | * limitations under the License.
16 | */
17 | package org.datanucleus.store.rdbms.datasource.dbcp2.pool2;
18 |
19 | /**
20 | * Pools that unavoidably swallow exceptions may be configured with an instance
21 | * of this listener so the user may receive notification of when this happens.
22 | * The listener should not throw an exception when called but pools calling
23 | * listeners should protect themselves against exceptions anyway.
24 | *
25 | * @since 2.0
26 | */
27 | public interface SwallowedExceptionListener {
28 |
29 | /**
30 | * This method is called every time the implementation unavoidably swallows
31 | * an exception.
32 | *
33 | * @param e The exception that was swallowed
34 | */
35 | void onSwallowException(Exception e);
36 | }
37 |
--------------------------------------------------------------------------------
/src/main/java/org/datanucleus/store/rdbms/datasource/dbcp2/pool2/TrackedUse.java:
--------------------------------------------------------------------------------
1 | /*
2 | * Licensed to the Apache Software Foundation (ASF) under one or more
3 | * contributor license agreements. See the NOTICE file distributed with
4 | * this work for additional information regarding copyright ownership.
5 | * The ASF licenses this file to You under the Apache License, Version 2.0
6 | * (the "License"); you may not use this file except in compliance with
7 | * the License. You may obtain a copy of the License at
8 | *
9 | * http://www.apache.org/licenses/LICENSE-2.0
10 | *
11 | * Unless required by applicable law or agreed to in writing, software
12 | * distributed under the License is distributed on an "AS IS" BASIS,
13 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14 | * See the License for the specific language governing permissions and
15 | * limitations under the License.
16 | */
17 | package org.datanucleus.store.rdbms.datasource.dbcp2.pool2;
18 |
19 | /**
20 | * This interface allows pooled objects to make information available about when
21 | * and how they were used available to the object pool. The object pool may, but
22 | * is not required, to use this information to make more informed decisions when
23 | * determining the state of a pooled object - for instance whether or not the
24 | * object has been abandoned.
25 | *
26 | * @since 2.0
27 | */
28 | public interface TrackedUse {
29 |
30 | /**
31 | * Get the last time this object was used in ms.
32 | *
33 | * @return long time in ms
34 | */
35 | long getLastUsed();
36 | }
37 |
--------------------------------------------------------------------------------
/src/main/java/org/datanucleus/store/rdbms/datasource/dbcp2/pool2/UsageTracking.java:
--------------------------------------------------------------------------------
1 | /*
2 | * Licensed to the Apache Software Foundation (ASF) under one or more
3 | * contributor license agreements. See the NOTICE file distributed with
4 | * this work for additional information regarding copyright ownership.
5 | * The ASF licenses this file to You under the Apache License, Version 2.0
6 | * (the "License"); you may not use this file except in compliance with
7 | * the License. You may obtain a copy of the License at
8 | *
9 | * http://www.apache.org/licenses/LICENSE-2.0
10 | *
11 | * Unless required by applicable law or agreed to in writing, software
12 | * distributed under the License is distributed on an "AS IS" BASIS,
13 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14 | * See the License for the specific language governing permissions and
15 | * limitations under the License.
16 | */
17 | package org.datanucleus.store.rdbms.datasource.dbcp2.pool2;
18 |
19 | /**
20 | * This interface may be implemented by an object pool to enable clients
21 | * (primarily those clients that wrap pools to provide pools with extended
22 | * features) to provide additional information to the pool relating to object
23 | * using allowing more informed decisions and reporting to be made regarding
24 | * abandoned objects.
25 | *
26 | * @param The type of object provided by the pool.
27 | *
28 | * @since 2.0
29 | */
30 | public interface UsageTracking {
31 |
32 | /**
33 | * This method is called every time a pooled object is used to enable the pool to
34 | * better track borrowed objects.
35 | *
36 | * @param pooledObject The object that is being used
37 | */
38 | void use(T pooledObject);
39 | }
40 |
--------------------------------------------------------------------------------
/src/main/java/org/datanucleus/store/rdbms/datasource/dbcp2/pool2/impl/NoOpCallStack.java:
--------------------------------------------------------------------------------
1 | /*
2 | * Licensed to the Apache Software Foundation (ASF) under one or more
3 | * contributor license agreements. See the NOTICE file distributed with
4 | * this work for additional information regarding copyright ownership.
5 | * The ASF licenses this file to You under the Apache License, Version 2.0
6 | * (the "License"); you may not use this file except in compliance with
7 | * the License. You may obtain a copy of the License at
8 | *
9 | * http://www.apache.org/licenses/LICENSE-2.0
10 | *
11 | * Unless required by applicable law or agreed to in writing, software
12 | * distributed under the License is distributed on an "AS IS" BASIS,
13 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14 | * See the License for the specific language governing permissions and
15 | * limitations under the License.
16 | */
17 | package org.datanucleus.store.rdbms.datasource.dbcp2.pool2.impl;
18 |
19 | import java.io.PrintWriter;
20 |
21 | /**
22 | * CallStack strategy using no-op implementations of all functionality. Can be used by default when abandoned object
23 | * logging is disabled.
24 | *
25 | * @since 2.5
26 | */
27 | public class NoOpCallStack implements CallStack {
28 |
29 | /**
30 | * Singleton instance.
31 | */
32 | public static final CallStack INSTANCE = new NoOpCallStack();
33 |
34 | /**
35 | * Constructs the singleton instance.
36 | */
37 | private NoOpCallStack() {
38 | }
39 |
40 | @Override
41 | public boolean printStackTrace(final PrintWriter writer) {
42 | return false;
43 | }
44 |
45 | @Override
46 | public void fillInStackTrace() {
47 | // no-op
48 | }
49 |
50 | @Override
51 | public void clear() {
52 | // no-op
53 | }
54 | }
55 |
--------------------------------------------------------------------------------
/src/main/java/org/datanucleus/store/rdbms/datasource/dbcp2/pool2/impl/package.html:
--------------------------------------------------------------------------------
1 |
2 | This is a repackaged Apache Commons DBCP v2.7.0 and Apache Commons Pool v2.8.0.
3 | We have omitted the packages "org/apache/commons/dbcp2/managed" and "org/apache/commons/pool2/proxy" since they are not needed and pull in other dependencies.
4 | We have changed the Apache Commons logging to use NucleusLogger.CONNECTION instead.
5 | Note that there is a file under "src/main/resources/org/datanucleus/store/rdbms/datasource/dbcp2" also.
6 |
7 |
--------------------------------------------------------------------------------
/src/main/java/org/datanucleus/store/rdbms/datasource/dbcp2/pool2/package.html:
--------------------------------------------------------------------------------
1 |
2 | This is a repackaged Apache Commons DBCP v2.7.0 and Apache Commons Pool v2.8.0.
3 | We have omitted the packages "org/apache/commons/dbcp2/managed" and "org/apache/commons/pool2/proxy" since they are not needed and pull in other dependencies.
4 | We have changed the Apache Commons logging to use NucleusLogger.CONNECTION instead.
5 | Note that there is a file under "src/main/resources/org/datanucleus/store/rdbms/datasource/dbcp2" also.
6 |
7 |
--------------------------------------------------------------------------------
/src/main/java/org/datanucleus/store/rdbms/discriminator/DiscriminatorClassNameResolver.java:
--------------------------------------------------------------------------------
1 | /**********************************************************************
2 | Copyright (c) 2023 kraendavid and others. All rights reserved.
3 | Licensed under the Apache License, Version 2.0 (the "License");
4 | you may not use this file except in compliance with the License.
5 | You may obtain a copy of the License at
6 |
7 | http://www.apache.org/licenses/LICENSE-2.0
8 |
9 | Unless required by applicable law or agreed to in writing, software
10 | distributed under the License is distributed on an "AS IS" BASIS,
11 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12 | See the License for the specific language governing permissions and
13 | limitations under the License.
14 |
15 | Contributors:
16 | ...
17 | **********************************************************************/
18 | package org.datanucleus.store.rdbms.discriminator;
19 |
20 | import java.sql.ResultSet;
21 |
22 | /**
23 | * Interface to be implemented to provide a custom handler for accessing class names for a discriminator.
24 | */
25 | public interface DiscriminatorClassNameResolver
26 | {
27 | /**
28 | * Method for returning persistent object class name represented by ResultSet row.
29 | * Return null to allow for resolving class name in normal manner.
30 | * @param rs result-set for next row to get class name for
31 | * @return null if leave class name resolving up to normal framework,
32 | * but for custom implementations return class name for object represented in result-set
33 | */
34 | String getClassName(ResultSet rs);
35 | }
36 |
--------------------------------------------------------------------------------
/src/main/java/org/datanucleus/store/rdbms/exceptions/ClassDefinitionException.java:
--------------------------------------------------------------------------------
1 | /**********************************************************************
2 | Copyright (c) 2002 Mike Martin and others. All rights reserved.
3 | Licensed under the Apache License, Version 2.0 (the "License");
4 | you may not use this file except in compliance with the License.
5 | You may obtain a copy of the License at
6 |
7 | http://www.apache.org/licenses/LICENSE-2.0
8 |
9 | Unless required by applicable law or agreed to in writing, software
10 | distributed under the License is distributed on an "AS IS" BASIS,
11 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12 | See the License for the specific language governing permissions and
13 | limitations under the License.
14 |
15 |
16 | Contributors:
17 | 2004 Andy Jefferson - coding standards
18 | ...
19 | **********************************************************************/
20 | package org.datanucleus.store.rdbms.exceptions;
21 |
22 | import org.datanucleus.exceptions.NucleusUserException;
23 |
24 | /**
25 | * A ClassDefinitionException is thrown if the settings of a
26 | * persistent class are inconsistent with it's metadata.
27 | */
28 | public class ClassDefinitionException extends NucleusUserException
29 | {
30 | private static final long serialVersionUID = -611709032031993187L;
31 |
32 | /**
33 | * Constructs a class definition exception with no specific detail
34 | * message.
35 | */
36 | public ClassDefinitionException()
37 | {
38 | super();
39 | setFatal();
40 | }
41 |
42 | /**
43 | * Constructs a class definition exception with the specified detail
44 | * message.
45 | * @param msg the detail message
46 | */
47 | public ClassDefinitionException(String msg)
48 | {
49 | super(msg);
50 | setFatal();
51 | }
52 | }
--------------------------------------------------------------------------------
/src/main/java/org/datanucleus/store/rdbms/exceptions/MissingTableException.java:
--------------------------------------------------------------------------------
1 | /**********************************************************************
2 | Copyright (c) 2002 Mike Martin and others. All rights reserved.
3 | Licensed under the Apache License, Version 2.0 (the "License");
4 | you may not use this file except in compliance with the License.
5 | You may obtain a copy of the License at
6 |
7 | http://www.apache.org/licenses/LICENSE-2.0
8 |
9 | Unless required by applicable law or agreed to in writing, software
10 | distributed under the License is distributed on an "AS IS" BASIS,
11 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12 | See the License for the specific language governing permissions and
13 | limitations under the License.
14 |
15 | Contributors:
16 | Andy Jefferson - coding standards
17 | ...
18 | **********************************************************************/
19 | package org.datanucleus.store.rdbms.exceptions;
20 |
21 | import org.datanucleus.exceptions.DatastoreValidationException;
22 | import org.datanucleus.util.Localiser;
23 |
24 | /**
25 | * A MissingTableException is thrown if an expected table is
26 | * not found in the database during schema validation.
27 | */
28 | public class MissingTableException extends DatastoreValidationException
29 | {
30 | private static final long serialVersionUID = 8360855107029754952L;
31 |
32 | /**
33 | * Constructs a missing table exception.
34 | * @param catalogName Catalog name which the table was searched.
35 | * @param schemaName Schema name which the table was searched.
36 | * @param tableName Name of the table that was missing.
37 | */
38 | public MissingTableException(String catalogName, String schemaName, String tableName)
39 | {
40 | super(Localiser.msg("020011", catalogName, schemaName, tableName));
41 | }
42 | }
--------------------------------------------------------------------------------
/src/main/java/org/datanucleus/store/rdbms/exceptions/NoDatastoreMappingException.java:
--------------------------------------------------------------------------------
1 | /**********************************************************************
2 | Copyright (c) 2002 Mike Martin and others. All rights reserved.
3 | Licensed under the Apache License, Version 2.0 (the "License");
4 | you may not use this file except in compliance with the License.
5 | You may obtain a copy of the License at
6 |
7 | http://www.apache.org/licenses/LICENSE-2.0
8 |
9 | Unless required by applicable law or agreed to in writing, software
10 | distributed under the License is distributed on an "AS IS" BASIS,
11 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12 | See the License for the specific language governing permissions and
13 | limitations under the License.
14 |
15 | Contributors:
16 | Andy Jefferson - coding standards
17 | Erik Bengtson - renamed to NoDatastoreMappingException
18 | ...
19 | **********************************************************************/
20 | package org.datanucleus.store.rdbms.exceptions;
21 |
22 | import org.datanucleus.exceptions.NucleusUserException;
23 | import org.datanucleus.util.Localiser;
24 |
25 | /**
26 | * A NoDatastoreMappingException is thrown if an operation is performed that
27 | * assumes that a particular persistent field is stored in a single datastore
28 | * field when it is not (such as if the field is a Collection or a Map).
29 | */
30 | public class NoDatastoreMappingException extends NucleusUserException
31 | {
32 | private static final long serialVersionUID = -4514927315711485556L;
33 |
34 | /**
35 | * Constructs a no datastore mapping exception.
36 | *
37 | * @param fieldName The name of the field.
38 | */
39 | public NoDatastoreMappingException(String fieldName)
40 | {
41 | super(Localiser.msg("020001",fieldName));
42 | }
43 | }
--------------------------------------------------------------------------------
/src/main/java/org/datanucleus/store/rdbms/exceptions/NoTableManagedException.java:
--------------------------------------------------------------------------------
1 | /**********************************************************************
2 | Copyright (c) 2004 Ralf Ullrich and others. All rights reserved.
3 | Licensed under the Apache License, Version 2.0 (the "License");
4 | you may not use this file except in compliance with the License.
5 | You may obtain a copy of the License at
6 |
7 | http://www.apache.org/licenses/LICENSE-2.0
8 |
9 | Unless required by applicable law or agreed to in writing, software
10 | distributed under the License is distributed on an "AS IS" BASIS,
11 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12 | See the License for the specific language governing permissions and
13 | limitations under the License.
14 |
15 | Contributors:
16 | ...
17 | **********************************************************************/
18 | package org.datanucleus.store.rdbms.exceptions;
19 |
20 | import org.datanucleus.exceptions.NucleusUserException;
21 | import org.datanucleus.util.Localiser;
22 |
23 | /**
24 | * A NoTableManagedException is thrown if an attempt is made to perform an
25 | * operation using a class that is not backed by an table or view
26 | * in the database and the operation is not supported on such classes.
27 | *
28 | * @see org.datanucleus.store.StoreManager
29 | */
30 | public class NoTableManagedException extends NucleusUserException
31 | {
32 | private static final long serialVersionUID = -1610018637755474684L;
33 |
34 | /**
35 | * Constructs a no table managed exception.
36 | * @param className Name of the class on which the operation requiring a
37 | * table was attempted.
38 | */
39 | public NoTableManagedException(String className)
40 | {
41 | super(Localiser.msg("020000",className));
42 | }
43 | }
--------------------------------------------------------------------------------
/src/main/java/org/datanucleus/store/rdbms/exceptions/NotATableException.java:
--------------------------------------------------------------------------------
1 | /**********************************************************************
2 | Copyright (c) 2002 Mike Martin and others. All rights reserved.
3 | Licensed under the Apache License, Version 2.0 (the "License");
4 | you may not use this file except in compliance with the License.
5 | You may obtain a copy of the License at
6 |
7 | http://www.apache.org/licenses/LICENSE-2.0
8 |
9 | Unless required by applicable law or agreed to in writing, software
10 | distributed under the License is distributed on an "AS IS" BASIS,
11 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12 | See the License for the specific language governing permissions and
13 | limitations under the License.
14 |
15 | Contributors:
16 | Andy Jefferson - coding standards
17 | ...
18 | **********************************************************************/
19 | package org.datanucleus.store.rdbms.exceptions;
20 |
21 | import org.datanucleus.exceptions.DatastoreValidationException;
22 | import org.datanucleus.util.Localiser;
23 |
24 | /**
25 | * A NotATableException is thrown during schema validation if a
26 | * table should be a table but is found not to be in the database.
27 | *
28 | * @see org.datanucleus.store.rdbms.table.TableImpl
29 | */
30 | public class NotATableException extends DatastoreValidationException
31 | {
32 | private static final long serialVersionUID = 8257695149631939361L;
33 |
34 | /**
35 | * Constructs a not-a-table exception.
36 | * @param tableName Name of the table that is of the wrong type.
37 | * @param type the type of the object
38 | */
39 | public NotATableException(String tableName, String type)
40 | {
41 | super(Localiser.msg("020012", tableName, type));
42 | }
43 | }
--------------------------------------------------------------------------------
/src/main/java/org/datanucleus/store/rdbms/exceptions/NotAViewException.java:
--------------------------------------------------------------------------------
1 | /**********************************************************************
2 | Copyright (c) 2002 Mike Martin and others. All rights reserved.
3 | Licensed under the Apache License, Version 2.0 (the "License");
4 | you may not use this file except in compliance with the License.
5 | You may obtain a copy of the License at
6 |
7 | http://www.apache.org/licenses/LICENSE-2.0
8 |
9 | Unless required by applicable law or agreed to in writing, software
10 | distributed under the License is distributed on an "AS IS" BASIS,
11 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12 | See the License for the specific language governing permissions and
13 | limitations under the License.
14 |
15 | Contributors:
16 | Andy Jefferson - coding standards
17 | ...
18 | **********************************************************************/
19 | package org.datanucleus.store.rdbms.exceptions;
20 |
21 | import org.datanucleus.exceptions.DatastoreValidationException;
22 | import org.datanucleus.util.Localiser;
23 |
24 | /**
25 | * A NotAViewException is thrown during schema validation if a
26 | * table should be a view but is found not to be in the database.
27 | */
28 | public class NotAViewException extends DatastoreValidationException
29 | {
30 | private static final long serialVersionUID = -3924285872907278607L;
31 |
32 | /**
33 | * Constructs a not-a-view exception.
34 | * @param viewName Name of the view that is of the wrong type.
35 | * @param type the type of the object
36 | */
37 | public NotAViewException(String viewName, String type)
38 | {
39 | super(Localiser.msg("020013", viewName, type));
40 | }
41 | }
--------------------------------------------------------------------------------
/src/main/java/org/datanucleus/store/rdbms/exceptions/NullValueException.java:
--------------------------------------------------------------------------------
1 | /**********************************************************************
2 | Copyright (c) 2002 Mike Martin and others. All rights reserved.
3 | Licensed under the Apache License, Version 2.0 (the "License");
4 | you may not use this file except in compliance with the License.
5 | You may obtain a copy of the License at
6 |
7 | http://www.apache.org/licenses/LICENSE-2.0
8 |
9 | Unless required by applicable law or agreed to in writing, software
10 | distributed under the License is distributed on an "AS IS" BASIS,
11 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12 | See the License for the specific language governing permissions and
13 | limitations under the License.
14 |
15 | Contributors:
16 | Andy Jefferson - coding standards
17 | ...
18 | **********************************************************************/
19 | package org.datanucleus.store.rdbms.exceptions;
20 |
21 | import org.datanucleus.exceptions.NucleusDataStoreException;
22 |
23 | /**
24 | * A NullValueException is thrown if a null value is encountered
25 | * in a database column that should prohibit null values.
26 | *
27 | * @version $Revision: 1.3 $
28 | */
29 | public class NullValueException extends NucleusDataStoreException
30 | {
31 | private static final long serialVersionUID = -4852762927328278822L;
32 |
33 | /**
34 | * Constructs a null value exception with no specific detail message.
35 | */
36 | public NullValueException()
37 | {
38 | super();
39 | }
40 |
41 | /**
42 | * Constructs a null value exception with the specified detail message.
43 | *
44 | * @param msg the detail message
45 | */
46 | public NullValueException(String msg)
47 | {
48 | super(msg);
49 | }
50 | }
51 |
--------------------------------------------------------------------------------
/src/main/java/org/datanucleus/store/rdbms/exceptions/PersistentSuperclassNotAllowedException.java:
--------------------------------------------------------------------------------
1 | /**********************************************************************
2 | Copyright (c) 2002 Mike Martin and others. All rights reserved.
3 | Licensed under the Apache License, Version 2.0 (the "License");
4 | you may not use this file except in compliance with the License.
5 | You may obtain a copy of the License at
6 |
7 | http://www.apache.org/licenses/LICENSE-2.0
8 |
9 | Unless required by applicable law or agreed to in writing, software
10 | distributed under the License is distributed on an "AS IS" BASIS,
11 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12 | See the License for the specific language governing permissions and
13 | limitations under the License.
14 |
15 | Contributors:
16 | Andy Jefferson - coding standards
17 | ...
18 | **********************************************************************/
19 | package org.datanucleus.store.rdbms.exceptions;
20 |
21 | import org.datanucleus.util.Localiser;
22 |
23 | /**
24 | * A PersistentSuperclassNotAllowedException is thrown if a
25 | * persistence-capable class is declared to have a persistence-capable
26 | * superclass when that class is backed by a view.
27 | *
28 | * @see org.datanucleus.store.rdbms.table.ClassView
29 | */
30 | public class PersistentSuperclassNotAllowedException extends ClassDefinitionException
31 | {
32 | private static final long serialVersionUID = -2749266341448447043L;
33 |
34 | /**
35 | * Constructs a persistent-superclass-not-allowed exception.
36 | *
37 | * @param className The class having the persistence-capable superclass.
38 | */
39 | public PersistentSuperclassNotAllowedException(String className)
40 | {
41 | super(Localiser.msg("020023",className));
42 | }
43 | }
--------------------------------------------------------------------------------
/src/main/java/org/datanucleus/store/rdbms/exceptions/PrimaryKeyColumnNotAllowedException.java:
--------------------------------------------------------------------------------
1 | /**********************************************************************
2 | Copyright (c) 2003 Mike Martin and others. All rights reserved.
3 | Licensed under the Apache License, Version 2.0 (the "License");
4 | you may not use this file except in compliance with the License.
5 | You may obtain a copy of the License at
6 |
7 | http://www.apache.org/licenses/LICENSE-2.0
8 |
9 | Unless required by applicable law or agreed to in writing, software
10 | distributed under the License is distributed on an "AS IS" BASIS,
11 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12 | See the License for the specific language governing permissions and
13 | limitations under the License.
14 |
15 | Contributors:
16 | Andy Jefferson - coding standards
17 | ...
18 | **********************************************************************/
19 | package org.datanucleus.store.rdbms.exceptions;
20 |
21 | import org.datanucleus.exceptions.NucleusException;
22 | import org.datanucleus.util.Localiser;
23 |
24 | /**
25 | * A PrimaryKeyColumnNotAllowedException is thrown if an attempt is
26 | * made to add a primary key column to a view.
27 | */
28 | public class PrimaryKeyColumnNotAllowedException extends NucleusException
29 | {
30 | private static final long serialVersionUID = 4600461704079232724L;
31 |
32 | /**
33 | * Constructs a primary key not allowed exception.
34 | * @param viewName Name of the view being initialized.
35 | * @param columnName Name of the column having the duplicate name.
36 | */
37 | public PrimaryKeyColumnNotAllowedException(String viewName, String columnName)
38 | {
39 | super(Localiser.msg("020014",viewName,columnName));
40 | setFatal();
41 | }
42 | }
--------------------------------------------------------------------------------
/src/main/java/org/datanucleus/store/rdbms/exceptions/TooManyForeignKeysException.java:
--------------------------------------------------------------------------------
1 | /**********************************************************************
2 | Copyright (c) 2002 Mike Martin and others. All rights reserved.
3 | Licensed under the Apache License, Version 2.0 (the "License");
4 | you may not use this file except in compliance with the License.
5 | You may obtain a copy of the License at
6 |
7 | http://www.apache.org/licenses/LICENSE-2.0
8 |
9 | Unless required by applicable law or agreed to in writing, software
10 | distributed under the License is distributed on an "AS IS" BASIS,
11 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12 | See the License for the specific language governing permissions and
13 | limitations under the License.
14 |
15 | Contributors:
16 | Andy Jefferson - coding standards
17 | ...
18 | **********************************************************************/
19 | package org.datanucleus.store.rdbms.exceptions;
20 |
21 | import org.datanucleus.exceptions.NucleusDataStoreException;
22 | import org.datanucleus.store.rdbms.adapter.DatastoreAdapter;
23 | import org.datanucleus.util.Localiser;
24 |
25 | /**
26 | * A TooManyForeignKeysException is thrown when trying to add a foreign
27 | * key to a table and the table already has the maximum allowed number of
28 | * foreign keys.
29 | */
30 | public class TooManyForeignKeysException extends NucleusDataStoreException
31 | {
32 | private static final long serialVersionUID = 927612239349408531L;
33 |
34 | /**
35 | * Constructs a too-many-foreign-keys exception.
36 | * @param dba the database adapter
37 | * @param table_name Name of the table with too many FKs
38 | */
39 | public TooManyForeignKeysException(DatastoreAdapter dba, String table_name)
40 | {
41 | super(Localiser.msg("020015","" + dba.getMaxForeignKeys(),table_name));
42 | setFatal();
43 | }
44 | }
--------------------------------------------------------------------------------
/src/main/java/org/datanucleus/store/rdbms/exceptions/TooManyIndicesException.java:
--------------------------------------------------------------------------------
1 | /**********************************************************************
2 | Copyright (c) 2003 Mike Martin and others. All rights reserved.
3 | Licensed under the Apache License, Version 2.0 (the "License");
4 | you may not use this file except in compliance with the License.
5 | You may obtain a copy of the License at
6 |
7 | http://www.apache.org/licenses/LICENSE-2.0
8 |
9 | Unless required by applicable law or agreed to in writing, software
10 | distributed under the License is distributed on an "AS IS" BASIS,
11 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12 | See the License for the specific language governing permissions and
13 | limitations under the License.
14 |
15 | Contributors:
16 | Andy Jefferson - coding standards
17 | ...
18 | **********************************************************************/
19 | package org.datanucleus.store.rdbms.exceptions;
20 |
21 | import org.datanucleus.exceptions.NucleusDataStoreException;
22 | import org.datanucleus.store.rdbms.adapter.DatastoreAdapter;
23 | import org.datanucleus.util.Localiser;
24 |
25 | /**
26 | * A TooManyIndicesException is thrown when trying to add an index
27 | * to a table and the table already has the maximum allowed number of indices.
28 | */
29 | public class TooManyIndicesException extends NucleusDataStoreException
30 | {
31 | private static final long serialVersionUID = 3906217271154531757L;
32 |
33 | /**
34 | * Constructs a too-many-indices exception.
35 | * @param dba the database adapter
36 | * @param tableName Name of the table with too many indices
37 | */
38 | public TooManyIndicesException(DatastoreAdapter dba, String tableName)
39 | {
40 | super(Localiser.msg("020016","" + dba.getMaxIndexes(), tableName));
41 | setFatal();
42 | }
43 | }
--------------------------------------------------------------------------------
/src/main/java/org/datanucleus/store/rdbms/exceptions/ViewDefinitionException.java:
--------------------------------------------------------------------------------
1 | /**********************************************************************
2 | Copyright (c) 2002 Mike Martin and others. All rights reserved.
3 | Licensed under the Apache License, Version 2.0 (the "License");
4 | you may not use this file except in compliance with the License.
5 | You may obtain a copy of the License at
6 |
7 | http://www.apache.org/licenses/LICENSE-2.0
8 |
9 | Unless required by applicable law or agreed to in writing, software
10 | distributed under the License is distributed on an "AS IS" BASIS,
11 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12 | See the License for the specific language governing permissions and
13 | limitations under the License.
14 |
15 | Contributors:
16 | Andy Jefferson - coding standards
17 | ...
18 | **********************************************************************/
19 | package org.datanucleus.store.rdbms.exceptions;
20 |
21 | import org.datanucleus.exceptions.NucleusUserException;
22 | import org.datanucleus.util.Localiser;
23 |
24 | /**
25 | * A ViewDefinitionException is thrown if the metadata extension(s)
26 | * that define a view are missing or invalid.
27 | *
28 | * @see org.datanucleus.store.rdbms.table.ClassView
29 | */
30 | public class ViewDefinitionException extends NucleusUserException
31 | {
32 | private static final long serialVersionUID = -3074298411767413664L;
33 |
34 | /**
35 | * Constructs a class definition exception with the specified detail
36 | * message.
37 | * @param className The class name for the class backed by a view.
38 | * @param viewDef The string provided in the metadata defining the view.
39 | */
40 | public ViewDefinitionException(String className, String viewDef)
41 | {
42 | super(Localiser.msg("020017",className,viewDef));
43 | setFatal();
44 | }
45 | }
46 |
--------------------------------------------------------------------------------
/src/main/java/org/datanucleus/store/rdbms/fieldmanager/package.html:
--------------------------------------------------------------------------------
1 |
2 | Provides field-managers to populate JDBC Statements, and to extract from JDBC ResultSets.
3 |
--------------------------------------------------------------------------------
/src/main/java/org/datanucleus/store/rdbms/identifier/CandidateKeyIdentifier.java:
--------------------------------------------------------------------------------
1 | /**********************************************************************
2 | Copyright (c) 2004 Erik Bengtson and others. All rights reserved.
3 | Licensed under the Apache License, Version 2.0 (the "License");
4 | you may not use this file except in compliance with the License.
5 | You may obtain a copy of the License at
6 |
7 | http://www.apache.org/licenses/LICENSE-2.0
8 |
9 | Unless required by applicable law or agreed to in writing, software
10 | distributed under the License is distributed on an "AS IS" BASIS,
11 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12 | See the License for the specific language governing permissions and
13 | limitations under the License.
14 |
15 | Contributors:
16 | ...
17 | **********************************************************************/
18 | package org.datanucleus.store.rdbms.identifier;
19 |
20 |
21 | /**
22 | * Identifier for a unique index (candidate keys).
23 | */
24 | class CandidateKeyIdentifier extends DatastoreIdentifierImpl
25 | {
26 | /**
27 | * Constructor for a column identifier
28 | * @param factory Identifier factory
29 | * @param sqlIdentifier the sql identifier
30 | */
31 | public CandidateKeyIdentifier(IdentifierFactory factory, String sqlIdentifier)
32 | {
33 | super(factory, sqlIdentifier);
34 | }
35 | }
--------------------------------------------------------------------------------
/src/main/java/org/datanucleus/store/rdbms/identifier/ColumnIdentifier.java:
--------------------------------------------------------------------------------
1 | /**********************************************************************
2 | Copyright (c) 2004 Erik Bengtson and others. All rights reserved.
3 | Licensed under the Apache License, Version 2.0 (the "License");
4 | you may not use this file except in compliance with the License.
5 | You may obtain a copy of the License at
6 |
7 | http://www.apache.org/licenses/LICENSE-2.0
8 |
9 | Unless required by applicable law or agreed to in writing, software
10 | distributed under the License is distributed on an "AS IS" BASIS,
11 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12 | See the License for the specific language governing permissions and
13 | limitations under the License.
14 |
15 | Contributors:
16 | ...
17 | **********************************************************************/
18 | package org.datanucleus.store.rdbms.identifier;
19 |
20 |
21 | /**
22 | * Identifier for a Column.
23 | */
24 | class ColumnIdentifier extends DatastoreIdentifierImpl
25 | {
26 | /**
27 | * Constructor for a column identifier
28 | * @param factory Identifier factory
29 | * @param sqlIdentifier the sql identifier
30 | */
31 | public ColumnIdentifier(IdentifierFactory factory, String sqlIdentifier)
32 | {
33 | super(factory, sqlIdentifier);
34 | }
35 | }
--------------------------------------------------------------------------------
/src/main/java/org/datanucleus/store/rdbms/identifier/ForeignKeyIdentifier.java:
--------------------------------------------------------------------------------
1 | /**********************************************************************
2 | Copyright (c) 2004 Erik Bengtson and others. All rights reserved.
3 | Licensed under the Apache License, Version 2.0 (the "License");
4 | you may not use this file except in compliance with the License.
5 | You may obtain a copy of the License at
6 |
7 | http://www.apache.org/licenses/LICENSE-2.0
8 |
9 | Unless required by applicable law or agreed to in writing, software
10 | distributed under the License is distributed on an "AS IS" BASIS,
11 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12 | See the License for the specific language governing permissions and
13 | limitations under the License.
14 |
15 | Contributors:
16 | ...
17 | **********************************************************************/
18 | package org.datanucleus.store.rdbms.identifier;
19 |
20 |
21 | /**
22 | * Identifier for a FK.
23 | */
24 | class ForeignKeyIdentifier extends DatastoreIdentifierImpl
25 | {
26 | /**
27 | * Constructor for a foreign key identifier
28 | * @param factory Identifier factory
29 | * @param sqlIdentifier the sql identifier
30 | */
31 | public ForeignKeyIdentifier(IdentifierFactory factory, String sqlIdentifier)
32 | {
33 | super(factory, sqlIdentifier);
34 | }
35 | }
--------------------------------------------------------------------------------
/src/main/java/org/datanucleus/store/rdbms/identifier/IdentifierType.java:
--------------------------------------------------------------------------------
1 | /**********************************************************************
2 | Copyright (c) 2008 Andy Jefferson and others. All rights reserved.
3 | Licensed under the Apache License, Version 2.0 (the "License");
4 | you may not use this file except in compliance with the License.
5 | You may obtain a copy of the License at
6 |
7 | http://www.apache.org/licenses/LICENSE-2.0
8 |
9 | Unless required by applicable law or agreed to in writing, software
10 | distributed under the License is distributed on an "AS IS" BASIS,
11 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12 | See the License for the specific language governing permissions and
13 | limitations under the License.
14 |
15 | Contributors:
16 | ...
17 | **********************************************************************/
18 | package org.datanucleus.store.rdbms.identifier;
19 |
20 | /**
21 | * Enum defining the type of component that the identifier is for.
22 | */
23 | public enum IdentifierType
24 | {
25 | TABLE,
26 | COLUMN,
27 | FOREIGN_KEY,
28 | INDEX,
29 | CANDIDATE_KEY,
30 | PRIMARY_KEY,
31 | SEQUENCE
32 | }
--------------------------------------------------------------------------------
/src/main/java/org/datanucleus/store/rdbms/identifier/IndexIdentifier.java:
--------------------------------------------------------------------------------
1 | /**********************************************************************
2 | Copyright (c) 2004 Erik Bengtson and others. All rights reserved.
3 | Licensed under the Apache License, Version 2.0 (the "License");
4 | you may not use this file except in compliance with the License.
5 | You may obtain a copy of the License at
6 |
7 | http://www.apache.org/licenses/LICENSE-2.0
8 |
9 | Unless required by applicable law or agreed to in writing, software
10 | distributed under the License is distributed on an "AS IS" BASIS,
11 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12 | See the License for the specific language governing permissions and
13 | limitations under the License.
14 |
15 | Contributors:
16 | ...
17 | **********************************************************************/
18 | package org.datanucleus.store.rdbms.identifier;
19 |
20 |
21 | /**
22 | * Identifier for an Index.
23 | */
24 | class IndexIdentifier extends DatastoreIdentifierImpl
25 | {
26 | /**
27 | * Constructor for an index identifier
28 | * @param factory Identifier factory
29 | * @param sqlIdentifier the sql identifier
30 | */
31 | public IndexIdentifier(IdentifierFactory factory, String sqlIdentifier)
32 | {
33 | super(factory, sqlIdentifier);
34 | }
35 | }
--------------------------------------------------------------------------------
/src/main/java/org/datanucleus/store/rdbms/identifier/PrimaryKeyIdentifier.java:
--------------------------------------------------------------------------------
1 | /**********************************************************************
2 | Copyright (c) 2004 Erik Bengtson and others. All rights reserved.
3 | Licensed under the Apache License, Version 2.0 (the "License");
4 | you may not use this file except in compliance with the License.
5 | You may obtain a copy of the License at
6 |
7 | http://www.apache.org/licenses/LICENSE-2.0
8 |
9 | Unless required by applicable law or agreed to in writing, software
10 | distributed under the License is distributed on an "AS IS" BASIS,
11 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12 | See the License for the specific language governing permissions and
13 | limitations under the License.
14 |
15 | Contributors:
16 | ...
17 | **********************************************************************/
18 | package org.datanucleus.store.rdbms.identifier;
19 |
20 |
21 | /**
22 | * Identifier for a PK.
23 | */
24 | class PrimaryKeyIdentifier extends DatastoreIdentifierImpl
25 | {
26 | /**
27 | * Constructor for a column identifier
28 | * @param factory Identifier factory
29 | * @param sqlIdentifier the sql identifier
30 | */
31 | public PrimaryKeyIdentifier(IdentifierFactory factory, String sqlIdentifier)
32 | {
33 | super(factory, sqlIdentifier);
34 | }
35 | }
--------------------------------------------------------------------------------
/src/main/java/org/datanucleus/store/rdbms/identifier/SequenceIdentifier.java:
--------------------------------------------------------------------------------
1 | /**********************************************************************
2 | Copyright (c) 2006 Andy Jefferson and others. All rights reserved.
3 | Licensed under the Apache License, Version 2.0 (the "License");
4 | you may not use this file except in compliance with the License.
5 | You may obtain a copy of the License at
6 |
7 | http://www.apache.org/licenses/LICENSE-2.0
8 |
9 | Unless required by applicable law or agreed to in writing, software
10 | distributed under the License is distributed on an "AS IS" BASIS,
11 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12 | See the License for the specific language governing permissions and
13 | limitations under the License.
14 |
15 |
16 | Contributors:
17 | ...
18 | **********************************************************************/
19 | package org.datanucleus.store.rdbms.identifier;
20 |
21 |
22 | /**
23 | * Representation of an identifier for a sequence.
24 | */
25 | class SequenceIdentifier extends DatastoreIdentifierImpl
26 | {
27 | /**
28 | * Constructor.
29 | * @param factory Identifier factory
30 | * @param sqlIdentifier SQL Identifier
31 | */
32 | public SequenceIdentifier(IdentifierFactory factory, String sqlIdentifier)
33 | {
34 | super(factory, sqlIdentifier);
35 | }
36 | }
--------------------------------------------------------------------------------
/src/main/java/org/datanucleus/store/rdbms/identifier/TableIdentifier.java:
--------------------------------------------------------------------------------
1 | /**********************************************************************
2 | Copyright (c) 2004 Erik Bengtson and others. All rights reserved.
3 | Licensed under the Apache License, Version 2.0 (the "License");
4 | you may not use this file except in compliance with the License.
5 | You may obtain a copy of the License at
6 |
7 | http://www.apache.org/licenses/LICENSE-2.0
8 |
9 | Unless required by applicable law or agreed to in writing, software
10 | distributed under the License is distributed on an "AS IS" BASIS,
11 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12 | See the License for the specific language governing permissions and
13 | limitations under the License.
14 |
15 | Contributors:
16 | ...
17 | **********************************************************************/
18 | package org.datanucleus.store.rdbms.identifier;
19 |
20 |
21 | /**
22 | * Representation of an identifier for a table.
23 | */
24 | class TableIdentifier extends DatastoreIdentifierImpl
25 | {
26 | /**
27 | * Constructor.
28 | * @param factory Identifier factory
29 | * @param sqlIdentifier SQL Identifier
30 | */
31 | public TableIdentifier(IdentifierFactory factory, String sqlIdentifier)
32 | {
33 | super(factory, sqlIdentifier);
34 | }
35 | }
--------------------------------------------------------------------------------
/src/main/java/org/datanucleus/store/rdbms/identifier/package.html:
--------------------------------------------------------------------------------
1 |
2 | This package contains a series of classes defining the identifier names of datastore objects,
3 | such as tables, foreign keys, indexes, primary keys etc.
4 |
5 |
--------------------------------------------------------------------------------
/src/main/java/org/datanucleus/store/rdbms/key/package.html:
--------------------------------------------------------------------------------
1 |
2 | This package contains wrappers to various types of keys found in RDBMS databases.
3 | Supports single and multiple column keys.
4 |
5 |
--------------------------------------------------------------------------------
/src/main/java/org/datanucleus/store/rdbms/mapping/MappingType.java:
--------------------------------------------------------------------------------
1 | /**********************************************************************
2 | Copyright (c) 2017 Andy Jefferson and others. All rights reserved.
3 | Licensed under the Apache License, Version 2.0 (the "License");
4 | you may not use this file except in compliance with the License.
5 | You may obtain a copy of the License at
6 |
7 | http://www.apache.org/licenses/LICENSE-2.0
8 |
9 | Unless required by applicable law or agreed to in writing, software
10 | distributed under the License is distributed on an "AS IS" BASIS,
11 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12 | See the License for the specific language governing permissions and
13 | limitations under the License.
14 |
15 | Contributors:
16 | ...
17 | **********************************************************************/
18 | package org.datanucleus.store.rdbms.mapping;
19 |
20 | /**
21 | * Enum defining types of mappings, for use with a MappingConsumer.
22 | */
23 | public enum MappingType
24 | {
25 | /** (Surrogate) version column */
26 | VERSION,
27 |
28 | /** Datastore id column. */
29 | DATASTORE_ID,
30 |
31 | /** Discriminator column. */
32 | DISCRIMINATOR,
33 |
34 | /** Multitenancy column. */
35 | MULTITENANCY,
36 |
37 | /** Soft-delete flag column. */
38 | SOFTDELETE,
39 |
40 | /** Create-user audit column. */
41 | CREATEUSER,
42 |
43 | /** Update-user audit column. */
44 | UPDATEUSER,
45 |
46 | /** Create-timestamp audit column. */
47 | CREATETIMESTAMP,
48 |
49 | /** Update-timestamp audit column. */
50 | UPDATETIMESTAMP,
51 |
52 | /** List index from related class. */
53 | EXTERNAL_INDEX,
54 |
55 | /** FK from related class (N side of 1-N). */
56 | EXTERNAL_FK,
57 |
58 | /** Shared relation discriminator, from related class (N side of 1-N). */
59 | EXTERNAL_FK_DISCRIMINATOR
60 | }
--------------------------------------------------------------------------------
/src/main/java/org/datanucleus/store/rdbms/mapping/column/BinaryColumnMapping.java:
--------------------------------------------------------------------------------
1 | /**********************************************************************
2 | Copyright (c) 2017 Andy Jefferson and others. All rights reserved.
3 | Licensed under the Apache License, Version 2.0 (the "License");
4 | you may not use this file except in compliance with the License.
5 | You may obtain a copy of the License at
6 |
7 | http://www.apache.org/licenses/LICENSE-2.0
8 |
9 | Unless required by applicable law or agreed to in writing, software
10 | distributed under the License is distributed on an "AS IS" BASIS,
11 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12 | See the License for the specific language governing permissions and
13 | limitations under the License.
14 |
15 |
16 | Contributors:
17 | ...
18 | **********************************************************************/
19 | package org.datanucleus.store.rdbms.mapping.column;
20 |
21 | import java.sql.Types;
22 |
23 | import org.datanucleus.store.rdbms.mapping.java.JavaTypeMapping;
24 | import org.datanucleus.store.rdbms.RDBMSStoreManager;
25 | import org.datanucleus.store.rdbms.table.Column;
26 |
27 | /**
28 | * Mapping of a BINARY column.
29 | */
30 | public class BinaryColumnMapping extends AbstractLargeBinaryColumnMapping
31 | {
32 | public BinaryColumnMapping(JavaTypeMapping mapping, RDBMSStoreManager storeMgr, Column col)
33 | {
34 | super(mapping, storeMgr, col);
35 | }
36 |
37 | public int getJDBCType()
38 | {
39 | return Types.BINARY;
40 | }
41 | }
--------------------------------------------------------------------------------
/src/main/java/org/datanucleus/store/rdbms/mapping/column/BitColumnMapping.java:
--------------------------------------------------------------------------------
1 | /**********************************************************************
2 | Copyright (c) 2004 Erik Bengtson and others. All rights reserved.
3 | Licensed under the Apache License, Version 2.0 (the "License");
4 | you may not use this file except in compliance with the License.
5 | You may obtain a copy of the License at
6 |
7 | http://www.apache.org/licenses/LICENSE-2.0
8 |
9 | Unless required by applicable law or agreed to in writing, software
10 | distributed under the License is distributed on an "AS IS" BASIS,
11 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12 | See the License for the specific language governing permissions and
13 | limitations under the License.
14 |
15 | Contributors:
16 | ...
17 | **********************************************************************/
18 | package org.datanucleus.store.rdbms.mapping.column;
19 |
20 | import java.sql.Types;
21 |
22 | import org.datanucleus.store.rdbms.RDBMSStoreManager;
23 | import org.datanucleus.store.rdbms.mapping.java.JavaTypeMapping;
24 | import org.datanucleus.store.rdbms.table.Column;
25 |
26 | /**
27 | * Mapping of a BIT column.
28 | */
29 | public class BitColumnMapping extends BooleanColumnMapping
30 | {
31 | /**
32 | * Constructor.
33 | * @param mapping Java type mapping
34 | * @param storeMgr Store Manager
35 | * @param col Column
36 | */
37 | public BitColumnMapping(JavaTypeMapping mapping, RDBMSStoreManager storeMgr, Column col)
38 | {
39 | super(mapping, storeMgr, col);
40 | }
41 |
42 | /**
43 | * Accessor for whether the mapping is bit-based.
44 | * @return Whether the mapping is bit based
45 | */
46 | public boolean isBitBased()
47 | {
48 | return true;
49 | }
50 |
51 | public int getJDBCType()
52 | {
53 | return Types.BIT;
54 | }
55 | }
--------------------------------------------------------------------------------
/src/main/java/org/datanucleus/store/rdbms/mapping/column/ColumnMappingPostSet.java:
--------------------------------------------------------------------------------
1 | /**********************************************************************
2 | Copyright (c) 2021 Andy Jefferson and others. All rights reserved.
3 | Licensed under the Apache License, Version 2.0 (the "License");
4 | you may not use this file except in compliance with the License.
5 | You may obtain a copy of the License at
6 |
7 | http://www.apache.org/licenses/LICENSE-2.0
8 |
9 | Unless required by applicable law or agreed to in writing, software
10 | distributed under the License is distributed on an "AS IS" BASIS,
11 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12 | See the License for the specific language governing permissions and
13 | limitations under the License.
14 |
15 | Contributors:
16 | ...
17 | **********************************************************************/
18 | package org.datanucleus.store.rdbms.mapping.column;
19 |
20 | import org.datanucleus.state.DNStateManager;
21 |
22 | /**
23 | * Interface implemented by any ColumnMapping that requires a post-set (insert/update) step.
24 | * For example, with Oracle CLOB/BLOB the INSERT will just put "EMPTY_CLOB" or "EMPTY_BLOB" and this will SELECT the column and update it.
25 | */
26 | public interface ColumnMappingPostSet
27 | {
28 | /**
29 | * Perform any post "set" processing on this column, using the provided value.
30 | * @param sm StateManager for object being set
31 | * @param value The value to use on the set
32 | */
33 | void setPostProcessing(DNStateManager sm, Object value);
34 | }
--------------------------------------------------------------------------------
/src/main/java/org/datanucleus/store/rdbms/mapping/column/NVarcharColumnMapping.java:
--------------------------------------------------------------------------------
1 | /**********************************************************************
2 | Copyright (c) 2010 Andy Jefferson and others. All rights reserved.
3 | Licensed under the Apache License, Version 2.0 (the "License");
4 | you may not use this file except in compliance with the License.
5 | You may obtain a copy of the License at
6 |
7 | http://www.apache.org/licenses/LICENSE-2.0
8 |
9 | Unless required by applicable law or agreed to in writing, software
10 | distributed under the License is distributed on an "AS IS" BASIS,
11 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12 | See the License for the specific language governing permissions and
13 | limitations under the License.
14 |
15 | Contributors:
16 | ...
17 | **********************************************************************/
18 | package org.datanucleus.store.rdbms.mapping.column;
19 |
20 | import java.sql.Types;
21 |
22 | import org.datanucleus.store.rdbms.RDBMSStoreManager;
23 | import org.datanucleus.store.rdbms.mapping.java.JavaTypeMapping;
24 | import org.datanucleus.store.rdbms.table.Column;
25 |
26 | /**
27 | * Mapping of a NVARCHAR column.
28 | */
29 | public class NVarcharColumnMapping extends NCharColumnMapping
30 | {
31 | public NVarcharColumnMapping(JavaTypeMapping mapping, RDBMSStoreManager storeMgr, Column col)
32 | {
33 | super(mapping, storeMgr, col);
34 | }
35 |
36 | public int getJDBCType()
37 | {
38 | return Types.NVARCHAR;
39 | }
40 | }
41 |
--------------------------------------------------------------------------------
/src/main/java/org/datanucleus/store/rdbms/mapping/column/VarBinaryColumnMapping.java:
--------------------------------------------------------------------------------
1 | /**********************************************************************
2 | Copyright (c) 2006 Andy Jefferson and others. All rights reserved.
3 | Licensed under the Apache License, Version 2.0 (the "License");
4 | you may not use this file except in compliance with the License.
5 | You may obtain a copy of the License at
6 |
7 | http://www.apache.org/licenses/LICENSE-2.0
8 |
9 | Unless required by applicable law or agreed to in writing, software
10 | distributed under the License is distributed on an "AS IS" BASIS,
11 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12 | See the License for the specific language governing permissions and
13 | limitations under the License.
14 |
15 |
16 | Contributors:
17 | ...
18 | **********************************************************************/
19 | package org.datanucleus.store.rdbms.mapping.column;
20 |
21 | import java.sql.Types;
22 |
23 | import org.datanucleus.store.rdbms.mapping.java.JavaTypeMapping;
24 | import org.datanucleus.store.rdbms.RDBMSStoreManager;
25 | import org.datanucleus.store.rdbms.table.Column;
26 |
27 | /**
28 | * Mapping of a VARBINARY column.
29 | */
30 | public class VarBinaryColumnMapping extends AbstractLargeBinaryColumnMapping
31 | {
32 | public VarBinaryColumnMapping(JavaTypeMapping mapping, RDBMSStoreManager storeMgr, Column col)
33 | {
34 | super(mapping, storeMgr, col);
35 | }
36 |
37 | public int getJDBCType()
38 | {
39 | return Types.VARBINARY;
40 | }
41 | }
--------------------------------------------------------------------------------
/src/main/java/org/datanucleus/store/rdbms/mapping/column/package.html:
--------------------------------------------------------------------------------
1 |
2 |
3 | Package containing mappings for column (JDBC) types. These mappings will be mapped via the MappingManager to
4 | the various java type mappings in org.datanucleus.store.rdbms.mapping.java
5 | These are column (JDBC) types, and probably most of them are atomic types mapping to atomic java types
6 |
7 | Mappings map persistent java fields in persistable classes to columns in RDBMS tables.
8 | Mappings are also used to map "non-fields" in persistable classes to columns in RDBMS tables.
9 | A class using datastore identity does not have java fields representing primary-keys in RDBMS tables, but as said earlier a Mapping is also applied to "non-fields".
10 | Therefore, a Mapping is applied to:
11 |
12 |
13 | - persistent java fields
14 | - datastore identity (primary-key columns)
15 | - optimistic columns (columns with version numbers)
16 | - index columns (columns indexing an ordered list)
17 | - owner columns in unidirectional inverse relationships
18 | - adapter columns (additional column added as primary key when the existing columns have datatype not allowed, by database limitation, to be part of the primary key)
19 |
20 |
21 | In addition to the representation of columns in tables for persistable classes, column mappings are also used for representing columns in queries.
22 |
23 |
24 |
--------------------------------------------------------------------------------
/src/main/java/org/datanucleus/store/rdbms/mapping/java/BigDecimalMapping.java:
--------------------------------------------------------------------------------
1 | /**********************************************************************
2 | Copyright (c) 2004 Erik Bengtson and others. All rights reserved.
3 | Licensed under the Apache License, Version 2.0 (the "License");
4 | you may not use this file except in compliance with the License.
5 | You may obtain a copy of the License at
6 |
7 | http://www.apache.org/licenses/LICENSE-2.0
8 |
9 | Unless required by applicable law or agreed to in writing, software
10 | distributed under the License is distributed on an "AS IS" BASIS,
11 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12 | See the License for the specific language governing permissions and
13 | limitations under the License.
14 |
15 | Contributors:
16 | ...
17 | **********************************************************************/
18 | package org.datanucleus.store.rdbms.mapping.java;
19 |
20 | import java.math.BigDecimal;
21 |
22 | /**
23 | * Mapping for BigDecimal type.
24 | */
25 | public class BigDecimalMapping extends SingleFieldMapping
26 | {
27 | @Override
28 | public Class getJavaType()
29 | {
30 | return BigDecimal.class;
31 | }
32 | }
--------------------------------------------------------------------------------
/src/main/java/org/datanucleus/store/rdbms/mapping/java/BigIntegerMapping.java:
--------------------------------------------------------------------------------
1 | /**********************************************************************
2 | Copyright (c) 2004 Erik Bengtson and others. All rights reserved.
3 | Licensed under the Apache License, Version 2.0 (the "License");
4 | you may not use this file except in compliance with the License.
5 | You may obtain a copy of the License at
6 |
7 | http://www.apache.org/licenses/LICENSE-2.0
8 |
9 | Unless required by applicable law or agreed to in writing, software
10 | distributed under the License is distributed on an "AS IS" BASIS,
11 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12 | See the License for the specific language governing permissions and
13 | limitations under the License.
14 |
15 | Contributors:
16 | ...
17 | **********************************************************************/
18 | package org.datanucleus.store.rdbms.mapping.java;
19 |
20 | import java.math.BigInteger;
21 |
22 | /**
23 | * Mapping for BigInteger type.
24 | */
25 | public class BigIntegerMapping extends SingleFieldMapping
26 | {
27 | @Override
28 | public Class getJavaType()
29 | {
30 | return BigInteger.class;
31 | }
32 | }
--------------------------------------------------------------------------------
/src/main/java/org/datanucleus/store/rdbms/mapping/java/BitSetMapping.java:
--------------------------------------------------------------------------------
1 | /**********************************************************************
2 | Copyright (c) 2004 Andy Jefferson and others. All rights reserved.
3 | Licensed under the Apache License, Version 2.0 (the "License");
4 | you may not use this file except in compliance with the License.
5 | You may obtain a copy of the License at
6 |
7 | http://www.apache.org/licenses/LICENSE-2.0
8 |
9 | Unless required by applicable law or agreed to in writing, software
10 | distributed under the License is distributed on an "AS IS" BASIS,
11 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12 | See the License for the specific language governing permissions and
13 | limitations under the License.
14 |
15 |
16 | Contributors:
17 | ...
18 | **********************************************************************/
19 | package org.datanucleus.store.rdbms.mapping.java;
20 |
21 | import java.util.BitSet;
22 |
23 | import org.datanucleus.ClassNameConstants;
24 |
25 | /**
26 | * Mapping for an array of bytes.
27 | */
28 | public class BitSetMapping extends SingleFieldMapping
29 | {
30 | @Override
31 | public Class getJavaType()
32 | {
33 | return BitSet.class;
34 | }
35 |
36 | /**
37 | * Accessor for the name of the java-type actually used when mapping the particular datastore field.
38 | * Returns java.io.Serializable
39 | * @param index requested column index.
40 | * @return the name of java-type for the requested column.
41 | */
42 | @Override
43 | public String getJavaTypeForColumnMapping(int index)
44 | {
45 | return ClassNameConstants.JAVA_IO_SERIALIZABLE;
46 | }
47 | }
--------------------------------------------------------------------------------
/src/main/java/org/datanucleus/store/rdbms/mapping/java/BooleanMapping.java:
--------------------------------------------------------------------------------
1 | /**********************************************************************
2 | Copyright (c) 2002 Kelly Grizzle (TJDO) and others. All rights reserved.
3 | Licensed under the Apache License, Version 2.0 (the "License");
4 | you may not use this file except in compliance with the License.
5 | You may obtain a copy of the License at
6 |
7 | http://www.apache.org/licenses/LICENSE-2.0
8 |
9 | Unless required by applicable law or agreed to in writing, software
10 | distributed under the License is distributed on an "AS IS" BASIS,
11 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12 | See the License for the specific language governing permissions and
13 | limitations under the License.
14 |
15 | Contributors:
16 | 2002 Mike Martin (TJDO)
17 | 2004 Andy Jefferson - removed dependency on JDK 1.4 (Boolean.valueOf(boolean))
18 | 2004 Andy Jefferson - updated type handling to use datastoreMappings
19 | 2007 Andy Jefferson - removed RDBMS-specifics
20 | ...
21 | **********************************************************************/
22 | package org.datanucleus.store.rdbms.mapping.java;
23 |
24 | /**
25 | * Mapping of Java Boolean object.
26 | */
27 | public class BooleanMapping extends SingleFieldMapping
28 | {
29 | @Override
30 | public Class getJavaType()
31 | {
32 | return Boolean.class;
33 | }
34 | }
--------------------------------------------------------------------------------
/src/main/java/org/datanucleus/store/rdbms/mapping/java/ByteMapping.java:
--------------------------------------------------------------------------------
1 | /**********************************************************************
2 | Copyright (c) 2002 Kelly Grizzle (TJDO) and others. All rights reserved.
3 | Licensed under the Apache License, Version 2.0 (the "License");
4 | you may not use this file except in compliance with the License.
5 | You may obtain a copy of the License at
6 |
7 | http://www.apache.org/licenses/LICENSE-2.0
8 |
9 | Unless required by applicable law or agreed to in writing, software
10 | distributed under the License is distributed on an "AS IS" BASIS,
11 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12 | See the License for the specific language governing permissions and
13 | limitations under the License.
14 |
15 | Contributors:
16 | 2002 Mike Martin (TJDO)
17 | 2003 Andy Jefferson - coding standards
18 | ...
19 | **********************************************************************/
20 | package org.datanucleus.store.rdbms.mapping.java;
21 |
22 | /**
23 | * Mapping for Byte type.
24 | */
25 | public class ByteMapping extends SingleFieldMapping
26 | {
27 | @Override
28 | public Class getJavaType()
29 | {
30 | return Byte.class;
31 | }
32 | }
--------------------------------------------------------------------------------
/src/main/java/org/datanucleus/store/rdbms/mapping/java/CharacterMapping.java:
--------------------------------------------------------------------------------
1 | /**********************************************************************
2 | Copyright (c) 2002 Kelly Grizzle (TJDO) and others. All rights reserved.
3 | Licensed under the Apache License, Version 2.0 (the "License");
4 | you may not use this file except in compliance with the License.
5 | You may obtain a copy of the License at
6 |
7 | http://www.apache.org/licenses/LICENSE-2.0
8 |
9 | Unless required by applicable law or agreed to in writing, software
10 | distributed under the License is distributed on an "AS IS" BASIS,
11 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12 | See the License for the specific language governing permissions and
13 | limitations under the License.
14 |
15 |
16 | Contributors:
17 | 2002 Mike Martin (TJDO)
18 | 2003 Andy Jefferson - coding standards
19 | 2004 Erik Bengtson - included a check "is null" on getObject method
20 | ...
21 | **********************************************************************/
22 | package org.datanucleus.store.rdbms.mapping.java;
23 |
24 | /**
25 | * Mapping for Character type.
26 | * In RDBMS, this mapping can be stored in INT or CHAR columns.
27 | * The use of INT columns facilitates greater than, less than operations within queries etc.
28 | */
29 | public class CharacterMapping extends SingleFieldMapping
30 | {
31 | @Override
32 | public Class getJavaType()
33 | {
34 | return Character.class;
35 | }
36 |
37 | /**
38 | * Method to return the default length of this type in the datastore.
39 | * Character/char will need a single character!
40 | * @param index The index position
41 | * @return The default length
42 | */
43 | @Override
44 | public int getDefaultLength(int index)
45 | {
46 | return 1;
47 | }
48 | }
--------------------------------------------------------------------------------
/src/main/java/org/datanucleus/store/rdbms/mapping/java/DateMapping.java:
--------------------------------------------------------------------------------
1 | /**********************************************************************
2 | Copyright (c) 2002 Mike Martin (TJDO) and others. All rights reserved.
3 | Licensed under the Apache License, Version 2.0 (the "License");
4 | you may not use this file except in compliance with the License.
5 | You may obtain a copy of the License at
6 |
7 | http://www.apache.org/licenses/LICENSE-2.0
8 |
9 | Unless required by applicable law or agreed to in writing, software
10 | distributed under the License is distributed on an "AS IS" BASIS,
11 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12 | See the License for the specific language governing permissions and
13 | limitations under the License.
14 |
15 | Contributors:
16 | Andy Jefferson - coding standards and javadocs
17 | ...
18 | **********************************************************************/
19 | package org.datanucleus.store.rdbms.mapping.java;
20 |
21 | import java.util.Date;
22 |
23 | /**
24 | * SCO Mapping for java.util.Date type.
25 | */
26 | public class DateMapping extends TemporalMapping
27 | {
28 | @Override
29 | public Class getJavaType()
30 | {
31 | return Date.class;
32 | }
33 |
34 | @Override
35 | protected int getDefaultLengthAsString()
36 | {
37 | return 28;
38 | }
39 | }
--------------------------------------------------------------------------------
/src/main/java/org/datanucleus/store/rdbms/mapping/java/DoubleMapping.java:
--------------------------------------------------------------------------------
1 | /**********************************************************************
2 | Copyright (c) 2002 Kelly Grizzle (TJDO) and others. All rights reserved.
3 | Licensed under the Apache License, Version 2.0 (the "License");
4 | you may not use this file except in compliance with the License.
5 | You may obtain a copy of the License at
6 |
7 | http://www.apache.org/licenses/LICENSE-2.0
8 |
9 | Unless required by applicable law or agreed to in writing, software
10 | distributed under the License is distributed on an "AS IS" BASIS,
11 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12 | See the License for the specific language governing permissions and
13 | limitations under the License.
14 |
15 | Contributors:
16 | 2002 Mike Martin (TJDO)
17 | 2003 Andy Jefferson - coding standards
18 | ...
19 | **********************************************************************/
20 | package org.datanucleus.store.rdbms.mapping.java;
21 |
22 | /**
23 | * Mapping for Double type.
24 | */
25 | public class DoubleMapping extends SingleFieldMapping
26 | {
27 | @Override
28 | public Class getJavaType()
29 | {
30 | return Double.class;
31 | }
32 | }
--------------------------------------------------------------------------------
/src/main/java/org/datanucleus/store/rdbms/mapping/java/FileMapping.java:
--------------------------------------------------------------------------------
1 | /**********************************************************************
2 | Copyright (c) 2013 Andy Jefferson and others. All rights reserved.
3 | Licensed under the Apache License, Version 2.0 (the "License");
4 | you may not use this file except in compliance with the License.
5 | You may obtain a copy of the License at
6 |
7 | http://www.apache.org/licenses/LICENSE-2.0
8 |
9 | Unless required by applicable law or agreed to in writing, software
10 | distributed under the License is distributed on an "AS IS" BASIS,
11 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12 | See the License for the specific language governing permissions and
13 | limitations under the License.
14 |
15 | Contributors:
16 | ...
17 | **********************************************************************/
18 | package org.datanucleus.store.rdbms.mapping.java;
19 |
20 | import java.io.File;
21 |
22 | /**
23 | * Mapping for a File member.
24 | */
25 | public class FileMapping extends SingleFieldMapping
26 | {
27 | @Override
28 | public Class getJavaType()
29 | {
30 | return File.class;
31 | }
32 | }
--------------------------------------------------------------------------------
/src/main/java/org/datanucleus/store/rdbms/mapping/java/FloatMapping.java:
--------------------------------------------------------------------------------
1 | /**********************************************************************
2 | Copyright (c) 2002 Kelly Grizzle (TJDO) and others. All rights reserved.
3 | Licensed under the Apache License, Version 2.0 (the "License");
4 | you may not use this file except in compliance with the License.
5 | You may obtain a copy of the License at
6 |
7 | http://www.apache.org/licenses/LICENSE-2.0
8 |
9 | Unless required by applicable law or agreed to in writing, software
10 | distributed under the License is distributed on an "AS IS" BASIS,
11 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12 | See the License for the specific language governing permissions and
13 | limitations under the License.
14 |
15 |
16 | Contributors:
17 | 2003 Andy Jefferson - coding standards
18 | 2004 Andy Jefferson - removed getTypeInfo since wasn't used
19 | ...
20 | **********************************************************************/
21 | package org.datanucleus.store.rdbms.mapping.java;
22 |
23 | /**
24 | * Mapping for Float Java type.
25 | */
26 | public class FloatMapping extends SingleFieldMapping
27 | {
28 | @Override
29 | public Class getJavaType()
30 | {
31 | return Float.class;
32 | }
33 | }
--------------------------------------------------------------------------------
/src/main/java/org/datanucleus/store/rdbms/mapping/java/NullMapping.java:
--------------------------------------------------------------------------------
1 | /**********************************************************************
2 | Copyright (c) 2006 Erik Bengtson and others. All rights reserved.
3 | Licensed under the Apache License, Version 2.0 (the "License");
4 | you may not use this file except in compliance with the License.
5 | You may obtain a copy of the License at
6 |
7 | http://www.apache.org/licenses/LICENSE-2.0
8 |
9 | Unless required by applicable law or agreed to in writing, software
10 | distributed under the License is distributed on an "AS IS" BASIS,
11 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12 | See the License for the specific language governing permissions and
13 | limitations under the License.
14 |
15 |
16 | Contributors:
17 | ...
18 | **********************************************************************/
19 | package org.datanucleus.store.rdbms.mapping.java;
20 |
21 | import java.sql.PreparedStatement;
22 | import java.sql.ResultSet;
23 |
24 | import org.datanucleus.ExecutionContext;
25 | import org.datanucleus.store.rdbms.RDBMSStoreManager;
26 |
27 | /**
28 | * Simple mapping for a null literal. Only used when the type is not determined
29 | */
30 | public class NullMapping extends SingleFieldMapping
31 | {
32 | public NullMapping(RDBMSStoreManager storeMgr)
33 | {
34 | initialize(storeMgr, null);
35 | }
36 |
37 | @Override
38 | public Class getJavaType()
39 | {
40 | return null;
41 | }
42 |
43 | @Override
44 | public Object getObject(ExecutionContext ec, ResultSet resultSet, int[] exprIndex)
45 | {
46 | return null;
47 | }
48 |
49 | @Override
50 | public void setObject(ExecutionContext ec, PreparedStatement ps, int[] exprIndex, Object value)
51 | {
52 | }
53 | }
--------------------------------------------------------------------------------
/src/main/java/org/datanucleus/store/rdbms/mapping/java/NumberMapping.java:
--------------------------------------------------------------------------------
1 | /**********************************************************************
2 | Copyright (c) 2007 Andy Jefferson and others. All rights reserved.
3 | Licensed under the Apache License, Version 2.0 (the "License");
4 | you may not use this file except in compliance with the License.
5 | You may obtain a copy of the License at
6 |
7 | http://www.apache.org/licenses/LICENSE-2.0
8 |
9 | Unless required by applicable law or agreed to in writing, software
10 | distributed under the License is distributed on an "AS IS" BASIS,
11 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12 | See the License for the specific language governing permissions and
13 | limitations under the License.
14 |
15 | Contributors:
16 | ...
17 | **********************************************************************/
18 | package org.datanucleus.store.rdbms.mapping.java;
19 |
20 | import org.datanucleus.ClassNameConstants;
21 |
22 | /**
23 | * Mapping for Number type.
24 | */
25 | public class NumberMapping extends SingleFieldMapping
26 | {
27 | @Override
28 | public String getJavaTypeForColumnMapping(int index)
29 | {
30 | // Assume it has the highest precision possible so we can store all subtypes of Number
31 | return ClassNameConstants.JAVA_MATH_BIGDECIMAL;
32 | }
33 |
34 | @Override
35 | public Class getJavaType()
36 | {
37 | return Number.class;
38 | }
39 | }
--------------------------------------------------------------------------------
/src/main/java/org/datanucleus/store/rdbms/mapping/java/OptionalMapping.java:
--------------------------------------------------------------------------------
1 | /**********************************************************************
2 | Copyright (c) 2016 Andy Jefferson and others. All rights reserved.
3 | Licensed under the Apache License, Version 2.0 (the "License");
4 | you may not use this file except in compliance with the License.
5 | You may obtain a copy of the License at
6 |
7 | http://www.apache.org/licenses/LICENSE-2.0
8 |
9 | Unless required by applicable law or agreed to in writing, software
10 | distributed under the License is distributed on an "AS IS" BASIS,
11 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12 | See the License for the specific language governing permissions and
13 | limitations under the License.
14 |
15 | Contributors:
16 | ...
17 | **********************************************************************/
18 | package org.datanucleus.store.rdbms.mapping.java;
19 |
20 | /**
21 | * Mapping for java.util.Optional.
22 | */
23 | public class OptionalMapping extends SingleCollectionMapping
24 | {
25 | }
--------------------------------------------------------------------------------
/src/main/java/org/datanucleus/store/rdbms/mapping/java/OrderIndexMapping.java:
--------------------------------------------------------------------------------
1 | /**********************************************************************
2 | Copyright (c) 2004 Erik Bengtson and others. All rights reserved.
3 | Licensed under the Apache License, Version 2.0 (the "License");
4 | you may not use this file except in compliance with the License.
5 | You may obtain a copy of the License at
6 |
7 | http://www.apache.org/licenses/LICENSE-2.0
8 |
9 | Unless required by applicable law or agreed to in writing, software
10 | distributed under the License is distributed on an "AS IS" BASIS,
11 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12 | See the License for the specific language governing permissions and
13 | limitations under the License.
14 |
15 | Contributors:
16 | Andy Jefferson - removed getUpdateInputParameter,getInsertionInputParameter
17 | ...
18 | **********************************************************************/
19 | package org.datanucleus.store.rdbms.mapping.java;
20 |
21 | /**
22 | * Mapping for the ordering of an "indexed" list.
23 | */
24 | public final class OrderIndexMapping extends SingleFieldMapping
25 | {
26 | /**
27 | * Accessor for whether to include this column in any fetch statement
28 | * @return Whether to include the column when fetching.
29 | */
30 | public boolean includeInFetchStatement()
31 | {
32 | // We will have an order by in the fetch statement, but no need to pull back this value
33 | return false;
34 | }
35 |
36 | /**
37 | * Accessor for the type represented here, returning the class itself
38 | * @return This class.
39 | */
40 | public Class getJavaType()
41 | {
42 | return Integer.class;
43 | }
44 | }
--------------------------------------------------------------------------------
/src/main/java/org/datanucleus/store/rdbms/mapping/java/SerialisedMapping.java:
--------------------------------------------------------------------------------
1 | /**********************************************************************
2 | Copyright (c) 2003 Erik Bengtson and others. All rights reserved.
3 | Licensed under the Apache License, Version 2.0 (the "License");
4 | you may not use this file except in compliance with the License.
5 | You may obtain a copy of the License at
6 |
7 | http://www.apache.org/licenses/LICENSE-2.0
8 |
9 | Unless required by applicable law or agreed to in writing, software
10 | distributed under the License is distributed on an "AS IS" BASIS,
11 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12 | See the License for the specific language governing permissions and
13 | limitations under the License.
14 |
15 |
16 | Contributors:
17 | 2003 Andy Jefferson - coding standards
18 | ...
19 | **********************************************************************/
20 | package org.datanucleus.store.rdbms.mapping.java;
21 |
22 | import org.datanucleus.ClassNameConstants;
23 |
24 | /**
25 | * Maps a field as serialised.
26 | */
27 | public class SerialisedMapping extends SingleFieldMapping
28 | {
29 | /**
30 | * Accessor for the (Java) type of data represented here
31 | * @return java.lang.Object
32 | */
33 | public Class getJavaType()
34 | {
35 | return Object.class;
36 | }
37 |
38 | /**
39 | * Accessor for the name of the java-type actually used when mapping the particular datastore
40 | * field. Returns Serializable since the object needs to be Serialisable
41 | * @param index requested column index.
42 | * @return the name of java-type for the requested column.
43 | */
44 | public String getJavaTypeForColumnMapping(int index)
45 | {
46 | return ClassNameConstants.JAVA_IO_SERIALIZABLE;
47 | }
48 | }
--------------------------------------------------------------------------------
/src/main/java/org/datanucleus/store/rdbms/mapping/java/SqlDateMapping.java:
--------------------------------------------------------------------------------
1 | /**********************************************************************
2 | Copyright (c) 2002 Mike Martin (TJDO) and others. All rights reserved.
3 | Licensed under the Apache License, Version 2.0 (the "License");
4 | you may not use this file except in compliance with the License.
5 | You may obtain a copy of the License at
6 |
7 | http://www.apache.org/licenses/LICENSE-2.0
8 |
9 | Unless required by applicable law or agreed to in writing, software
10 | distributed under the License is distributed on an "AS IS" BASIS,
11 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12 | See the License for the specific language governing permissions and
13 | limitations under the License.
14 |
15 | Contributors:
16 | Andy Jefferson - coding standards and javadocs
17 | ...
18 | **********************************************************************/
19 | package org.datanucleus.store.rdbms.mapping.java;
20 |
21 | /**
22 | * SCO Mapping for a java.sql.Date type.
23 | * Maps between a java.sql.Date object and an SQL "DATE" type in the datatsore.
24 | */
25 | public class SqlDateMapping extends TemporalMapping
26 | {
27 | @Override
28 | public Class getJavaType()
29 | {
30 | return java.sql.Date.class;
31 | }
32 |
33 | @Override
34 | protected int getDefaultLengthAsString()
35 | {
36 | // String-based storage when persisted as "YYYY-MM-DD"
37 | return 10;
38 | }
39 | }
--------------------------------------------------------------------------------
/src/main/java/org/datanucleus/store/rdbms/mapping/java/SqlTimeMapping.java:
--------------------------------------------------------------------------------
1 | /**********************************************************************
2 | Copyright (c) 2003 Andy Jefferson and others. All rights reserved.
3 | Licensed under the Apache License, Version 2.0 (the "License");
4 | you may not use this file except in compliance with the License.
5 | You may obtain a copy of the License at
6 |
7 | http://www.apache.org/licenses/LICENSE-2.0
8 |
9 | Unless required by applicable law or agreed to in writing, software
10 | distributed under the License is distributed on an "AS IS" BASIS,
11 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12 | See the License for the specific language governing permissions and
13 | limitations under the License.
14 |
15 | Contributors:
16 | ...
17 | **********************************************************************/
18 | package org.datanucleus.store.rdbms.mapping.java;
19 |
20 | /**
21 | * SCO Mapping for a java.sql.Time type.
22 | */
23 | public class SqlTimeMapping extends TemporalMapping
24 | {
25 | @Override
26 | public Class getJavaType()
27 | {
28 | return java.sql.Time.class;
29 | }
30 |
31 | @Override
32 | protected int getDefaultLengthAsString()
33 | {
34 | // java.sql.Time requires 8 characters ("hh:mm:ss")
35 | return 8;
36 | }
37 | }
--------------------------------------------------------------------------------
/src/main/java/org/datanucleus/store/rdbms/mapping/java/SqlTimestampMapping.java:
--------------------------------------------------------------------------------
1 | /**********************************************************************
2 | Copyright (c) 2002 Mike Martin (TJDO) and others. All rights reserved.
3 | Licensed under the Apache License, Version 2.0 (the "License");
4 | you may not use this file except in compliance with the License.
5 | You may obtain a copy of the License at
6 |
7 | http://www.apache.org/licenses/LICENSE-2.0
8 |
9 | Unless required by applicable law or agreed to in writing, software
10 | distributed under the License is distributed on an "AS IS" BASIS,
11 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12 | See the License for the specific language governing permissions and
13 | limitations under the License.
14 |
15 |
16 | Contributors:
17 | 2003 Andy Jefferson - coding standards and javadocs
18 | ...
19 | **********************************************************************/
20 | package org.datanucleus.store.rdbms.mapping.java;
21 |
22 | /**
23 | * SCO Mapping for a java.sql.Timestamp type.
24 | */
25 | public class SqlTimestampMapping extends TemporalMapping
26 | {
27 | @Override
28 | public Class getJavaType()
29 | {
30 | return java.sql.Timestamp.class;
31 | }
32 |
33 | @Override
34 | protected int getDefaultLengthAsString()
35 | {
36 | // String-based storage when persisted as "YYYY-MM-DD HH:MM:SS.FFFFFFFFF"
37 | return 29;
38 | }
39 | }
--------------------------------------------------------------------------------
/src/main/java/org/datanucleus/store/rdbms/mapping/java/StringMapping.java:
--------------------------------------------------------------------------------
1 | /**********************************************************************
2 | Copyright (c) 2002 Kelly Grizzle (TJDO) and others. All rights reserved.
3 | Licensed under the Apache License, Version 2.0 (the "License");
4 | you may not use this file except in compliance with the License.
5 | You may obtain a copy of the License at
6 |
7 | http://www.apache.org/licenses/LICENSE-2.0
8 |
9 | Unless required by applicable law or agreed to in writing, software
10 | distributed under the License is distributed on an "AS IS" BASIS,
11 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12 | See the License for the specific language governing permissions and
13 | limitations under the License.
14 |
15 |
16 | Contributors:
17 | 2002 Mike Martin (TJDO)
18 | 2003 Andy Jefferson - coding standards
19 | ...
20 | **********************************************************************/
21 | package org.datanucleus.store.rdbms.mapping.java;
22 |
23 | import org.datanucleus.util.StringUtils;
24 |
25 | /**
26 | * Mapping for a String type.
27 | */
28 | public class StringMapping extends SingleFieldMapping
29 | {
30 | @Override
31 | public Class getJavaType()
32 | {
33 | return String.class;
34 | }
35 |
36 | @Override
37 | public Object[] getValidValues(int index)
38 | {
39 | if (mmd != null)
40 | {
41 | if (mmd.hasExtension(EXTENSION_CHECK_CONSTRAINT_VALUES))
42 | {
43 | String valuesStr = mmd.getValueForExtension(EXTENSION_CHECK_CONSTRAINT_VALUES);
44 | return StringUtils.split(valuesStr, ",");
45 | }
46 | }
47 |
48 | return super.getValidValues(index);
49 | }
50 | }
--------------------------------------------------------------------------------
/src/main/java/org/datanucleus/store/rdbms/mapping/java/package.html:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 | Package providing mappings for all supported Java types in DataNucleus.
5 | A JavaTypeMapping provides a mapping from the Java type to the associated ColumnMapping type(s).
6 | At the class side we have a field, and at the datastore side we have the column(s).
7 |
8 |
9 |
--------------------------------------------------------------------------------
/src/main/java/org/datanucleus/store/rdbms/mapping/package.html:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 | In an RDBMS datastore each class is represented as a Table (maybe shared with other classes).
5 | Each field/property of the class is represented as a JavaTypeMapping (see classes under org.datanucleus.store.rdbms.mapping.java).
6 | Each JavaTypeMapping has [0-N] DatastoreMapping(s) (see classes under org.datanucleus.store.rdbms.mapping.column).
7 |
8 |
9 |
--------------------------------------------------------------------------------
/src/main/java/org/datanucleus/store/rdbms/overview.html:
--------------------------------------------------------------------------------
1 |
2 |
3 | DataNucleus "RDBMS" provides persistence of Java objects to RDBMS datastores. It builds on top
4 | of the DataNucleus "core" jar supporting specific features of RDBMS datastores. It handles
5 | Object/Relational mapping (ORM), mapping between the Java class and SQL table(s).
6 | It provides querying capabilities using either JDOQL, or SQL.
7 | The code can be utilised with either JDO or JPA persistence APIs.
8 |
9 |
10 | Support is provided by way of a Forum at
11 | http://www.datanucleus.org.
12 |
13 |
--------------------------------------------------------------------------------
/src/main/java/org/datanucleus/store/rdbms/package.html:
--------------------------------------------------------------------------------
1 |
2 | Package providing management of the persistence to RDBMS datastores.
3 | All subpackages below this level are specific to RDBMS.
4 |
--------------------------------------------------------------------------------
/src/main/java/org/datanucleus/store/rdbms/query/package.html:
--------------------------------------------------------------------------------
1 |
2 | Package providing the querying mechanism for DataNucleus for RDBMS datastores.
3 |
4 | Query Generation
5 | Queries are supported on RDBMS datastore using JDOQL, JPQL, SQL, or alternatively StoredProcedures.
6 | JDOQL queries are converted into SQL using a query compilation process, firstly compiling generically, and then converting the generic compilation into SQL using QueryToSQLMapper
.
7 | JPQL queries are converted into SQL using a query compilation process, firstly compiling generically, and then converting the generic compilation into SQL using QueryToSQLMapper
.
8 |
9 | Query Result Processing
10 | A query is executed and returns a JDBC ResultSet. The ResultSet is then converted into the requisite result format using either of
11 | PersistentClassROF
, ResultClassROF
or ResultMetaDataROF
.
12 | These "result object factories" convert each row of the ResultSet into the required object(s).
13 | Where part of the result is a persistable object, it makes use of ResultSetGetter to populate the fields of the persistable object.
14 |
--------------------------------------------------------------------------------
/src/main/java/org/datanucleus/store/rdbms/request/RequestType.java:
--------------------------------------------------------------------------------
1 | /**********************************************************************
2 | Copyright (c) 2009 Andy Jefferson and others. All rights reserved.
3 | Licensed under the Apache License, Version 2.0 (the "License");
4 | you may not use this file except in compliance with the License.
5 | You may obtain a copy of the License at
6 |
7 | http://www.apache.org/licenses/LICENSE-2.0
8 |
9 | Unless required by applicable law or agreed to in writing, software
10 | distributed under the License is distributed on an "AS IS" BASIS,
11 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12 | See the License for the specific language governing permissions and
13 | limitations under the License.
14 |
15 | Contributors:
16 | ...
17 | **********************************************************************/
18 | package org.datanucleus.store.rdbms.request;
19 |
20 | /**
21 | * Enum of possible request types.
22 | */
23 | public enum RequestType
24 | {
25 | INSERT("insert"),
26 | UPDATE("update"),
27 | DELETE("delete"),
28 | FETCH("fetch"),
29 | LOCATE("locate");
30 |
31 | private String name;
32 | private RequestType(String name)
33 | {
34 | this.name = name;
35 | }
36 |
37 | public String toString()
38 | {
39 | return name;
40 | }
41 | }
--------------------------------------------------------------------------------
/src/main/java/org/datanucleus/store/rdbms/request/package.html:
--------------------------------------------------------------------------------
1 |
2 | Provides the mechanism of communicating with the database using JDBC.
3 | Provides a request for all types of database communication.
4 |
5 |
--------------------------------------------------------------------------------
/src/main/java/org/datanucleus/store/rdbms/schema/package.html:
--------------------------------------------------------------------------------
1 |
2 | Provides a definition of the schema in the datastore, including tables, columns and types.
3 | The public access point for datastore schema information is RDBMSSchemaHandler
4 | which provides a series of methods for accessing key schema data. For example
5 |
6 | - handler.getSchemaData(conn, "types"); returns all JDBC/SQL type information
7 | for this datastore.
8 | - handler.getSchemaData(conn, "tables", "myCatalog", "mySchema"); returns all
9 | table information in the supplied catalog/schema for this datastore.
10 |
11 |
12 |
--------------------------------------------------------------------------------
/src/main/java/org/datanucleus/store/rdbms/scostore/package.html:
--------------------------------------------------------------------------------
1 |
2 | This package provides classes defining the (SCO) backing store for various container classes (Collections/Maps/arrays) within DataNucleus.
3 | These classes handle the reading/writing of data from/to the datastore for these SCO containers.
4 | There should be a maximum of one backing store per class member, shared amongst all objects with that member.
5 | Each backing store should be thread-safe.
6 |
7 |
--------------------------------------------------------------------------------
/src/main/java/org/datanucleus/store/rdbms/sql/SQLTableNameNamer.java:
--------------------------------------------------------------------------------
1 | /**********************************************************************
2 | Copyright (c) 2015 Andy Jefferson and others. All rights reserved.
3 | Licensed under the Apache License, Version 2.0 (the "License");
4 | you may not use this file except in compliance with the License.
5 | You may obtain a copy of the License at
6 |
7 | http://www.apache.org/licenses/LICENSE-2.0
8 |
9 | Unless required by applicable law or agreed to in writing, software
10 | distributed under the License is distributed on an "AS IS" BASIS,
11 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12 | See the License for the specific language governing permissions and
13 | limitations under the License.
14 |
15 | Contributors:
16 | ...
17 | **********************************************************************/
18 | package org.datanucleus.store.rdbms.sql;
19 |
20 | import org.datanucleus.store.rdbms.table.Table;
21 |
22 | /**
23 | * SQLTable namer that uses the table name as the "alias".
24 | * Useful for datastores that don't allow aliases in UPDATE/DELETE statements.
25 | */
26 | public class SQLTableNameNamer implements SQLTableNamer
27 | {
28 | /* (non-Javadoc)
29 | * @see org.datanucleus.store.rdbms.sql.SQLTableNamer#getAliasForTable(org.datanucleus.store.rdbms.sql.SQLStatement, org.datanucleus.store.rdbms.DatastoreContainerObject)
30 | */
31 | public String getAliasForTable(SQLStatement stmt, Table table, String groupName)
32 | {
33 | return table.getName();
34 | }
35 | }
--------------------------------------------------------------------------------
/src/main/java/org/datanucleus/store/rdbms/sql/SQLTableNamer.java:
--------------------------------------------------------------------------------
1 | /**********************************************************************
2 | Copyright (c) 2008 Andy Jefferson and others. All rights reserved.
3 | Licensed under the Apache License, Version 2.0 (the "License");
4 | you may not use this file except in compliance with the License.
5 | You may obtain a copy of the License at
6 |
7 | http://www.apache.org/licenses/LICENSE-2.0
8 |
9 | Unless required by applicable law or agreed to in writing, software
10 | distributed under the License is distributed on an "AS IS" BASIS,
11 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12 | See the License for the specific language governing permissions and
13 | limitations under the License.
14 |
15 | Contributors:
16 | ...
17 | **********************************************************************/
18 | package org.datanucleus.store.rdbms.sql;
19 |
20 | import org.datanucleus.store.rdbms.table.Table;
21 |
22 | /**
23 | * Interface to be implemented by a class providing naming for SQL tables.
24 | */
25 | public interface SQLTableNamer
26 | {
27 | /**
28 | * Method to return the alias to use for the specified table.
29 | * @param stmt The statement where we will use the table
30 | * @param table The table
31 | * @param groupName Name of the table group
32 | * @return The alias to use
33 | */
34 | public String getAliasForTable(SQLStatement stmt, Table table, String groupName);
35 | }
--------------------------------------------------------------------------------
/src/main/java/org/datanucleus/store/rdbms/sql/expression/AggregateExpression.java:
--------------------------------------------------------------------------------
1 | /**********************************************************************
2 | Copyright (c) 2015 Andy Jefferson and others. All rights reserved.
3 | Licensed under the Apache License, Version 2.0 (the "License");
4 | you may not use this file except in compliance with the License.
5 | You may obtain a copy of the License at
6 |
7 | http://www.apache.org/licenses/LICENSE-2.0
8 |
9 | Unless required by applicable law or agreed to in writing, software
10 | distributed under the License is distributed on an "AS IS" BASIS,
11 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12 | See the License for the specific language governing permissions and
13 | limitations under the License.
14 |
15 | Contributors:
16 | ...
17 | **********************************************************************/
18 | package org.datanucleus.store.rdbms.sql.expression;
19 |
20 | /**
21 | * Representation of an aggregated expression.
22 | */
23 | public interface AggregateExpression
24 | {
25 | }
--------------------------------------------------------------------------------
/src/main/java/org/datanucleus/store/rdbms/sql/expression/AggregateNumericExpression.java:
--------------------------------------------------------------------------------
1 | /**********************************************************************
2 | Copyright (c) 2009 Andy Jefferson and others. All rights reserved.
3 | Licensed under the Apache License, Version 2.0 (the "License");
4 | you may not use this file except in compliance with the License.
5 | You may obtain a copy of the License at
6 |
7 | http://www.apache.org/licenses/LICENSE-2.0
8 |
9 | Unless required by applicable law or agreed to in writing, software
10 | distributed under the License is distributed on an "AS IS" BASIS,
11 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12 | See the License for the specific language governing permissions and
13 | limitations under the License.
14 |
15 | Contributors:
16 | ...
17 | **********************************************************************/
18 | package org.datanucleus.store.rdbms.sql.expression;
19 |
20 | import java.util.List;
21 |
22 | import org.datanucleus.store.rdbms.mapping.java.JavaTypeMapping;
23 | import org.datanucleus.store.rdbms.sql.SQLStatement;
24 |
25 | /**
26 | * Expression for an aggregate function.
27 | * Allows us to distinguish aggregate expressions from other numeric expressions.
28 | */
29 | public class AggregateNumericExpression extends NumericExpression implements AggregateExpression
30 | {
31 | public AggregateNumericExpression(SQLStatement stmt, JavaTypeMapping mapping, String functionName, List args)
32 | {
33 | super(stmt, mapping, functionName, args);
34 | }
35 |
36 | public AggregateNumericExpression(SQLStatement stmt, JavaTypeMapping mapping, String sql)
37 | {
38 | super(stmt, mapping, sql);
39 | }
40 | }
--------------------------------------------------------------------------------
/src/main/java/org/datanucleus/store/rdbms/sql/expression/AggregateStringExpression.java:
--------------------------------------------------------------------------------
1 | /**********************************************************************
2 | Copyright (c) 2015 Andy Jefferson and others. All rights reserved.
3 | Licensed under the Apache License, Version 2.0 (the "License");
4 | you may not use this file except in compliance with the License.
5 | You may obtain a copy of the License at
6 |
7 | http://www.apache.org/licenses/LICENSE-2.0
8 |
9 | Unless required by applicable law or agreed to in writing, software
10 | distributed under the License is distributed on an "AS IS" BASIS,
11 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12 | See the License for the specific language governing permissions and
13 | limitations under the License.
14 |
15 | Contributors:
16 | ...
17 | **********************************************************************/
18 | package org.datanucleus.store.rdbms.sql.expression;
19 |
20 | import java.util.List;
21 |
22 | import org.datanucleus.store.rdbms.mapping.java.JavaTypeMapping;
23 | import org.datanucleus.store.rdbms.sql.SQLStatement;
24 |
25 | /**
26 | * Expression for an aggregate function.
27 | * Allows us to distinguish aggregate expressions from other string expressions.
28 | */
29 | public class AggregateStringExpression extends StringExpression implements AggregateExpression
30 | {
31 | public AggregateStringExpression(SQLStatement stmt, JavaTypeMapping mapping, String functionName, List args)
32 | {
33 | super(stmt, mapping, functionName, args);
34 | }
35 | }
--------------------------------------------------------------------------------
/src/main/java/org/datanucleus/store/rdbms/sql/expression/AggregateTemporalExpression.java:
--------------------------------------------------------------------------------
1 | /**********************************************************************
2 | Copyright (c) 2011 Andy Jefferson and others. All rights reserved.
3 | Licensed under the Apache License, Version 2.0 (the "License");
4 | you may not use this file except in compliance with the License.
5 | You may obtain a copy of the License at
6 |
7 | http://www.apache.org/licenses/LICENSE-2.0
8 |
9 | Unless required by applicable law or agreed to in writing, software
10 | distributed under the License is distributed on an "AS IS" BASIS,
11 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12 | See the License for the specific language governing permissions and
13 | limitations under the License.
14 |
15 | Contributors:
16 | ...
17 | **********************************************************************/
18 | package org.datanucleus.store.rdbms.sql.expression;
19 |
20 | import java.util.List;
21 |
22 | import org.datanucleus.store.rdbms.mapping.java.JavaTypeMapping;
23 | import org.datanucleus.store.rdbms.sql.SQLStatement;
24 |
25 | /**
26 | * Expression for an aggregate function.
27 | * Allows us to distinguish aggregate expressions from other temporal expressions.
28 | */
29 | public class AggregateTemporalExpression extends TemporalExpression implements AggregateExpression
30 | {
31 | public AggregateTemporalExpression(SQLStatement stmt, JavaTypeMapping mapping, String functionName, List args)
32 | {
33 | super(stmt, mapping, functionName, args);
34 | }
35 | }
--------------------------------------------------------------------------------
/src/main/java/org/datanucleus/store/rdbms/sql/expression/BooleanSubqueryExpression.java:
--------------------------------------------------------------------------------
1 | /**********************************************************************
2 | Copyright (c) 2009 Andy Jefferson and others. All rights reserved.
3 | Licensed under the Apache License, Version 2.0 (the "License");
4 | you may not use this file except in compliance with the License.
5 | You may obtain a copy of the License at
6 |
7 | http://www.apache.org/licenses/LICENSE-2.0
8 |
9 | Unless required by applicable law or agreed to in writing, software
10 | distributed under the License is distributed on an "AS IS" BASIS,
11 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12 | See the License for the specific language governing permissions and
13 | limitations under the License.
14 |
15 | Contributors:
16 | ...
17 | **********************************************************************/
18 | package org.datanucleus.store.rdbms.sql.expression;
19 |
20 | import org.datanucleus.store.rdbms.sql.SQLStatement;
21 |
22 | /**
23 | * Boolean expression to wrap a subquery.
24 | * The subquery will be a "SELECT 1 FROM ..." resulting in SQL like
25 | * {keyword} (SELECT 1 FROM ...)
26 | * where the keyword is supplied (e.g EXISTS).
27 | * e.g EXISTS (SELECT 1 FROM TBL WHERE TBL.ID = A0.ID)
28 | */
29 | public class BooleanSubqueryExpression extends BooleanExpression
30 | {
31 | public BooleanSubqueryExpression(SQLStatement stmt, String keyword, SQLStatement subStmt)
32 | {
33 | super(stmt, null);
34 |
35 | // SQL for this expression should be the subquery, within brackets (for clarity)
36 | st.append(keyword).append(" (");
37 | st.append(subStmt);
38 | st.append(")");
39 | }
40 | }
--------------------------------------------------------------------------------
/src/main/java/org/datanucleus/store/rdbms/sql/expression/OptionalExpression.java:
--------------------------------------------------------------------------------
1 | /**********************************************************************
2 | Copyright (c) 2016 Andy Jefferson and others. All rights reserved.
3 | Licensed under the Apache License, Version 2.0 (the "License");
4 | you may not use this file except in compliance with the License.
5 | You may obtain a copy of the License at
6 |
7 | http://www.apache.org/licenses/LICENSE-2.0
8 |
9 | Unless required by applicable law or agreed to in writing, software
10 | distributed under the License is distributed on an "AS IS" BASIS,
11 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12 | See the License for the specific language governing permissions and
13 | limitations under the License.
14 |
15 | Contributors:
16 | ...
17 | **********************************************************************/
18 | package org.datanucleus.store.rdbms.sql.expression;
19 |
20 | import java.util.List;
21 |
22 | import org.datanucleus.store.rdbms.mapping.java.JavaTypeMapping;
23 | import org.datanucleus.store.rdbms.sql.SQLStatement;
24 | import org.datanucleus.store.rdbms.sql.SQLTable;
25 |
26 | /**
27 | * Expression for java.util.Optional.
28 | */
29 | public class OptionalExpression extends SingleCollectionExpression
30 | {
31 | public OptionalExpression(SQLStatement stmt, SQLTable table, JavaTypeMapping mapping)
32 | {
33 | super(stmt, table, mapping);
34 | }
35 |
36 | @Override
37 | public SQLExpression invoke(String methodName, List args)
38 | {
39 | return stmt.getRDBMSManager().getSQLExpressionFactory().invokeMethod(stmt, java.util.Optional.class.getName(), methodName, this, args);
40 | }
41 | }
42 |
--------------------------------------------------------------------------------
/src/main/java/org/datanucleus/store/rdbms/sql/expression/ResultAliasExpression.java:
--------------------------------------------------------------------------------
1 | /**********************************************************************
2 | Copyright (c) 2015 Andy Jefferson and others. All rights reserved.
3 | Licensed under the Apache License, Version 2.0 (the "License");
4 | you may not use this file except in compliance with the License.
5 | You may obtain a copy of the License at
6 |
7 | http://www.apache.org/licenses/LICENSE-2.0
8 |
9 | Unless required by applicable law or agreed to in writing, software
10 | distributed under the License is distributed on an "AS IS" BASIS,
11 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12 | See the License for the specific language governing permissions and
13 | limitations under the License.
14 |
15 | Contributors:
16 | ...
17 | **********************************************************************/
18 | package org.datanucleus.store.rdbms.sql.expression;
19 |
20 | import org.datanucleus.store.rdbms.sql.SQLStatement;
21 |
22 | /**
23 | * Expression for use in an ordering clause representing a result alias.
24 | * JPQL allows specification of a result clause with alias, and to be able to order by exactly that alias.
25 | */
26 | public class ResultAliasExpression extends SQLExpression
27 | {
28 | protected String aliasName;
29 |
30 | public ResultAliasExpression(SQLStatement stmt, String aliasName)
31 | {
32 | super(stmt, null, null);
33 | this.aliasName = aliasName;
34 | }
35 |
36 | public String getResultAlias()
37 | {
38 | return aliasName;
39 | }
40 | }
41 |
--------------------------------------------------------------------------------
/src/main/java/org/datanucleus/store/rdbms/sql/expression/SQLLiteral.java:
--------------------------------------------------------------------------------
1 | /**********************************************************************
2 | Copyright (c) 2008 Andy Jefferson and others. All rights reserved.
3 | Licensed under the Apache License, Version 2.0 (the "License");
4 | you may not use this file except in compliance with the License.
5 | You may obtain a copy of the License at
6 |
7 | http://www.apache.org/licenses/LICENSE-2.0
8 |
9 | Unless required by applicable law or agreed to in writing, software
10 | distributed under the License is distributed on an "AS IS" BASIS,
11 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12 | See the License for the specific language governing permissions and
13 | limitations under the License.
14 |
15 | Contributors:
16 | ...
17 | **********************************************************************/
18 | package org.datanucleus.store.rdbms.sql.expression;
19 |
20 | /**
21 | * Representation of an SQL Literal in a query.
22 | */
23 | public interface SQLLiteral
24 | {
25 | /**
26 | * Accessor to the literal value
27 | * @return the value of the literal
28 | */
29 | public Object getValue();
30 |
31 | /**
32 | * Method to set this literal as not being a parameter.
33 | * If the literal if not currently a parameter then does nothing.
34 | * Updates any underlying SQL to have the value.
35 | */
36 | public void setNotParameter();
37 | }
--------------------------------------------------------------------------------
/src/main/java/org/datanucleus/store/rdbms/sql/expression/SubqueryExpression.java:
--------------------------------------------------------------------------------
1 | /**********************************************************************
2 | Copyright (c) 2009 Andy Jefferson and others. All rights reserved.
3 | Licensed under the Apache License, Version 2.0 (the "License");
4 | you may not use this file except in compliance with the License.
5 | You may obtain a copy of the License at
6 |
7 | http://www.apache.org/licenses/LICENSE-2.0
8 |
9 | Unless required by applicable law or agreed to in writing, software
10 | distributed under the License is distributed on an "AS IS" BASIS,
11 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12 | See the License for the specific language governing permissions and
13 | limitations under the License.
14 |
15 | Contributors:
16 | ...
17 | **********************************************************************/
18 | package org.datanucleus.store.rdbms.sql.expression;
19 |
20 | import org.datanucleus.store.rdbms.sql.SQLStatement;
21 |
22 | /**
23 | * Expression containing a subquery.
24 | */
25 | public class SubqueryExpression extends SQLExpression
26 | {
27 | SQLStatement subStatement;
28 |
29 | public SubqueryExpression(SQLStatement stmt, SQLStatement subStmt)
30 | {
31 | super(stmt, null, null);
32 | subStatement = subStmt;
33 |
34 | // SQL for this expression should be the subquery, within brackets (for clarity)
35 | st.append("(");
36 | st.append(subStmt);
37 | st.append(")");
38 | }
39 |
40 | public SQLStatement getSubqueryStatement()
41 | {
42 | return subStatement;
43 | }
44 | }
--------------------------------------------------------------------------------
/src/main/java/org/datanucleus/store/rdbms/sql/expression/SubqueryExpressionComponent.java:
--------------------------------------------------------------------------------
1 | /**********************************************************************
2 | Copyright (c) 2009 Andy Jefferson and others. All rights reserved.
3 | Licensed under the Apache License, Version 2.0 (the "License");
4 | you may not use this file except in compliance with the License.
5 | You may obtain a copy of the License at
6 |
7 | http://www.apache.org/licenses/LICENSE-2.0
8 |
9 | Unless required by applicable law or agreed to in writing, software
10 | distributed under the License is distributed on an "AS IS" BASIS,
11 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12 | See the License for the specific language governing permissions and
13 | limitations under the License.
14 |
15 | Contributors:
16 | ...
17 | **********************************************************************/
18 | package org.datanucleus.store.rdbms.sql.expression;
19 |
20 | import org.datanucleus.store.rdbms.sql.SQLStatement;
21 |
22 | /**
23 | * Interface representing an expression that contains a subquery.
24 | * Provides a way of getting the subquery statement.
25 | */
26 | public interface SubqueryExpressionComponent
27 | {
28 | /**
29 | * Accessor for the subquery.
30 | * @return The subquery statement
31 | */
32 | public SQLStatement getSubqueryStatement();
33 | }
--------------------------------------------------------------------------------
/src/main/java/org/datanucleus/store/rdbms/sql/expression/TypeConverterMultiExpression.java:
--------------------------------------------------------------------------------
1 | /**********************************************************************
2 | Copyright (c) 2014 Andy Jefferson and others. All rights reserved.
3 | Licensed under the Apache License, Version 2.0 (the "License");
4 | you may not use this file except in compliance with the License.
5 | You may obtain a copy of the License at
6 |
7 | http://www.apache.org/licenses/LICENSE-2.0
8 |
9 | Unless required by applicable law or agreed to in writing, software
10 | distributed under the License is distributed on an "AS IS" BASIS,
11 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12 | See the License for the specific language governing permissions and
13 | limitations under the License.
14 |
15 | Contributors:
16 | ...
17 | **********************************************************************/
18 | package org.datanucleus.store.rdbms.sql.expression;
19 |
20 | import java.util.List;
21 |
22 | import org.datanucleus.store.rdbms.mapping.java.JavaTypeMapping;
23 | import org.datanucleus.store.rdbms.sql.SQLStatement;
24 | import org.datanucleus.store.rdbms.sql.SQLTable;
25 |
26 | /**
27 | * Expression representing a TypeConverterMultiMapping where we have a java type mapped to multiple columns.
28 | */
29 | public class TypeConverterMultiExpression extends ObjectExpression
30 | {
31 | public TypeConverterMultiExpression(SQLStatement stmt, SQLTable table, JavaTypeMapping mapping)
32 | {
33 | super(stmt, table, mapping);
34 | }
35 |
36 | @Override
37 | public SQLExpression invoke(String methodName, List args)
38 | {
39 | return stmt.getRDBMSManager().getSQLExpressionFactory().invokeMethod(stmt, mapping.getJavaType().getName(), methodName, this, args);
40 | }
41 | }
--------------------------------------------------------------------------------
/src/main/java/org/datanucleus/store/rdbms/sql/expression/package.html:
--------------------------------------------------------------------------------
1 |
2 | Series of expressions representing conditions in SQL statements.
3 | Each expression represents an object, of a type, and hence has a JavaTypeMapping responsible
4 | for any get/set of that object in the SQL statement. Calling of the toSQL() method on an expression
5 | generates the SQL that it represents.
6 |
--------------------------------------------------------------------------------
/src/main/java/org/datanucleus/store/rdbms/sql/method/AbsFunction.java:
--------------------------------------------------------------------------------
1 | /**********************************************************************
2 | Copyright (c) 2008 Andy Jefferson and others. All rights reserved.
3 | Licensed under the Apache License, Version 2.0 (the "License");
4 | you may not use this file except in compliance with the License.
5 | You may obtain a copy of the License at
6 |
7 | http://www.apache.org/licenses/LICENSE-2.0
8 |
9 | Unless required by applicable law or agreed to in writing, software
10 | distributed under the License is distributed on an "AS IS" BASIS,
11 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12 | See the License for the specific language governing permissions and
13 | limitations under the License.
14 |
15 | Contributors:
16 | ...
17 | **********************************************************************/
18 | package org.datanucleus.store.rdbms.sql.method;
19 |
20 | /**
21 | * Expression handler to invoke the SQL ABS function.
22 | * For use in evaluating ABS({expr}) where the RDBMS supports this function.
23 | * Returns a NumericExpression "ABS({numericExpr})".
24 | */
25 | public class AbsFunction extends SimpleNumericMethod
26 | {
27 | protected String getFunctionName()
28 | {
29 | return "ABS";
30 | }
31 |
32 | /* (non-Javadoc)
33 | * @see org.datanucleus.store.rdbms.sql.method.SimpleNumericMethod#getClassForMapping()
34 | */
35 | @Override
36 | protected Class getClassForMapping()
37 | {
38 | return double.class;
39 | }
40 | }
--------------------------------------------------------------------------------
/src/main/java/org/datanucleus/store/rdbms/sql/method/AcosFunction.java:
--------------------------------------------------------------------------------
1 | /**********************************************************************
2 | Copyright (c) 2008 Andy Jefferson and others. All rights reserved.
3 | Licensed under the Apache License, Version 2.0 (the "License");
4 | you may not use this file except in compliance with the License.
5 | You may obtain a copy of the License at
6 |
7 | http://www.apache.org/licenses/LICENSE-2.0
8 |
9 | Unless required by applicable law or agreed to in writing, software
10 | distributed under the License is distributed on an "AS IS" BASIS,
11 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12 | See the License for the specific language governing permissions and
13 | limitations under the License.
14 |
15 | Contributors:
16 | ...
17 | **********************************************************************/
18 | package org.datanucleus.store.rdbms.sql.method;
19 |
20 | /**
21 | * Expression handler to invoke the SQL ACOS function.
22 | * For use in evaluating ACOS({expr}) where the RDBMS supports this function.
23 | * Returns a NumericExpression "ACOS({numericExpr})".
24 | */
25 | public class AcosFunction extends SimpleNumericMethod
26 | {
27 | protected String getFunctionName()
28 | {
29 | return "ACOS";
30 | }
31 |
32 | /* (non-Javadoc)
33 | * @see org.datanucleus.store.rdbms.sql.method.SimpleNumericMethod#getClassForMapping()
34 | */
35 | @Override
36 | protected Class getClassForMapping()
37 | {
38 | return double.class;
39 | }
40 | }
--------------------------------------------------------------------------------
/src/main/java/org/datanucleus/store/rdbms/sql/method/AsinFunction.java:
--------------------------------------------------------------------------------
1 | /**********************************************************************
2 | Copyright (c) 2008 Andy Jefferson and others. All rights reserved.
3 | Licensed under the Apache License, Version 2.0 (the "License");
4 | you may not use this file except in compliance with the License.
5 | You may obtain a copy of the License at
6 |
7 | http://www.apache.org/licenses/LICENSE-2.0
8 |
9 | Unless required by applicable law or agreed to in writing, software
10 | distributed under the License is distributed on an "AS IS" BASIS,
11 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12 | See the License for the specific language governing permissions and
13 | limitations under the License.
14 |
15 | Contributors:
16 | ...
17 | **********************************************************************/
18 | package org.datanucleus.store.rdbms.sql.method;
19 |
20 | /**
21 | * Expression handler to invoke the SQL ASIN function.
22 | * For use in evaluating ASIN({expr}) where the RDBMS supports this function.
23 | * Returns a NumericExpression "ASIN({numericExpr})".
24 | */
25 | public class AsinFunction extends SimpleNumericMethod
26 | {
27 | protected String getFunctionName()
28 | {
29 | return "ASIN";
30 | }
31 |
32 | /* (non-Javadoc)
33 | * @see org.datanucleus.store.rdbms.sql.method.SimpleNumericMethod#getClassForMapping()
34 | */
35 | @Override
36 | protected Class getClassForMapping()
37 | {
38 | return double.class;
39 | }
40 | }
--------------------------------------------------------------------------------
/src/main/java/org/datanucleus/store/rdbms/sql/method/AtanFunction.java:
--------------------------------------------------------------------------------
1 | /**********************************************************************
2 | Copyright (c) 2008 Andy Jefferson and others. All rights reserved.
3 | Licensed under the Apache License, Version 2.0 (the "License");
4 | you may not use this file except in compliance with the License.
5 | You may obtain a copy of the License at
6 |
7 | http://www.apache.org/licenses/LICENSE-2.0
8 |
9 | Unless required by applicable law or agreed to in writing, software
10 | distributed under the License is distributed on an "AS IS" BASIS,
11 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12 | See the License for the specific language governing permissions and
13 | limitations under the License.
14 |
15 | Contributors:
16 | ...
17 | **********************************************************************/
18 | package org.datanucleus.store.rdbms.sql.method;
19 |
20 | /**
21 | * Expression handler to invoke the SQL ATAN function.
22 | * For use in evaluating ATAN({expr}) where the RDBMS supports this function.
23 | * Returns a NumericExpression "ATAN({numericExpr})".
24 | */
25 | public class AtanFunction extends SimpleNumericMethod
26 | {
27 | protected String getFunctionName()
28 | {
29 | return "ATAN";
30 | }
31 |
32 | /* (non-Javadoc)
33 | * @see org.datanucleus.store.rdbms.sql.method.SimpleNumericMethod#getClassForMapping()
34 | */
35 | @Override
36 | protected Class getClassForMapping()
37 | {
38 | return double.class;
39 | }
40 | }
--------------------------------------------------------------------------------
/src/main/java/org/datanucleus/store/rdbms/sql/method/CeilFunction.java:
--------------------------------------------------------------------------------
1 | /**********************************************************************
2 | Copyright (c) 2008 Andy Jefferson and others. All rights reserved.
3 | Licensed under the Apache License, Version 2.0 (the "License");
4 | you may not use this file except in compliance with the License.
5 | You may obtain a copy of the License at
6 |
7 | http://www.apache.org/licenses/LICENSE-2.0
8 |
9 | Unless required by applicable law or agreed to in writing, software
10 | distributed under the License is distributed on an "AS IS" BASIS,
11 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12 | See the License for the specific language governing permissions and
13 | limitations under the License.
14 |
15 | Contributors:
16 | ...
17 | **********************************************************************/
18 | package org.datanucleus.store.rdbms.sql.method;
19 |
20 | /**
21 | * Expression handler to invoke the SQL CEIL function.
22 | * For use in evaluating CEIL({expr}) where the RDBMS supports this function.
23 | * Returns a NumericExpression "CEIL({numericExpr})".
24 | */
25 | public class CeilFunction extends SimpleNumericMethod
26 | {
27 | protected String getFunctionName()
28 | {
29 | return "CEIL";
30 | }
31 |
32 | /* (non-Javadoc)
33 | * @see org.datanucleus.store.rdbms.sql.method.SimpleNumericMethod#getClassForMapping()
34 | */
35 | @Override
36 | protected Class getClassForMapping()
37 | {
38 | return int.class;
39 | }
40 | }
--------------------------------------------------------------------------------
/src/main/java/org/datanucleus/store/rdbms/sql/method/CosFunction.java:
--------------------------------------------------------------------------------
1 | /**********************************************************************
2 | Copyright (c) 2008 Andy Jefferson and others. All rights reserved.
3 | Licensed under the Apache License, Version 2.0 (the "License");
4 | you may not use this file except in compliance with the License.
5 | You may obtain a copy of the License at
6 |
7 | http://www.apache.org/licenses/LICENSE-2.0
8 |
9 | Unless required by applicable law or agreed to in writing, software
10 | distributed under the License is distributed on an "AS IS" BASIS,
11 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12 | See the License for the specific language governing permissions and
13 | limitations under the License.
14 |
15 | Contributors:
16 | ...
17 | **********************************************************************/
18 | package org.datanucleus.store.rdbms.sql.method;
19 |
20 | /**
21 | * Expression handler to invoke the SQL COS function.
22 | * For use in evaluating COS({expr}) where the RDBMS supports this function.
23 | * Returns a NumericExpression "COS({numericExpr})".
24 | */
25 | public class CosFunction extends SimpleNumericMethod
26 | {
27 | protected String getFunctionName()
28 | {
29 | return "COS";
30 | }
31 |
32 | /* (non-Javadoc)
33 | * @see org.datanucleus.store.rdbms.sql.method.SimpleNumericMethod#getClassForMapping()
34 | */
35 | @Override
36 | protected Class getClassForMapping()
37 | {
38 | return double.class;
39 | }
40 | }
--------------------------------------------------------------------------------
/src/main/java/org/datanucleus/store/rdbms/sql/method/CoshFunction.java:
--------------------------------------------------------------------------------
1 | /**********************************************************************
2 | Copyright (c) 2022 Andy Jefferson and others. All rights reserved.
3 | Licensed under the Apache License, Version 2.0 (the "License");
4 | you may not use this file except in compliance with the License.
5 | You may obtain a copy of the License at
6 |
7 | http://www.apache.org/licenses/LICENSE-2.0
8 |
9 | Unless required by applicable law or agreed to in writing, software
10 | distributed under the License is distributed on an "AS IS" BASIS,
11 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12 | See the License for the specific language governing permissions and
13 | limitations under the License.
14 |
15 | Contributors:
16 | ...
17 | **********************************************************************/
18 | package org.datanucleus.store.rdbms.sql.method;
19 |
20 | /**
21 | * Expression handler to invoke the SQL COSH function.
22 | * For use in evaluating COSH({expr}) where the RDBMS supports this function.
23 | * Returns a NumericExpression "COSH({numericExpr})".
24 | */
25 | public class CoshFunction extends SimpleNumericMethod
26 | {
27 | protected String getFunctionName()
28 | {
29 | return "COSH";
30 | }
31 |
32 | @Override
33 | protected Class getClassForMapping()
34 | {
35 | return double.class;
36 | }
37 | }
--------------------------------------------------------------------------------
/src/main/java/org/datanucleus/store/rdbms/sql/method/CotFunction.java:
--------------------------------------------------------------------------------
1 | /**********************************************************************
2 | Copyright (c) 2022 Andy Jefferson and others. All rights reserved.
3 | Licensed under the Apache License, Version 2.0 (the "License");
4 | you may not use this file except in compliance with the License.
5 | You may obtain a copy of the License at
6 |
7 | http://www.apache.org/licenses/LICENSE-2.0
8 |
9 | Unless required by applicable law or agreed to in writing, software
10 | distributed under the License is distributed on an "AS IS" BASIS,
11 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12 | See the License for the specific language governing permissions and
13 | limitations under the License.
14 |
15 | Contributors:
16 | ...
17 | **********************************************************************/
18 | package org.datanucleus.store.rdbms.sql.method;
19 |
20 | /**
21 | * Expression handler to invoke the SQL COT function.
22 | * For use in evaluating COT({expr}) where the RDBMS supports this function.
23 | * Returns a NumericExpression "COT({numericExpr})".
24 | */
25 | public class CotFunction extends SimpleNumericMethod
26 | {
27 | protected String getFunctionName()
28 | {
29 | return "COT";
30 | }
31 |
32 | @Override
33 | protected Class getClassForMapping()
34 | {
35 | return double.class;
36 | }
37 | }
--------------------------------------------------------------------------------
/src/main/java/org/datanucleus/store/rdbms/sql/method/DegreesFunction.java:
--------------------------------------------------------------------------------
1 | /**********************************************************************
2 | Copyright (c) 2008 Andy Jefferson and others. All rights reserved.
3 | Licensed under the Apache License, Version 2.0 (the "License");
4 | you may not use this file except in compliance with the License.
5 | You may obtain a copy of the License at
6 |
7 | http://www.apache.org/licenses/LICENSE-2.0
8 |
9 | Unless required by applicable law or agreed to in writing, software
10 | distributed under the License is distributed on an "AS IS" BASIS,
11 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12 | See the License for the specific language governing permissions and
13 | limitations under the License.
14 |
15 | Contributors:
16 | ...
17 | **********************************************************************/
18 | package org.datanucleus.store.rdbms.sql.method;
19 |
20 | /**
21 | * Expression handler to invoke the SQL DEGREES function.
22 | * For use in evaluating DEGREES({expr}) where the RDBMS supports this function.
23 | * Returns a NumericExpression "DEGREES({numericExpr})".
24 | */
25 | public class DegreesFunction extends SimpleNumericMethod
26 | {
27 | protected String getFunctionName()
28 | {
29 | return "DEGREES";
30 | }
31 |
32 | /* (non-Javadoc)
33 | * @see org.datanucleus.store.rdbms.sql.method.SimpleNumericMethod#getClassForMapping()
34 | */
35 | @Override
36 | protected Class getClassForMapping()
37 | {
38 | return double.class;
39 | }
40 | }
--------------------------------------------------------------------------------
/src/main/java/org/datanucleus/store/rdbms/sql/method/ExpFunction.java:
--------------------------------------------------------------------------------
1 | /**********************************************************************
2 | Copyright (c) 2008 Andy Jefferson and others. All rights reserved.
3 | Licensed under the Apache License, Version 2.0 (the "License");
4 | you may not use this file except in compliance with the License.
5 | You may obtain a copy of the License at
6 |
7 | http://www.apache.org/licenses/LICENSE-2.0
8 |
9 | Unless required by applicable law or agreed to in writing, software
10 | distributed under the License is distributed on an "AS IS" BASIS,
11 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12 | See the License for the specific language governing permissions and
13 | limitations under the License.
14 |
15 | Contributors:
16 | ...
17 | **********************************************************************/
18 | package org.datanucleus.store.rdbms.sql.method;
19 |
20 | /**
21 | * Expression handler to invoke the SQL EXP function.
22 | * For use in evaluating EXP({expr}) where the RDBMS supports this function.
23 | * Returns a NumericExpression "EXP({numericExpr})".
24 | */
25 | public class ExpFunction extends SimpleNumericMethod
26 | {
27 | protected String getFunctionName()
28 | {
29 | return "EXP";
30 | }
31 |
32 | /* (non-Javadoc)
33 | * @see org.datanucleus.store.rdbms.sql.method.SimpleNumericMethod#getClassForMapping()
34 | */
35 | @Override
36 | protected Class getClassForMapping()
37 | {
38 | return double.class;
39 | }
40 | }
--------------------------------------------------------------------------------
/src/main/java/org/datanucleus/store/rdbms/sql/method/FloorFunction.java:
--------------------------------------------------------------------------------
1 | /**********************************************************************
2 | Copyright (c) 2008 Andy Jefferson and others. All rights reserved.
3 | Licensed under the Apache License, Version 2.0 (the "License");
4 | you may not use this file except in compliance with the License.
5 | You may obtain a copy of the License at
6 |
7 | http://www.apache.org/licenses/LICENSE-2.0
8 |
9 | Unless required by applicable law or agreed to in writing, software
10 | distributed under the License is distributed on an "AS IS" BASIS,
11 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12 | See the License for the specific language governing permissions and
13 | limitations under the License.
14 |
15 | Contributors:
16 | ...
17 | **********************************************************************/
18 | package org.datanucleus.store.rdbms.sql.method;
19 |
20 | /**
21 | * Expression handler to invoke the SQL FLOOR function.
22 | * For use in evaluating FLOOR({expr}) where the RDBMS supports this function.
23 | * Returns a NumericExpression "FLOOR({numericExpr})".
24 | */
25 | public class FloorFunction extends SimpleNumericMethod
26 | {
27 | protected String getFunctionName()
28 | {
29 | return "FLOOR";
30 | }
31 |
32 | /* (non-Javadoc)
33 | * @see org.datanucleus.store.rdbms.sql.method.SimpleNumericMethod#getClassForMapping()
34 | */
35 | @Override
36 | protected Class getClassForMapping()
37 | {
38 | return int.class;
39 | }
40 | }
--------------------------------------------------------------------------------
/src/main/java/org/datanucleus/store/rdbms/sql/method/LogFunction.java:
--------------------------------------------------------------------------------
1 | /**********************************************************************
2 | Copyright (c) 2008 Andy Jefferson and others. All rights reserved.
3 | Licensed under the Apache License, Version 2.0 (the "License");
4 | you may not use this file except in compliance with the License.
5 | You may obtain a copy of the License at
6 |
7 | http://www.apache.org/licenses/LICENSE-2.0
8 |
9 | Unless required by applicable law or agreed to in writing, software
10 | distributed under the License is distributed on an "AS IS" BASIS,
11 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12 | See the License for the specific language governing permissions and
13 | limitations under the License.
14 |
15 | Contributors:
16 | ...
17 | **********************************************************************/
18 | package org.datanucleus.store.rdbms.sql.method;
19 |
20 | /**
21 | * Expression handler to invoke the SQL LOG function.
22 | * For use in evaluating LOG({expr}) where the RDBMS supports this function.
23 | * Returns a NumericExpression "LOG({numericExpr})".
24 | */
25 | public class LogFunction extends SimpleNumericMethod
26 | {
27 | protected String getFunctionName()
28 | {
29 | return "LOG";
30 | }
31 |
32 | /* (non-Javadoc)
33 | * @see org.datanucleus.store.rdbms.sql.method.SimpleNumericMethod#getClassForMapping()
34 | */
35 | @Override
36 | protected Class getClassForMapping()
37 | {
38 | return double.class;
39 | }
40 | }
--------------------------------------------------------------------------------
/src/main/java/org/datanucleus/store/rdbms/sql/method/LogFunction2.java:
--------------------------------------------------------------------------------
1 | /**********************************************************************
2 | Copyright (c) 2008 Andy Jefferson and others. All rights reserved.
3 | Licensed under the Apache License, Version 2.0 (the "License");
4 | you may not use this file except in compliance with the License.
5 | You may obtain a copy of the License at
6 |
7 | http://www.apache.org/licenses/LICENSE-2.0
8 |
9 | Unless required by applicable law or agreed to in writing, software
10 | distributed under the License is distributed on an "AS IS" BASIS,
11 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12 | See the License for the specific language governing permissions and
13 | limitations under the License.
14 |
15 | Contributors:
16 | ...
17 | **********************************************************************/
18 | package org.datanucleus.store.rdbms.sql.method;
19 |
20 | /**
21 | * Expression handler to invoke the SQL (natural) LOG function.
22 | * For use in evaluating LN({expr}) where the RDBMS supports this function.
23 | * Returns a NumericExpression "LN({numericExpr})".
24 | */
25 | public class LogFunction2 extends SimpleNumericMethod
26 | {
27 | protected String getFunctionName()
28 | {
29 | return "LN";
30 | }
31 |
32 | /* (non-Javadoc)
33 | * @see org.datanucleus.store.rdbms.sql.method.SimpleNumericMethod#getClassForMapping()
34 | */
35 | @Override
36 | protected Class getClassForMapping()
37 | {
38 | return double.class;
39 | }
40 | }
--------------------------------------------------------------------------------
/src/main/java/org/datanucleus/store/rdbms/sql/method/MaxFunction.java:
--------------------------------------------------------------------------------
1 | /**********************************************************************
2 | Copyright (c) 2009 Andy Jefferson and others. All rights reserved.
3 | Licensed under the Apache License, Version 2.0 (the "License");
4 | you may not use this file except in compliance with the License.
5 | You may obtain a copy of the License at
6 |
7 | http://www.apache.org/licenses/LICENSE-2.0
8 |
9 | Unless required by applicable law or agreed to in writing, software
10 | distributed under the License is distributed on an "AS IS" BASIS,
11 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12 | See the License for the specific language governing permissions and
13 | limitations under the License.
14 |
15 | Contributors:
16 | ...
17 | **********************************************************************/
18 | package org.datanucleus.store.rdbms.sql.method;
19 |
20 | /**
21 | * Expression handler to invoke the SQL MAX aggregation function.
22 | * For use in evaluating MAX({expr}) where the RDBMS supports this function.
23 | * Returns an Expression "MAX({orderableExpr})", where the orderable expression is either numeric or temporal
24 | */
25 | public class MaxFunction extends SimpleOrderableAggregateMethod
26 | {
27 | protected String getFunctionName()
28 | {
29 | return "MAX";
30 | }
31 | }
--------------------------------------------------------------------------------
/src/main/java/org/datanucleus/store/rdbms/sql/method/MinFunction.java:
--------------------------------------------------------------------------------
1 | /**********************************************************************
2 | Copyright (c) 2009 Andy Jefferson and others. All rights reserved.
3 | Licensed under the Apache License, Version 2.0 (the "License");
4 | you may not use this file except in compliance with the License.
5 | You may obtain a copy of the License at
6 |
7 | http://www.apache.org/licenses/LICENSE-2.0
8 |
9 | Unless required by applicable law or agreed to in writing, software
10 | distributed under the License is distributed on an "AS IS" BASIS,
11 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12 | See the License for the specific language governing permissions and
13 | limitations under the License.
14 |
15 | Contributors:
16 | ...
17 | **********************************************************************/
18 | package org.datanucleus.store.rdbms.sql.method;
19 |
20 | /**
21 | * Expression handler to invoke the SQL MIN aggregation function.
22 | * For use in evaluating MIN({expr}) where the RDBMS supports this function.
23 | * Returns an Expression "MIN({orderableExpr})", where the orderable expression is either numeric or temporal
24 | */
25 | public class MinFunction extends SimpleOrderableAggregateMethod
26 | {
27 | protected String getFunctionName()
28 | {
29 | return "MIN";
30 | }
31 | }
--------------------------------------------------------------------------------
/src/main/java/org/datanucleus/store/rdbms/sql/method/ObjectGetClassMethod.java:
--------------------------------------------------------------------------------
1 | /**********************************************************************
2 | Copyright (c) 2008 Andy Jefferson and others. All rights reserved.
3 | Licensed under the Apache License, Version 2.0 (the "License");
4 | you may not use this file except in compliance with the License.
5 | You may obtain a copy of the License at
6 |
7 | http://www.apache.org/licenses/LICENSE-2.0
8 |
9 | Unless required by applicable law or agreed to in writing, software
10 | distributed under the License is distributed on an "AS IS" BASIS,
11 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12 | See the License for the specific language governing permissions and
13 | limitations under the License.
14 |
15 | Contributors:
16 | ...
17 | **********************************************************************/
18 | package org.datanucleus.store.rdbms.sql.method;
19 |
20 | import java.util.List;
21 |
22 | import org.datanucleus.exceptions.NucleusException;
23 | import org.datanucleus.store.rdbms.sql.SQLStatement;
24 | import org.datanucleus.store.rdbms.sql.expression.SQLExpression;
25 |
26 | /**
27 | * Expression handler to evaluate {objectExpression}.getClass().
28 | */
29 | public class ObjectGetClassMethod implements SQLMethod
30 | {
31 | /* (non-Javadoc)
32 | * @see org.datanucleus.store.rdbms.sql.method.SQLMethod#getExpression(org.datanucleus.store.rdbms.sql.expression.SQLExpression, java.util.List)
33 | */
34 | public SQLExpression getExpression(SQLStatement stmt, SQLExpression expr, List args)
35 | {
36 | // TODO Support this type
37 | throw new NucleusException("getClass is not yet supported for " + expr);
38 | }
39 | }
--------------------------------------------------------------------------------
/src/main/java/org/datanucleus/store/rdbms/sql/method/PowerFunction.java:
--------------------------------------------------------------------------------
1 | /**********************************************************************
2 | Copyright (c) 2008 Andy Jefferson and others. All rights reserved.
3 | Licensed under the Apache License, Version 2.0 (the "License");
4 | you may not use this file except in compliance with the License.
5 | You may obtain a copy of the License at
6 |
7 | http://www.apache.org/licenses/LICENSE-2.0
8 |
9 | Unless required by applicable law or agreed to in writing, software
10 | distributed under the License is distributed on an "AS IS" BASIS,
11 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12 | See the License for the specific language governing permissions and
13 | limitations under the License.
14 |
15 | Contributors:
16 | ...
17 | **********************************************************************/
18 | package org.datanucleus.store.rdbms.sql.method;
19 |
20 | /**
21 | * Expression handler to invoke the SQL POWER function.
22 | * For use in evaluating POWER({expr}) where the RDBMS supports this function.
23 | * Returns a NumericExpression "POWER({numericExpr})".
24 | */
25 | public class PowerFunction extends SimpleNumericMethod
26 | {
27 | protected String getFunctionName()
28 | {
29 | return "POWER";
30 | }
31 |
32 | /* (non-Javadoc)
33 | * @see org.datanucleus.store.rdbms.sql.method.SimpleNumericMethod#getClassForMapping()
34 | */
35 | @Override
36 | protected Class getClassForMapping()
37 | {
38 | return double.class;
39 | }
40 | }
--------------------------------------------------------------------------------
/src/main/java/org/datanucleus/store/rdbms/sql/method/RadiansFunction.java:
--------------------------------------------------------------------------------
1 | /**********************************************************************
2 | Copyright (c) 2008 Andy Jefferson and others. All rights reserved.
3 | Licensed under the Apache License, Version 2.0 (the "License");
4 | you may not use this file except in compliance with the License.
5 | You may obtain a copy of the License at
6 |
7 | http://www.apache.org/licenses/LICENSE-2.0
8 |
9 | Unless required by applicable law or agreed to in writing, software
10 | distributed under the License is distributed on an "AS IS" BASIS,
11 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12 | See the License for the specific language governing permissions and
13 | limitations under the License.
14 |
15 | Contributors:
16 | ...
17 | **********************************************************************/
18 | package org.datanucleus.store.rdbms.sql.method;
19 |
20 | /**
21 | * Expression handler to invoke the SQL RADIANS function.
22 | * For use in evaluating RADIANS({expr}) where the RDBMS supports this function.
23 | * Returns a NumericExpression "RADIANS({numericExpr})".
24 | */
25 | public class RadiansFunction extends SimpleNumericMethod
26 | {
27 | protected String getFunctionName()
28 | {
29 | return "RADIANS";
30 | }
31 |
32 | /* (non-Javadoc)
33 | * @see org.datanucleus.store.rdbms.sql.method.SimpleNumericMethod#getClassForMapping()
34 | */
35 | @Override
36 | protected Class getClassForMapping()
37 | {
38 | return double.class;
39 | }
40 | }
--------------------------------------------------------------------------------
/src/main/java/org/datanucleus/store/rdbms/sql/method/SQLCubeFunction.java:
--------------------------------------------------------------------------------
1 | /**********************************************************************
2 | Copyright (c) 2008 Andy Jefferson and others. All rights reserved.
3 | Licensed under the Apache License, Version 2.0 (the "License");
4 | you may not use this file except in compliance with the License.
5 | You may obtain a copy of the License at
6 |
7 | http://www.apache.org/licenses/LICENSE-2.0
8 |
9 | Unless required by applicable law or agreed to in writing, software
10 | distributed under the License is distributed on an "AS IS" BASIS,
11 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12 | See the License for the specific language governing permissions and
13 | limitations under the License.
14 |
15 | Contributors:
16 | ...
17 | **********************************************************************/
18 | package org.datanucleus.store.rdbms.sql.method;
19 |
20 | /**
21 | * Expression handler to evaluate SQL.cube(args).
22 | * Returns a NumericExpression. Ignores the "expr" since is a function
23 | */
24 | public class SQLCubeFunction extends SimpleNumericMethod
25 | {
26 | protected String getFunctionName()
27 | {
28 | return "CUBE";
29 | }
30 |
31 | /* (non-Javadoc)
32 | * @see org.datanucleus.store.rdbms.sql.method.SimpleNumericMethod#getClassForMapping()
33 | */
34 | @Override
35 | protected Class getClassForMapping()
36 | {
37 | return double.class;
38 | }
39 | }
--------------------------------------------------------------------------------
/src/main/java/org/datanucleus/store/rdbms/sql/method/SQLMethod.java:
--------------------------------------------------------------------------------
1 | /**********************************************************************
2 | Copyright (c) 2008 Andy Jefferson and others. All rights reserved.
3 | Licensed under the Apache License, Version 2.0 (the "License");
4 | you may not use this file except in compliance with the License.
5 | You may obtain a copy of the License at
6 |
7 | http://www.apache.org/licenses/LICENSE-2.0
8 |
9 | Unless required by applicable law or agreed to in writing, software
10 | distributed under the License is distributed on an "AS IS" BASIS,
11 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12 | See the License for the specific language governing permissions and
13 | limitations under the License.
14 |
15 | Contributors:
16 | ...
17 | **********************************************************************/
18 | package org.datanucleus.store.rdbms.sql.method;
19 |
20 | import java.util.List;
21 |
22 | import org.datanucleus.store.rdbms.sql.SQLStatement;
23 | import org.datanucleus.store.rdbms.sql.expression.SQLExpression;
24 |
25 | /**
26 | * Interface to implement to wrap an SQL function.
27 | */
28 | public interface SQLMethod
29 | {
30 | /**
31 | * Return the expression for this SQL function.
32 | * @param stmt SQLStatement that this expression is for
33 | * @param expr The expression that it is invoked on
34 | * @param args Arguments passed in
35 | * @return The SQL expression using the SQL function
36 | */
37 | public SQLExpression getExpression(SQLStatement stmt, SQLExpression expr, List args);
38 | }
--------------------------------------------------------------------------------
/src/main/java/org/datanucleus/store/rdbms/sql/method/SQLRollupFunction.java:
--------------------------------------------------------------------------------
1 | /**********************************************************************
2 | Copyright (c) 2008 Andy Jefferson and others. All rights reserved.
3 | Licensed under the Apache License, Version 2.0 (the "License");
4 | you may not use this file except in compliance with the License.
5 | You may obtain a copy of the License at
6 |
7 | http://www.apache.org/licenses/LICENSE-2.0
8 |
9 | Unless required by applicable law or agreed to in writing, software
10 | distributed under the License is distributed on an "AS IS" BASIS,
11 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12 | See the License for the specific language governing permissions and
13 | limitations under the License.
14 |
15 | Contributors:
16 | ...
17 | **********************************************************************/
18 | package org.datanucleus.store.rdbms.sql.method;
19 |
20 | /**
21 | * Expression handler to evaluate SQL.rollup(args).
22 | * Returns a NumericExpression. Ignores the "expr" since is a function
23 | */
24 | public class SQLRollupFunction extends SimpleNumericMethod
25 | {
26 | protected String getFunctionName()
27 | {
28 | return "ROLLUP";
29 | }
30 |
31 | /* (non-Javadoc)
32 | * @see org.datanucleus.store.rdbms.sql.method.SimpleNumericMethod#getClassForMapping()
33 | */
34 | @Override
35 | protected Class getClassForMapping()
36 | {
37 | return double.class;
38 | }
39 | }
--------------------------------------------------------------------------------
/src/main/java/org/datanucleus/store/rdbms/sql/method/SignFunction.java:
--------------------------------------------------------------------------------
1 | /**********************************************************************
2 | Copyright (c) 2022 Andy Jefferson and others. All rights reserved.
3 | Licensed under the Apache License, Version 2.0 (the "License");
4 | you may not use this file except in compliance with the License.
5 | You may obtain a copy of the License at
6 |
7 | http://www.apache.org/licenses/LICENSE-2.0
8 |
9 | Unless required by applicable law or agreed to in writing, software
10 | distributed under the License is distributed on an "AS IS" BASIS,
11 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12 | See the License for the specific language governing permissions and
13 | limitations under the License.
14 |
15 | Contributors:
16 | ...
17 | **********************************************************************/
18 | package org.datanucleus.store.rdbms.sql.method;
19 |
20 | /**
21 | * Expression handler to invoke the SQL SIGN function.
22 | * For use in evaluating SIGN({expr}) where the RDBMS supports this function.
23 | * Returns a NumericExpression "SIGN({numericExpr})".
24 | */
25 | public class SignFunction extends SimpleNumericMethod
26 | {
27 | protected String getFunctionName()
28 | {
29 | return "SIGN";
30 | }
31 |
32 | @Override
33 | protected Class getClassForMapping()
34 | {
35 | return int.class;
36 | }
37 | }
--------------------------------------------------------------------------------
/src/main/java/org/datanucleus/store/rdbms/sql/method/SinFunction.java:
--------------------------------------------------------------------------------
1 | /**********************************************************************
2 | Copyright (c) 2008 Andy Jefferson and others. All rights reserved.
3 | Licensed under the Apache License, Version 2.0 (the "License");
4 | you may not use this file except in compliance with the License.
5 | You may obtain a copy of the License at
6 |
7 | http://www.apache.org/licenses/LICENSE-2.0
8 |
9 | Unless required by applicable law or agreed to in writing, software
10 | distributed under the License is distributed on an "AS IS" BASIS,
11 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12 | See the License for the specific language governing permissions and
13 | limitations under the License.
14 |
15 | Contributors:
16 | ...
17 | **********************************************************************/
18 | package org.datanucleus.store.rdbms.sql.method;
19 |
20 | /**
21 | * Expression handler to invoke the SQL SIN function.
22 | * For use in evaluating SIN({expr}) where the RDBMS supports this function.
23 | * Returns a NumericExpression "SIN({numericExpr})".
24 | */
25 | public class SinFunction extends SimpleNumericMethod
26 | {
27 | protected String getFunctionName()
28 | {
29 | return "SIN";
30 | }
31 |
32 | /* (non-Javadoc)
33 | * @see org.datanucleus.store.rdbms.sql.method.SimpleNumericMethod#getClassForMapping()
34 | */
35 | @Override
36 | protected Class getClassForMapping()
37 | {
38 | return double.class;
39 | }
40 | }
--------------------------------------------------------------------------------
/src/main/java/org/datanucleus/store/rdbms/sql/method/SinhFunction.java:
--------------------------------------------------------------------------------
1 | /**********************************************************************
2 | Copyright (c) 2022 Andy Jefferson and others. All rights reserved.
3 | Licensed under the Apache License, Version 2.0 (the "License");
4 | you may not use this file except in compliance with the License.
5 | You may obtain a copy of the License at
6 |
7 | http://www.apache.org/licenses/LICENSE-2.0
8 |
9 | Unless required by applicable law or agreed to in writing, software
10 | distributed under the License is distributed on an "AS IS" BASIS,
11 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12 | See the License for the specific language governing permissions and
13 | limitations under the License.
14 |
15 | Contributors:
16 | ...
17 | **********************************************************************/
18 | package org.datanucleus.store.rdbms.sql.method;
19 |
20 | /**
21 | * Expression handler to invoke the SQL SINH function.
22 | * For use in evaluating SINH({expr}) where the RDBMS supports this function.
23 | * Returns a NumericExpression "SINH({numericExpr})".
24 | */
25 | public class SinhFunction extends SimpleNumericMethod
26 | {
27 | protected String getFunctionName()
28 | {
29 | return "SINH";
30 | }
31 |
32 | @Override
33 | protected Class getClassForMapping()
34 | {
35 | return double.class;
36 | }
37 | }
--------------------------------------------------------------------------------
/src/main/java/org/datanucleus/store/rdbms/sql/method/SqrtFunction.java:
--------------------------------------------------------------------------------
1 | /**********************************************************************
2 | Copyright (c) 2008 Andy Jefferson and others. All rights reserved.
3 | Licensed under the Apache License, Version 2.0 (the "License");
4 | you may not use this file except in compliance with the License.
5 | You may obtain a copy of the License at
6 |
7 | http://www.apache.org/licenses/LICENSE-2.0
8 |
9 | Unless required by applicable law or agreed to in writing, software
10 | distributed under the License is distributed on an "AS IS" BASIS,
11 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12 | See the License for the specific language governing permissions and
13 | limitations under the License.
14 |
15 | Contributors:
16 | ...
17 | **********************************************************************/
18 | package org.datanucleus.store.rdbms.sql.method;
19 |
20 | /**
21 | * Expression handler to invoke the SQL SQRT function.
22 | * For use in evaluating SQRT({expr}) where the RDBMS supports this function.
23 | * Returns a NumericExpression "SQRT({numericExpr})".
24 | */
25 | public class SqrtFunction extends SimpleNumericMethod
26 | {
27 | protected String getFunctionName()
28 | {
29 | return "SQRT";
30 | }
31 |
32 | /* (non-Javadoc)
33 | * @see org.datanucleus.store.rdbms.sql.method.SimpleNumericMethod#getClassForMapping()
34 | */
35 | @Override
36 | protected Class getClassForMapping()
37 | {
38 | return double.class;
39 | }
40 | }
--------------------------------------------------------------------------------
/src/main/java/org/datanucleus/store/rdbms/sql/method/StringTrimLeft3Method.java:
--------------------------------------------------------------------------------
1 | /**********************************************************************
2 | Copyright (c) 2010 Andy Jefferson and others. All rights reserved.
3 | Licensed under the Apache License, Version 2.0 (the "License");
4 | you may not use this file except in compliance with the License.
5 | You may obtain a copy of the License at
6 |
7 | http://www.apache.org/licenses/LICENSE-2.0
8 |
9 | Unless required by applicable law or agreed to in writing, software
10 | distributed under the License is distributed on an "AS IS" BASIS,
11 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12 | See the License for the specific language governing permissions and
13 | limitations under the License.
14 |
15 | Contributors:
16 | ...
17 | **********************************************************************/
18 | package org.datanucleus.store.rdbms.sql.method;
19 |
20 | /**
21 | * Method for evaluating {strExpr1}.trimLeft() or "TRIM(LEADING trimChar FROM strExpr1)".
22 | * Returns a StrignExpression that equates to TRIM([[LEADING] [{trim_char}] FROM] strExpr)
23 | */
24 | public class StringTrimLeft3Method extends StringTrim3Method
25 | {
26 | protected String getTrimSpecKeyword()
27 | {
28 | return "LEADING";
29 | }
30 | }
31 |
--------------------------------------------------------------------------------
/src/main/java/org/datanucleus/store/rdbms/sql/method/StringTrimLeftMethod.java:
--------------------------------------------------------------------------------
1 | /**********************************************************************
2 | Copyright (c) 2008 Andy Jefferson and others. All rights reserved.
3 | Licensed under the Apache License, Version 2.0 (the "License");
4 | you may not use this file except in compliance with the License.
5 | You may obtain a copy of the License at
6 |
7 | http://www.apache.org/licenses/LICENSE-2.0
8 |
9 | Unless required by applicable law or agreed to in writing, software
10 | distributed under the License is distributed on an "AS IS" BASIS,
11 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12 | See the License for the specific language governing permissions and
13 | limitations under the License.
14 |
15 | Contributors:
16 | ...
17 | **********************************************************************/
18 | package org.datanucleus.store.rdbms.sql.method;
19 |
20 | /**
21 | * Expression handler to invoke the SQL LTRIM function.
22 | * For use in evaluating StringExpression.trim() (but only from left) where the RDBMS supports this function.
23 | * Returns a StringExpression "LTRIM({stringExpr})".
24 | */
25 | public class StringTrimLeftMethod extends SimpleStringMethod
26 | {
27 | protected String getFunctionName()
28 | {
29 | return "LTRIM";
30 | }
31 | }
--------------------------------------------------------------------------------
/src/main/java/org/datanucleus/store/rdbms/sql/method/StringTrimRight3Method.java:
--------------------------------------------------------------------------------
1 | /**********************************************************************
2 | Copyright (c) 2010 Andy Jefferson and others. All rights reserved.
3 | Licensed under the Apache License, Version 2.0 (the "License");
4 | you may not use this file except in compliance with the License.
5 | You may obtain a copy of the License at
6 |
7 | http://www.apache.org/licenses/LICENSE-2.0
8 |
9 | Unless required by applicable law or agreed to in writing, software
10 | distributed under the License is distributed on an "AS IS" BASIS,
11 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12 | See the License for the specific language governing permissions and
13 | limitations under the License.
14 |
15 | Contributors:
16 | ...
17 | **********************************************************************/
18 | package org.datanucleus.store.rdbms.sql.method;
19 |
20 | /**
21 | * Method for evaluating {strExpr1}.trimLeft() or "TRIM(TRAILING trimChar FROM strExpr1)".
22 | * Returns a StrignExpression that equates to TRIM([[TRAILING] [{trim_char}] FROM] strExpr)
23 | */
24 | public class StringTrimRight3Method extends StringTrim3Method
25 | {
26 | protected String getTrimSpecKeyword()
27 | {
28 | return "TRAILING";
29 | }
30 | }
31 |
--------------------------------------------------------------------------------
/src/main/java/org/datanucleus/store/rdbms/sql/method/StringTrimRightMethod.java:
--------------------------------------------------------------------------------
1 | /**********************************************************************
2 | Copyright (c) 2008 Andy Jefferson and others. All rights reserved.
3 | Licensed under the Apache License, Version 2.0 (the "License");
4 | you may not use this file except in compliance with the License.
5 | You may obtain a copy of the License at
6 |
7 | http://www.apache.org/licenses/LICENSE-2.0
8 |
9 | Unless required by applicable law or agreed to in writing, software
10 | distributed under the License is distributed on an "AS IS" BASIS,
11 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12 | See the License for the specific language governing permissions and
13 | limitations under the License.
14 |
15 | Contributors:
16 | ...
17 | **********************************************************************/
18 | package org.datanucleus.store.rdbms.sql.method;
19 |
20 | /**
21 | * Expression handler to invoke the SQL RTRIM function.
22 | * For use in evaluating StringExpression.trim() (but only from right) where the RDBMS supports this function.
23 | * Returns a StringExpression "RTRIM({stringExpr})".
24 | */
25 | public class StringTrimRightMethod extends SimpleStringMethod
26 | {
27 | protected String getFunctionName()
28 | {
29 | return "RTRIM";
30 | }
31 | }
--------------------------------------------------------------------------------
/src/main/java/org/datanucleus/store/rdbms/sql/method/TanFunction.java:
--------------------------------------------------------------------------------
1 | /**********************************************************************
2 | Copyright (c) 2008 Andy Jefferson and others. All rights reserved.
3 | Licensed under the Apache License, Version 2.0 (the "License");
4 | you may not use this file except in compliance with the License.
5 | You may obtain a copy of the License at
6 |
7 | http://www.apache.org/licenses/LICENSE-2.0
8 |
9 | Unless required by applicable law or agreed to in writing, software
10 | distributed under the License is distributed on an "AS IS" BASIS,
11 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12 | See the License for the specific language governing permissions and
13 | limitations under the License.
14 |
15 | Contributors:
16 | ...
17 | **********************************************************************/
18 | package org.datanucleus.store.rdbms.sql.method;
19 |
20 | /**
21 | * Expression handler to invoke the SQL TAN function.
22 | * For use in evaluating TAN({expr}) where the RDBMS supports this function.
23 | * Returns a NumericExpression "TAN({numericExpr})".
24 | */
25 | public class TanFunction extends SimpleNumericMethod
26 | {
27 | protected String getFunctionName()
28 | {
29 | return "TAN";
30 | }
31 |
32 | /* (non-Javadoc)
33 | * @see org.datanucleus.store.rdbms.sql.method.SimpleNumericMethod#getClassForMapping()
34 | */
35 | @Override
36 | protected Class getClassForMapping()
37 | {
38 | return double.class;
39 | }
40 | }
--------------------------------------------------------------------------------
/src/main/java/org/datanucleus/store/rdbms/sql/method/TanhFunction.java:
--------------------------------------------------------------------------------
1 | /**********************************************************************
2 | Copyright (c) 2022 Andy Jefferson and others. All rights reserved.
3 | Licensed under the Apache License, Version 2.0 (the "License");
4 | you may not use this file except in compliance with the License.
5 | You may obtain a copy of the License at
6 |
7 | http://www.apache.org/licenses/LICENSE-2.0
8 |
9 | Unless required by applicable law or agreed to in writing, software
10 | distributed under the License is distributed on an "AS IS" BASIS,
11 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12 | See the License for the specific language governing permissions and
13 | limitations under the License.
14 |
15 | Contributors:
16 | ...
17 | **********************************************************************/
18 | package org.datanucleus.store.rdbms.sql.method;
19 |
20 | /**
21 | * Expression handler to invoke the SQL TANH function.
22 | * For use in evaluating TANH({expr}) where the RDBMS supports this function.
23 | * Returns a NumericExpression "TANH({numericExpr})".
24 | */
25 | public class TanhFunction extends SimpleNumericMethod
26 | {
27 | protected String getFunctionName()
28 | {
29 | return "TANH";
30 | }
31 |
32 | @Override
33 | protected Class getClassForMapping()
34 | {
35 | return double.class;
36 | }
37 | }
--------------------------------------------------------------------------------
/src/main/java/org/datanucleus/store/rdbms/sql/method/TemporalMilliSecondMethod.java:
--------------------------------------------------------------------------------
1 | /**********************************************************************
2 | Copyright 2021 Google LLC
3 |
4 | Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file
5 | except in compliance with the License. You may obtain a copy of the License at
6 |
7 | https://www.apache.org/licenses/LICENSE-2.0
8 |
9 | Unless required by applicable law or agreed to in writing, software distributed under the
10 | License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either
11 | express or implied. See the License for the specific language governing permissions and
12 | limitations under the License.
13 |
14 | Contributors:
15 | 2021 Yunus Durmus - Spanner support
16 | **********************************************************************/
17 | package org.datanucleus.store.rdbms.sql.method;
18 |
19 | import java.util.List;
20 | import org.datanucleus.store.rdbms.sql.SQLStatement;
21 | import org.datanucleus.store.rdbms.sql.expression.NumericExpression;
22 | import org.datanucleus.store.rdbms.sql.expression.SQLExpression;
23 |
24 | /**
25 | * Method for evaluating MILLISECOND({dateExpr}) for CloudSpanner.
26 | * Returns a NumericExpression that equates to extract(MILLISECOND FROM expr)
27 | */
28 | public class TemporalMilliSecondMethod extends TemporalBaseMethod
29 | {
30 | @Override
31 | public SQLExpression getExpression(SQLStatement stmt, SQLExpression expr, List args)
32 | {
33 | SQLExpression invokedExpr = getInvokedExpression(expr, args, "MILLISECOND");
34 |
35 | invokedExpr.toSQLText().prepend("MILLISECOND FROM ");
36 |
37 | List funcArgs = List.of(invokedExpr);
38 | return new NumericExpression(stmt, stmt.getSQLExpressionFactory().getMappingForType(int.class, true), "EXTRACT", funcArgs);
39 | }
40 | }
41 |
--------------------------------------------------------------------------------
/src/main/java/org/datanucleus/store/rdbms/sql/method/TemporalMinuteMethod.java:
--------------------------------------------------------------------------------
1 | /**********************************************************************
2 | Copyright (c) 2016 Andy Jefferson and others. All rights reserved.
3 | Licensed under the Apache License, Version 2.0 (the "License");
4 | you may not use this file except in compliance with the License.
5 | You may obtain a copy of the License at
6 |
7 | http://www.apache.org/licenses/LICENSE-2.0
8 |
9 | Unless required by applicable law or agreed to in writing, software
10 | distributed under the License is distributed on an "AS IS" BASIS,
11 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12 | See the License for the specific language governing permissions and
13 | limitations under the License.
14 |
15 | Contributors:
16 | ...
17 | **********************************************************************/
18 | package org.datanucleus.store.rdbms.sql.method;
19 |
20 | import java.util.List;
21 |
22 | import org.datanucleus.store.rdbms.sql.SQLStatement;
23 | import org.datanucleus.store.rdbms.sql.expression.NumericExpression;
24 | import org.datanucleus.store.rdbms.sql.expression.SQLExpression;
25 |
26 | /**
27 | * Method for evaluating MINUTE({dateExpr}).
28 | * Returns a NumericExpression that equates to MINUTE(dateExpr)
29 | */
30 | public class TemporalMinuteMethod extends TemporalBaseMethod
31 | {
32 | @Override
33 | public SQLExpression getExpression(SQLStatement stmt, SQLExpression expr, List args)
34 | {
35 | SQLExpression invokedExpr = getInvokedExpression(expr, args, "MINUTE");
36 |
37 | List funcArgs = List.of(invokedExpr);
38 | return new NumericExpression(stmt, stmt.getSQLExpressionFactory().getMappingForType(int.class, true), "MINUTE", funcArgs);
39 | }
40 | }
--------------------------------------------------------------------------------
/src/main/java/org/datanucleus/store/rdbms/sql/method/TemporalMinuteMethod6.java:
--------------------------------------------------------------------------------
1 | /**********************************************************************
2 | Copyright (c) 2016 Andy Jefferson and others. All rights reserved.
3 | Licensed under the Apache License, Version 2.0 (the "License");
4 | you may not use this file except in compliance with the License.
5 | You may obtain a copy of the License at
6 |
7 | http://www.apache.org/licenses/LICENSE-2.0
8 |
9 | Unless required by applicable law or agreed to in writing, software
10 | distributed under the License is distributed on an "AS IS" BASIS,
11 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12 | See the License for the specific language governing permissions and
13 | limitations under the License.
14 |
15 | Contributors:
16 | ...
17 | **********************************************************************/
18 | package org.datanucleus.store.rdbms.sql.method;
19 |
20 | import java.util.List;
21 |
22 | import org.datanucleus.store.rdbms.sql.SQLStatement;
23 | import org.datanucleus.store.rdbms.sql.expression.NumericExpression;
24 | import org.datanucleus.store.rdbms.sql.expression.SQLExpression;
25 |
26 | /**
27 | * Method for evaluating MINUTE({dateExpr}) for Firebird and CloudSpanner.
28 | * Returns a NumericExpression that equates to extract(MINUTE FROM expr)
29 | */
30 | public class TemporalMinuteMethod6 extends TemporalBaseMethod
31 | {
32 | @Override
33 | public SQLExpression getExpression(SQLStatement stmt, SQLExpression expr, List args)
34 | {
35 | SQLExpression invokedExpr = getInvokedExpression(expr, args, "MINUTE");
36 |
37 | invokedExpr.toSQLText().prepend("MINUTE FROM ");
38 | return new NumericExpression(stmt, stmt.getSQLExpressionFactory().getMappingForType(int.class, true), "EXTRACT", List.of(invokedExpr));
39 | }
40 | }
41 |
--------------------------------------------------------------------------------
/src/main/java/org/datanucleus/store/rdbms/sql/method/TemporalMonthMethod.java:
--------------------------------------------------------------------------------
1 | /**********************************************************************
2 | Copyright (c) 2016 Andy Jefferson and others. All rights reserved.
3 | Licensed under the Apache License, Version 2.0 (the "License");
4 | you may not use this file except in compliance with the License.
5 | You may obtain a copy of the License at
6 |
7 | http://www.apache.org/licenses/LICENSE-2.0
8 |
9 | Unless required by applicable law or agreed to in writing, software
10 | distributed under the License is distributed on an "AS IS" BASIS,
11 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12 | See the License for the specific language governing permissions and
13 | limitations under the License.
14 |
15 | Contributors:
16 | ...
17 | **********************************************************************/
18 | package org.datanucleus.store.rdbms.sql.method;
19 |
20 | import java.util.List;
21 |
22 | import org.datanucleus.store.rdbms.sql.SQLStatement;
23 | import org.datanucleus.store.rdbms.sql.expression.NumericExpression;
24 | import org.datanucleus.store.rdbms.sql.expression.SQLExpression;
25 |
26 | /**
27 | * Method for evaluating MONTH({dateExpr}).
28 | * Returns a NumericExpression that equates to MONTH(dateExpr)
29 | */
30 | public class TemporalMonthMethod extends TemporalBaseMethod
31 | {
32 | @Override
33 | public SQLExpression getExpression(SQLStatement stmt, SQLExpression expr, List args)
34 | {
35 | SQLExpression invokedExpr = getInvokedExpression(expr, args, "MONTH");
36 |
37 | List funcArgs = List.of(invokedExpr);
38 | return new NumericExpression(stmt, stmt.getSQLExpressionFactory().getMappingForType(int.class, true), "MONTH", funcArgs);
39 | }
40 | }
41 |
--------------------------------------------------------------------------------
/src/main/java/org/datanucleus/store/rdbms/sql/method/TemporalSecondMethod.java:
--------------------------------------------------------------------------------
1 | /**********************************************************************
2 | Copyright (c) 2016 Andy Jefferson and others. All rights reserved.
3 | Licensed under the Apache License, Version 2.0 (the "License");
4 | you may not use this file except in compliance with the License.
5 | You may obtain a copy of the License at
6 |
7 | http://www.apache.org/licenses/LICENSE-2.0
8 |
9 | Unless required by applicable law or agreed to in writing, software
10 | distributed under the License is distributed on an "AS IS" BASIS,
11 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12 | See the License for the specific language governing permissions and
13 | limitations under the License.
14 |
15 | Contributors:
16 | ...
17 | **********************************************************************/
18 | package org.datanucleus.store.rdbms.sql.method;
19 |
20 | import java.util.List;
21 |
22 | import org.datanucleus.store.rdbms.sql.SQLStatement;
23 | import org.datanucleus.store.rdbms.sql.expression.NumericExpression;
24 | import org.datanucleus.store.rdbms.sql.expression.SQLExpression;
25 |
26 | /**
27 | * Method for evaluating SECOND({dateExpr}).
28 | * Returns a NumericExpression that equates to SECOND(dateExpr)
29 | */
30 | public class TemporalSecondMethod extends TemporalBaseMethod
31 | {
32 | @Override
33 | public SQLExpression getExpression(SQLStatement stmt, SQLExpression expr, List args)
34 | {
35 | SQLExpression invokedExpr = getInvokedExpression(expr, args, "SECOND");
36 |
37 | List funcArgs = List.of(invokedExpr);
38 | return new NumericExpression(stmt, stmt.getSQLExpressionFactory().getMappingForType(int.class, true), "SECOND", funcArgs);
39 | }
40 | }
--------------------------------------------------------------------------------
/src/main/java/org/datanucleus/store/rdbms/sql/method/TemporalSecondMethod7.java:
--------------------------------------------------------------------------------
1 | /**********************************************************************
2 | Copyright (c) 2016 Andy Jefferson and others. All rights reserved.
3 | Licensed under the Apache License, Version 2.0 (the "License");
4 | you may not use this file except in compliance with the License.
5 | You may obtain a copy of the License at
6 |
7 | http://www.apache.org/licenses/LICENSE-2.0
8 |
9 | Unless required by applicable law or agreed to in writing, software
10 | distributed under the License is distributed on an "AS IS" BASIS,
11 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12 | See the License for the specific language governing permissions and
13 | limitations under the License.
14 |
15 | Contributors:
16 | ...
17 | **********************************************************************/
18 | package org.datanucleus.store.rdbms.sql.method;
19 |
20 | import java.util.List;
21 |
22 | import org.datanucleus.store.rdbms.sql.SQLStatement;
23 | import org.datanucleus.store.rdbms.sql.expression.NumericExpression;
24 | import org.datanucleus.store.rdbms.sql.expression.SQLExpression;
25 |
26 | /**
27 | * Method for evaluating SECOND({dateExpr}) for Firebird and CloudSpanner.
28 | * Returns a NumericExpression that equates to extract(SECOND FROM expr)
29 | */
30 | public class TemporalSecondMethod7 extends TemporalBaseMethod
31 | {
32 | @Override
33 | public SQLExpression getExpression(SQLStatement stmt, SQLExpression expr, List args)
34 | {
35 | SQLExpression invokedExpr = getInvokedExpression(expr, args, "SECOND");
36 |
37 | invokedExpr.toSQLText().prepend("SECOND FROM ");
38 | return new NumericExpression(stmt, stmt.getSQLExpressionFactory().getMappingForType(int.class, true), "EXTRACT", List.of(invokedExpr));
39 | }
40 | }
41 |
--------------------------------------------------------------------------------
/src/main/java/org/datanucleus/store/rdbms/sql/method/TemporalWeekMethod5.java:
--------------------------------------------------------------------------------
1 | /**********************************************************************
2 | Copyright (c) 2021 Andy Jefferson and others. All rights reserved.
3 | Licensed under the Apache License, Version 2.0 (the "License");
4 | you may not use this file except in compliance with the License.
5 | You may obtain a copy of the License at
6 |
7 | http://www.apache.org/licenses/LICENSE-2.0
8 |
9 | Unless required by applicable law or agreed to in writing, software
10 | distributed under the License is distributed on an "AS IS" BASIS,
11 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12 | See the License for the specific language governing permissions and
13 | limitations under the License.
14 |
15 | Contributors:
16 | ...
17 | **********************************************************************/
18 | package org.datanucleus.store.rdbms.sql.method;
19 |
20 | import java.util.List;
21 |
22 | import org.datanucleus.store.rdbms.sql.SQLStatement;
23 | import org.datanucleus.store.rdbms.sql.expression.NumericExpression;
24 | import org.datanucleus.store.rdbms.sql.expression.SQLExpression;
25 |
26 | /**
27 | * Method for evaluating WEEK({dateExpr}) for Firebird and CloudSpanner.
28 | * Returns a NumericExpression that equates to extract(WEEK FROM expr)
29 | */
30 | public class TemporalWeekMethod5 extends TemporalBaseMethod
31 | {
32 | @Override
33 | public SQLExpression getExpression(SQLStatement stmt, SQLExpression expr, List args)
34 | {
35 | SQLExpression invokedExpr = getInvokedExpression(expr, args, "WEEK");
36 |
37 | expr.toSQLText().prepend("WEEK FROM ");
38 | return new NumericExpression(stmt, stmt.getSQLExpressionFactory().getMappingForType(int.class, true), "EXTRACT", List.of(invokedExpr));
39 | }
40 | }
41 |
--------------------------------------------------------------------------------
/src/main/java/org/datanucleus/store/rdbms/sql/method/package.html:
--------------------------------------------------------------------------------
1 |
2 |
3 | Support for invocation of Java methods, typically using SQL functions.
4 | Registered using the plugin-point org.datanucleus.store.rdbms.sql_method
5 | allowing users to register handling for particular methods to override/extend the default
6 | behaviour. All RDBMS have their own set of SQL functions and this is typically used to
7 | provide for all different possible SQL functions and tie them to a datastore.
8 |
9 |
--------------------------------------------------------------------------------
/src/main/java/org/datanucleus/store/rdbms/sql/operation/Mod2Operation.java:
--------------------------------------------------------------------------------
1 | /**********************************************************************
2 | Copyright (c) 2008 Andy Jefferson and others. All rights reserved.
3 | Licensed under the Apache License, Version 2.0 (the "License");
4 | you may not use this file except in compliance with the License.
5 | You may obtain a copy of the License at
6 |
7 | http://www.apache.org/licenses/LICENSE-2.0
8 |
9 | Unless required by applicable law or agreed to in writing, software
10 | distributed under the License is distributed on an "AS IS" BASIS,
11 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12 | See the License for the specific language governing permissions and
13 | limitations under the License.
14 |
15 | Contributors:
16 | ...
17 | **********************************************************************/
18 | package org.datanucleus.store.rdbms.sql.operation;
19 |
20 | import java.util.ArrayList;
21 | import java.util.List;
22 |
23 | import org.datanucleus.store.rdbms.sql.expression.NumericExpression;
24 | import org.datanucleus.store.rdbms.sql.expression.SQLExpression;
25 |
26 | /**
27 | * Implementation of MOD, using SQL MOD function.
28 | * Results in MOD(expr1, expr2)
29 | */
30 | public class Mod2Operation implements SQLOperation
31 | {
32 | @Override
33 | public SQLExpression getExpression(SQLExpression expr, SQLExpression expr2)
34 | {
35 | List args = new ArrayList<>();
36 | args.add(expr);
37 | args.add(expr2);
38 | return new NumericExpression(expr.getSQLStatement(), expr.getSQLStatement().getSQLExpressionFactory().getMappingForType(int.class), "MOD", args);
39 | }
40 | }
--------------------------------------------------------------------------------
/src/main/java/org/datanucleus/store/rdbms/sql/operation/SQLOperation.java:
--------------------------------------------------------------------------------
1 | /**********************************************************************
2 | Copyright (c) 2008 Andy Jefferson and others. All rights reserved.
3 | Licensed under the Apache License, Version 2.0 (the "License");
4 | you may not use this file except in compliance with the License.
5 | You may obtain a copy of the License at
6 |
7 | http://www.apache.org/licenses/LICENSE-2.0
8 |
9 | Unless required by applicable law or agreed to in writing, software
10 | distributed under the License is distributed on an "AS IS" BASIS,
11 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12 | See the License for the specific language governing permissions and
13 | limitations under the License.
14 |
15 | Contributors:
16 | ...
17 | **********************************************************************/
18 | package org.datanucleus.store.rdbms.sql.operation;
19 |
20 | import org.datanucleus.store.rdbms.sql.expression.SQLExpression;
21 |
22 | /**
23 | * Interface to implement an operation in SQL.
24 | */
25 | public interface SQLOperation
26 | {
27 | /**
28 | * Return the expression for this SQL function.
29 | * @param expr Left hand expression
30 | * @param expr2 Right hand expression
31 | * @return The SQL expression for the operation
32 | */
33 | public SQLExpression getExpression(SQLExpression expr, SQLExpression expr2);
34 | }
--------------------------------------------------------------------------------
/src/main/java/org/datanucleus/store/rdbms/sql/operation/package.html:
--------------------------------------------------------------------------------
1 |
2 |
3 | Support for operations between expressions where we may need to use SQL functions.
4 | Registered using the plugin-point org.datanucleus.store.rdbms.sql_operation
5 | allowing users to register handling for particular operations to override/extend the default
6 | behaviour.
7 |
8 |
--------------------------------------------------------------------------------
/src/main/java/org/datanucleus/store/rdbms/table/SecondaryDatastoreClass.java:
--------------------------------------------------------------------------------
1 | /**********************************************************************
2 | Copyright (c) 2007 Andy Jefferson and others. All rights reserved.
3 | Licensed under the Apache License, Version 2.0 (the "License");
4 | you may not use this file except in compliance with the License.
5 | You may obtain a copy of the License at
6 |
7 | http://www.apache.org/licenses/LICENSE-2.0
8 |
9 | Unless required by applicable law or agreed to in writing, software
10 | distributed under the License is distributed on an "AS IS" BASIS,
11 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12 | See the License for the specific language governing permissions and
13 | limitations under the License.
14 |
15 | Contributors:
16 | ...
17 | **********************************************************************/
18 | package org.datanucleus.store.rdbms.table;
19 |
20 | import org.datanucleus.metadata.JoinMetaData;
21 |
22 | /**
23 | * Secondary datastore class, managing the mapping of some of the fields of the class and dependent on a DatastoreClass.
24 | */
25 | public interface SecondaryDatastoreClass extends DatastoreClass
26 | {
27 | /**
28 | * Accessor for the primary datastore class that this is dependent on.
29 | * @return The associated primary datastore class.
30 | */
31 | DatastoreClass getPrimaryDatastoreClass();
32 |
33 | /**
34 | * Accessor for the JoinMetaData which is used to join to the primary DatastoreClass.
35 | * @return JoinMetaData
36 | */
37 | JoinMetaData getJoinMetaData();
38 | }
--------------------------------------------------------------------------------
/src/main/java/org/datanucleus/store/rdbms/table/package.html:
--------------------------------------------------------------------------------
1 |
2 | Provides the internal DataNucleus definition of a table/view and its columns.
3 | Tables/Views can represent a (persistent) class, or can be a join table for the relation between classes.
4 | Additionally there are special cases of SchemaTable, ProbeTable, and SequenceTable
5 | which provide auto-start, table detection, and table-based sequences.
6 |
7 |
--------------------------------------------------------------------------------
/src/main/java/org/datanucleus/store/rdbms/valuegenerator/package.html:
--------------------------------------------------------------------------------
1 |
2 | Package providing a series of value generators for use in RDBMS datastores.
3 |
--------------------------------------------------------------------------------
/src/main/resources/META-INF/NOTICE.txt:
--------------------------------------------------------------------------------
1 | =========================================================================
2 | == NOTICE file corresponding to section 4(d) of the Apache License, ==
3 | == Version 2.0, in this case for the DataNucleus distribution. ==
4 | =========================================================================
5 |
6 | ===================================================================
7 | This product includes software developed by many individuals,
8 | including the following:
9 | ===================================================================
10 | Andy Jefferson
11 | Erik Bengtson
12 | Joerg von Frantzius
13 | Marco Schulze
14 |
15 |
16 | ===================================================================
17 | This product has included contributions from some individuals,
18 | including the following:
19 | ===================================================================
20 | Barry Haddow
21 | Ralph Ullrich
22 | David Ezzio
23 | Brendan de Beer
24 | David Eaves
25 | Martin Taal
26 | Tony Lai
27 | Roland Szabo
28 | Anton Troshin (Timesten)
29 |
30 |
31 | ===================================================================
32 | This product also includes software developed by the TJDO project
33 | (http://tjdo.sourceforge.net/).
34 | ===================================================================
35 |
36 | ===================================================================
37 | This product also includes software developed by the Apache Commons project
38 | (http://commons.apache.org/).
39 | ===================================================================
40 |
--------------------------------------------------------------------------------
/src/main/resources/META-INF/README.txt:
--------------------------------------------------------------------------------
1 | RDBMS Plugin
2 | ============
3 | This project provides support for persistence to RDBMS datastores.
4 |
5 | This project is licensed by the Apache 2 license which you should have received with this.
6 |
--------------------------------------------------------------------------------
/src/main/resources/org/datanucleus/store/rdbms/Localisation_es.properties:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/datanucleus/datanucleus-rdbms/98fe4db812cc35157dcdb96f7f78f347706d9113/src/main/resources/org/datanucleus/store/rdbms/Localisation_es.properties
--------------------------------------------------------------------------------
/src/main/resources/org/datanucleus/store/rdbms/datasource/dbcp2/LocalStrings.properties:
--------------------------------------------------------------------------------
1 | # Licensed to the Apache Software Foundation (ASF) under one or more
2 | # contributor license agreements. See the NOTICE file distributed with
3 | # this work for additional information regarding copyright ownership.
4 | # The ASF licenses this file to You under the Apache License, Version 2.0
5 | # (the "License"); you may not use this file except in compliance with
6 | # the License. You may obtain a copy of the License at
7 | #
8 | # http://www.apache.org/licenses/LICENSE-2.0
9 | #
10 | # Unless required by applicable law or agreed to in writing, software
11 | # distributed under the License is distributed on an "AS IS" BASIS,
12 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 | # See the License for the specific language governing permissions and
14 | # limitations under the License.
15 |
16 | connectionFactory.lifetimeExceeded=The lifetime of the connection [{0}] milliseconds exceeds the maximum permitted value of [{1}] milliseconds
17 |
18 | poolableConnectionFactory.validateObject.fail=Failed to validate a poolable connection.
19 |
20 | poolableConnection.validate.fastFail=Fatal SQLException was thrown previously on this connection.
21 |
22 | swallowedExceptionLogger.onSwallowedException=An internal object pool swallowed an Exception.
23 |
24 | poolingDataSource.factoryConfig=PoolableConnectionFactory not linked to pool. Calling setPool() to fix the configuration.
25 |
26 | pool.close.fail=Cannot close connection pool.
27 |
--------------------------------------------------------------------------------
/src/test/java/org/datanucleus/store/rdbms/mapping/column/ClobImplTest.java:
--------------------------------------------------------------------------------
1 | /**********************************************************************
2 | Copyright (c) 2006 Erik Bengtson and others. All rights reserved.
3 | Licensed under the Apache License, Version 2.0 (the "License");
4 | you may not use this file except in compliance with the License.
5 | You may obtain a copy of the License at
6 |
7 | http://www.apache.org/licenses/LICENSE-2.0
8 |
9 | Unless required by applicable law or agreed to in writing, software
10 | distributed under the License is distributed on an "AS IS" BASIS,
11 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12 | See the License for the specific language governing permissions and
13 | limitations under the License.
14 |
15 |
16 | Contributors:
17 | ...
18 | **********************************************************************/
19 | package org.datanucleus.store.rdbms.mapping.column;
20 |
21 | import java.io.IOException;
22 | import java.sql.SQLException;
23 |
24 | import junit.framework.TestCase;
25 |
26 | public class ClobImplTest extends TestCase
27 | {
28 | public void testNull() throws IOException
29 | {
30 | try
31 | {
32 | new ClobImpl(null);
33 | }
34 | catch(IllegalArgumentException ex)
35 | {
36 | return;
37 | }
38 | fail("expected IllegalArgumentException");
39 | }
40 |
41 | public void testLength() throws SQLException, IOException
42 | {
43 | assertEquals("test string".length(),new ClobImpl("test string").length());
44 | }
45 |
46 | public void testGetSubString() throws SQLException, IOException
47 | {
48 | assertEquals("es",new ClobImpl("test string").getSubString(2, 2));
49 | }
50 |
51 | }
52 |
--------------------------------------------------------------------------------