[TxMt] Broken in r1405: Execute Line / Selection as Query: Only works for a line - not multi-line selection

Brad Miller bmiller at luther.edu
Mon Jul 16 22:53:04 UTC 2007


Cliff,

The difficulty is that the new version introduced a completely and much more
friendly way to maintain configuration information like your database
username, password, and the database you want to use.  The new version also
has a completely re-written interface to the table browser, which is now
used for executing queries as well.

If you want a quick and dirty work-around for yourself  You can use the
bundle editor to create your own command:

Set up the command in your own personal bundle as follows:

Save:  Current File  (or Nothing if you prefer)
Commands:   mysql --html --user=<your username> --password=<yourpassword>
--database=<yourdatabase>

Input:  Selected Text or Document
Output: Show as html


Assign a key equivalent  like cmd-R
Scope selector:  source.sql

Now if you are in a sql file and hit cmd-R with nothing selected the entire
file will be piped to mysql and the results will appear as an html table.
If you do the same thing, but with several queries selected then only the
selected queries will be piped to mysql.

Hope that helps people until a permanent solution within the SQL bundle is
found.

Brad

-- 
Brad Miller
Assistant Professor, Computer Science
Luther College

On 7/16/07, Cliff Pruitt <lists.cpruitt at cliffpruitt.com> wrote:
>
> I'm a little confused (not using the bundle much).  If it's working
> in an older version of the bundle, can't you simply re-name the old
> version of the command and re-introduce it to the bundle (either
> officially or as a user change) with the new name?  Is there
> something else about the current version Bundle that would break the
> old command?
>
> - Cliff
>
> On Jul 16, 2007, at 3:41 PM, Allan Odgaard wrote:
>
> > On 16. Jul 2007, at 11:14, Jeremy Keen wrote:
> >
> >> Shame. I NEED multi-line SQL Execution. I will be sticking with a
> >> previous version of TM then.
> >>
> >> I can't see how the issue of SQL injection matters though...
> >
> > I am parroting Ciarán here, but the problem with injection is when
> > a string is taken from the user and just inserted into a query.
> > E.g. SELECT * FROM table WHERE text = "$string" -- here the user
> > would ensure that $string starts with "; and if multi-line queries
> > is supported, can basically do whatever SQL command he desires.
> >
> > It seems rather brutal to just cut-off the ability to do multi-line
> > queries in the MySQL API, but apparently that's what they decided.
> >
> >> Anyone got a work-around? Can I use the SQL bundle from a previous
> >> version in the latest version?
> >
> > That should work, I think r7187 is the last revision prior to the
> > change. So use the following command to checkout that bundle:
> >
> >     svn co http://macromates.com/svn/Bundles/trunk/Bundles/
> > SQL.tmbundle at 7187
> >
> > There's a lot of people who do want the multi-line query
> > functionality back, and I used it as well, so presumably a solution
> > will be found, but for now there is the old bundle for those who
> > want it now.
> >
> >
> > ______________________________________________________________________
> > For new threads USE THIS: textmate at lists.macromates.com
> > (threading gets destroyed and the universe will collapse if you don't)
> > http://lists.macromates.com/mailman/listinfo/textmate
>
>
>
> ______________________________________________________________________
> For new threads USE THIS: textmate at lists.macromates.com
> (threading gets destroyed and the universe will collapse if you don't)
> http://lists.macromates.com/mailman/listinfo/textmate
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.macromates.com/textmate/attachments/20070716/b1cc9f54/attachment.html>


More information about the textmate mailing list