mirror of
				https://github.com/nsnail/FreeSql.git
				synced 2025-11-04 17:20:49 +08:00 
			
		
		
		
	- 增加 Where In 表达式解析;
- 增加 FreeSqlBuilder.UseConnectionFactory 自定义数据库连接对象的创建方法;
This commit is contained in:
		@@ -12,9 +12,14 @@ namespace FreeSql.Sqlite
 | 
			
		||||
    class SqliteAdo : FreeSql.Internal.CommonProvider.AdoProvider
 | 
			
		||||
    {
 | 
			
		||||
        public SqliteAdo() : base(DataType.Sqlite) { }
 | 
			
		||||
        public SqliteAdo(CommonUtils util, string masterConnectionString, string[] slaveConnectionStrings) : base(DataType.Sqlite)
 | 
			
		||||
        public SqliteAdo(CommonUtils util, string masterConnectionString, string[] slaveConnectionStrings, Func<DbConnection> connectionFactory) : base(DataType.Sqlite)
 | 
			
		||||
        {
 | 
			
		||||
            base._util = util;
 | 
			
		||||
            if (connectionFactory != null)
 | 
			
		||||
            {
 | 
			
		||||
                MasterPool = new FreeSql.Internal.CommonProvider.DbConnectionPool(DataType.Sqlite, connectionFactory);
 | 
			
		||||
                return;
 | 
			
		||||
            }
 | 
			
		||||
            if (!string.IsNullOrEmpty(masterConnectionString))
 | 
			
		||||
                MasterPool = new SqliteConnectionPool("主库", masterConnectionString, null, null);
 | 
			
		||||
            if (slaveConnectionStrings != null)
 | 
			
		||||
@@ -55,9 +60,11 @@ namespace FreeSql.Sqlite
 | 
			
		||||
            return AdonetPortable.GetSqliteCommand();
 | 
			
		||||
        }
 | 
			
		||||
 | 
			
		||||
        protected override void ReturnConnection(ObjectPool<DbConnection> pool, Object<DbConnection> conn, Exception ex)
 | 
			
		||||
        protected override void ReturnConnection(IObjectPool<DbConnection> pool, Object<DbConnection> conn, Exception ex)
 | 
			
		||||
        {
 | 
			
		||||
            (pool as SqliteConnectionPool).Return(conn, ex);
 | 
			
		||||
            var rawPool = pool as SqliteConnectionPool;
 | 
			
		||||
            if (rawPool != null) rawPool.Return(conn, ex);
 | 
			
		||||
            else pool.Return(conn);
 | 
			
		||||
        }
 | 
			
		||||
 | 
			
		||||
        protected override DbParameter[] GetDbParamtersByObject(string sql, object obj) => _util.GetDbParamtersByObject(sql, obj);
 | 
			
		||||
 
 | 
			
		||||
@@ -224,7 +224,10 @@ namespace FreeSql.Sqlite
 | 
			
		||||
        {
 | 
			
		||||
            try
 | 
			
		||||
            {
 | 
			
		||||
                PingCommand(that).ExecuteNonQuery();
 | 
			
		||||
                using (var cmd = PingCommand(that))
 | 
			
		||||
                {
 | 
			
		||||
                    cmd.ExecuteNonQuery();
 | 
			
		||||
                }
 | 
			
		||||
                return true;
 | 
			
		||||
            }
 | 
			
		||||
            catch
 | 
			
		||||
@@ -247,6 +250,7 @@ namespace FreeSql.Sqlite
 | 
			
		||||
                var cmd = that.CreateCommand();
 | 
			
		||||
                cmd.CommandText = sb.ToString();
 | 
			
		||||
                cmd.ExecuteNonQuery();
 | 
			
		||||
                cmd.Dispose();
 | 
			
		||||
            }
 | 
			
		||||
        }
 | 
			
		||||
 | 
			
		||||
@@ -256,7 +260,10 @@ namespace FreeSql.Sqlite
 | 
			
		||||
        {
 | 
			
		||||
            try
 | 
			
		||||
            {
 | 
			
		||||
                await PingCommand(that).ExecuteNonQueryAsync();
 | 
			
		||||
                using (var cmd = PingCommand(that))
 | 
			
		||||
                {
 | 
			
		||||
                    await cmd.ExecuteNonQueryAsync();
 | 
			
		||||
                }
 | 
			
		||||
                return true;
 | 
			
		||||
            }
 | 
			
		||||
            catch
 | 
			
		||||
@@ -279,6 +286,7 @@ namespace FreeSql.Sqlite
 | 
			
		||||
                var cmd = that.CreateCommand();
 | 
			
		||||
                cmd.CommandText = sb.ToString();
 | 
			
		||||
                await cmd.ExecuteNonQueryAsync();
 | 
			
		||||
                cmd.Dispose();
 | 
			
		||||
            }
 | 
			
		||||
        }
 | 
			
		||||
#endif
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user