// Generated by Haxe 4.3.3
package sys.db;

import haxe.root.*;

@SuppressWarnings(value={"rawtypes", "unchecked"})
public class Sqlite extends haxe.lang.HxObject
{
	static
	{
		//line 26 "/usr/share/haxe/std/java/_std/sys/db/Sqlite.hx"
		sys.db.Sqlite.init = false;
	}
	
	public Sqlite(haxe.lang.EmptyObject empty)
	{
	}
	
	
	public Sqlite()
	{
		//line 25 "/usr/share/haxe/std/java/_std/sys/db/Sqlite.hx"
		sys.db.Sqlite.__hx_ctor_sys_db_Sqlite(this);
	}
	
	
	protected static void __hx_ctor_sys_db_Sqlite(sys.db.Sqlite __hx_this)
	{
	}
	
	
	public static boolean init;
	
	public static sys.db.Connection open(java.lang.String file)
	{
		//line 29 "/usr/share/haxe/std/java/_std/sys/db/Sqlite.hx"
		if ( ! (sys.db.Sqlite.init) ) 
		{
			//line 31 "/usr/share/haxe/std/java/_std/sys/db/Sqlite.hx"
			try 
			{
				//line 31 "/usr/share/haxe/std/java/_std/sys/db/Sqlite.hx"
				java.lang.Class.forName(haxe.lang.Runtime.toString("org.sqlite.JDBC"));
			}
			catch (java.lang.Throwable _g)
			{
				//line 32 "/usr/share/haxe/std/java/_std/sys/db/Sqlite.hx"
				java.lang.Object e = ((java.lang.Object) (haxe.Exception.caught(_g).unwrap()) );
				//line 33 "/usr/share/haxe/std/java/_std/sys/db/Sqlite.hx"
				throw ((java.lang.RuntimeException) (haxe.Exception.thrown(e)) );
			}
			
			
			//line 34 "/usr/share/haxe/std/java/_std/sys/db/Sqlite.hx"
			sys.db.Sqlite.init = true;
		}
		
		//line 36 "/usr/share/haxe/std/java/_std/sys/db/Sqlite.hx"
		try 
		{
			//line 37 "/usr/share/haxe/std/java/_std/sys/db/Sqlite.hx"
			java.sql.Connection cnx = java.sql.DriverManager.getConnection(haxe.lang.Runtime.toString(( "jdbc:sqlite:" + file )));
			//line 38 "/usr/share/haxe/std/java/_std/sys/db/Sqlite.hx"
			return haxe.java.db.Jdbc.create(cnx);
		}
		catch (java.lang.Throwable _g1)
		{
			//line 39 "/usr/share/haxe/std/java/_std/sys/db/Sqlite.hx"
			java.lang.Object e1 = ((java.lang.Object) (haxe.Exception.caught(_g1).unwrap()) );
			//line 40 "/usr/share/haxe/std/java/_std/sys/db/Sqlite.hx"
			throw ((java.lang.RuntimeException) (haxe.Exception.thrown(e1)) );
		}
		
		
	}
	
	
}


