Esempio n. 1
0
        public string CreateDeleteStatement(DatabaseObject databaseObject)
        {
            var tableName  = databaseObject.GetTableName();
            var primaryKey = databaseObject.GetPrimaryKey();

            return(string.Format("DELETE FROM {0} WHERE {1}",
                                 tableName,
                                 SqlQueryFactoryUtility.CreateEqualityClause(primaryKey, databaseObject.GetDatabaseFields()[primaryKey])));
        }
Esempio n. 2
0
        public string CreateSelectCountStatementWithId(DatabaseObject databaseObject)
        {
            var tableName  = databaseObject.GetTableName();
            var primaryKey = databaseObject.GetPrimaryKey();

            return(string.Format("SELECT COUNT(*) FROM {0} WHERE {1}",
                                 tableName,
                                 SqlQueryFactoryUtility.CreateEqualityClause(primaryKey, databaseObject.GetDatabaseFields()[primaryKey])));
        }
Esempio n. 3
0
        public string CreateUpdateStatement(DatabaseObject databaseObject)
        {
            var tableName  = databaseObject.GetTableName();
            var primaryKey = databaseObject.GetPrimaryKey();

            return(string.Format("UPDATE {0} SET {1} WHERE {2}",
                                 tableName,
                                 SqlQueryFactoryUtility.CreateUpdateList(databaseObject.GetDatabaseFields()),
                                 SqlQueryFactoryUtility.CreateEqualityClause(primaryKey, databaseObject.GetDatabaseFields()[primaryKey])));
        }