File: Sqlite.hx

package info (click to toggle)
haxe 1%3A3.2.1%2Bdfsg-1
  • links: PTS, VCS
  • area: main
  • in suites: stretch
  • size: 23,464 kB
  • ctags: 9,612
  • sloc: ml: 83,200; ansic: 1,724; makefile: 473; java: 349; cs: 314; python: 250; sh: 43; cpp: 39; xml: 25
file content (23 lines) | stat: -rw-r--r-- 550 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
package sys.db;

class Sqlite
{
	static var init = false;
	/**
		Opens a new SQLite connection on the specified path.
		Note that you will need a SQLite JDBC driver (like https://bitbucket.org/xerial/sqlite-jdbc).
	**/
	public static function open(file:String):sys.db.Connection
	{
		if (!init)
		{
			try java.lang.Class.forName("org.sqlite.JDBC") catch(e:Dynamic) throw e;
			init = true;
		}
		try
		{
			var cnx = java.sql.DriverManager.getConnection("jdbc:sqlite:" + file);
			return java.db.Jdbc.create(cnx);
		} catch(e:Dynamic) throw e;
	}
}