// Path: src/main/java/us/monoid/psql/async/converter/Converter.java
// public abstract class Converter {
// 	public abstract String toString(Buffer buffer, int pos, int len, boolean isBinary);
// 	public abstract boolean toBoolean(Buffer buffer, int pos, int len, boolean isBinary);
// 	public abstract int toInt(Buffer buffer, int pos, int len, boolean isBinary);
// 	public abstract long toLong(Buffer buffer, int pos, int len, boolean isBinary);
// 	public abstract double toDouble(Buffer buffer, int pos, int len, boolean isBinary);
// 	public abstract float toFloat(Buffer buffer, int pos, int len, boolean isBinary);
// 	public abstract short toShort(Buffer buffer, int pos, int len, boolean isBinary);
// 	public abstract char toChar(Buffer buffer, int pos, int len, boolean isBinary);
// 	public abstract Object toObject(Buffer buffer, int pos, int len, boolean isBinary);
// }
// 
// Path: src/main/java/us/monoid/psql/async/message/DataRow.java
// public class DataRow extends BackendMessage {
// 	// this is possibly a micro-optimization, as finding the data for a column is summing up a few ints
// 	// we are sacrificing heap for ease-of-use and cpu
// 	int[] indexes; // for each column, records pointer in buffer where the content is. Makes it easier to read column data which will most likely be done
// 	
// 	@Override 
// 	public void setBuffer(Buffer aBuffer) {
// 		super.setBuffer(aBuffer);
// 		short col = buffer.getShort(5);
// 		indexes = new int[col];
// 		for (int pos = 7,i = 0; i < col; i++) {
// 			indexes[i] = pos;
// 			int lenData = buffer.getInt(pos); // length is raw length of column data excluding the length information
// 			if (lenData == -1) { // NULL value
// 				pos += 4; // next column starts right away
// 			} else {
// 				pos += 4 + lenData;
// 			}
// 		}
// 	}
// 	
// 	/** Get a copy of the raw bytes making up the value of that column. Data will be copied for each call to this method.
// 	 * 
// 	 * @param column the column index (0-based)
// 	 * @return a buffer with the raw data
// 	 */
// 	public Buffer getRawBytes(int column) {
// 		int lenData = buffer.getInt(indexes[column]);
// 		if (lenData == -1) return new Buffer(0); // NULL
// 		return buffer.getBuffer(indexes[column] + 4,  indexes[column] + 4 + lenData);		
// 	}
// 
// 	public Buffer getBuffer() {
// 		return buffer;
// 	}
// 
// 	/** Return the length of the data in the column. If -1, there is no data, return null */
// 	public int len(int col) {
// 		return buffer.getInt(indexes[col]);
// 	}
// 
// 	/** Return the position in the buffer where the data starts. If length is -1, there is no data, return null */
// 	public int pos(int col) {
// 		return indexes[col] + 4;
// 	}
// 	
// }


import org.vertx.java.core.buffer.Buffer;
import us.monoid.psql.async.converter.Converter;
import us.monoid.psql.async.message.DataRow;
		int col = columns().index(colName);
		return asFloat(col);
	}
	
	public double asDouble(String colName) {
		int col = columns().index(colName);
		return asDouble(col);
	}
	
	/** Get a copy of the bytes for the requested column */
	public Buffer asBuffer(String colName) {
		int col = columns().index(colName);
		return asBuffer(col);
	}

	
	/** Return the length of a column in bytes. Might return -1 in which case the value is NULL */
	public int length(int col) {
		return row.len(col);
	}
	
	/** Append bytes for column 'col' to target buffer. Return the number of bytes written.
	 * @return number of bytes copied
	 * This should work for Strings / varchar / character varying if both buffers use UTF8 as String encoding
	 */
	public int appendBytes(Buffer target, int col) {
		target.appendBuffer(row.getRawBytes(col)); // can't get deep enough access to Netty to use buffer transfer, too bad
		return row.len(col);
	}
	
