public override bool TryParseNode(XmlNode xmlNode, out ParmData parmData) { if (base.TryParseNode(xmlNode, out parmData)) { if (ParmValue.Length >= 8 && ParmValue.Substring(0, 6) == "{guid'" && ParmValue.Substring(ParmValue.Length - 2, 2) == "'}") { ParmType = "uniqueidentifier"; parmData = BuildParmData(); return(true); } } return(false); }
public override bool TryParseNode(XmlNode xmlNode, out ParmData parmData) { if (base.TryParseNode(xmlNode, out parmData)) { if (ParmValue.Length >= 2 && ParmValue.Substring(0, 2) == "0x") { ParmType = "varbinary(max)"; parmData = BuildParmData(); return(true); } } return(false); }
public override bool TryParseNode(XmlNode xmlNode, out ParmData parmData) { if (base.TryParseNode(xmlNode, out parmData)) { if (ParmValue.Length >= 2 && ParmValue.Substring(0, 1) == "(" && ParmValue.Substring(ParmValue.Length - 1, 1) == ")") { string parsedValue = ParmValue; char[] chars = { '(', ')' }; parsedValue = parsedValue.Trim(chars); short shortVal; int intVal; long longVal; if (parsedValue.IndexOf('.') != -1) { parsedValue = parsedValue.TrimEnd('0').TrimEnd('.'); ParmType = string.Format("numeric({0},{1})", parsedValue.Length - (parsedValue.IndexOf('.') != -1 ? 1 : 0), parsedValue.IndexOf('.') != -1 ? parsedValue.Substring(parsedValue.IndexOf('.')).Length - 1 : 0); } else if (short.TryParse(parsedValue, out shortVal)) { ParmType = "smallint"; } else if (int.TryParse(parsedValue, out intVal)) { ParmType = "smallint"; } else if (long.TryParse(parsedValue, out longVal)) { ParmType = "bigint"; } parmData = BuildParmData(); parmData.Value = parsedValue; return(true); } } return(false); }
public override bool TryParseNode(XmlNode xmlNode, out ParmData parmData) { if (base.TryParseNode(xmlNode, out parmData)) { if (ParmValue.Length >= 2 && ParmValue.Substring(0, 1) == "'" && ParmValue.Substring(ParmValue.Length - 1, 1) == "'") { ParmType = "varchar(" + Math.Max(ParmValue.Length - 2, 1) + ")"; parmData = BuildParmData(); return(true); } else if (ParmValue.Length >= 3 && ParmValue.Substring(0, 2) == "N'" && ParmValue.Substring(ParmValue.Length - 1, 1) == "'") { ParmType = "nvarchar(" + Math.Max(ParmValue.Length - 3, 1) + ")"; parmData = BuildParmData(); return(true); } } return(false); }
public override bool TryParseNode(XmlNode xmlNode, out ParmData parmData) { if (base.TryParseNode(xmlNode, out parmData)) { if (ParmValue.Length >= 2 && ParmValue.Substring(0, 1) == "'" && ParmValue.Substring(ParmValue.Length - 1, 1) == "'") { char[] chars = { '\'', '\'' }; DateTime dateTimeVal; string parmValueTrimmed = ParmValue.Trim(chars); if (DateTime.TryParse(parmValueTrimmed, out dateTimeVal)) { ParmType = "datetime"; parmValueTrimmed = "{ts '" + Regex.Replace(parmValueTrimmed, "\\.0*$", "") + "'}"; parmData = BuildParmData(); parmData.Value = parmValueTrimmed; return(true); } } } return(false); }