Search in sources :

Example 6 with QuerySet

use of com.servoy.j2db.persistence.QuerySet in project servoy-client by Servoy.

the class ProfileDataServer method createSQLStatement.

@Override
public ISQLStatement createSQLStatement(int action, String server_name, String tableName, Object[] pkColumnData, String tid, ISQLUpdate sqlUpdate, ArrayList<TableFilter> filters) throws RemoteException, RepositoryException {
    long startTime = System.currentTimeMillis();
    try {
        return super.createSQLStatement(action, server_name, tableName, pkColumnData, tid, sqlUpdate, filters);
    } finally {
        QuerySet set;
        try {
            set = getSQLQuerySet(server_name, sqlUpdate, filters, -1, -1, false, false);
            informListeners("Query", server_name, set.getUpdate().getSql(), tid, startTime, set.getUpdate().getParameters());
        } catch (RepositoryException e) {
            Debug.error(e);
        }
    }
}
Also used : QuerySet(com.servoy.j2db.persistence.QuerySet) RepositoryException(com.servoy.j2db.persistence.RepositoryException)

Example 7 with QuerySet

use of com.servoy.j2db.persistence.QuerySet in project servoy-client by Servoy.

the class ProfileDataServer method performCustomQuery.

/**
 * @param client_id
 * @param server_name
 * @param driverTableName
 * @param transaction_id
 * @param startRow
 * @param rowsToRetrieve
 * @return
 * @throws ServoyException
 * @throws RemoteException
 * @see com.servoy.j2db.dataprocessing.IDataServer#performCustomQuery(java.lang.String, java.lang.String, java.lang.String, java.lang.String, ISQLSelect, int, int)
 */
@Override
public IDataSet performCustomQuery(String client_id, String server_name, String driverTableName, String transaction_id, ISQLSelect sqlSelect, ArrayList<TableFilter> filters, int startRow, int rowsToRetrieve) throws ServoyException, RemoteException {
    long startTime = System.currentTimeMillis();
    try {
        return super.performCustomQuery(client_id, server_name, driverTableName, transaction_id, sqlSelect, filters, startRow, rowsToRetrieve);
    } finally {
        QuerySet set = getSQLQuerySet(server_name, sqlSelect, filters, 0, 1, false, false);
        informListeners("Query", server_name, set.getSelect().getSql(), transaction_id, startTime, set.getSelect().getParameters());
    }
}
Also used : QuerySet(com.servoy.j2db.persistence.QuerySet)

Example 8 with QuerySet

use of com.servoy.j2db.persistence.QuerySet in project servoy-client by Servoy.

the class ProfileDataServer method insertQueryResult.

/**
 * @param client_id
 * @param queryServerName
 * @param queryTid
 * @param sqlSelect the sql statement
 * @param filters filters to apply
 * @param distinctInMemory require distinct values but query is not distinct
 * @param startRow start row normally 0
 * @param rowsToRetrieve rowsToRetrieve number of rows to retrieve
 * @param type query type
 * @param dataSource
 * @param targetServerName
 * @param targetTableName when null a temporary table will be created
 * @param targetTid transaction id
 * @param types the column types
 * @return the table where the set was inserted into
 * @throws ServoyException
 * @throws RemoteException
 */
@Override
public ITable insertQueryResult(String client_id, String queryServerName, String queryTid, ISQLSelect sqlSelect, ArrayList<TableFilter> filters, boolean distinctInMemory, int startRow, int rowsToRetrieve, int type, String dataSource, String targetServerName, String targetTableName, String targetTid, ColumnType[] columnTypes, String[] pkNames) throws ServoyException, RemoteException {
    long startTime = System.currentTimeMillis();
    try {
        return super.insertQueryResult(client_id, queryServerName, queryTid, sqlSelect, filters, distinctInMemory, startRow, rowsToRetrieve, type, dataSource, targetServerName, targetTableName, targetTid, columnTypes, pkNames);
    } finally {
        QuerySet set = getSQLQuerySet(queryServerName, sqlSelect, filters, startRow, rowsToRetrieve, false, false);
        informListeners("FillDataSource", queryServerName, set.getSelect().getSql(), queryTid, startTime, set.getSelect().getParameters());
    }
}
Also used : QuerySet(com.servoy.j2db.persistence.QuerySet)

