I wasn't able to get jtrujillo's answer to work, but after much testing was able to convert my db query macros to dbx macros. Note, this is for a mysql database, if you have an oracle database or a different time format in the database, then you'll have to adjust the strftime format to match the time format in the database.
Simplified Macro Search Query:
dbxstart SELECT * FROM Database.Table WHERE timefield>= %earliest_time% AND timefield< %latest_time% dbxend("dbConnectName") maxrows=1000
Macro `dbxstart'
index=XXX | stats count | addinfo | eval et=round(info_min_time,0) | eval lt=if(info_max_time='+Infinity','now',round(info_max_time,0)) | convert timeformat='%Y-%m-%d" "%H:%M:%S' ctime(et), ctime(lt) | eval search="
Macro 'dbxend(1)' - with 1 argument for your connection name
" | eval search=replace(search, "%earliest_time%",et) | eval search=replace(search, "%latest_time%", lt) | map search="| dbxquery connection="$connection$" query=$search$ "
So this is what the Full Search looks like without Macros:
index=XXX | stats count | addinfo | eval et=round(info_min_time,0) | eval lt=if(info_max_time='+Infinity','now',round(info_max_time,0)) | convert timeformat='%Y-%m-%d" "%H:%M:%S' ctime(et), ctime(lt)
| eval search="SELECT * FROM Database.Table WHERE timefield>= %earliest_time% AND timefield< %latest_time% "
| eval search=replace(search, "%earliest_time%",et) | eval search=replace(search, "%latest_time%", lt)
| map search="| dbxquery connection="dbConnectName" query=$search$ " maxrows=1000
... View more