[SVN] SQL schema browser

Brad Miller bonelake at mac.com
Fri Feb 17 00:08:58 UTC 2006


Hi everyone,

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.  The idea is that it will list the tables in your  
database, and then
allow you to click on a table to see all the columns in that table.

Inspired by the weblog entry and the ruby documentation command I set  
out:


Here's what my script generates:

<script>
        function tb(db,tbl) {
           var cmd = "tableBrowser.py --database=" + db + " --table="  
+ tbl;
           var res = TextMate.system(cmd, null).outputString;
           document.getElementById("result").innerHTML = res;
           window.location.hash = "result";
        }
     </script>
<ul class='tableList'>
<li><a
href='javascript:tb(%22bmiller%22,%22public.mycourse% 
22)'>public.mycourse</a></li>
<li><a
href='javascript:tb(%22bmiller%22,%22public.mystudent% 
22)'>public.mystudent</a></li>
<li><a
href='javascript:tb(%22bmiller%22,%22public.mytranscript% 
22)'>public.mytranscript</a></li>
<li><a
href='javascript:tb(%22bmiller%22,%22wfb.belongs_to% 
22)'>wfb.belongs_to</a></li>
<li><a
href='javascript:tb(%22bmiller%22,%22wfb.boundaries% 
22)'>wfb.boundaries</a></li>
<li><a
href='javascript:tb(%22bmiller%22,%22wfb.countries% 
22)'>wfb.countries</a></li>
<li><a href='javascript:tb(%22bmiller%22,%22wfb.flags%22)'>wfb.flags</ 
a></li>
<li><a href='javascript:tb(%22bmiller%22,%22wfb.maps%22)'>wfb.maps</ 
a></li>
<li><a
href='javascript:tb(%22bmiller%22,%22wfb.organizations% 
22)'>wfb.organizations</a></li>
</ul>


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.

Does the result of calling TextMate.System() include output to stdout  
from the command it runs?

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.

Any help is much appreciated!

Thanks,

Brad

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.macromates.com/textmate-dev/attachments/20060216/d0068fe2/attachment.html>


More information about the textmate-dev mailing list