/// <summary></summary> static Dialect() { standardAggregateFunctions["count"] = new CountQueryFunctionInfo(); standardAggregateFunctions["avg"] = new AvgQueryFunctionInfo(); standardAggregateFunctions["max"] = new ClassicAggregateFunction("max",false); standardAggregateFunctions["min"] = new ClassicAggregateFunction("min",false); standardAggregateFunctions["sum"] = new SumQueryFunctionInfo(); Extracter = new NoOpViolatedConstraintNameExtracter(); }
private static ISQLExceptionConverter ConstructConverter(string converterClassName, IViolatedConstraintNameExtracter violatedConstraintNameExtracter) { try { log.Debug("Attempting to construct instance of specified SQLExceptionConverter [" + converterClassName + "]"); System.Type converterClass = ReflectHelper.ClassForName(converterClassName); // First, try to find a matching constructor accepting a ViolatedConstraintNameExtracter param... ConstructorInfo[] ctors = converterClass.GetConstructors(ReflectHelper.AnyVisibilityInstance); foreach (ConstructorInfo ctor in ctors) { ParameterInfo[] parameters = ctor.GetParameters(); if (parameters == null || parameters.Length != 1) continue; if (typeof(IViolatedConstraintNameExtracter).IsAssignableFrom(parameters[0].ParameterType)) { try { return (ISQLExceptionConverter)ctor.Invoke(new object[] { violatedConstraintNameExtracter }); } catch (Exception) { // eat it and try next } } } // Otherwise, try to use the no-arg constructor return (ISQLExceptionConverter)Activator.CreateInstance(converterClass); } catch (Exception t) { log.Warn("Unable to construct instance of specified SQLExceptionConverter", t); } return null; }
private static ISQLExceptionConverter ConstructConverter(string converterClassName, IViolatedConstraintNameExtracter violatedConstraintNameExtracter) { try { log.Debug("Attempting to construct instance of specified SQLExceptionConverter [" + converterClassName + "]"); System.Type converterClass = ReflectHelper.ClassForName(converterClassName); // First, try to find a matching constructor accepting a ViolatedConstraintNameExtracter param... ConstructorInfo[] ctors = converterClass.GetConstructors(ReflectHelper.AnyVisibilityInstance); foreach (ConstructorInfo ctor in ctors) { ParameterInfo[] parameters = ctor.GetParameters(); if (parameters == null || parameters.Length != 1) { continue; } if (typeof(IViolatedConstraintNameExtracter).IsAssignableFrom(parameters[0].ParameterType)) { try { return((ISQLExceptionConverter)ctor.Invoke(new object[] { violatedConstraintNameExtracter })); } catch (Exception) { // eat it and try next } } } // Otherwise, try to use the no-arg constructor return((ISQLExceptionConverter)Cfg.Environment.BytecodeProvider.ObjectsFactory.CreateInstance(converterClass)); } catch (Exception t) { log.Warn("Unable to construct instance of specified SQLExceptionConverter", t); } return(null); }
public CacheSQLStateConverter(IViolatedConstraintNameExtracter extracter) { this.extracter = extracter; }
public SQLStateConverter(IViolatedConstraintNameExtracter extracter) { }