CoreFiles by mySites.guru
sql-hint.min.js1 lines, 3,502 bytes, from Joomla_4.0.0-alpha2-Alpha-Full_Package.zip
Raw History Compare with 3.10.0-alpha9
md5
6302b75f725796ab1fb49351658f7b02
sha1
be65830fba1865665238571d9bb836ec1b7d4834
sha256
860b53708bae691054d3d078a205b388b112d8692711b50eda625aee10ad97d4
!function(t){"object"==typeof exports&&"object"==typeof module?t(require("../../lib/codemirror"),require("../../mode/sql/sql")):"function"==typeof define&&define.amd?define(["../../lib/codemirror","../../mode/sql/sql"],t):t(CodeMirror)}(function(t){"use strict";function e(t){return"[object Array]"==Object.prototype.toString.call(t)}function r(t){return"string"==typeof t?t:t.text}function n(t,r){return e(r)&&(r={columns:r}),r.text||(r.text=t),r}function o(t){return p[t.toUpperCase()]}function i(t){var e={};for(var r in t)t.hasOwnProperty(r)&&(e[r]=t[r]);return e}function s(t,e){var n=t.length,o=r(e).substr(0,n);return t.toUpperCase()===o.toUpperCase()}function a(t,r,n,o){if(e(n))for(var i=0;i<n.length;i++)s(r,n[i])&&t.push(o(n[i]));else for(var a in n)if(n.hasOwnProperty(a)){var u=n[a];s(r,u=u&&!0!==u?u.displayText?{text:u.text,displayText:u.displayText}:u.text:a)&&t.push(o(u))}}function u(t){"."==t.charAt(0)&&(t=t.substr(1));for(var e=t.split(v+v),r=0;r<e.length;r++)e[r]=e[r].replace(new RegExp(v,"g"),"");return e.join(v)}function l(t){for(var e=r(t).split("."),n=0;n<e.length;n++)e[n]=v+e[n].replace(new RegExp(v,"g"),v+v)+v;var o=e.join(".");return"string"==typeof t?o:(t=i(t),t.text=o,t)}function f(t,e){for(var r=t.split(/\s+/),n=0;n<r.length;n++)r[n]&&e(r[n].replace(/[,;]/g,""))}function c(t,e){for(var r=e.doc,n=r.getValue(),i=t.toUpperCase(),s="",a="",u=[],l={start:x(0,0),end:x(e.lastLine(),e.getLineHandle(e.lastLine()).length)},c=n.indexOf(h.QUERY_DIV);-1!=c;)u.push(r.posFromIndex(c)),c=n.indexOf(h.QUERY_DIV,c+1);u.unshift(x(0,0)),u.push(x(e.lastLine(),e.getLineHandle(e.lastLine()).text.length));for(var p=null,g=e.getCursor(),d=0;d<u.length;d++){if((null==p||m(g,p)>0)&&m(g,u[d])<=0){l={start:p,end:u[d]};break}p=u[d]}for(var v=r.getRange(l.start,l.end,!1),d=0;d<v.length;d++){if(f(v[d],function(t){var e=t.toUpperCase();e===i&&o(s)&&(a=s),e!==h.ALIAS_KEYWORD&&(s=t)}),a)break}return a}var p,g,d,v,h={QUERY_DIV:";",ALIAS_KEYWORD:"AS"},x=t.Pos,m=t.cmpPos;t.registerHelper("hint","sql",function(s,f){p=function(t){var o={};if(e(t))for(var i=t.length-1;i>=0;i--){var s=t[i];o[r(s).toUpperCase()]=n(r(s),s)}else if(t)for(var a in t)o[a.toUpperCase()]=n(a,t[a]);return o}(f&&f.tables);var h=f&&f.defaultTable,m=f&&f.disableKeywords;g=h&&o(h),d=function(e){var r=e.doc.modeOption;return"sql"===r&&(r="text/x-sql"),t.resolveMode(r).keywords}(s),v=function(e){var r=e.doc.modeOption;return"sql"===r&&(r="text/x-sql"),t.resolveMode(r).identifierQuote||"`"}(s),h&&!g&&(g=c(h,s)),(g=g||[]).columns&&(g=g.columns);var y,A,b,q=s.getCursor(),C=[],U=s.getTokenAt(q);return U.end>q.ch&&(U.end=q.ch,U.string=U.string.slice(0,q.ch-U.start)),U.string.match(/^[.`"\w@]\w*$/)?(b=U.string,y=U.start,A=U.end):(y=A=q.ch,b=""),"."==b.charAt(0)||b.charAt(0)==v?y=function(t,e,r,n){for(var s=!1,f=[],d=e.start,h=!0;h;)h="."==e.string.charAt(0),s=s||e.string.charAt(0)==v,d=e.start,f.unshift(u(e.string)),"."==(e=n.getTokenAt(x(t.line,e.start))).string&&(h=!0,e=n.getTokenAt(x(t.line,e.start)));var m=f.join(".");a(r,m,p,function(t){return s?l(t):t}),a(r,m,g,function(t){return s?l(t):t}),m=f.pop();var y=f.join("."),A=!1,b=y;if(!o(y)){var q=y;(y=c(y,n))!==q&&(A=!0)}var C=o(y);return C&&C.columns&&(C=C.columns),C&&a(r,m,C,function(t){var e=y;return 1==A&&(e=b),"string"==typeof t?t=e+"."+t:(t=i(t)).text=e+"."+t.text,s?l(t):t}),d}(q,U,C,s):(a(C,b,p,function(t){return t}),a(C,b,g,function(t){return t}),m||a(C,b,d,function(t){return t.toUpperCase()})),{list:C,from:x(q.line,y),to:x(q.line,A)}})});

No other release has this exact content. See every version of this file.