[TxMt] mysql snippet and query (getting a carriage return?)
Paul Nordstrom August
paul at archivistes.com
Wed Dec 1 17:00:26 UTC 2004
Following up on a post from a week or so ago, I've created a "mysql"
snippet to run MySQL commands within TM. (This probably works best if
you have a ~/usr/.my.cnf file configured with a default login and
password on localhost.)
The snippet simply is the following: /usr/local/mysql/bin/mysql
${1:database} -e "${2:SELECT}"
... so I hit mysql, tab, then enter the DB name and then the command.
Some sample queries are appended below.
My problem is that the output begins directly after the final " in the
-e statement. What's the easiest way to insert a carriage return here?
Or is this better run as a command and not a snippet?
I've already got macros to convert DESCRIBE TABLE output into all sorts
of PHP elements... TM is great :)
Paul
> /usr/local/mysql/bin/mysql iedb -e "show tables"
> Tables_in_iedb
> clients
> firms
> iedbdata
> irt_metadata
> metadata
> sections
> stock
> /usr/local/mysql/bin/mysql iedb -e "describe
> metadata"Field Type Null Key Default Extra
> field_id int(11) PRI NULL auto_increment
> section_id int(2) YES NULL
> category varchar(100) YES NULL
> subcategory varchar(100) YES NULL
> section varchar(100) YES NULL
> subsection varchar(100) YES NULL
> field varchar(255) YES NULL
> descr tinytext YES NULL
> type varchar(100) YES NULL
> avail varchar(100) YES NULL
> comments text YES NULL
> fieldcode varchar(100) YES NULL
> /usr/local/mysql/bin/mysql iedb -e "select * from
> clients"clno fname lname job account_balance
> 10 sam smith auditor 5525.75
> 20 james jones manager 8960.25
More information about the textmate
mailing list