public static String GetTopRecords(String Command, String TopRecord, DBCommandFactory type) { switch (type) { case DBCommandFactory.SQLServer: Command = Command.Replace("select", "select Top " + TopRecord); return(Command); case DBCommandFactory.Oracle: if (Command.Contains("where")) { Command += "and rownum <=" + TopRecord; } else { Command += "rownum <=" + TopRecord; } return(Command); case DBCommandFactory.MySQL: Command += "limit " + TopRecord; return(Command); case DBCommandFactory.Access: Command = Command.Replace("select", "Select Top " + TopRecord); return(Command); default: return(""); } }
//get nowdate function public static String GetSQLDate(DBCommandFactory type) { switch (type) { case DBCommandFactory.SQLServer: return("getdate()"); case DBCommandFactory.Oracle: return("sysdate "); case DBCommandFactory.MySQL: return("curdate() "); case DBCommandFactory.Access: return("now()"); default: return(""); } }
public InterceptingData(DBCommandFactory factory) : base(factory) { //no-op }
/// <summary> /// set database /// </summary> /// <param name="DataModule"></param> public DeleteDBCommandBuilder(DBCommandFactory DataModule) { DatabaseType = DataModule; }
/// <summary> /// set default database /// </summary> /// <param name="DataModule"></param> public DeleteDBCommandBuilder() { DatabaseType = DBCommandFactory.SQLServer; }
/// <summary> /// set database /// </summary> /// <param name="DataModule"></param> public InsertDBCommandBuilder(DBCommandFactory DataModule) { DatabaseType = DataModule; }
/// <summary> /// set default database /// </summary> /// <param name="DataModule"></param> public InsertDBCommandBuilder() { DatabaseType = DBCommandFactory.SQLServer; }
public TransactionFactory() { factory = new DBCommandFactory(); }
//note use of constructor injection public DataImpl(DBCommandFactory factory) { CommandFactory = factory; }