Example 9 with QuerySet

use of com.servoy.j2db.persistence.QuerySet in project servoy-client by Servoy.

the class ProfileDataServer method getBlob.

/**
 * @param clientId
 * @param serverName
 * @param blobSelect
 * @param filters
 * @param tid
 * @return
 * @throws RepositoryException
 * @throws RemoteException
 * @see com.servoy.j2db.dataprocessing.IDataServer#getBlob(java.lang.String, java.lang.String, com.servoy.j2db.query.ISQLSelect, java.util.ArrayList, java.lang.String)
 */
@Override
public Blob getBlob(String clientId, String serverName, ISQLSelect blobSelect, ArrayList<TableFilter> filters, String tid) throws RepositoryException, RemoteException {
    long startTime = System.currentTimeMillis();
    try {
        return super.getBlob(clientId, serverName, blobSelect, filters, tid);
    } finally {
        QuerySet set = getSQLQuerySet(serverName, blobSelect, filters, 0, 1, false, false);
        informListeners("BlobLoad", serverName, set.getSelect().getSql(), tid, startTime, set.getSelect().getParameters());
    }
}
Also used : QuerySet(com.servoy.j2db.persistence.QuerySet)

Example 10 with QuerySet

use of com.servoy.j2db.persistence.QuerySet in project servoy-client by Servoy.

the class ProfileDataServer method performQuery.

@Override
public IDataSet[] performQuery(String client_id, String server_name, String transaction_id, QueryData[] array) throws ServoyException, RemoteException {
    long startTime = System.currentTimeMillis();
    try {
        return super.performQuery(client_id, server_name, transaction_id, array);
    } finally {
        int counter = 0;
        long timePerQuery = (System.currentTimeMillis() - startTime) / array.length;
        for (QueryData queryData : array) {
            long time = System.currentTimeMillis() - timePerQuery;
            QuerySet set = getSQLQuerySet(server_name, queryData.getSqlSelect(), queryData.getFilters(), queryData.getStartRow(), queryData.getRowsToRetrieve(), false, false);
            informListeners(PerformanceTiming.getTypeString(queryData.getType()) + " Combined Query[" + (counter++) + '/' + array.length + ']', server_name, set.getSelect().getSql(), transaction_id, time, set.getSelect().getParameters());
        }
    }
}
Also used : QueryData(com.servoy.j2db.dataprocessing.QueryData) QuerySet(com.servoy.j2db.persistence.QuerySet)

Aggregations

QuerySet (com.servoy.j2db.persistence.QuerySet)12 RepositoryException (com.servoy.j2db.persistence.RepositoryException)4 QuerySelect (com.servoy.j2db.query.QuerySelect)4 Column (com.servoy.j2db.persistence.Column)3 ITable (com.servoy.j2db.persistence.ITable)3 Table (com.servoy.j2db.persistence.Table)3 RemoteException (java.rmi.RemoteException)3 IBaseColumn (com.servoy.base.persistence.IBaseColumn)2 BaseQueryTable (com.servoy.base.query.BaseQueryTable)2 ApplicationException (com.servoy.j2db.ApplicationException)2 QueryString (com.servoy.j2db.persistence.QueryString)2 QueryColumn (com.servoy.j2db.query.QueryColumn)2 QueryTable (com.servoy.j2db.query.QueryTable)2 QBColumn (com.servoy.j2db.querybuilder.impl.QBColumn)2 QBSelect (com.servoy.j2db.querybuilder.impl.QBSelect)2 ServoyException (com.servoy.j2db.util.ServoyException)2 SQLException (java.sql.SQLException)2 Iterator (java.util.Iterator)2 NativeObject (org.mozilla.javascript.NativeObject)2 BufferedDataSet (com.servoy.j2db.dataprocessing.BufferedDataSet)1