mirror of
https://github.com/KeymonSoft/Ruteador-NonUI.git
synced 2026-04-20 14:19:23 +00:00
Commit inicial
This commit is contained in:
57
delDB.bas
Normal file
57
delDB.bas
Normal file
@@ -0,0 +1,57 @@
|
||||
B4J=true
|
||||
Group=Default Group
|
||||
ModulesStructureVersion=1
|
||||
Type=Class
|
||||
Version=10
|
||||
@EndOfDesignText@
|
||||
Sub Class_Globals
|
||||
Private mreq As ServletRequest 'ignore
|
||||
Private mresp As ServletResponse 'ignore
|
||||
' Dim cmd As DBCommand
|
||||
Dim theQuery As String
|
||||
Dim m, m2 As Map
|
||||
Dim getHash As CalculateHash
|
||||
Dim js As JSONGenerator
|
||||
End Sub
|
||||
|
||||
'Initializes the object. You can add parameters to this method if needed.
|
||||
Public Sub Initialize
|
||||
|
||||
End Sub
|
||||
|
||||
'Resumable Subs (wait for / sleep) in server handlers
|
||||
'Resumable subs can only work when there is a message queue.
|
||||
'By default, server handlers end when the Handle sub is completed. They do not create a message loop.
|
||||
'If you want to wait for an event then you need to call StartMessageLoop and later StopMessageLoop.
|
||||
'https://www.b4x.com/android/forum/threads/resumable-subs-wait-for-sleep-in-server-handlers.81833/
|
||||
Sub Handle(req As ServletRequest, resp As ServletResponse)
|
||||
' Log("q='"&req.GetParameter("q")&"'")
|
||||
Log($"REQ: ${req.FullRequestURI}"$)
|
||||
Private b As String = req.GetParameter("b")
|
||||
If b = 1 Then
|
||||
Try
|
||||
Log("Borramos base")
|
||||
Main.db.InitializeSQLite(File.DirApp, "kmt.db", True)
|
||||
|
||||
Main.db.ExecNonQuery("PRAGMA writable_schema = 1")
|
||||
Main.db.ExecNonQuery("delete from sqlite_master where Type in ('table', 'index', 'trigger')")
|
||||
Main.db.ExecNonQuery("PRAGMA writable_schema = 0")
|
||||
|
||||
' Private t As ResultSet = Main.db.ExecQuery($"Select name FROM sqlite_master WHERE Type='table'"$)
|
||||
' Do While t.NextRow
|
||||
' Log(t.GetString("name"))
|
||||
' Main.db.ExecNonQuery($"drop table ${t.GetString("name")}"$)
|
||||
' Loop
|
||||
Main.db.ExecNonQuery("vacuum")
|
||||
|
||||
Catch
|
||||
Log(LastException)
|
||||
End Try
|
||||
Else
|
||||
resp.ContentType = "text/html"
|
||||
resp.Write("Hay un error en la solicitud, son necesarios los parametros:<br>* r - La ruta<br>* a - El almacen<br>* c - id_cliente,lon,lat separadas por punto y coma.<br>* m - La matriz a usar LOCAL u OSRM (Opcional, default local)") 'this file will be loaded from the www folder
|
||||
End If
|
||||
End Sub
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user