// Generated by Haxe 4.3.3
package haxe.java.db;

import haxe.root.*;

@SuppressWarnings(value={"rawtypes", "unchecked"})
public class JdbcResultSet extends haxe.lang.HxObject implements sys.db.ResultSet
{
	public JdbcResultSet(haxe.lang.EmptyObject empty)
	{
	}
	
	
	public JdbcResultSet(java.sql.ResultSet rs, java.lang.String dbName, java.sql.ResultSetMetaData meta)
	{
		//line 193 "/usr/share/haxe/std/java/db/Jdbc.hx"
		haxe.java.db.JdbcResultSet.__hx_ctor_haxe_java_db_JdbcResultSet(this, rs, dbName, meta);
	}
	
	
	protected static void __hx_ctor_haxe_java_db_JdbcResultSet(haxe.java.db.JdbcResultSet __hx_this, java.sql.ResultSet rs, java.lang.String dbName, java.sql.ResultSetMetaData meta)
	{
		//line 194 "/usr/share/haxe/std/java/db/Jdbc.hx"
		__hx_this.dbName = dbName;
		//line 195 "/usr/share/haxe/std/java/db/Jdbc.hx"
		__hx_this.rs = rs;
		//line 196 "/usr/share/haxe/std/java/db/Jdbc.hx"
		if (( meta != null )) 
		{
			//line 197 "/usr/share/haxe/std/java/db/Jdbc.hx"
			try 
			{
				//line 198 "/usr/share/haxe/std/java/db/Jdbc.hx"
				int count = meta.getColumnCount();
				//line 199 "/usr/share/haxe/std/java/db/Jdbc.hx"
				haxe.root.Array<java.lang.String> names = new haxe.root.Array<java.lang.String>(new java.lang.String[]{});
				//line 199 "/usr/share/haxe/std/java/db/Jdbc.hx"
				int[] types = new int[count];
				//line 200 "/usr/share/haxe/std/java/db/Jdbc.hx"
				{
					//line 200 "/usr/share/haxe/std/java/db/Jdbc.hx"
					int _g = 0;
					//line 200 "/usr/share/haxe/std/java/db/Jdbc.hx"
					int _g1 = count;
					//line 200 "/usr/share/haxe/std/java/db/Jdbc.hx"
					while (( _g < _g1 ))
					{
						//line 200 "/usr/share/haxe/std/java/db/Jdbc.hx"
						int i = _g++;
						//line 201 "/usr/share/haxe/std/java/db/Jdbc.hx"
						names.push(meta.getColumnName(((int) (( i + 1 )) )));
						//line 202 "/usr/share/haxe/std/java/db/Jdbc.hx"
						types[i] = meta.getColumnType(((int) (( i + 1 )) ));
					}
					
				}
				
				//line 204 "/usr/share/haxe/std/java/db/Jdbc.hx"
				__hx_this.types = types;
				//line 205 "/usr/share/haxe/std/java/db/Jdbc.hx"
				__hx_this.names = names;
			}
			catch (java.lang.Throwable _g2)
			{
				//line 206 "/usr/share/haxe/std/java/db/Jdbc.hx"
				java.lang.Object e = ((java.lang.Object) (haxe.Exception.caught(_g2).unwrap()) );
				//line 207 "/usr/share/haxe/std/java/db/Jdbc.hx"
				throw ((java.lang.RuntimeException) (haxe.Exception.thrown(e)) );
			}
			
			
		}
		
	}
	
	
	public java.sql.ResultSet rs;
	
	public haxe.root.Array<java.lang.String> names;
	
	public int[] types;
	
	public java.lang.String dbName;
	
	public boolean didNext;
	
