Home Download Buy Blog Forum Support

Exec command and next_result/prev_result

Exec command and next_result/prev_result

Postby bizoo on Mon Jun 27, 2011 1:26 pm

I try to make my own build system based on the default one.
But I couldn't find a way to make next_result/prev_result working.
I try this:
Code: Select all
class OracleExecuteCommand(sublime_plugin.WindowCommand):
    def run(self, dsn):
        self.window.run_command("exec", {"cmd": ["sqlplus.exe", "-s", dsn, "@", sublime.packages_path()+"\\RunSQL.sql", self.window.active_view().file_name()], "line_regex": "^(.+?)@([0-9]+)/([0-9]+):(.+)$"})
        self.window.get_output_panel("exec")
        self.window.run_command("show_panel", {"panel": "output.exec"})

But it doesn't works.
It seems that the next_result/prev_result commands only work after a build command. Calling exec command is not enough.

Could someone help me please ?
bizoo
 
Posts: 876
Joined: Wed Dec 08, 2010 6:53 am
Location: Switzerland

Re: Exec command and next_result/prev_result

Postby bizoo on Mon Jun 27, 2011 1:38 pm

On the same subject:
Is there a way to give the build command a custom variable ?
Something like:
Code: Select all
{
   "cmd": ["sqlplus.exe", "-s", "${myvar:default}", "@", "${packages}\\RunSQL.sql", "\"$file\""],
   "file_regex": "^(.+?)@([0-9]+)/([0-9]+):(.+)$"
}

That we call with:
Code: Select all
window.run_command("build", {"myvar": "1252"})

The variable look to processed but never get the value passing to the build command.
bizoo
 
Posts: 876
Joined: Wed Dec 08, 2010 6:53 am
Location: Switzerland

Re: Exec command and next_result/prev_result

Postby jps on Mon Jun 27, 2011 1:55 pm

You need to pass exec a file_regex for this to work (line_regex is optional, but file_regex isn't)

There's no way to pass additional arguments to the build command, but there probably should be.
jps
Site Admin
 
Posts: 3062
Joined: Wed Mar 19, 2008 12:33 pm

Re: Exec command and next_result/prev_result

Postby bizoo on Mon Jun 27, 2011 2:13 pm

jps wrote:You need to pass exec a file_regex for this to work (line_regex is optional, but file_regex isn't)

There's no way to pass additional arguments to the build command, but there probably should be.

Damn, how I didn't notice that. :oops:

Additional arguments to the build command could give it a lot more flexibility.
Typically I need for some kind of files more than one build command and having dozen of different entry in the Build System menu is not very user friendly.
So I make a menu for them using the new quick panel API and call the exec command manually.
With additional arguments I could create a standard Build System file for all my needs.
bizoo
 
Posts: 876
Joined: Wed Dec 08, 2010 6:53 am
Location: Switzerland


Return to Technical Support

Who is online

Users browsing this forum: Google [Bot] and 28 guests