Ejemplo n.º 1
0
        public static async Task <System.Data.DataSet> QueryDataSetAsync(this CONNECTOR.IDataConnector connector, SqlBuilder sqlBuilder)
        {
            sqlBuilder.SqlEngine = ConnectorTools.FindEngine(connector.EngineName);
            QueryContext query = new QueryContext(sqlBuilder.ToString(), sqlBuilder.SqlInputParameters);

            return(await connector.QueryDataSetAsync(query));
        }
Ejemplo n.º 2
0
        public static System.Data.DataSet QueryDataSet(this CONNECTOR.IDataConnector connector, SqlBuilder sqlBuilder)
        {
            sqlBuilder.SqlEngine = ConnectorTools.FindEngine(connector.EngineName);
            QueryContext query = new QueryContext(sqlBuilder.ToString(), sqlBuilder.SqlInputParameters);

            return(connector.QueryDataSetAsync(query).GetAwaiter().GetResult());
        }
Ejemplo n.º 3
0
        /// <summary>
        /// Execution d'une requette SQL avec retour de données
        /// </summary>
        /// <param name="connector"></param>
        /// <param name="sqlQuery"></param>
        /// <param name="oparameters"></param>
        /// <returns></returns>
        public static async Task <System.Data.DataTable> QueryAsync(this CONNECTOR.IDataConnector connector, string sqlQuery, params object[] oparameters)
        {
            QueryContext query = new QueryContext(sqlQuery, ConvertArrayParameters(oparameters));

            System.Data.DataSet retset = await connector.QueryDataSetAsync(query);

            return(retset.Tables[0]);
        }
Ejemplo n.º 4
0
        /// <summary>
        /// Execution d'une requette SQL avec retour de données
        /// </summary>
        /// <param name="sqlQuery"></param>
        /// <param name="parameters"></param>
        /// <returns></returns>
        public static async Task <System.Data.DataTable> QueryAsync(this CONNECTOR.IDataConnector connector, string sqlQuery, Dictionary <string, object> parameters = null)
        {
            QueryContext query = new QueryContext(sqlQuery, parameters);

            System.Data.DataSet retset = await connector.QueryDataSetAsync(query);

            if (retset.Tables.Count == 0)
            {
                return(null);
            }
            else
            {
                return(retset.Tables[0]);
            }
        }
Ejemplo n.º 5
0
        public static async Task <System.Data.DataTable> QueryAsync(this CONNECTOR.IDataConnector connector, SqlBuilder sqlBuilder)
        {
            sqlBuilder.SqlEngine = ConnectorTools.FindEngine(connector.EngineName);
            QueryContext query = new QueryContext(sqlBuilder.ToString(), sqlBuilder.SqlInputParameters);

            System.Data.DataSet retset = await connector.QueryDataSetAsync(query);

            if (retset.Tables.Count == 0)
            {
                return(null);
            }
            else
            {
                return(retset.Tables[0]);
            }
        }
Ejemplo n.º 6
0
        /// <summary>
        /// Execution d'une requette SQL, Return Dataset
        /// </summary>
        public static System.Data.DataSet QueryDataSet(this CONNECTOR.IDataConnector connector, string sqlQuery, Dictionary <string, object> parameters)
        {
            QueryContext query = new QueryContext(sqlQuery, parameters);

            return(connector.QueryDataSetAsync(query).GetAwaiter().GetResult());
        }
Ejemplo n.º 7
0
 /// <summary>
 /// Query with insert sql auto build
 /// </summary>
 /// <param name="connector"></param>
 /// <param name="table"></param>
 /// <param name="parametersValues"></param>
 /// <param name="AutoIncrementColumn"></param>
 /// <returns></returns>
 public static async Task InsertAsync(this CONNECTOR.IDataConnector connector, string table, Dictionary <string, object> parametersValues, string AutoIncrementColumn = null)
 {
     SqlBuilder sql = new SqlBuilder(table).Insert(parametersValues);
     await connector.QueryScalarAsync(sql);
 }
Ejemplo n.º 8
0
 /// <summary>
 /// Query with Update sql auto build
 /// </summary>
 /// <param name="connector"></param>
 /// <param name="table"></param>
 /// <param name="parametersKey"></param>
 /// <param name="parametersValues"></param>
 /// <returns></returns>
 public static async Task UpdateAsync(this CONNECTOR.IDataConnector connector, string table, Dictionary <string, object> parametersWhereKey, Dictionary <string, object> parametersUpdateValues)
 {
     SqlBuilder sql = new SqlBuilder(table).Update(parametersUpdateValues).AddWheres(parametersWhereKey);
     await connector.QueryScalarAsync(sql);
 }
Ejemplo n.º 9
0
        /// <summary>
        /// Execution d'une requette SQL, Return Dataset
        /// </summary>
        public static async Task <System.Data.DataSet> QueryDataSetAsync(this CONNECTOR.IDataConnector connector, string sqlQuery, Dictionary <string, object> parameters)
        {
            QueryContext query = new QueryContext(sqlQuery, parameters);

            return(await connector.QueryDataSetAsync(query));
        }
Ejemplo n.º 10
0
 public static object QueryScalar(this CONNECTOR.IDataConnector connector, SqlBuilder sqlBuilder)
 {
     return(QueryScalarAsync(connector, sqlBuilder).GetAwaiter().GetResult());
 }
Ejemplo n.º 11
0
 /// <summary>
 ///  Execution d'une requette SQL
 /// </summary>
 /// <param name="connector"></param>
 /// <param name="sqlQuery"></param>
 /// <param name="parameters"></param>
 /// <returns></returns>
 public static object QueryScalar(this CONNECTOR.IDataConnector connector, string sqlQuery, Dictionary <string, object> parameters = null)
 {
     return(QueryScalarAsync(connector, sqlQuery, parameters).GetAwaiter().GetResult());
 }
Ejemplo n.º 12
0
        /// <summary>
        /// Execution d'une requette SQL
        /// </summary>
        /// <param name="connector"></param>
        /// <param name="sqlQuery"></param>
        /// <param name="oparameters"></param>
        /// <returns></returns>
        public static async Task <object> QueryScalarAsync(this CONNECTOR.IDataConnector connector, string sqlQuery, params object[] oparameters)
        {
            QueryContext query = new QueryContext(sqlQuery, ConvertArrayParameters(oparameters));

            return(await connector.QueryScalarAsync(query));
        }
Ejemplo n.º 13
0
 public static ConnectorConstants.ConnectorEngineEnum GetEngine(this CONNECTOR.IDataConnector connector)
 {
     return(ConnectorTools.FindEngine(connector.EngineName));
 }
Ejemplo n.º 14
0
 public static System.Data.DataTable Query(this CONNECTOR.IDataConnector connector, SqlBuilder sqlBuilderl)
 {
     return(QueryAsync(connector, sqlBuilderl).GetAwaiter().GetResult());
 }
Ejemplo n.º 15
0
 /// <summary>
 /// Execution d'une requette SQL avec retour de données
 /// </summary>
 /// <param name="connector"></param>
 /// <param name="sqlQuery"></param>
 /// <param name="parameters"></param>
 /// <returns></returns>
 public static System.Data.DataTable Query(this CONNECTOR.IDataConnector connector, string sqlQuery, Dictionary <string, object> parameters = null)
 {
     return(QueryAsync(connector, sqlQuery, parameters).GetAwaiter().GetResult());
 }