Skip to main content

system.kanoa.lot.deleteRoute

Requires kanoaOPS license

Description

Deletes a route record from the database.

Syntax

deleteRoute(routeId, userId)

Parameters:

– routeId (int): The ID of the route to delete.
– userId (int): The ID of the user performing the deletion.

Returns:

– recordsModified (int): Number of records deleted (typically 1).
– message (string): None if success; error message if an exception occurs.

Behavior

The function permanently removes a route record from the mes.route table.

– Logs the deletion attempt for audit purposes.
– Executes a parameterized SQL DELETE query to prevent SQL injection.
– Returns the number of deleted records and None if successful.
– Returns an error message if the deletion fails.

Parameters

ParameterTypeRequiredNotes
routeIdintYesID of the route to delete
userIdintYesID of the user performing the deletion

Code Examples

# Delete a route by ID
recordsModified, msg = system.kanoa.lot.deleteRoute(
routeId=10,
userId=123
)
print(recordsModified, msg) # (1, None)

# Attempt to delete a route that doesn't exist
recordsModified, msg = system.kanoa.lot.deleteRoute(
routeId=9999,
userId=123
)
print(recordsModified, msg) # (0, None)