Forms with subforms are the way to go.
Programmatically:
Sub Main
REM SELECT * FROM `dummy`.`Table1` AS `Table1` WHERE `Name` LIKE CONCAT( ?, '%' )
Const cQuery = "Param_StartsWith"
Const cColumn = "Name"
Const cParam = "C"
iType = com.sun.star.sdb.CommandType.QUERY
con = ThisDatabaseDocument.CurrentController.ActiveConnection
oCmd = con.prepareCommand(cQuery, iType)
REM param indices are 1-based!
oCmd.setString(1, cParam)
oRS = oCmd.executeQuery()
'mri oRS
If oRS.first() AND oRS.isFirst() = True then
nCol = oRS.findColumn(cColumn)
Msgbox oRS.getString(nCol)
else
Msgbox "No records"
endif
End Sub
Quick translation to Python:
def ParamQuery_MariaDB():
from com.sun.star.sdb.CommandType import QUERY
# SELECT * FROM `dummy`.`Table1` AS `Table1` WHERE `Name` LIKE CONCAT( ?, '%' )
cQuery = "Param_StartsWith"
cColumn = "Name"
cParam = "C"
iType = QUERY
ThisDatabaseDocument = XSCRIPTCONTEXT.getDocument()
con = ThisDatabaseDocument.CurrentController.ActiveConnection
oCmd = con.prepareCommand(cQuery, iType)
oCmd.setString(1, cParam)
oRS = oCmd.executeQuery()
if oRS.first() and oRS.isFirst():
nCol = oRS.findColumn(cColumn)
print(oRS.getString(nCol))
else:
print("No records")