mm_sqlite 1.1.6 → 1.1.7

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (2) hide show
  1. package/index.js +28 -30
  2. package/package.json +1 -1
package/index.js CHANGED
@@ -715,36 +715,6 @@ Sqlite.prototype.table = function (name, key) {
715
715
  return db;
716
716
  };
717
717
 
718
- // close 方法已在文件前面部分实现,这里不再重复
719
-
720
- /**
721
- * 确保连接池对象存在
722
- */
723
- if (!$.pool) {
724
- $.pool = {};
725
- }
726
- if (!$.pool.sqlite) {
727
- $.pool.sqlite = {};
728
- }
729
-
730
- /**
731
- * Sqlite管理器,用于创建缓存
732
- * @param {String} scope 作用域
733
- * @param {Object} config 配置参数
734
- * @return {Object} 返回一个Sqlite类实例
735
- */
736
- function sqliteAdmin(scope, config) {
737
- if (!scope) {
738
- scope = 'sys';
739
- }
740
- var obj = $.pool.sqlite[scope];
741
- if (!obj) {
742
- $.pool.sqlite[scope] = new Sqlite(config);
743
- obj = $.pool.sqlite[scope];
744
- }
745
- return obj;
746
- }
747
-
748
718
  /**
749
719
  * 创建SQLite连接
750
720
  * @private
@@ -919,6 +889,34 @@ Sqlite.prototype._closePool = function () {
919
889
  this.logger('debug', '连接池已关闭');
920
890
  };
921
891
 
892
+ /**
893
+ * 确保连接池对象存在
894
+ */
895
+ if (!$.pool) {
896
+ $.pool = {};
897
+ }
898
+ if (!$.pool.sqlite) {
899
+ $.pool.sqlite = {};
900
+ }
901
+
902
+ /**
903
+ * Sqlite管理器,用于创建缓存
904
+ * @param {String} scope 作用域
905
+ * @param {Object} config 配置参数
906
+ * @return {Object} 返回一个Sqlite类实例
907
+ */
908
+ function sqliteAdmin(scope, config) {
909
+ if (!scope) {
910
+ scope = 'sys';
911
+ }
912
+ var obj = $.pool.sqlite[scope];
913
+ if (!obj) {
914
+ $.pool.sqlite[scope] = new Sqlite(config);
915
+ obj = $.pool.sqlite[scope];
916
+ }
917
+ return obj;
918
+ }
919
+
922
920
  // 模块导出
923
921
  exports.Sqlite = Sqlite;
924
922
  exports.sqliteAdmin = sqliteAdmin;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "mm_sqlite",
3
- "version": "1.1.6",
3
+ "version": "1.1.7",
4
4
  "description": "高性能SQLite数据库操作模块,提供与mm_mysql完全兼容的API接口,支持异步操作、事务处理和批量操作",
5
5
  "main": "index.js",
6
6
  "scripts": {