// Path: src/main/java/us/monoid/psql/async/converter/Converter.java
// public abstract class Converter {
// 	public abstract String toString(Buffer buffer, int pos, int len, boolean isBinary);
// 	public abstract boolean toBoolean(Buffer buffer, int pos, int len, boolean isBinary);
// 	public abstract int toInt(Buffer buffer, int pos, int len, boolean isBinary);
// 	public abstract long toLong(Buffer buffer, int pos, int len, boolean isBinary);
// 	public abstract double toDouble(Buffer buffer, int pos, int len, boolean isBinary);
// 	public abstract float toFloat(Buffer buffer, int pos, int len, boolean isBinary);
// 	public abstract short toShort(Buffer buffer, int pos, int len, boolean isBinary);
// 	public abstract char toChar(Buffer buffer, int pos, int len, boolean isBinary);
// 	public abstract Object toObject(Buffer buffer, int pos, int len, boolean isBinary);
// }
// 
// Path: src/main/java/us/monoid/psql/async/message/DataRow.java
// public class DataRow extends BackendMessage {
// 	// this is possibly a micro-optimization, as finding the data for a column is summing up a few ints
// 	// we are sacrificing heap for ease-of-use and cpu
// 	int[] indexes; // for each column, records pointer in buffer where the content is. Makes it easier to read column data which will most likely be done
// 	
// 	@Override 
// 	public void setBuffer(Buffer aBuffer) {
// 		super.setBuffer(aBuffer);
// 		short col = buffer.getShort(5);
// 		indexes = new int[col];
// 		for (int pos = 7,i = 0; i < col; i++) {
// 			indexes[i] = pos;
// 			int lenData = buffer.getInt(pos); // length is raw length of column data excluding the length information
// 			if (lenData == -1) { // NULL value
// 				pos += 4; // next column starts right away
// 			} else {
// 				pos += 4 + lenData;
// 			}
// 		}
// 	}
// 	
// 	/** Get a copy of the raw bytes making up the value of that column. Data will be copied for each call to this method.
// 	 * 
// 	 * @param column the column index (0-based)
// 	 * @return a buffer with the raw data
// 	 */
// 	public Buffer getRawBytes(int column) {
// 		int lenData = buffer.getInt(indexes[column]);
// 		if (lenData == -1) return new Buffer(0); // NULL
// 		return buffer.getBuffer(indexes[column] + 4,  indexes[column] + 4 + lenData);		
// 	}
// 
// 	public Buffer getBuffer() {
// 		return buffer;
// 	}
// 
// 	/** Return the length of the data in the column. If -1, there is no data, return null */
// 	public int len(int col) {
// 		return buffer.getInt(indexes[col]);
// 	}
// 
// 	/** Return the position in the buffer where the data starts. If length is -1, there is no data, return null */
// 	public int pos(int col) {
// 		return indexes[col] + 4;
// 	}
// 	
// }


// Path: src/main/java/us/monoid/psql/async/Row.java
import org.vertx.java.core.buffer.Buffer;
import us.monoid.psql.async.converter.Converter;
import us.monoid.psql.async.message.DataRow;

		int col = columns().index(colName);
		return asFloat(col);
	}
	
	public double asDouble(String colName) {
		int col = columns().index(colName);
		return asDouble(col);
	}
	
	/** Get a copy of the bytes for the requested column */
	public Buffer asBuffer(String colName) {
		int col = columns().index(colName);
		return asBuffer(col);
	}

	
	/** Return the length of a column in bytes. Might return -1 in which case the value is NULL */
	public int length(int col) {
		return row.len(col);
	}
	
	/** Append bytes for column 'col' to target buffer. Return the number of bytes written.
	 * @return number of bytes copied
	 * This should work for Strings / varchar / character varying if both buffers use UTF8 as String encoding
	 */
	public int appendBytes(Buffer target, int col) {
		target.appendBuffer(row.getRawBytes(col)); // can't get deep enough access to Netty to use buffer transfer, too bad
		return row.len(col);
	}
	
	private Converter converter(int col) {