Ejemplo n.º 1
0
        /// <summary>
        /// Finds all of the column names in the given <paramref name="table"/>.
        /// </summary>
        /// <param name="table">The table.</param>
        /// <returns>All of the column names in the given <paramref name="table"/>.</returns>
        public IEnumerable <string> GetTableColumns(string table)
        {
            var ret = new List <string>();

            using (var conn = _connectionPool.Acquire())
            {
                using (var cmd = conn.Connection.CreateCommand())
                {
                    cmd.CommandText = string.Format("SELECT * FROM `{0}` WHERE 0=1", table);
                    using (var r = cmd.ExecuteReader())
                    {
                        var fields = r.FieldCount;
                        for (var i = 0; i < fields; i++)
                        {
                            var fieldName = r.GetName(i);
                            ret.Add(fieldName);
                        }
                    }
                }
            }

            return(ret);
        }
Ejemplo n.º 2
0
        /// <summary>
        /// Gets the next available connection.
        /// </summary>
        /// <returns>Next available connection.</returns>
        public IPoolableDbConnection GetConnection()
        {
            var poolableConn = _connectionPool.Acquire();

            return(poolableConn);
        }