package com.intrack.session;

import com.intrack.cursor.Cursor;

import java.io.Closeable;
import java.util.List;
import java.util.Map;

/**
 * The primary Java interface for working with mybatis-wheel.
 * Through this interface you can execute commands, get mappers nad manage transactions.
 *
 * @author intrack
 */
public interface SqlSession extends Closeable {

    /**
     * Retrieve a simple row mapped from the statement key.
     * <T> The return object type.
     */
    <T> T selectOne(String statement);

    /**
     * Retrieve a simple row mapped from the statement key and parameter.
     * <T> The return object type.
     */
    <T> T selectOne(String statement, Object parameter);


    /**
     * Retrieve a list of mapped objects from the statement key.
     * <E> The return list element type.
     */
    <E> List<E> selectList(String statement);

    /**
     * Retrieve a list of mapped objects from the statement key and parameter.
     * <E> The return list element type.
     */
    <E> List<E> selectList(String statement, Object parameter);

    /**
     * Retrieve a list of mapped objects from the statement key and parameter,
     * within the specified row bounds.
     * <E> The return list element type.
     */
    <E> List<E> selectList(String statement, Object parameter, RowBounds rowBounds);

    /**
     * THe selectMap is a special case in that ti is designed to convert a list of results
     * into a Map based on one of the properties in the resulting objects.
     * Eg. Return a of Map[Integer,Author] for selectMap("selectAuthors","id")
     * <K> the returned Map keys type
     * <V> the returned Map values tpe
     */
    <K, V> Map<K, V> selectMap(String statement, String mapKey);

    /**
     * THe selectMap is a special case in that ti is designed to convert a list of results
     * into a Map based on one of the properties in the resulting objects with parameter.
     * Eg. Return a of Map[Integer,Author] for selectMap("selectAuthors","id")
     * <K> the returned Map keys type
     * <V> the returned Map values tpe
     */
    <K, V> Map<K, V> selectMap(String statement, Object parameter, String mapKey);

    /**
     * THe selectMap is a special case in that ti is designed to convert a list of results
     * into a Map based on one of the properties in the resulting objects with parameter.
     * Eg. Return a of Map[Integer,Author] for selectMap("selectAuthors","id")
     * <K> the returned Map keys type
     * <V> the returned Map values tpe
     */
    <K, V> Map<K, V> selectMap(String statement, Object parameter, String mapKey, RowBounds rowBounds);

    /**
     * A Cursor offers the same results as a List, except it fetches data lazily using an Iterator.
     */
    <T> Cursor<T> selectCursor(String statement);

    /**
     * A Cursor offers the same results as a List, except it fetches data lazily using an Iterator.
     */
    <T> Cursor<T> selectCursor(String statement, Object parameter);

    /**
     * A Cursor offers the same results as a List, except it fetches data lazily using an Iterator.
     */
    <T> Cursor<T> selectCursor(String statement, Object parameter, RowBounds rowBounds);

    /**
     * Retrieve a single row mapped from the statement key
     * using a ResultHandler.
     */
    void select(String statement, ResultHandler resultHandler);

    /**
     * Retrieve a single row mapped from the statement key and parameter
     * using a ResultHandler.
     */
    void select(String statement, Object parameter, ResultHandler resultHandler);

    @Override
    void close();

}

@@ -84,16 +84,44 @@
 seable;%0A
+import java.sql.Connection;%0A
 import j
@@ -3592,32 +3592,1583 @@
     
-@Override%0A    void close
+/**%0A     * Retrieve a single row mapped from the statement key and parameter using%0A     * a ResultHandler and RowBounds.%0A     */%0A    void select(String statement, Object parameter, RowBounds rowBounds, ResultHandler resultHandler);%0A%0A    /**%0A     * Execute an insert statement.%0A     */%0A    int insert(String statement);%0A%0A    /**%0A     * Execute an insert statement with parameter.%0A     */%0A    int insert(String statement, Object parameter);%0A%0A    /**%0A     * Execute an update statement.%0A     */%0A    int update(String statement);%0A%0A    /**%0A     * Execute on update statement with parameter.%0A     */%0A    int update(String statement, Object parameter);%0A%0A    /**%0A     * Execute an delete statement.%0A     */%0A    int delete(String statement);%0A%0A    /**%0A     * Execute an delete statement with parameter.%0A     */%0A    int delete(String statement, Object parameter);%0A%0A    /**%0A     * Flushes batch statement and commits database connection.%0A     */%0A    void commit();%0A%0A    /**%0A     * Discards pending batch statements and rolls database connection back.%0A     */%0A    void rollback();%0A%0A    /**%0A     * Flushes batch statements.%0A     */%0A//    List%3CBatchResult%3E flushStatements();%0A%0A    /**%0A     * Close the session.%0A     */%0A    @Override%0A    void close();%0A%0A    /**%0A     * Clears local session cache.%0A     */%0A    void clearCache();%0A%0A    /**%0A     * Retrieves current configuration.%0A     */%0A    Configuration getConfiguration();%0A%0A    /**%0A     * Retrieves a mapper.%0A     */%0A    %3CT%3E T getMapper(Class%3CT%3E type);%0A%0A    /**%0A     * Retrieves inner database connection.%0A     */%0A    Connection getConnection
 ();%0A

update SqlSession