aboutsummaryrefslogtreecommitdiffstats
path: root/SharedSupport
diff options
context:
space:
mode:
Diffstat (limited to 'SharedSupport')
-rw-r--r--SharedSupport/Default Bundles/CopyAsJSON.spBundle/command.plist132
-rw-r--r--SharedSupport/Default Bundles/CopySingleLineQuoted.spBundle/command.plist49
-rw-r--r--SharedSupport/Default Bundles/DB Report.spBundle/Support/header.html41
-rwxr-xr-xSharedSupport/Default Bundles/DB Report.spBundle/Support/processTableData.pl32
-rw-r--r--SharedSupport/Default Bundles/DB Report.spBundle/command.plist174
-rw-r--r--SharedSupport/Default Bundles/Format SQL.spBundle/command.plist203
-rw-r--r--SharedSupport/Default Bundles/Toggle JSON Format.spBundle/command.plist72
-rw-r--r--SharedSupport/Default Bundles/WrapInDelimiter.spBundle/command.plist47
8 files changed, 750 insertions, 0 deletions
diff --git a/SharedSupport/Default Bundles/CopyAsJSON.spBundle/command.plist b/SharedSupport/Default Bundles/CopyAsJSON.spBundle/command.plist
new file mode 100644
index 00000000..f4f1ecd9
--- /dev/null
+++ b/SharedSupport/Default Bundles/CopyAsJSON.spBundle/command.plist
@@ -0,0 +1,132 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
+<plist version="1.0">
+<dict>
+ <key>author</key>
+ <string>Hans-Jörg Bibiko</string>
+ <key>category</key>
+ <string>Copy</string>
+ <key>command</key>
+ <string>cat | perl -e '
+
+# read first line to get the column names (header)
+$firstLine = &lt;&gt;;
+
+# bail if nothing could read
+if(!defined($firstLine)) {
+ exit 0;
+}
+
+# store the column names
+chomp($firstLine);
+$firstLine =~ s/\"/\\\"/g; # escape "
+@header = split(/\t/, $firstLine);
+
+$h_cnt = $#header; # number of columns
+
+# get the column definitions
+open(META, $ENV{"SP_BUNDLE_INPUT_TABLE_METADATA"}) or die $!;
+@meta = ();
+while(&lt;META&gt;) {
+ chomp();
+ my @arr = split(/\t/);
+ push @meta, \@arr;
+}
+close(META);
+
+print "{\n\t\"data\":\n\t[\n";
+
+# read row data of each selected row
+$rowData=&lt;&gt;;
+while($rowData) {
+
+ print "\t\t{\n";
+
+ # remove line ending
+ chomp($rowData);
+
+ # escape "
+ $rowData=~s/\"/\\\"/g;
+
+ # split column data which are tab-delimited
+ @data = split(/\t/, $rowData);
+ for($i=0; $i&lt;=$h_cnt; $i++) {
+
+ # re-escape \t and \n
+ $cellData = $data[$i];
+ $cellData =~ s/↵/\n/g;
+ $cellData =~ s/⇥/\t/g;
+
+ print "\t\t\t\"$header[$i]\": ";
+
+ # check for data types
+ if($cellData eq "NULL") {
+ print "null";
+ }
+ elsif($meta[$i]-&gt;[1] eq "integer" || $meta[$i]-&gt;[1] eq "float") {
+ chomp($cellData);
+ $d = $cellData+0;
+ print "$d";
+ } else {
+ chomp($cellData);
+ print "\"$cellData\"";
+ }
+
+ # suppress last ,
+ if($i&lt;$h_cnt) {
+ print ",";
+ }
+
+ print "\n";
+
+ }
+
+ print "\t\t}";
+
+ # get next row
+ $rowData=&lt;&gt;;
+
+ # suppress last ,
+ if($rowData) {
+ print ",";
+ }
+
+ print "\n";
+}
+
+print "\t]\n}";
+
+' | __CF_USER_TEXT_ENCODING=$UID:0x8000100:0x8000100 pbcopy</string>
+ <key>contact</key>
+ <string>znvy@ovovxb.qr</string>
+ <key>description</key>
+ <string>Copies the selected rows excluding any BLOB data in a data table JSON formatted into the pasteboard.
+
+Version 1.0</string>
+ <key>input</key>
+ <string>selectedtablerowsastab</string>
+ <key>internalKeyEquivalent</key>
+ <dict>
+ <key>characters</key>
+ <string>C</string>
+ <key>keyCode</key>
+ <integer>8</integer>
+ <key>modifierFlags</key>
+ <integer>262144</integer>
+ </dict>
+ <key>keyEquivalent</key>
+ <string>^c</string>
+ <key>name</key>
+ <string>Copy as JSON</string>
+ <key>output</key>
+ <string>none</string>
+ <key>scope</key>
+ <string>datatable</string>
+ <key>tooltip</key>
+ <string>Copies the selected rows excluding any BLOB data JSON formatted into the pasteboard</string>
+ <key>uuid</key>
+ <string>CBB8B7A7-5AB9-4F4C-A404-D99CA9521337</string>
+ <key>isDefaultBundle</key>
+ <true/>
+</dict>
+</plist>
diff --git a/SharedSupport/Default Bundles/CopySingleLineQuoted.spBundle/command.plist b/SharedSupport/Default Bundles/CopySingleLineQuoted.spBundle/command.plist
new file mode 100644
index 00000000..56cdd9c4
--- /dev/null
+++ b/SharedSupport/Default Bundles/CopySingleLineQuoted.spBundle/command.plist
@@ -0,0 +1,49 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
+<plist version="1.0">
+<dict>
+ <key>author</key>
+ <string>Hans-Jörg Bibiko</string>
+ <key>category</key>
+ <string>Query Editor</string>
+ <key>command</key>
+ <string>cat | perl -ne 'chomp;s/\t/ /g;s/"/\\"/g;print "\"".$_."\" . \"\\n\" .\n"' | sed '$ s/.........$//' | sed '$ s/$/;/' | __CF_USER_TEXT_ENCODING=$UID:0x8000100:0x8000100 pbcopy</string>
+ <key>contact</key>
+ <string>znvy@ovovxb.qr</string>
+ <key>description</key>
+ <string>Takes the current query or the selection and copies it as a single line quoted multi-line string by appending a ; into the pasteboard for usage in other IDEs as e.g. PHP code snippet.
+
+Example:
+
+SELECT a
+ FROM b
+ ORDER BY c DESC
+
+will copy
+
+"SELECT a" . "\n" .
+" FROM b" . "\n" .
+" ORDER BY c DESC";
+
+Version 1.0
+</string>
+ <key>input</key>
+ <string>selectedtext</string>
+ <key>input_fallback</key>
+ <string>currentquery</string>
+ <key>keyEquivalent</key>
+ <string></string>
+ <key>name</key>
+ <string>Copy Single Line Quoted</string>
+ <key>output</key>
+ <string>none</string>
+ <key>scope</key>
+ <string>inputfield</string>
+ <key>tooltip</key>
+ <string>Takes the current query or the selection and copies it as a single line quoted multi-line string by appending a ; into the pasteboard</string>
+ <key>uuid</key>
+ <string>CDAC825A-AE80-4544-9DBB-8E68A5C540D0</string>
+ <key>isDefaultBundle</key>
+ <true/>
+</dict>
+</plist>
diff --git a/SharedSupport/Default Bundles/DB Report.spBundle/Support/header.html b/SharedSupport/Default Bundles/DB Report.spBundle/Support/header.html
new file mode 100644
index 00000000..b67b633c
--- /dev/null
+++ b/SharedSupport/Default Bundles/DB Report.spBundle/Support/header.html
@@ -0,0 +1,41 @@
+<html>
+ <head>
+ <title>Database Report</title>
+ <style type="text/css">
+ hr {
+ background: #606060;
+ color: #606060;
+ border-style: solid;
+ border-color: #606060;
+ border-width: 2px 0 0 0;
+ margin-top: 0;
+ }
+ a:hover {
+ text-decoration: none;
+ }
+ a {
+ text-decoration: none;
+ }
+ a:hover:after {
+ content: " ➪";
+ }
+ .nonVisible {
+ display:none;
+ }
+ </style>
+ <script type="text/javascript" charset="utf-8">
+ function toggle_display(elt)
+ {
+ var e; var p;
+ e = elt.getAttribute("id") + ":data";
+ if (window.document.getElementById(e).className != "") {
+ window.document.getElementById(e).className = "";
+ elt.innerHTML = "▼";
+ } else {
+ window.document.getElementById(e).className = "nonVisible";
+ elt.innerHTML = "▶";
+ }
+ }
+ </script>
+ </head>
+<body>
diff --git a/SharedSupport/Default Bundles/DB Report.spBundle/Support/processTableData.pl b/SharedSupport/Default Bundles/DB Report.spBundle/Support/processTableData.pl
new file mode 100755
index 00000000..7d0b5545
--- /dev/null
+++ b/SharedSupport/Default Bundles/DB Report.spBundle/Support/processTableData.pl
@@ -0,0 +1,32 @@
+#!/usr/bin/env perl -w
+
+while(<>) {
+
+ # split tab delimited data
+ @data = split(/\t/);
+
+ $pid = $ENV{"PID"};
+ $db = $ENV{"DB"};
+ $res = $ENV{"RES"};
+ $itemType = "table";
+
+ # $data[1] is NULL indicates item is a view
+ if($data[1] eq "NULL") {
+ $img = "file://$res/table-view-small-square.tiff";
+ $itemType = "view";
+ } else {
+ $img = "file://$res/table-small-square.tiff";
+ }
+
+ print <<HTML4;
+ <tr>
+ <td align=center width='40px'><img src=\"$img\"></td>
+ <td><a href=\"sequelpro://$pid\@passToDoc/SelectDatabase/$db/$data[0]/\" title=\"Click to select $itemType “$db.$data[0]”\">$data[0]</a></td>
+ <td>$data[1]</td>
+ <td align=right>$data[4]</td>
+ <td align=right>$data[6]</td>
+ <td align=right>$data[11]</td>
+ <td align=right>$data[12]</td>
+ </tr>
+HTML4
+} \ No newline at end of file
diff --git a/SharedSupport/Default Bundles/DB Report.spBundle/command.plist b/SharedSupport/Default Bundles/DB Report.spBundle/command.plist
new file mode 100644
index 00000000..e6c808ae
--- /dev/null
+++ b/SharedSupport/Default Bundles/DB Report.spBundle/command.plist
@@ -0,0 +1,174 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
+<plist version="1.0">
+<dict>
+ <key>author</key>
+ <string>Hans-Jörg Bibiko</string>
+ <key>category</key>
+ <string>Report</string>
+ <key>command</key>
+ <string>
+# Since this command will execute SQL statements at the front most
+# document window's connection check for a passed process ID to cancel
+# this command by displaying a tooltip. Otherwise the loop after
+# “open "sequelpro://$SP_PROCESS_ID@passToDoc/ExecuteQuery"”
+# won't break.
+if [ -z $SP_PROCESS_ID ]; then
+ echo "&lt;font color=red&gt;No front most connection window found!&lt;/font&gt;"
+ exit $SP_BUNDLE_EXIT_SHOW_AS_HTML_TOOLTIP
+fi
+
+# send query to Sequel Pro
+cat &lt;&lt;SQL &gt; "$SP_QUERY_FILE"
+SELECT TABLE_SCHEMA AS Name, FORMAT((SUM(DATA_LENGTH)+SUM(INDEX_LENGTH))/1000, 1) AS \`Size (kiB) incl. indices\`
+FROM information_schema.TABLES
+GROUP BY TABLE_SCHEMA
+SQL
+
+# execute the SQL statement; the result will be available in the file $SP_QUERY_RESULT_FILE
+open "sequelpro://$SP_PROCESS_ID@passToDoc/ExecuteQuery"
+
+# wait for Sequel Pro; status file will be written to disk if query was finished
+while [ 1 ]
+do
+ [[ -e "$SP_QUERY_RESULT_STATUS_FILE" ]] &amp;&amp; break
+ sleep 0.01
+done
+
+# Prepair HTML code
+cat "$SP_BUNDLE_PATH/Support/header.html"
+cat &lt;&lt;HTML1
+&lt;center&gt;
+&lt;h3&gt;&lt;font color=blue&gt;Connection: ‘$SP_CURRENT_HOST’ – $SP_RDBMS_TYPE ($SP_RDBMS_VERSION)&lt;/font&gt;&lt;/h3&gt;
+&lt;table width=80%&gt;
+ &lt;tr&gt;
+ &lt;td align=center&gt;&lt;img width='96px' src='file://$SP_ICON_FILE'&gt;&lt;/td&gt;
+ &lt;td&gt;
+ &lt;table style='border-collapse:collapse'&gt;
+ &lt;tr&gt;
+ &lt;th align=left&gt;
+HTML1
+
+# Check for possible MySQL error
+if [ `cat "$SP_QUERY_RESULT_STATUS_FILE"` == 1 ]; then
+
+ # If error
+ echo "&lt;i&gt;No global summary available&lt;/i&gt;"
+
+else
+
+ # $SP_QUERY_RESULT_FILE contains the file path to the query result
+
+ # First line contains the column names - wrap them into &lt;th&gt; tags
+ cat "$SP_QUERY_RESULT_FILE" | head -n 1 |perl -pe 's!\t!&lt;/th&gt;&lt;th&gt;&lt;/th&gt;&lt;th align=right&gt;!g;s!$!&lt;/th&gt;&lt;/tr&gt;&lt;tr&gt;&lt;td&gt;!'
+
+ # Output all row except the first one and wrap them into &lt;tr&gt;&lt;td&gt; tags
+ cat "$SP_QUERY_RESULT_FILE" | sed '1d' | perl -pe 's!\t!&lt;/td&gt;&lt;td&gt;&amp;nbsp;&amp;nbsp;&lt;/td&gt;&lt;td align='right'&gt;!g;s!$!&lt;/tr&gt;&lt;tr&gt;&lt;td&gt;!'
+
+fi
+cat &lt;&lt;HTML2
+ &lt;/table&gt;
+ &lt;/td&gt;
+ &lt;/tr&gt;
+&lt;/table&gt;
+&lt;hr&gt;
+&lt;/center&gt;
+HTML2
+
+# Clear hand-shake files for further usage
+rm -f "$SP_QUERY_FILE"
+rm -f "$SP_QUERY_RESULT_STATUS_FILE"
+rm -f "$SP_QUERY_RESULT_FILE"
+rm -f "$SP_QUERY_RESULT_META_FILE"
+
+# Read all databases into a BASH array; $SP_ALL_DATABASES provides them as a tab delimited string
+# Set the Internal Field Separator IFS to 'tab' and process the array by using the new IFS due to
+# the fact that a database name could contain 'spaces'
+OLDIFS="$IFS"
+IFS=" "
+dbs=("$SP_ALL_DATABASES")
+
+# Loop through all databases
+cnt=1
+for db in $dbs
+do
+
+ cat &lt;&lt;HTML3
+ &lt;br&gt;
+ &lt;table width=100% style='background-color:#ECECEC;'&gt;
+ &lt;tr&gt;
+ &lt;td width=20px&gt;&lt;span id="$cnt" onclick=toggle_display(this) style="cursor:pointer;color:gray;font-size:smaller;" title="Toggle visibility"&gt;▼&lt;/span&gt;&lt;/td&gt;
+ &lt;td align=center width='40px'&gt;&lt;img src='file://$SP_APP_RESOURCES_DIRECTORY/database-small.png'&gt;&lt;/td&gt;
+ &lt;td&gt;&lt;big&gt;&lt;a href='sequelpro://$SP_PROCESS_ID@passToDoc/SelectDatabase/$db' title='Click to select database “$db”'&gt;$db&lt;/big&gt;&lt;/a&gt;&lt;/td&gt;
+ &lt;/tr&gt;
+ &lt;/table&gt;
+ &lt;table id="$cnt:data" border=1 style='border-collapse:collapse' width=100%&gt;
+ &lt;tr&gt;
+ &lt;th&gt;&lt;/th&gt;&lt;th&gt;Name&lt;/th&gt;&lt;th&gt;Engine&lt;/th&gt;&lt;th&gt;Rows&lt;/th&gt;&lt;th&gt;Size&lt;/th&gt;&lt;th&gt;Created&lt;/th&gt;&lt;th&gt;Updated&lt;/th&gt;
+ &lt;/tr&gt;
+HTML3
+
+ # Query for table status
+ echo "SHOW TABLE STATUS IN \`$db\`" &gt; "$SP_QUERY_FILE"
+ open "sequelpro://$SP_PROCESS_ID@passToDoc/ExecuteQuery"
+
+ # wait for Sequel Pro; status file will be written to disk if query was finished
+ while [ 1 ]
+ do
+ [[ -e "$SP_QUERY_RESULT_STATUS_FILE" ]] &amp;&amp; break
+ sleep 0.01
+ done
+
+ cnt=$((cnt+1))
+
+ export DB="$db"
+ export PID="$SP_PROCESS_ID"
+ export RES="$SP_APP_RESOURCES_DIRECTORY";
+ cat "$SP_QUERY_RESULT_FILE" | sed '1d' | perl "$SP_BUNDLE_PATH/Support/processTableData.pl"
+
+ echo "&lt;/table&gt;"
+
+ # Clear hand-shake files
+ rm -f "$SP_QUERY_FILE"
+ rm -f "$SP_QUERY_RESULT_STATUS_FILE"
+ rm -f "$SP_QUERY_RESULT_FILE"
+ rm -f "$SP_QUERY_RESULT_META_FILE"
+
+done
+
+# Reset IFS
+IFS="$OLDIFS"
+
+echo "&lt;/body&gt;&lt;/html&gt;"
+</string>
+ <key>contact</key>
+ <string>znvy@ovovxb.qr</string>
+ <key>description</key>
+ <string>Display a report about all databases of the current connection including the possibility to select a database or table via hyperlink.
+
+Version 1.0</string>
+ <key>internalKeyEquivalent</key>
+ <dict>
+ <key>characters</key>
+ <string>A</string>
+ <key>keyCode</key>
+ <integer>0</integer>
+ <key>modifierFlags</key>
+ <integer>1835008</integer>
+ </dict>
+ <key>keyEquivalent</key>
+ <string>^~@a</string>
+ <key>name</key>
+ <string>Database Report</string>
+ <key>output</key>
+ <string>showashtml</string>
+ <key>scope</key>
+ <string>general</string>
+ <key>tooltip</key>
+ <string>Display report about all databases of the current connection</string>
+ <key>uuid</key>
+ <string>AC45C093-9157-4E18-9683-C94415995935</string>
+ <key>isDefaultBundle</key>
+ <true/>
+</dict>
+</plist>
diff --git a/SharedSupport/Default Bundles/Format SQL.spBundle/command.plist b/SharedSupport/Default Bundles/Format SQL.spBundle/command.plist
new file mode 100644
index 00000000..13e86145
--- /dev/null
+++ b/SharedSupport/Default Bundles/Format SQL.spBundle/command.plist
@@ -0,0 +1,203 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
+<plist version="1.0">
+<dict>
+ <key>author</key>
+ <string>Hans-Jörg Bibiko</string>
+ <key>category</key>
+ <string>Format</string>
+ <key>command</key>
+ <string>
+
+# check for empty STDIN
+SQL=$(cat)
+if [ -z "$SQL" ]; then
+ echo "No SQL statements passed."
+ exit $SP_BUNDLE_EXIT_SHOW_AS_TEXT_TOOLTIP
+fi
+
+# check if connected to the internet and if server is up
+connected=$(/sbin/ping -t 8 -c 1 -on www.dpriver.com 2&gt; /dev/null | grep '69\.5\.11\.169' | wc -l)
+if [ $connected -eq "0" ]; then
+ echo "&lt;font color=red&gt;You are probably not connected to the internet or http://www.dpriver.com/ server is down.&lt;/font&gt;"
+ exit $SP_BUNDLE_EXIT_SHOW_AS_HTML_TOOLTIP
+fi
+
+# show info alert about sending the SQL statements to an online service
+if [ ! -e infoShowed ]; then
+ touch infoShowed
+ osascript -e 'tell app "Sequel Pro" to display dialog "This command will send the SQL statement(s) - unencrypted - to an online service (http://www.dpriver.com). Please consider this before sending confidential data!\n\nThis message will only be displayed once." with icon caution' 2&gt; 1
+ if [ `cat 1 | wc -c` -ne 0 ]; then
+ rm -f 1
+ exit $SP_BUNDLE_EXIT_NONE
+ fi
+ rm -f 1
+fi
+
+# send SQL to www.dpriver.com and replace the formatted SQL string in first responder; if a parser error occurred
+# show error message and try to jump to the error
+cat &lt;&lt;HTML
+&lt;!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd"&gt;
+&lt;html&gt;
+&lt;head&gt;
+ &lt;base href="http://www.dpriver.com/pp/"&gt;
+ &lt;title&gt;Connecting www.dpriver.com&lt;/title&gt;
+ &lt;script&gt;
+ function lookForResult() {
+ if(document.all.outputsql.value.length &gt; 8) {
+ if(document.all.errorhint.style.display == "inline") {
+ var errormes = document.all.outputsql.value;
+ var re = /.*?\(\d+\s*,\s*(\d+)\).*/;
+ re.exec(errormes);
+ var pos = parseInt(RegExp.\$1) - 1;
+ re = /.*?(\d+).*/;
+ re.exec('$SP_SELECTED_TEXT_RANGE');
+ var offset = parseInt(RegExp.\$1);
+ pos = pos + offset;
+ alert(document.all.outputsql.value);
+ window.system.setSelectedTextRange(pos+'');
+ } else {
+ var txt = document.all.outputsql.value;
+ var len = txt.length;
+ window.system.setSelectedTextRange('$SP_SELECTED_TEXT_RANGE');
+ window.system.insertText(txt.slice(0,len-2));
+ }
+ window.system.closeHTMLOutputWindow();
+ } else {
+ setTimeout("lookForResult()",50);
+ }
+ }
+
+ function waitForResult() {
+ window.system.suppressExceptionAlert();
+ setTimeout("lookForResult()",50);
+ }
+ &lt;/script&gt;
+ &lt;script language="JavaScript" type="text/javascript" src="pp.js"&gt;&lt;/script&gt;
+&lt;/head&gt;
+&lt;body onload='window.resizeTo(300,200);SQLFMT.format(document.all.sp_submit);waitForResult()'&gt;
+&lt;div id="retvalues"&gt;&lt;/div&gt;
+&lt;p&gt;&lt;b&gt;Copyright &amp;copy; 2001-2010 Gudu Software&lt;br&gt;All Rights Reserved&lt;br&gt;&lt;a href="mailto:support@dpriver.com"&gt;Contact US&lt;/a&gt;&lt;/b&gt;&lt;/p&gt;
+&lt;br&gt;&lt;br&gt;&lt;br&gt;&lt;br&gt;&lt;br&gt;
+&lt;p align=right&gt;Please wait…&lt;/p&gt;
+&lt;div class="page-container-1" style="display:none;"&gt;
+ &lt;div id="container"&gt;
+ &lt;div id="wrapper"&gt;
+ &lt;div id="content"&gt;
+ &lt;form id="SqlFmtForm" name="frm_sqlformat" method="post" action="/cgi-bin/ppserver" onsubmit="return false;"&gt;
+ &lt;div id="secondpanel"&gt;
+ &lt;div id="sp_database"&gt;
+ &lt;label class="desc" style="display:inline;"&gt;Database&lt;/label&gt;
+ &lt;select name="dbvendor"&gt;
+ &lt;option value="mysql" selected&gt;MySQL&lt;/option&gt;
+ &lt;/select&gt;
+ &lt;label class="desc" style="display:inline;padding:0 0 0px 40px; border:0px solid;"&gt;Output:&lt;/label&gt;
+ &lt;select name="outputfmt"&gt;
+ &lt;option value="SQL" selected&gt;SQL(Text)&lt;/option&gt;
+ &lt;/select&gt;
+ &lt;/div&gt;
+ &lt;/div&gt;
+ &lt;div id="sqlpanel"&gt;
+ &lt;div id="sp_inputsql"&gt;
+ &lt;textarea id ="inputsql" name="inputsql" cols="1" rows="1" wrap="off"&gt;
+ $SQL
+ &lt;/textarea&gt;
+ &lt;/div&gt;
+ &lt;div id="sp_submit"&gt;
+ &lt;input type="button" id="btnformat" name="print" value="Format SQL" onclick="SQLFMT.format(this)" value="Format SQL"&gt;
+ &lt;label style="display:none;"&gt;(Time used: &lt;span id="timestamp"&gt;0&lt;/span&gt; seconds)&lt;/label&gt;
+ &lt;/div&gt;
+ &lt;div id="sp_submit" style="text-align:left;"&gt;
+ &lt;/div&gt;
+ &lt;label id="errorhint" class="desc" style="color:#DF0000 !important;display:none;"&gt;
+ Can't format input sql, make sure there is no syntax error and select correct database.
+ &lt;a href="" style="display:none;"&gt;OR Report a bug of this sql beautifier&lt;/a&gt;
+ &lt;/label&gt;
+ &lt;iframe id="ioutputsql" &gt;&lt;/iframe&gt;
+ &lt;div id="sp_outputsql" style="display:none;"&gt;
+ &lt;textarea id = "outputsql" name="outputsql" cols="80" rows="15" wrap="off" &gt;
+ &lt;/textarea&gt;
+ &lt;/div&gt;
+ &lt;div id="sp_errormsg" style="display:none;"&gt;
+ Error message goes to here!
+ &lt;/div&gt;
+ &lt;/div&gt;
+ &lt;div id="formatoptions"&gt;
+ &lt;select name="keywordcs"&gt;
+ &lt;option value="Uppercase" selected &gt;Uppercase&lt;/option&gt;
+ &lt;option value="Lowercase" &gt;Lowercase&lt;/option&gt;
+ &lt;option value="InitCap" &gt;InitCap&lt;/option&gt;
+ &lt;option value="Unchanged" &gt;Unchanged&lt;/option&gt;
+ &lt;/select&gt;
+ &lt;select name="identifiercs"&gt;
+ &lt;option value="Uppercase" &gt;Uppercase&lt;/option&gt;
+ &lt;option value="Lowercase" selected &gt;Lowercase&lt;/option&gt;
+ &lt;option value="InitCap" &gt;InitCap&lt;/option&gt;
+ &lt;option value="Unchanged" &gt;Unchanged&lt;/option&gt;
+ &lt;option value="initcapeachword" &gt;Init cap each word&lt;/option&gt;
+ &lt;/select&gt;
+ &lt;select name="functioncs"&gt;
+ &lt;option value="Uppercase" &gt;Uppercase&lt;/option&gt;
+ &lt;option value="Lowercase" &gt;Lowercase&lt;/option&gt;
+ &lt;option value="InitCap" selected &gt;InitCap&lt;/option&gt;
+ &lt;option value="Unchanged" &gt;Unchanged&lt;/option&gt;
+ &lt;/select&gt;
+ &lt;input type="radio" name="lnbrwithcomma" value="after" checked &gt; After
+ &lt;input type="radio" name="lnbrwithcomma" value="before" &gt; Before
+ &lt;input type="radio" name="lnbrwithcomma" value= "beforewithspace" &gt; Before with space
+ &lt;input type="radio" name="liststyle" value="stack" checked&gt;Stacked
+ &lt;input type="radio" name="liststyle" value="nostack"&gt;Not Stacked
+ &lt;input type="radio" name="salign" value="sleft" checked&gt; Align left
+ &lt;input type="radio" name="salign" value="sright" &gt; Align right
+ &lt;input type="checkbox" name="andorunderwhere" value="yes" checked&gt; And/Or under Where
+ &lt;input type="checkbox" name="removelnbr" value="no" checked&gt; Remove Linebreak before beautify
+ &lt;input type="checkbox" name="trimquotechar" value="yes"&gt; Trim Quoted Char of Each Line quoted char of eachline: &lt;input type="text" name="quotechar" value= "&amp;#34" size = 5 &gt;
+ &lt;input type="checkbox" name="compactmode" value="yes"&gt; Compact the output of sql output
+ &lt;input type="text" name="maxlenincm" value= "80" size = 5 &gt;
+ &lt;/div&gt;
+ &lt;input type="hidden" name="clientid" value="4149-9094-8133-2031" /&gt;
+ &lt;/form&gt;
+ &lt;/div&gt;
+ &lt;/div&gt;
+ &lt;/div&gt;
+&lt;/div&gt;
+
+&lt;/body&gt;
+&lt;/html&gt;
+HTML
+</string>
+ <key>contact</key>
+ <string>znvy@ovovxb.qr</string>
+ <key>description</key>
+ <string>Send the current query or selection to www.dpriver.com and replace the current query or selection of the first responder by the server's formatted output. If a parser error occurred alert that error and tries to jump to the error location.
+
+Version 1.0</string>
+ <key>input</key>
+ <string>selectedtext</string>
+ <key>input_fallback</key>
+ <string>currentquery</string>
+ <key>internalKeyEquivalent</key>
+ <dict>
+ <key>characters</key>
+ <string>T</string>
+ <key>keyCode</key>
+ <integer>17</integer>
+ <key>modifierFlags</key>
+ <integer>1835008</integer>
+ </dict>
+ <key>keyEquivalent</key>
+ <string>^~@t</string>
+ <key>name</key>
+ <string>Format SQL</string>
+ <key>output</key>
+ <string>showashtml</string>
+ <key>scope</key>
+ <string>inputfield</string>
+ <key>tooltip</key>
+ <string>Send query or selection to www.dpriver.com to insert the SQL statement formatted</string>
+ <key>uuid</key>
+ <string>36E1F94D-D6C4-460A-A663-C694AF85E099</string>
+ <key>isDefaultBundle</key>
+ <true/>
+</dict>
+</plist>
diff --git a/SharedSupport/Default Bundles/Toggle JSON Format.spBundle/command.plist b/SharedSupport/Default Bundles/Toggle JSON Format.spBundle/command.plist
new file mode 100644
index 00000000..39555369
--- /dev/null
+++ b/SharedSupport/Default Bundles/Toggle JSON Format.spBundle/command.plist
@@ -0,0 +1,72 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
+<plist version="1.0">
+<dict>
+ <key>author</key>
+ <string>Hans-Jörg Bibiko</string>
+ <key>category</key>
+ <string>Format</string>
+ <key>command</key>
+ <string>DATA=$(cat)
+
+FORMAT=$(echo "$DATA" | head -n 1 | perl -e '$l=&lt;&gt;;if($l=~m/^\s*\{\s*$/) {print "1";} else {print "2";}')
+
+# if FORMAT == 1 then serialize JSON data otherwise pretty print them
+if [ "$FORMAT" -eq "1" ]; then
+
+ DATA=$(echo "$DATA" | php -r '
+ $jsonData = "";
+ $inputStream = fopen("php://stdin", "r");
+ while($d = fgets($inputStream)) { $jsonData .= $d; }
+ print json_encode(json_decode($jsonData));
+ ')
+ if [ "$DATA" == "null" ]; then
+ echo "&lt;font&gt;An error occured while serializing JSON data!&lt;/font&gt;"
+ exit $SP_BUNDLE_EXIT_SHOW_AS_HTML_TOOLTIP
+ fi
+
+else
+
+ DATA=$(echo "$DATA" | python -mjson.tool)
+
+fi
+
+# if there's a need to preserve Unicode characters remove the first to characters of the following line
+# DATA=$(echo "$DATA" | perl -Xpe 'binmode STDIN,":utf8";binmode STDOUT,":utf8";s/\\u([0-9A-F]{4})/chr(hex($1))/ieg')
+
+printf "%b" "$DATA"</string>
+ <key>contact</key>
+ <string>znvy@ovovxb.qr</string>
+ <key>description</key>
+ <string>If the first line of the selection or the entire content of the current text input field only contains a "{" then serialize the JSON data otherwise the JSON data will be pretty printed. If there's a need to preserve the Unicode characters you can uncomment the line 22.
+
+Version 1.0</string>
+ <key>input</key>
+ <string>selectedtext</string>
+ <key>input_fallback</key>
+ <string>entirecontent</string>
+ <key>internalKeyEquivalent</key>
+ <dict>
+ <key>characters</key>
+ <string>J</string>
+ <key>keyCode</key>
+ <integer>38</integer>
+ <key>modifierFlags</key>
+ <integer>1572864</integer>
+ </dict>
+ <key>keyEquivalent</key>
+ <string>~@j</string>
+ <key>name</key>
+ <string>Toggle JSON Format</string>
+ <key>output</key>
+ <string>replaceselection</string>
+ <key>scope</key>
+ <string>inputfield</string>
+ <key>tooltip</key>
+ <string>Serialize or pretty print JSON data</string>
+ <key>uuid</key>
+ <string>87FD8A4F-90AA-4020-9E0B-8CDD05764D08</string>
+ <key>isDefaultBundle</key>
+ <true/>
+</dict>
+</plist>
diff --git a/SharedSupport/Default Bundles/WrapInDelimiter.spBundle/command.plist b/SharedSupport/Default Bundles/WrapInDelimiter.spBundle/command.plist
new file mode 100644
index 00000000..3588396e
--- /dev/null
+++ b/SharedSupport/Default Bundles/WrapInDelimiter.spBundle/command.plist
@@ -0,0 +1,47 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
+<plist version="1.0">
+<dict>
+ <key>author</key>
+ <string>Hans-Jörg Bibiko</string>
+ <key>category</key>
+ <string>Query Editor</string>
+ <key>command</key>
+ <string>echo "DELIMITER \${0:;;}"
+echo "\${1:`cat`}\${1:\$0}"
+echo "DELIMITER ;"</string>
+ <key>contact</key>
+ <string>znvy@ovovxb.qr</string>
+ <key>description</key>
+ <string>Wrap the current query or the selection in DELIMITER inserted as snippet to allow to modify the default delimiter ;;
+
+Version 1.0</string>
+ <key>input</key>
+ <string>selectedtext</string>
+ <key>input_fallback</key>
+ <string>currentquery</string>
+ <key>internalKeyEquivalent</key>
+ <dict>
+ <key>characters</key>
+ <string>W</string>
+ <key>keyCode</key>
+ <integer>13</integer>
+ <key>modifierFlags</key>
+ <integer>1835008</integer>
+ </dict>
+ <key>keyEquivalent</key>
+ <string>^~@w</string>
+ <key>name</key>
+ <string>Wrap query/selection in DELIMITER</string>
+ <key>output</key>
+ <string>insertassnippet</string>
+ <key>scope</key>
+ <string>inputfield</string>
+ <key>tooltip</key>
+ <string>Wrap the current query or selection in DELIMITER ;;</string>
+ <key>uuid</key>
+ <string>A67BDE10-0A76-45C2-98DB-B35AC731E8DA</string>
+ <key>isDefaultBundle</key>
+ <true/>
+</dict>
+</plist>