DATABASE
This commit is contained in:
parent
90fc2795d2
commit
339f42872c
|
@ -2,9 +2,19 @@
|
|||
<classpath>
|
||||
<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-17">
|
||||
<attributes>
|
||||
<attribute name="module" value="true"/>
|
||||
<attribute name="maven.pomderived" value="true"/>
|
||||
</attributes>
|
||||
</classpathentry>
|
||||
<classpathentry kind="src" path="src"/>
|
||||
<classpathentry kind="output" path="bin"/>
|
||||
<classpathentry kind="src" output="target/classes" path="src">
|
||||
<attributes>
|
||||
<attribute name="optional" value="true"/>
|
||||
<attribute name="maven.pomderived" value="true"/>
|
||||
</attributes>
|
||||
</classpathentry>
|
||||
<classpathentry kind="con" path="org.eclipse.m2e.MAVEN2_CLASSPATH_CONTAINER">
|
||||
<attributes>
|
||||
<attribute name="maven.pomderived" value="true"/>
|
||||
</attributes>
|
||||
</classpathentry>
|
||||
<classpathentry kind="output" path="target/classes"/>
|
||||
</classpath>
|
||||
|
|
|
@ -0,0 +1 @@
|
|||
/target/
|
|
@ -10,8 +10,14 @@
|
|||
<arguments>
|
||||
</arguments>
|
||||
</buildCommand>
|
||||
<buildCommand>
|
||||
<name>org.eclipse.m2e.core.maven2Builder</name>
|
||||
<arguments>
|
||||
</arguments>
|
||||
</buildCommand>
|
||||
</buildSpec>
|
||||
<natures>
|
||||
<nature>org.eclipse.m2e.core.maven2Nature</nature>
|
||||
<nature>org.eclipse.jdt.core.javanature</nature>
|
||||
</natures>
|
||||
</projectDescription>
|
||||
|
|
|
@ -0,0 +1,26 @@
|
|||
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 https://maven.apache.org/xsd/maven-4.0.0.xsd">
|
||||
<modelVersion>4.0.0</modelVersion>
|
||||
<groupId>Elaborato_IS</groupId>
|
||||
<artifactId>Elaborato_IS</artifactId>
|
||||
<version>0.0.1-SNAPSHOT</version>
|
||||
<name>Elaborato_IS</name>
|
||||
<build>
|
||||
<sourceDirectory>src</sourceDirectory>
|
||||
<plugins>
|
||||
<plugin>
|
||||
<artifactId>maven-compiler-plugin</artifactId>
|
||||
<version>3.8.1</version>
|
||||
<configuration>
|
||||
<release>17</release>
|
||||
</configuration>
|
||||
</plugin>
|
||||
</plugins>
|
||||
</build>
|
||||
<dependencies>
|
||||
<dependency>
|
||||
<groupId>org.postgresql</groupId>
|
||||
<artifactId>postgresql</artifactId>
|
||||
<version>42.6.0</version>
|
||||
</dependency>
|
||||
</dependencies>
|
||||
</project>
|
|
@ -1,9 +1,44 @@
|
|||
import java.sql.Connection;
|
||||
import java.sql.DriverManager;
|
||||
import java.sql.SQLException;
|
||||
|
||||
import javax.management.loading.PrivateClassLoader;
|
||||
|
||||
import org.postgresql.*;
|
||||
import org.postgresql.util.LruCache.CreateAction;
|
||||
|
||||
public class Main {
|
||||
|
||||
public static void main(String[] args) {
|
||||
// TODO Auto-generated method stub
|
||||
//Edi frocio pipino piccolo
|
||||
public static void main(String[] args) throws SQLException {
|
||||
|
||||
|
||||
Connection connection = DriverManager.getConnection("jdbc:postgresql://127.0.0.1:5432/ingegneria",
|
||||
"neto", "fethergay");
|
||||
|
||||
var stmt = connection.prepareStatement("DO $$ BEGIN "
|
||||
+ "CREATE TYPE categoria_appartenenza AS ENUM ('gay', 'frocio');"
|
||||
+ "EXCEPTION "
|
||||
+ "WHEN duplicate_object THEN null; "
|
||||
+ "END $$;");
|
||||
stmt.execute();
|
||||
|
||||
|
||||
stmt = connection.prepareStatement("CREATE TABLE IF NOT EXISTS anagrafica("
|
||||
+ "codice_fiscale VARCHAR(16) PRIMARY KEY,"
|
||||
+ "nome VARCHAR(16) NOT NULL,"
|
||||
+ "cognome VARCHAR(16) NOT NULL,"
|
||||
+ "data_nascita DATE,"
|
||||
+ "luogo_nascita VARCHAR(32),"
|
||||
+ "num_sanitario BIGINT,"
|
||||
+ "categorie_appartenenze categoria_appartenenza[],"
|
||||
+ "password VARCHAR(16)"
|
||||
+ ")");
|
||||
stmt.execute();
|
||||
|
||||
stmt = connection.prepareStatement("INSERT INTO anagrafica(codice_fiscale, nome, cognome) VALUES('test', 'neto', 'whites')");
|
||||
stmt.execute();
|
||||
|
||||
System.out.println("ok");
|
||||
}
|
||||
|
||||
public boolean Registrazione(String nome, String cognome, String codice_fiscale, Data data_nascita, String luogo_nascita, String password) {
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
|
||||
public class Prenotazione {
|
||||
|
||||
|
||||
}
|
||||
|
|
|
@ -9,7 +9,7 @@ public class User_data {
|
|||
private final String luogo_nascita;
|
||||
//TODO: non so farlo, List categoria_appartenenza = new ArrayList<>();
|
||||
|
||||
String password;
|
||||
private final String password;
|
||||
|
||||
public User_data(String nome, String cognome, String codice_fiscale, Data data_nascita, String luogo_nascita) {
|
||||
this.nome = nome;
|
||||
|
|
Loading…
Reference in New Issue