	public boolean hasNext()
	{
		//line 229 "/usr/share/haxe/std/java/db/Jdbc.hx"
		try 
		{
			//line 230 "/usr/share/haxe/std/java/db/Jdbc.hx"
			this.didNext = true;
			//line 231 "/usr/share/haxe/std/java/db/Jdbc.hx"
			if (( this.rs != null )) 
			{
				//line 231 "/usr/share/haxe/std/java/db/Jdbc.hx"
				return this.rs.next();
			}
			else
			{
				//line 231 "/usr/share/haxe/std/java/db/Jdbc.hx"
				return false;
			}
			
		}
		catch (java.lang.Throwable _g)
		{
			//line 232 "/usr/share/haxe/std/java/db/Jdbc.hx"
			java.lang.Object e = ((java.lang.Object) (haxe.Exception.caught(_g).unwrap()) );
			//line 233 "/usr/share/haxe/std/java/db/Jdbc.hx"
			throw ((java.lang.RuntimeException) (haxe.Exception.thrown(e)) );
		}
		
		
	}
	
	
	public java.lang.Object next()
	{
		//line 238 "/usr/share/haxe/std/java/db/Jdbc.hx"
		try 
		{
			//line 239 "/usr/share/haxe/std/java/db/Jdbc.hx"
			if (( this.rs == null )) 
			{
				//line 240 "/usr/share/haxe/std/java/db/Jdbc.hx"
				return null;
			}
			
			//line 241 "/usr/share/haxe/std/java/db/Jdbc.hx"
			if (this.didNext) 
			{
				//line 242 "/usr/share/haxe/std/java/db/Jdbc.hx"
				this.didNext = false;
			}
			else
			{
				//line 244 "/usr/share/haxe/std/java/db/Jdbc.hx"
				if ( ! (this.rs.next()) ) 
				{
					//line 245 "/usr/share/haxe/std/java/db/Jdbc.hx"
					return null;
				}
				
			}
			
			//line 248 "/usr/share/haxe/std/java/db/Jdbc.hx"
			java.lang.Object ret = new haxe.lang.DynamicObject(new java.lang.String[]{}, new java.lang.Object[]{}, new java.lang.String[]{}, new double[]{});
			//line 248 "/usr/share/haxe/std/java/db/Jdbc.hx"
			haxe.root.Array<java.lang.String> names = this.names;
			//line 248 "/usr/share/haxe/std/java/db/Jdbc.hx"
			int[] types = this.types;
			//line 249 "/usr/share/haxe/std/java/db/Jdbc.hx"
			{
				//line 249 "/usr/share/haxe/std/java/db/Jdbc.hx"
				int _g = 0;
				//line 249 "/usr/share/haxe/std/java/db/Jdbc.hx"
				int _g1 = names.length;
				//line 249 "/usr/share/haxe/std/java/db/Jdbc.hx"
				while (( _g < _g1 ))
				{
					//line 249 "/usr/share/haxe/std/java/db/Jdbc.hx"
					int i = _g++;
					//line 250 "/usr/share/haxe/std/java/db/Jdbc.hx"
					java.lang.String name = names.__get(i);
					//line 250 "/usr/share/haxe/std/java/db/Jdbc.hx"
					int t = types[i];
					//line 250 "/usr/share/haxe/std/java/db/Jdbc.hx"
					java.lang.Object val = null;
					//line 251 "/usr/share/haxe/std/java/db/Jdbc.hx"
					if (( t == java.sql.Types.FLOAT )) 
					{
						//line 252 "/usr/share/haxe/std/java/db/Jdbc.hx"
						val = this.rs.getDouble(((int) (( i + 1 )) ));
					}
					else
					{
						//line 253 "/usr/share/haxe/std/java/db/Jdbc.hx"
						if (( ( t == java.sql.Types.DATE ) || ( t == java.sql.Types.TIME ) )) 
						{
							//line 254 "/usr/share/haxe/std/java/db/Jdbc.hx"
							if (haxe.lang.Runtime.valEq(this.dbName, "SQLite")) 
							{
								//line 255 "/usr/share/haxe/std/java/db/Jdbc.hx"
								java.lang.String str = this.rs.getString(((int) (( i + 1 )) ));
								//line 256 "/usr/share/haxe/std/java/db/Jdbc.hx"
								if (( str != null )) 
								{
									//line 257 "/usr/share/haxe/std/java/db/Jdbc.hx"
									haxe.root.Date d = haxe.root.Date.fromString(str);
									//line 258 "/usr/share/haxe/std/java/db/Jdbc.hx"
									val = d;
								}
								
							}
							else
							{
								//line 261 "/usr/share/haxe/std/java/db/Jdbc.hx"
								java.sql.Date d1 = this.rs.getDate(((int) (( i + 1 )) ));
								//line 262 "/usr/share/haxe/std/java/db/Jdbc.hx"
								if (( d1 != null )) 
								{
									//line 263 "/usr/share/haxe/std/java/db/Jdbc.hx"
									val = haxe.root.Date.fromTime(((double) (d1.getTime()) ));
								}
								
							}
							
						}
						else
						{
							//line 265 "/usr/share/haxe/std/java/db/Jdbc.hx"
							if (( ( ( ( t == java.sql.Types.LONGVARBINARY ) || ( t == java.sql.Types.VARBINARY ) ) || ( t == java.sql.Types.BINARY ) ) || ( t == java.sql.Types.BLOB ) )) 
							{
								//line 266 "/usr/share/haxe/std/java/db/Jdbc.hx"
								byte[] b = this.rs.getBytes(((int) (( i + 1 )) ));
								//line 267 "/usr/share/haxe/std/java/db/Jdbc.hx"
								if (( b != null )) 
								{
									//line 268 "/usr/share/haxe/std/java/db/Jdbc.hx"
									val = haxe.io.Bytes.ofData(b);
								}
								
							}
							else
							{
								//line 270 "/usr/share/haxe/std/java/db/Jdbc.hx"
								val = this.rs.getObject(((int) (( i + 1 )) ));
							}
							
						}
						
					}
					
					//line 272 "/usr/share/haxe/std/java/db/Jdbc.hx"
					haxe.root.Reflect.setField(ret, name, val);
				}
				
			}
			
			//line 274 "/usr/share/haxe/std/java/db/Jdbc.hx"
			return ret;
		}
		catch (java.lang.Throwable _g2)
		{
			//line 275 "/usr/share/haxe/std/java/db/Jdbc.hx"
			java.lang.Object e = ((java.lang.Object) (haxe.Exception.caught(_g2).unwrap()) );
			//line 276 "/usr/share/haxe/std/java/db/Jdbc.hx"
			throw ((java.lang.RuntimeException) (haxe.Exception.thrown(e)) );
		}
		
		
	}
	
	
	@Override public java.lang.Object __hx_setField(java.lang.String field, java.lang.Object value, boolean handleProperties)
	{
		//line 183 "/usr/share/haxe/std/java/db/Jdbc.hx"
		{
			//line 183 "/usr/share/haxe/std/java/db/Jdbc.hx"
			boolean __temp_executeDef1 = true;
			//line 183 "/usr/share/haxe/std/java/db/Jdbc.hx"
			if (( field != null )) 
			{
				//line 183 "/usr/share/haxe/std/java/db/Jdbc.hx"
				switch (field.hashCode())
				{
					case 1656892434:
					{
						//line 183 "/usr/share/haxe/std/java/db/Jdbc.hx"
						if (field.equals("didNext")) 
						{
							//line 183 "/usr/share/haxe/std/java/db/Jdbc.hx"
							__temp_executeDef1 = false;
							//line 183 "/usr/share/haxe/std/java/db/Jdbc.hx"
							this.didNext = haxe.lang.Runtime.toBool(((java.lang.Boolean) (value) ));
							//line 183 "/usr/share/haxe/std/java/db/Jdbc.hx"
							return value;
						}
						
						//line 183 "/usr/share/haxe/std/java/db/Jdbc.hx"
						break;
					}
					
					
					case 3649:
					{
						//line 183 "/usr/share/haxe/std/java/db/Jdbc.hx"
						if (field.equals("rs")) 
						{
							//line 183 "/usr/share/haxe/std/java/db/Jdbc.hx"
							__temp_executeDef1 = false;
							//line 183 "/usr/share/haxe/std/java/db/Jdbc.hx"
							this.rs = ((java.sql.ResultSet) (value) );
							//line 183 "/usr/share/haxe/std/java/db/Jdbc.hx"
							return value;
						}
						
						//line 183 "/usr/share/haxe/std/java/db/Jdbc.hx"
						break;
					}
					
					
					case -1339126743:
					{
						//line 183 "/usr/share/haxe/std/java/db/Jdbc.hx"
						if (field.equals("dbName")) 
						{
							//line 183 "/usr/share/haxe/std/java/db/Jdbc.hx"
							__temp_executeDef1 = false;
							//line 183 "/usr/share/haxe/std/java/db/Jdbc.hx"
							this.dbName = haxe.lang.Runtime.toString(value);
							//line 183 "/usr/share/haxe/std/java/db/Jdbc.hx"
							return value;
						}
						
						//line 183 "/usr/share/haxe/std/java/db/Jdbc.hx"
						break;
					}
					
					
					case 104585032:
					{
						//line 183 "/usr/share/haxe/std/java/db/Jdbc.hx"
						if (field.equals("names")) 
						{
							//line 183 "/usr/share/haxe/std/java/db/Jdbc.hx"
							__temp_executeDef1 = false;
							//line 183 "/usr/share/haxe/std/java/db/Jdbc.hx"
							this.names = ((haxe.root.Array<java.lang.String>) (value) );
							//line 183 "/usr/share/haxe/std/java/db/Jdbc.hx"
							return value;
						}
						
						//line 183 "/usr/share/haxe/std/java/db/Jdbc.hx"
						break;
					}
					
					
					case 110844025:
					{
						//line 183 "/usr/share/haxe/std/java/db/Jdbc.hx"
						if (field.equals("types")) 
						{
							//line 183 "/usr/share/haxe/std/java/db/Jdbc.hx"
							__temp_executeDef1 = false;
							//line 183 "/usr/share/haxe/std/java/db/Jdbc.hx"
							this.types = ((int[]) (value) );
							//line 183 "/usr/share/haxe/std/java/db/Jdbc.hx"
							return value;
						}
						
						//line 183 "/usr/share/haxe/std/java/db/Jdbc.hx"
						break;
					}
					
					
				}
				
			}
			
			//line 183 "/usr/share/haxe/std/java/db/Jdbc.hx"
			if (__temp_executeDef1) 
			{
				//line 183 "/usr/share/haxe/std/java/db/Jdbc.hx"
				return super.__hx_setField(field, value, handleProperties);
			}
			else
			{
				//line 183 "/usr/share/haxe/std/java/db/Jdbc.hx"
				throw null;
			}
			
		}
		
	}
	
	
	@Override public java.lang.Object __hx_getField(java.lang.String field, boolean throwErrors, boolean isCheck, boolean handleProperties)
	{
		//line 183 "/usr/share/haxe/std/java/db/Jdbc.hx"
		{
			//line 183 "/usr/share/haxe/std/java/db/Jdbc.hx"
			boolean __temp_executeDef1 = true;
			//line 183 "/usr/share/haxe/std/java/db/Jdbc.hx"
			if (( field != null )) 
			{
				//line 183 "/usr/share/haxe/std/java/db/Jdbc.hx"
				switch (field.hashCode())
				{
					case 3377907:
					{
						//line 183 "/usr/share/haxe/std/java/db/Jdbc.hx"
						if (field.equals("next")) 
						{
							//line 183 "/usr/share/haxe/std/java/db/Jdbc.hx"
							__temp_executeDef1 = false;
							//line 183 "/usr/share/haxe/std/java/db/Jdbc.hx"
							return ((haxe.lang.Function) (new haxe.lang.Closure(this, "next")) );
						}
						
						//line 183 "/usr/share/haxe/std/java/db/Jdbc.hx"
						break;
					}
					
					
					case 3649:
					{
						//line 183 "/usr/share/haxe/std/java/db/Jdbc.hx"
						if (field.equals("rs")) 
						{
							//line 183 "/usr/share/haxe/std/java/db/Jdbc.hx"
							__temp_executeDef1 = false;
							//line 183 "/usr/share/haxe/std/java/db/Jdbc.hx"
							return this.rs;
						}
						
						//line 183 "/usr/share/haxe/std/java/db/Jdbc.hx"
						break;
					}
					
					
					case 696759469:
					{
						//line 183 "/usr/share/haxe/std/java/db/Jdbc.hx"
						if (field.equals("hasNext")) 
						{
							//line 183 "/usr/share/haxe/std/java/db/Jdbc.hx"
							__temp_executeDef1 = false;
							//line 183 "/usr/share/haxe/std/java/db/Jdbc.hx"
							return ((haxe.lang.Function) (new haxe.lang.Closure(this, "hasNext")) );
						}
						
						//line 183 "/usr/share/haxe/std/java/db/Jdbc.hx"
						break;
					}
					
					
					case 104585032:
					{
						//line 183 "/usr/share/haxe/std/java/db/Jdbc.hx"
						if (field.equals("names")) 
						{
							//line 183 "/usr/share/haxe/std/java/db/Jdbc.hx"
							__temp_executeDef1 = false;
							//line 183 "/usr/share/haxe/std/java/db/Jdbc.hx"
							return this.names;
						}
						
						//line 183 "/usr/share/haxe/std/java/db/Jdbc.hx"
						break;
					}
					
					
					case 1656892434:
					{
						//line 183 "/usr/share/haxe/std/java/db/Jdbc.hx"
						if (field.equals("didNext")) 
						{
							//line 183 "/usr/share/haxe/std/java/db/Jdbc.hx"
							__temp_executeDef1 = false;
							//line 183 "/usr/share/haxe/std/java/db/Jdbc.hx"
							return this.didNext;
						}
						
						//line 183 "/usr/share/haxe/std/java/db/Jdbc.hx"
						break;
					}
					
					
					case 110844025:
					{
						//line 183 "/usr/share/haxe/std/java/db/Jdbc.hx"
						if (field.equals("types")) 
						{
							//line 183 "/usr/share/haxe/std/java/db/Jdbc.hx"
							__temp_executeDef1 = false;
							//line 183 "/usr/share/haxe/std/java/db/Jdbc.hx"
							return this.types;
						}
						
						//line 183 "/usr/share/haxe/std/java/db/Jdbc.hx"
						break;
					}
					
					
					case -1339126743:
					{
						//line 183 "/usr/share/haxe/std/java/db/Jdbc.hx"
						if (field.equals("dbName")) 
						{
							//line 183 "/usr/share/haxe/std/java/db/Jdbc.hx"
							__temp_executeDef1 = false;
							//line 183 "/usr/share/haxe/std/java/db/Jdbc.hx"
							return this.dbName;
						}
						
						//line 183 "/usr/share/haxe/std/java/db/Jdbc.hx"
						break;
					}
					
					
				}
				
			}
			
			//line 183 "/usr/share/haxe/std/java/db/Jdbc.hx"
			if (__temp_executeDef1) 
			{
				//line 183 "/usr/share/haxe/std/java/db/Jdbc.hx"
				return super.__hx_getField(field, throwErrors, isCheck, handleProperties);
			}
			else
			{
				//line 183 "/usr/share/haxe/std/java/db/Jdbc.hx"
				throw null;
			}
			
		}
		
	}
	
	
	@Override public java.lang.Object __hx_invokeField(java.lang.String field, java.lang.Object[] dynargs)
	{
		//line 183 "/usr/share/haxe/std/java/db/Jdbc.hx"
		{
			//line 183 "/usr/share/haxe/std/java/db/Jdbc.hx"
			boolean __temp_executeDef1 = true;
			//line 183 "/usr/share/haxe/std/java/db/Jdbc.hx"
			if (( field != null )) 
			{
				//line 183 "/usr/share/haxe/std/java/db/Jdbc.hx"
				switch (field.hashCode())
				{
					case 3377907:
					{
						//line 183 "/usr/share/haxe/std/java/db/Jdbc.hx"
						if (field.equals("next")) 
						{
							//line 183 "/usr/share/haxe/std/java/db/Jdbc.hx"
							__temp_executeDef1 = false;
							//line 183 "/usr/share/haxe/std/java/db/Jdbc.hx"
							return this.next();
						}
						
						//line 183 "/usr/share/haxe/std/java/db/Jdbc.hx"
						break;
					}
					
					
					case 696759469:
					{
						//line 183 "/usr/share/haxe/std/java/db/Jdbc.hx"
						if (field.equals("hasNext")) 
						{
							//line 183 "/usr/share/haxe/std/java/db/Jdbc.hx"
							__temp_executeDef1 = false;
							//line 183 "/usr/share/haxe/std/java/db/Jdbc.hx"
							return this.hasNext();
						}
						
						//line 183 "/usr/share/haxe/std/java/db/Jdbc.hx"
						break;
					}
					
					
				}
				
			}
			
			//line 183 "/usr/share/haxe/std/java/db/Jdbc.hx"
			if (__temp_executeDef1) 
			{
				//line 183 "/usr/share/haxe/std/java/db/Jdbc.hx"
				return super.__hx_invokeField(field, dynargs);
			}
			else
			{
				//line 183 "/usr/share/haxe/std/java/db/Jdbc.hx"
				throw null;
			}
			
		}
		
	}
	
	
	@Override public void __hx_getFields(haxe.root.Array<java.lang.String> baseArr)
	{
		//line 183 "/usr/share/haxe/std/java/db/Jdbc.hx"
		baseArr.push("didNext");
		//line 183 "/usr/share/haxe/std/java/db/Jdbc.hx"
		baseArr.push("dbName");
		//line 183 "/usr/share/haxe/std/java/db/Jdbc.hx"
		baseArr.push("types");
		//line 183 "/usr/share/haxe/std/java/db/Jdbc.hx"
		baseArr.push("names");
		//line 183 "/usr/share/haxe/std/java/db/Jdbc.hx"
		baseArr.push("rs");
		//line 183 "/usr/share/haxe/std/java/db/Jdbc.hx"
		super.__hx_getFields(baseArr);
	}
	
	
}


