-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathconexion.py
More file actions
59 lines (49 loc) · 2.05 KB
/
conexion.py
File metadata and controls
59 lines (49 loc) · 2.05 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
import mysql.connector
conexion = mysql.connector.connect(
host="localhost",
port=3306,
user="root",
password="link79743114200309",
database="derechos_reales"
)
def estado_tramite(nrotramite):
cursor = conexion.cursor()
consulta = "SELECT * FROM tramite tr, en_demora de where tr.nrotramite = "+nrotramite+" and tr.idtramite = de.idtramite"
cursor.execute(consulta)
datos = cursor.fetchall()
if len(datos) != 0: return "en_demora"
consulta = "SELECT * FROM tramite tr, listo li where tr.nrotramite = "+nrotramite+" and tr.idtramite = li.idtramite"
cursor.execute(consulta)
datos = cursor.fetchall()
if len(datos) != 0: return "listo"
consulta = "SELECT * FROM tramite tr, observado ob where tr.nrotramite = "+nrotramite+" and tr.idtramite = ob.idtramite"
cursor.execute(consulta)
datos = cursor.fetchall()
if len(datos) != 0: return "observado"
##cursor.close()
#conexion.close()
def en_demora(nrotramite):
cursor = conexion.cursor()
consulta = "SELECT de.fecha_limite FROM tramite tr, en_demora de where tr.nrotramite = "+nrotramite+" and tr.idtramite = de.idtramite"
cursor.execute(consulta)
datos = cursor.fetchall()
return datos[0]
def listo(nrotramite):
cursor = conexion.cursor()
consulta = "SELECT li.fecha_aceptado,li.fecha_recojo FROM tramite tr, listo li where tr.nrotramite = "+nrotramite+" and tr.idtramite = li.idtramite"
cursor.execute(consulta)
datos = cursor.fetchall()
return datos[0]
def observado(nrotramite):
cursor = conexion.cursor()
consulta = "SELECT ob.descripcion, ob.fecha_limite_subsanacion FROM tramite tr, observado ob where tr.nrotramite = "+nrotramite+" and tr.idtramite = ob.idtramite"
cursor.execute(consulta)
datos = cursor.fetchall()
return datos[0]
def agregarTramitador():
cursor = conexion.cursor()
nuevo_registro = ("adolfo", "98765432")
consulta = "INSERT INTO tramitador(nombre, telefono) VALUES (%s, %s)"
cursor.execute(consulta, nuevo_registro)
conexion.commit()
cursor.close()