Initial commit
This commit is contained in:
No files matched your search
@@ -40,7 +40,7 @@ func (h *DatabaseHandler) handleDatabaseInsert(client *Client, message WebSocket
|
||||
return nil
|
||||
}
|
||||
|
||||
table, ok := data["table"].(string)
|
||||
table, ok := data["m_deviceqris"].(string)
|
||||
if !ok || table == "" {
|
||||
client.sendErrorResponse("Invalid table name", "table is required")
|
||||
return nil
|
||||
@@ -55,7 +55,7 @@ func (h *DatabaseHandler) handleDatabaseInsert(client *Client, message WebSocket
|
||||
// Perform actual database insert
|
||||
if h.hub.dbService != nil {
|
||||
// Get database connection
|
||||
db, err := h.hub.GetDatabaseConnection("postgres_satudata")
|
||||
db, err := h.hub.GetDatabaseConnection("simrs_backup")
|
||||
if err != nil {
|
||||
client.sendErrorResponse("Database connection error", err.Error())
|
||||
return nil
|
||||
@@ -110,14 +110,14 @@ func (h *DatabaseHandler) handleDatabaseQuery(client *Client, message WebSocketM
|
||||
return nil
|
||||
}
|
||||
|
||||
table, ok := data["table"].(string)
|
||||
table, ok := data["m_deviceqris"].(string)
|
||||
if !ok || table == "" {
|
||||
client.sendErrorResponse("Invalid table name", "table is required")
|
||||
return nil
|
||||
}
|
||||
|
||||
// Execute query
|
||||
results, err := h.hub.ExecuteDatabaseQuery("postgres_satudata", fmt.Sprintf("SELECT * FROM %s LIMIT 100", table))
|
||||
results, err := h.hub.ExecuteDatabaseQuery("simrs_backup", fmt.Sprintf("SELECT * FROM %s LIMIT 100", table))
|
||||
if err != nil {
|
||||
client.sendErrorResponse("Database query error", err.Error())
|
||||
return nil
|
||||
@@ -142,7 +142,7 @@ func (h *DatabaseHandler) handleDatabaseCustomQuery(client *Client, message WebS
|
||||
|
||||
database, ok := data["database"].(string)
|
||||
if !ok || database == "" {
|
||||
database = "postgres_satudata"
|
||||
database = "simrs_backup"
|
||||
}
|
||||
|
||||
query, ok := data["query"].(string)
|
||||
|
||||
Reference in New Issue
Block a user