package org.nybatis.core.db.sql.mapper.implement;

import java.sql.CallableStatement;
import java.sql.PreparedStatement;
import java.sql.ResultSet;
import java.sql.SQLException;
import java.sql.Time;
import java.util.Date;

import org.nybatis.core.db.sql.mapper.SqlType;
import org.nybatis.core.db.sql.mapper.TypeMapperIF;

public class TimeMapper implements TypeMapperIF<Date> {

	@Override
    public void setParameter( PreparedStatement statement, int index, Date param ) throws SQLException {
		statement.setTime( index, new Time(param.getTime()) );
    }

	@Override
	public void setOutParameter( CallableStatement statement, int index ) throws SQLException {
		statement.registerOutParameter( index, SqlType.TIME.toCode() );
	}

	@Override
    public Date getResult( ResultSet resultSet, String columnName ) throws SQLException {
	    return resultSet.getTime( columnName );
    }

	@Override
    public Date getResult( ResultSet resultSet, int columnIndex ) throws SQLException {
		return resultSet.getTime( columnIndex );
    }

	@Override
    public Date getResult( CallableStatement statement, int columnIndex ) throws SQLException {
	    return statement.getTime( columnIndex );
    }

}

@@ -836,24 +836,34 @@
 %0A%09    return
+ new Date(
  resultSet.g
@@ -880,16 +880,28 @@
 lumnName
+ ).getTime()
  );%0A    
@@ -1010,16 +1010,26 @@
 %09%09return
+ new Date(
  resultS
@@ -1043,32 +1043,44 @@
 ime( columnIndex
+ ).getTime()
  );%0A    %7D%0A%0A%09@Ove
@@ -1192,16 +1192,26 @@
   return
+ new Date(
  stateme
@@ -1233,16 +1233,28 @@
 umnIndex
+ ).getTime()
  );%0A    

fix time converter