[SVN] SQL schema browser
Allan Odgaard
throw-away-1 at macromates.com
Fri Feb 17 04:41:49 UTC 2006
On 17/2/2006, at 1:08, Brad Miller wrote:
> Since I'm always forgetting the names of the tables and their
> columns, I thought I would put together a nice schema browser for
> the SQL bundle [...]
Sound very cool! Looking forward to ditching CocoaMySQL :)
> So far so good, the html window pops up and displays this little
> list of tables.
> The problem is that when I click on any of the generated links
> nothing happens...
>
> Any hints on how to debug this? I'm not sure if its a javascript
> thing or what. I'm no javascript expert to begin with. So I'm
> just trying to follow the examples that I see.
One thing with JavaScript is that it seems to just silently quit at
the point of where there is an error, be it syntactical or semantic.
What I do is add “<div id="debug"></div>” to the HTML part, and then
put lines like the following in my script, to see how far it gets:
document.getElementById("debug").innerText = "«line number»";
As for your problem though, I think it is only, that tableBrowser.py
is not found. You will have to specify the absolute path -- commands
executed from JavaScript do not go through the normal shell startup,
and they have no TM-variables available.
> Does the result of calling TextMate.System() include output to
> stdout from the command it runs?
Do you mean stderr? If so, no. The result of system() is an object
with 3 attributes: outputString, errorString, and status (see table
15 at [1]).
Strangely though, I just tried creating a simple example which calls
a non-existing shell command, and both outputString and errorString
were empty, plus status was 0. Not sure if there is an underlying
problem here -- although as long as the executable is found, there
should be no problem (you can always try to execute a “which” or
“type -p”).
> Allan: There are differences between the actual ruby command and
> what is documented on the weblog. Particularly the <a tag uses
> onClick in the weblog and getElementById("result").innerHTML is
> innerText on the weblog. I know the first one is significant
> because you don't get a link without the href="javascript:xxx"
> stuff. Not sure about innerHTML versus inner Text.
The underlining of using the href argument I think can conceptually
just be viewed as the default style sheet having a rule like below
(because people expect anchors to be underlined, where the onClick is
the general on-click event-handler that can be set on any element,
though it also only can call out to the scripting language, not
specify arbitrary URLs like the hyper-ref attribute):
a[href] { text-decoration: underline; }
As for innerHTML versus innerText: the former will treat the string
as HTML, adding new nodes to the DOM, that is, innerHTML = '<b>test</
b>'; will insert ‘test’ in bold, where had we used innerText, it
would insert the entire string (as text).
I think the Ruby documentation command from my weblog asks the ri
command for the plain text version of the documentation, but the
current command asks for a HTML version, hence the difference.
oh, there actually is one other difference between href and onClick.
Since the former normally is used to link to a new page, the href
attribute argument would normally be placed in the location bar of
the browser. But if the script returns false (or it seems, returns
nothing), the browser is prevented from following the link -- though
AFAIK this is more of a de-facto standard than an actual standard.
[1] http://developer.apple.com/documentation/AppleApplications/
Conceptual/Dashboard_ProgTopics/Articles/CommandLine.html#//apple_ref/
doc/uid/TP40003050-DontLinkElementID_21
More information about the textmate-dev
mailing list