//>>built define(["dijit","dojo","dojox","dojo/require!dojo/gears,dojox/storage/Provider,dojox/storage/manager,dojox/sql"],function(_1,_2,_3){ _2.provide("dojox.storage.GearsStorageProvider"); _2.require("dojo.gears"); _2.require("dojox.storage.Provider"); _2.require("dojox.storage.manager"); _2.require("dojox.sql"); if(_2.gears.available){ (function(){ _2.declare("dojox.storage.GearsStorageProvider",_3.storage.Provider,{constructor:function(){ },TABLE_NAME:"__DOJO_STORAGE",initialized:false,_available:null,_storageReady:false,initialize:function(){ if(_2.config["disableGearsStorage"]==true){ return; } this.TABLE_NAME="__DOJO_STORAGE"; this.initialized=true; _3.storage.manager.loaded(); },isAvailable:function(){ return this._available=_2.gears.available; },put:function(_4,_5,_6,_7){ this._initStorage(); if(!this.isValidKey(_4)){ throw new Error("Invalid key given: "+_4); } _7=_7||this.DEFAULT_NAMESPACE; if(!this.isValidKey(_7)){ throw new Error("Invalid namespace given: "+_4); } if(_2.isString(_5)){ _5="string:"+_5; }else{ _5=_2.toJson(_5); } try{ _3.sql("DELETE FROM "+this.TABLE_NAME+" WHERE namespace = ? AND key = ?",_7,_4); _3.sql("INSERT INTO "+this.TABLE_NAME+" VALUES (?, ?, ?)",_7,_4,_5); } catch(e){ _6(this.FAILED,_4,e.toString(),_7); return; } if(_6){ _6(_3.storage.SUCCESS,_4,null,_7); } },get:function(_8,_9){ this._initStorage(); if(!this.isValidKey(_8)){ throw new Error("Invalid key given: "+_8); } _9=_9||this.DEFAULT_NAMESPACE; if(!this.isValidKey(_9)){ throw new Error("Invalid namespace given: "+_8); } var _a=_3.sql("SELECT * FROM "+this.TABLE_NAME+" WHERE namespace = ? AND "+" key = ?",_9,_8); if(!_a.length){ return null; }else{ _a=_a[0].value; } if(_2.isString(_a)&&(/^string:/.test(_a))){ _a=_a.substring("string:".length); }else{ _a=_2.fromJson(_a); } return _a; },getNamespaces:function(){ this._initStorage(); var _b=[_3.storage.DEFAULT_NAMESPACE]; var rs=_3.sql("SELECT namespace FROM "+this.TABLE_NAME+" DESC GROUP BY namespace"); for(var i=0;i