// 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;
package us.monoid.psql.async;



/** Represents a row of data. Uses the fly-weight pattern, i.e. don't hold onto instances of this class. Just use the row instance passed into
 * your ResultListener to copy the data.
 *
 * For each row, access the data for each column using one of the asXxxx methods. You can either use the zero-based column index or the column name.
 * 
 * Row does some conversions for you. If you call asString(..) on a value that is a number, it will be converted to a String. 
 * However, trying to call asInt, asLong, asShort on a value that is not parseable will result in a NumberFormatException
 * 
 * Also note the various implementations of ResultListener which makes retrieving data a bit easier in may cases
 * @see us.monoid.psql.async.callback.ResultListener
 * @see us.monoid.psql.async.callback.SingleResult
 * @see us.monoid.psql.async.callback.JsonResult
 **/
public class Row {
	Columns columns;
// 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;

package us.monoid.psql.async;



/** Represents a row of data. Uses the fly-weight pattern, i.e. don't hold onto instances of this class. Just use the row instance passed into
 * your ResultListener to copy the data.
 *
 * For each row, access the data for each column using one of the asXxxx methods. You can either use the zero-based column index or the column name.
 * 
 * Row does some conversions for you. If you call asString(..) on a value that is a number, it will be converted to a String. 
 * However, trying to call asInt, asLong, asShort on a value that is not parseable will result in a NumberFormatException
 * 
 * Also note the various implementations of ResultListener which makes retrieving data a bit easier in may cases
 * @see us.monoid.psql.async.callback.ResultListener
 * @see us.monoid.psql.async.callback.SingleResult
 * @see us.monoid.psql.async.callback.JsonResult
 **/
public class Row {
	Columns columns;
	DataRow row;