All Downloads are FREE. Search and download functionalities are using the official Maven repository.

com.genexus.db.DataStoreProviderBase Maven / Gradle / Ivy

Go to download

Core classes for the runtime used by Java and Android apps generated with GeneXus

There is a newer version: 4.7.0
Show newest version
package com.genexus.db;

import java.sql.SQLException;
import java.util.Date;

import com.genexus.*;
import com.genexus.common.classes.AbstractDataStoreProviderBase;
import com.genexus.common.classes.AbstractGXConnection;
import com.genexus.db.driver.DataSource;
import com.genexus.db.driver.GXConnection;

public abstract class DataStoreProviderBase extends AbstractDataStoreProviderBase
{
	
	private IConnectionProvider connectionProvider;
	protected ModelContext context;
	protected int remoteHandle;
	protected Cursor[] cursors;
	protected DataSource dataSource;
	protected GXParameterUnpacker unpacker = new GXParameterUnpacker();
	protected GXParameterPacker packer = new GXParameterPacker();
	protected IErrorHandler errorHandler;
	protected Date beginExecute;
	
	protected GXConnection con;

	protected DataStoreProviderBase(ModelContext context, int remoteHandle)
	{
		this.context = context;
		this.remoteHandle = remoteHandle;
	}

	public AbstractGXConnection getConnection() throws SQLException
	{
		if	(connectionProvider == null)
		{
			connectionProvider = getHelper().getConnectionProvider();
		}
		
		con = (GXConnection) connectionProvider.getConnection(context, remoteHandle, getHelper().getDataStoreName(), getHelper().needsReadOnlyConnection(), true);
		return con; 
	}

	protected DataSource getDataSource()
	{
		if (dataSource == null)
			dataSource = Application.getConnectionManager(context).getDataSource(remoteHandle, getHelper().getDataStoreName());

		return dataSource;
	}
	
	protected DataSource getDataSourceNoException()
	{
		if (dataSource == null)
			dataSource = Application.getConnectionManager(context).getDataSourceNoException(remoteHandle, getHelper().getDataStoreName());

		return dataSource;
	}

	public void setErrorHandler(IErrorHandler errorHandler)
	{
		this.errorHandler = errorHandler;
	}

	protected Object [] dynConstraints = null;
	public void dynParam(int cursorId, Object [] dynConstraints)
	{
		this.dynConstraints = dynConstraints;
	}
	
	public Object [] getDynConstraints()
	{
		return (Object[])dynConstraints[0];
	}
		
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy