I'm about to embark on a lengthy and complex project (changing 30-odd FileMaker tables into MySQL). Usually I use the (excellent) CocoaMySQL for table creation but I thought I'd explore using snippets in TM...
Basically it works like a charm (create table, add date field, add varchar, add int...), though I haven't tested it vs CocoaMySQL to see which will be faster (as CMS offers more tweaking of the field definitions). But I figure I can whack out the fields in TM then import the whole .sql file into CMS for the tweaking, adding indexes, etc.
CREATE TABLE textmate ( textmate_id int(11) NOT NULL auto_increment, tm_user varchar(50) default NULL, user_no int(5) default NULL, user_email varchar(50) default NULL, entry_date date default NULL, PRIMARY KEY (textmate_id) ) ENGINE=InnoDB;
The one thing I can't manage to sort out is including e.g. "`textmate_id`" since the "`" is used in the snippets to evoke a shell command... I tried escaping with "`" but that didn't work. Am I missing something obvious?
In any case, it's clear that snippets can revolutionize coding :) Wish I had more time to explore... embedding shell commands could be fantastic...
Paul
On 09.11.2004, at 15:45, Paul Nordstrom August wrote:
The one thing I can't manage to sort out is including e.g. "`textmate_id`" since the "`" is used in the snippets to evoke a shell command... I tried escaping with "`" but that didn't work. Am I missing something obvious?
It's ugly, but it works: `printf '\140'`textmate_id`printf '\140'` See man ascii for other character codes.
Cheers, -Ralph.
On 09-11-2004 15:45, Paul Nordstrom August wrote:
The one thing I can't manage to sort out is including e.g. "`textmate_id`" since the "`" is used in the snippets to evoke a shell command... I tried escaping with "`" but that didn't work. Am I missing something obvious?
This is probably a problem because of "stacking" of escapes, i.e. TextMate strips off an escape, but feeds it to another process, which strips off another escape and finally it is fed to the shell, which strips off the last escape.
So try to experiment with more escapes. You need three slashes to get an escape to the shell: "echo \' " as command in TM prints a '.
Jeroen.
PS. If you think this is bad, Have a look at the plist syntax highlighting file, I had to use 8 consecutive slashes there to be able to recognize 2 consecutive ones in the text ;-)
On 9. Nov 2004, at 15:45, Paul Nordstrom August wrote:
The one thing I can't manage to sort out is including e.g. "`textmate_id`" since the "`" is used in the snippets to evoke a shell command... I tried escaping with "`" but that didn't work. Am I missing something obvious?
Sorry, that's my bad. I completely forgot about escaping them, when I added shell command interpolation.
I'll have it fixed for beta 4, although it doesn't help you here and now -- I hope you can do with the trick Ralph suggested!?!
Kind regards Allan
hi Allan Thanks for the rapid follow-up -- (one of) the great things about TM! I tried Joeren's multiple escapes to no avail (perhaps didn't apply properly and a bit rushed) but will wait for the next beta. Thanks to all for their tips.
What's interesting to me (and I'm sure others have noted this) is how TM is serving as a model for a rapid-feedback system for software design. Perhaps the lack of this (not Barebones's fault, mind you, given their older roots) explains why BBEdit is so currently bloated?
cheers Paul
On 9 Nov 2004, at 22:05, Allan Odgaard wrote:
On 9. Nov 2004, at 15:45, Paul Nordstrom August wrote:
The one thing I can't manage to sort out is including e.g. "`textmate_id`" since the "`" is used in the snippets to evoke a shell command... I tried escaping with "`" but that didn't work. Am I missing something obvious?
Sorry, that's my bad. I completely forgot about escaping them, when I added shell command interpolation.
I'll have it fixed for beta 4, although it doesn't help you here and now -- I hope you can do with the trick Ralph suggested!?!
Kind regards Allan
until it's fixed in TextMate, you can probably get by with leaving off the backticks in all your SQL queries. The only time you would need them is if the mysql field, table, or database name includes some character that is not alphanumeric or an underscore. Plus, you would be writing more portable SQL code by leaving out the backticks and avoiding funny characters in your identifiers altogether.
k
On Nov 9, 2004, at 8:45 AM, Paul Nordstrom August wrote:
I'm about to embark on a lengthy and complex project (changing 30-odd FileMaker tables into MySQL). Usually I use the (excellent) CocoaMySQL for table creation but I thought I'd explore using snippets in TM...
Basically it works like a charm (create table, add date field, add varchar, add int...), though I haven't tested it vs CocoaMySQL to see which will be faster (as CMS offers more tweaking of the field definitions). But I figure I can whack out the fields in TM then import the whole .sql file into CMS for the tweaking, adding indexes, etc.
CREATE TABLE textmate ( textmate_id int(11) NOT NULL auto_increment, tm_user varchar(50) default NULL, user_no int(5) default NULL, user_email varchar(50) default NULL, entry_date date default NULL, PRIMARY KEY (textmate_id) ) ENGINE=InnoDB;
The one thing I can't manage to sort out is including e.g. "`textmate_id`" since the "`" is used in the snippets to evoke a shell command... I tried escaping with "`" but that didn't work. Am I missing something obvious?
In any case, it's clear that snippets can revolutionize coding :) Wish I had more time to explore... embedding shell commands could be fantastic...
Paul
textmate mailing list textmate@lists.macromates.com http://lists.macromates.com/mailman/listinfo/textmate