# Encoding: UTF-8

[{beforeRunningCommand: "nop",
  command: "\"$TM_BUNDLE_SUPPORT/bin/completion.rb\"",
  input: "none",
  keyEquivalent: "~",
  name: "Completion",
  output: "afterSelectedText",
  scope: "source.sql",
  uuid: "AFBD4D3D-926A-44B1-91CD-2BF793BCB8FD"},
 {beforeRunningCommand: "nop",
  command: 
   "#!/usr/bin/env perl\n$/=\\0;$_=<>; # Read all input\n\ns/\\s*\\-\\-.*$//g; # Strip comments\n\n1while s@^(([^'\"]*[\"'][^'\"]*[\"'])*[^\"']*)(\\n+|\\s{2,})@$1 @; # Compact whitespace\n\n# set defaultCStringEncoding to UTF-8 and open pbcopy\nopen(PBCOPY, '|__CF_USER_TEXT_ENCODING=$UID:0x8000100:0x8000100 pbcopy');\nprint PBCOPY; # Print the SQL to pbcopy\nclose PBCOPY;\nprint \"Copied SQL to Clipboard\";",
  input: "selection",
  keyEquivalent: "~@C",
  name: "Copy Condensed SQL",
  output: "showAsTooltip",
  scope: "source.sql",
  uuid: "37E7E7F5-DD1E-4306-B258-0F9176DC8D7E"},
 {beforeRunningCommand: "nop",
  command: "\"${TM_RUBY:=ruby}\" \"$TM_BUNDLE_SUPPORT/bin/db_browser.rb\"",
  input: "none",
  name: "Database Browser",
  output: "showAsHTML",
  uuid: "CDD74FE0-32E1-4604-BFC9-96173A557550"},
 {beforeRunningCommand: "nop",
  command: 
   "#!/usr/bin/env ruby -wKU\n\nrequire ENV['TM_BUNDLE_SUPPORT'] + '/bin/db_browser_lib.rb'\n\noptions = OpenStruct.new\nget_connection_settings(options)\n\nif options.server == 'mysql'\n  url = \"http://dev.mysql.com/\#{ENV['TM_CURRENT_WORD'].downcase}\"\nelsif options.server == 'postgresql'\n  url = \"http://www.postgresql.org/docs/current/static/sql-\#{ENV['TM_CURRENT_WORD'].downcase}.html\"\n  if `curl --silent -I \"\#{url}\" | grep '200 OK'`.empty?\n    url = \"http://search.postgresql.org/search?q=\#{ENV['TM_CURRENT_WORD'].downcase}\"\n  end\nend\nputs \"<script>window.location='\#{url}'</script>\"",
  input: "none",
  keyEquivalent: "^h",
  name: "Documentation for Current Word",
  output: "showAsHTML",
  scope: "source.sql",
  uuid: "245B2739-B3C5-4BBD-9772-C97C3C790BB6"},
 {beforeRunningCommand: "nop",
  command: 
   "query=${TM_SELECTED_TEXT:-$TM_CURRENT_LINE}\n\n\"${TM_RUBY:=ruby}\" \"$TM_BUNDLE_SUPPORT/bin/db_browser.rb\" --query=\"$(tr '\\n' ' ' <<< \"$query\")\"\n",
  fallbackInput: "line",
  input: "selection",
  keyEquivalent: "^Q",
  name: "Execute Line / Selection as Query",
  output: "showAsHTML",
  uuid: "C3045596-791D-11D9-9130-000A95766570"},
 {beforeRunningCommand: "nop",
  bundleUUID: "AAB4CBF7-73F9-11D9-B89A-000D93589AF6",
  command: 
   "#!/usr/bin/env bash\n\n. \"$TM_SUPPORT_PATH/lib/webpreview.sh\"\nhtml_header \"SQL Bundle Help\" \"SQL\"\n\n\"$TM_SUPPORT_PATH/lib/markdown_to_help.rb\" <<'MARKDOWN'\n<script type=\"text/javascript\" charset=\"utf-8\">\n\tfunction launchConfig() {\n\t    TextMate.system('\"$TM_BUNDLE_SUPPORT\"/bin/configure.sh 2>&1', null);\n\t    window.close();\n\t}\n</script>\nThe SQL bundle allows you to browse MySQL/PostgreSQL databases and execute queries.\n\n# Configuration\n\nBefore you can use the SQL bundle you must configure at least one SQL connection using the <a href=\"javascript:launchConfig()\">*Configure*</a> command.\nYou must provide at least a username and a hostname (note that if you wish to connect locally bypassing a socket, you must use `127.0.0.1` rather than `localhost`).\n\nYou can store multiple connections – use the ‘+’ button to add another connection. Whichever profile is selected when you close the dialog will be used when connecting.\n\nAlternatively you can set `TM_SQL_CONNECTION` to the title of a connection and it will take precedence. This is useful for setting connections on a per-project basis.\n\n# Execute Line / Selection as Query\n\nThe _Execute Line / Selection as Query_ command takes the selected text or current line and submits it as a query to either MySQL or PostgreSQL.\n\nYou will need to setup a database connection via the <a href=\"javascript:launchConfig()\">*Configure*</a> command. Pressing ⌃⇧Q on an empty line will open the database browser.\n\n# Database Browser\n\nThe database browser command displays a list of tables in whatever database you are currently working in using either PostgreSQL or MySQL. Click on the name of a database on the left to view the tables in that database.\n\nThe connection to your server is setup with the <a href=\"javascript:launchConfig()\">*Configure*</a> command.\n\nMARKDOWN\n\nhtml_footer\n",
  input: "none",
  name: "Help",
  output: "showAsHTML",
  scope: "source.sql",
  uuid: "FE9FF936-7E32-11D9-B7C6-000D93B6E43C"},
 {beforeRunningCommand: "nop",
  keyEquivalent: "~@,",
  command: "configure.sh",
  input: "none",
  name: "Preferences…",
  output: "discard",
  scope: "source.sql",
  uuid: "6374BC72-221E-4517-95DA-5D63B50E77BC"}]
