On 8/16/2016 3:57 PM, Kristjan Siimson wrote:
Basically when I said "query" I meant the SQL-language strings, which can be copy-pasted and executed independently. Some utilities (Percona tools) call it "dry run"; the queries are printed as strings for end user verification, and they never reach the database.

For example pt-table-sync in Percona toolkit (https://www.percona.com/doc/percona-toolkit/2.2/pt-table-sync.html) has --dry-run and --print options. I have a more application-specific DBA tool in mind for mitigating issues in a legacy application. Of course it's a very specific use case, and as direct queries lend to injection attacks, I would be somewhat surprised if it was possible. I still have hope that I have overlooked something. :-)

Sorry, there is no built in way to do this. But it seems like it should be pretty easy to roll your own.


The most flexible way to convert ordinary values to text is with the *racket/format* library.
https://docs.racket-lang.org/reference/strings.html?q=racket%2Fformat#%28mod-path._racket%2Fformat%29

The SRFI-48 library provides *format* which is similar to C's sprintf().
https://docs.racket-lang.org/srfi/srfi-std/srfi-48.html

For structured types like dates/times there are separate printing functions ... you just need to look up the type. Be aware that SQL dates and times are separate from Racket dates and times. You may need to convert types from one to the other to get what you want.
https://docs.racket-lang.org/db/util.html?q=date-%3Esql#%28mod-path._db%2Futil%2Fdatetime%29


For string manipulation Racket has whatever you need. Simplest is probably regex (built in). Look at *regexp-replaces* for an easy way to do multiple string substitutions.
https://docs.racket-lang.org/reference/strings.html
https://docs.racket-lang.org/reference/regexp.html
https://docs.racket-lang.org/reference/regexp.html?q=regex#%28def._%28%28lib._racket%2Fprivate%2Fbase..rkt%29._regexp-replaces%29%29


George

--
You received this message because you are subscribed to the Google Groups "Racket 
Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to racket-users+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to