Esempio n. 1
0
        string GetFullDeleteSql(DatabaseProvider provider)
        {
            var sb = this;

            var where = sb.GetUpdateWhere(provider);
            if (where == null)
            {
                throw new NoWhereException();
            }
            var table = _tables[0];

            if (_tables.Count == 1)
            {
                return("DELETE FROM " + table.ToTableSql(provider, _tables.Count) + " WHERE " + where);
            }

            var tableName  = table.ToSql(provider);
            var fromtable  = table.ToTableSql(provider, _tables.Count);
            var jointables = sb.GetJoinSql(provider);
            var pk         = table.GetPrimaryKey();

            return(provider.Delete(_tables, pk, tableName, fromtable, jointables, where));
        }