diff --git a/Mage.Common/pom.xml b/Mage.Common/pom.xml index b54b291129..c6173ac3b1 100644 --- a/Mage.Common/pom.xml +++ b/Mage.Common/pom.xml @@ -50,6 +50,13 @@ trove 1.0.2 + + + org.sqlite + sqlite + 0.5.6 + + diff --git a/Mage.Common/src/mage/db/EntityManager.java b/Mage.Common/src/mage/db/EntityManager.java new file mode 100644 index 0000000000..567bdc6213 --- /dev/null +++ b/Mage.Common/src/mage/db/EntityManager.java @@ -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(); + } +} diff --git a/Mage.Common/src/mage/db/model/User.java b/Mage.Common/src/mage/db/model/User.java new file mode 100644 index 0000000000..2664aaad1f --- /dev/null +++ b/Mage.Common/src/mage/db/model/User.java @@ -0,0 +1,11 @@ +package mage.db.model; + +/** + * @author noxx + */ +public class User { + + private String login; + + private String password; +} diff --git a/README b/README new file mode 100644 index 0000000000..cd026d07b4 --- /dev/null +++ b/README @@ -0,0 +1,3 @@ +Before building with Maven, install 3rd party libs to your repository using .bat or .sh file in +/repository folder + diff --git a/pom.xml b/pom.xml index ed43700a5b..80d813fb7c 100644 --- a/pom.xml +++ b/pom.xml @@ -89,6 +89,16 @@ + + + + org.sqlite + sqlite + 0.5.6 + + + + 0.8.2 diff --git a/repository/install-maven.bat b/repository/install-maven.bat new file mode 100644 index 0000000000..8373a9d011 --- /dev/null +++ b/repository/install-maven.bat @@ -0,0 +1 @@ +mvn install:install-file -DgroupId=org.sqlite -DartifactId=sqlite -Dversion=0.5.6 -Dpackaging=jar -Dfile=./org/sqlite/sqlitejdbc-v056.jar \ No newline at end of file diff --git a/repository/install-maven.sh b/repository/install-maven.sh new file mode 100644 index 0000000000..8373a9d011 --- /dev/null +++ b/repository/install-maven.sh @@ -0,0 +1 @@ +mvn install:install-file -DgroupId=org.sqlite -DartifactId=sqlite -Dversion=0.5.6 -Dpackaging=jar -Dfile=./org/sqlite/sqlitejdbc-v056.jar \ No newline at end of file diff --git a/repository/org/sqlite/sqlitejdbc-v056.jar b/repository/org/sqlite/sqlitejdbc-v056.jar new file mode 100644 index 0000000000..f95d90eb07 Binary files /dev/null and b/repository/org/sqlite/sqlitejdbc-v056.jar differ