mirror of
https://github.com/correl/mage.git
synced 2024-12-25 03:00:15 +00:00
Initial sqlite support.
This commit is contained in:
parent
e901343aad
commit
20402f1cad
8 changed files with 68 additions and 0 deletions
|
@ -50,6 +50,13 @@
|
|||
<artifactId>trove</artifactId>
|
||||
<version>1.0.2</version>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>org.sqlite</groupId>
|
||||
<artifactId>sqlite</artifactId>
|
||||
<version>0.5.6</version>
|
||||
</dependency>
|
||||
|
||||
</dependencies>
|
||||
|
||||
<build>
|
||||
|
|
35
Mage.Common/src/mage/db/EntityManager.java
Normal file
35
Mage.Common/src/mage/db/EntityManager.java
Normal file
|
@ -0,0 +1,35 @@
|
|||
package mage.db;
|
||||
|
||||
import java.sql.*;
|
||||
|
||||
/**
|
||||
* @author noxx
|
||||
*/
|
||||
public class EntityManager {
|
||||
|
||||
public static void main(String[] args) throws Exception {
|
||||
Class.forName("org.sqlite.JDBC");
|
||||
Connection conn = DriverManager.getConnection("jdbc:sqlite:mage.db");
|
||||
Statement stat = conn.createStatement();
|
||||
stat.executeUpdate("drop table if exists users;");
|
||||
stat.executeUpdate("create table users (login, password);");
|
||||
|
||||
PreparedStatement prep = conn.prepareStatement("insert into users values (?, ?);");
|
||||
|
||||
prep.setString(1, "TestUser");
|
||||
prep.setString(2, "123");
|
||||
prep.execute();
|
||||
|
||||
prep.setString(1, "TestUser2");
|
||||
prep.setString(2, "12345");
|
||||
prep.execute();
|
||||
|
||||
ResultSet rs = stat.executeQuery("select * from users;");
|
||||
while (rs.next()) {
|
||||
System.out.println("user = " + rs.getString("login"));
|
||||
System.out.println("password = " + rs.getString("password"));
|
||||
}
|
||||
rs.close();
|
||||
conn.close();
|
||||
}
|
||||
}
|
11
Mage.Common/src/mage/db/model/User.java
Normal file
11
Mage.Common/src/mage/db/model/User.java
Normal file
|
@ -0,0 +1,11 @@
|
|||
package mage.db.model;
|
||||
|
||||
/**
|
||||
* @author noxx
|
||||
*/
|
||||
public class User {
|
||||
|
||||
private String login;
|
||||
|
||||
private String password;
|
||||
}
|
3
README
Normal file
3
README
Normal file
|
@ -0,0 +1,3 @@
|
|||
Before building with Maven, install 3rd party libs to your repository using .bat or .sh file in
|
||||
/repository folder
|
||||
|
10
pom.xml
10
pom.xml
|
@ -89,6 +89,16 @@
|
|||
</pluginRepository>
|
||||
</pluginRepositories>
|
||||
|
||||
<dependencyManagement>
|
||||
<dependencies>
|
||||
<dependency>
|
||||
<groupId>org.sqlite</groupId>
|
||||
<artifactId>sqlite</artifactId>
|
||||
<version>0.5.6</version>
|
||||
</dependency>
|
||||
</dependencies>
|
||||
</dependencyManagement>
|
||||
|
||||
<properties>
|
||||
<mage-version>0.8.2</mage-version>
|
||||
</properties>
|
||||
|
|
1
repository/install-maven.bat
Normal file
1
repository/install-maven.bat
Normal file
|
@ -0,0 +1 @@
|
|||
mvn install:install-file -DgroupId=org.sqlite -DartifactId=sqlite -Dversion=0.5.6 -Dpackaging=jar -Dfile=./org/sqlite/sqlitejdbc-v056.jar
|
1
repository/install-maven.sh
Normal file
1
repository/install-maven.sh
Normal file
|
@ -0,0 +1 @@
|
|||
mvn install:install-file -DgroupId=org.sqlite -DartifactId=sqlite -Dversion=0.5.6 -Dpackaging=jar -Dfile=./org/sqlite/sqlitejdbc-v056.jar
|
BIN
repository/org/sqlite/sqlitejdbc-v056.jar
Normal file
BIN
repository/org/sqlite/sqlitejdbc-v056.jar
Normal file
Binary file not shown.
Loading…
Reference in a new issue