Exemple #1
0
        protected int InsertRow(IDictionary <string, object> row, IDbCommand command)
        {
            var values = new object[command.Parameters.Count];

            foreach (var kvp in row)
            {
                int index = _columns.IndexOf(_table.FindColumn(kvp.Key));
                if (index > -1)
                {
                    values[index] = kvp.Value;
                }
            }

            CommandHelper.SetParameterValues(command, values);
            return(TryExecute(command));
        }
Exemple #2
0
        protected IDictionary <string, object> InsertRow(IDictionary <string, object> row, IDbCommand insertCommand, IDbCommand selectCommand)
        {
            var values = new object[insertCommand.Parameters.Count];

            foreach (var kvp in row)
            {
                int index = _columns.IndexOf(_table.FindColumn(kvp.Key));
                if (index > -1)
                {
                    values[index] = kvp.Value;
                }
            }

            CommandHelper.SetParameterValues(insertCommand, values);
            if (TryExecute(insertCommand) == 1)
            {
                return(TryExecuteSingletonQuery(selectCommand));
            }
            return(null);
        }