public void GetParameter() { SqlType type = new SqlXml(testXml, ParameterDirection.Input); TestHelper.AssertSqlParameter(type.GetParameter(), SqlDbType.Xml, testXml); type = new SqlXml(null, ParameterDirection.Input); TestHelper.AssertSqlParameter(type.GetParameter(), SqlDbType.Xml, DBNull.Value); }
public void GetRawValue() { SqlType type = new SqlXml(testXml, ParameterDirection.Input); Assert.AreEqual(testXml, type.GetRawValue()); type = new SqlXml(null, ParameterDirection.Input); Assert.Null(type.GetRawValue()); }
public void CreateMetaData() { Assert.Throws<TypeCannotBeUsedAsAClrTypeException>(() => SqlXml.GetTypeHandler().CreateMetaData(null)); SqlTypeHandler col = new SqlXml(testXml, ParameterDirection.Input); var meta = col.CreateMetaData("Test"); Assert.AreEqual(SqlDbType.Xml, meta.SqlDbType); Assert.AreEqual(-1, meta.MaxLength); Assert.AreEqual("Test", meta.Name); }
private static void ReadXmlFile(string filename) { XmlDocument doc = new XmlDocument(); DbClass dbClass = new DbClass(); doc.Load(filename); StringWriter sw = new StringWriter(); XmlTextWriter xw = new XmlTextWriter(sw); doc.WriteTo(xw); StringReader transactionXml = new StringReader(sw.ToString()); XmlTextReader xmlReader = new XmlTextReader(transactionXml); SqlXml sqlXml = new SqlXml(xmlReader); dbClass.ImportData(sqlXml); }
protected void buildInventoryMain_Graphics(SqlDataReader reader) { if (!reader.IsDBNull(reader.GetOrdinal("xmlProductDtls1"))) { SqlXml sqlXmlValue = reader.GetSqlXml(reader.GetOrdinal("xmlProductDtls1")); buildInventoryDetails_Graphics(CommonFunctions.isDbReaderNull(reader, reader.GetOrdinal("listName1")), sqlXmlValue, placeHolderA1, 1); } if (!reader.IsDBNull(reader.GetOrdinal("xmlProductDtls2"))) { SqlXml sqlXmlValue = reader.GetSqlXml(reader.GetOrdinal("xmlProductDtls2")); buildInventoryDetails_Graphics(CommonFunctions.isDbReaderNull(reader, reader.GetOrdinal("listName2")), sqlXmlValue, placeHolderB1, 2); } if (!reader.IsDBNull(reader.GetOrdinal("xmlProductDtls3"))) { SqlXml sqlXmlValue = reader.GetSqlXml(reader.GetOrdinal("xmlProductDtls3")); buildInventoryDetails_Graphics(CommonFunctions.isDbReaderNull(reader, reader.GetOrdinal("listName3")), sqlXmlValue, placeHolderC1, 3); } if (!reader.IsDBNull(reader.GetOrdinal("xmlProductDtls4"))) { SqlXml sqlXmlValue = reader.GetSqlXml(reader.GetOrdinal("xmlProductDtls4")); buildInventoryDetails_Graphics(CommonFunctions.isDbReaderNull(reader, reader.GetOrdinal("listName4")), sqlXmlValue, placeHolderD1, 4); } if (!reader.IsDBNull(reader.GetOrdinal("xmlProductDtls5"))) { SqlXml sqlXmlValue = reader.GetSqlXml(reader.GetOrdinal("xmlProductDtls5")); buildInventoryDetails_Graphics(CommonFunctions.isDbReaderNull(reader, reader.GetOrdinal("listName5")), sqlXmlValue, placeHolderD1, 5); } if (!reader.IsDBNull(reader.GetOrdinal("docPath"))) { Literal invtabLI = new Literal(); invtabLI.Text = "<li><a href='#UpdatePanelDocs'><span>Downloads</span></a></li> "; placeHolderInvContainer.Controls.Add(invtabLI); Literal invtabDiv = new Literal(); invtabDiv.Text = "<div style='width:400px;height:200px;text-align:center;background-color:white;font-size:small; font-weight:bold; color:#669;'><a href='" + reader.GetValue(reader.GetOrdinal("docPath")) + "'>Click to view inventory document</a></div>"; placeHolderDocs.Controls.Add(invtabDiv); } }
public static void HttpPost( SqlString url, SqlXml headerXml, SqlString requestBody, out SqlBoolean success, out SqlString response, out SqlString error) { List <KeyValuePair <string, string> > headers = ClrHttp.GetHeaders(headerXml); string url1 = url.IsNull ? (string)null : url.Value; string requestBody1 = requestBody.IsNull ? (string)null : requestBody.Value; HttpResult httpResult = HttpLayer.Post(url1, (IEnumerable <KeyValuePair <string, string> >)headers, requestBody1); success = (SqlBoolean)httpResult.Success; response = (SqlString)httpResult.Response; error = (SqlString)httpResult.Error; }
public void ReceiveMessage(out string MessageType, out string Message, out Guid ConversationGroupID, out Guid DialogHandle) { //default return values MessageType = null; Message = null; ConversationGroupID = Guid.Empty; DialogHandle = Guid.Empty; SqlCommand cmd = _cnn.CreateCommand(); cmd.Transaction = _trans; cmd.CommandTimeout = _receiveTimeout / 1000 + 2; cmd.CommandText = "WAITFOR (RECEIVE TOP(1) message_type_name, " + "CAST(message_body AS XML), " + "conversation_group_id, " + "conversation_handle FROM [" + _queueName + "]), TIMEOUT " + _receiveTimeout; try { SqlDataReader rdr = cmd.ExecuteReader(); if (rdr.HasRows) { rdr.Read(); MessageType = (String)rdr.GetSqlString(0); SqlXml sx = rdr.GetSqlXml(1); if (!sx.IsNull) { Message = sx.Value; } ConversationGroupID = rdr.GetGuid(2); DialogHandle = rdr.GetGuid(3); } rdr.Close(); } catch (SqlException e) { Console.WriteLine("RECEIVE failed " + e.Message); } }
public void SerializationDeepTargetTest() { //Set up the model Model model = new Model(); model.SetSize(new SizeF(1000, 1000)); //Set the container size so that the shape can be moved //Set up a shape element Shape shape = new Shape(); shape.Location = new PointF(100, 100); model.Shapes.Add("Shape1", shape); //Set up another shape element Shape shape2 = new Shape(); shape2.Location = new PointF(200, 200); model.Shapes.Add("Shape2", shape2); //Connect with a line Link line = new Link(shape, shape2); model.Lines.Add("Line1", line); //Serialize the model MemoryStream stream = new MemoryStream(); XmlFormatter serializer = new XmlFormatter(); serializer.Shallow = false; serializer.Serialize(stream, model); stream.Position = 0; // reset the stream to the beginning SqlXml xml = new SqlXml(stream); //Stream the data back into the same model object serializer.Target = model; using (MemoryStream stream2 = new MemoryStream(Encoding.UTF8.GetBytes(xml.Value))) { serializer.Deserialize(stream2); } Assert.IsTrue(model.Shapes.Count == 2, "Shapes count not set back to 2."); Assert.IsTrue(model.Lines.Count == 1, "Line count not set back to 1."); }
/// <summary> /// Retrieves xml with a maximum number of bytes to return /// </summary> /// <param name="iCol">Column ordinal</param> /// <param name="maxCharsToReturn">Number of chars to return at maximum</param> /// <returns>String</returns> public string GetXmlWithMaxCapacity(int iCol, int maxCharsToReturn) { if (maxCharsToReturn <= 0) { throw new ArgumentOutOfRangeException(nameof(maxCharsToReturn), SR.QueryServiceDataReaderXmlCountInvalid); } // If we're not in SQL XML mode, just return the entire thing as a string if (!supportSqlXml) { object o = GetValue(iCol); return(o?.ToString()); } // We have SQL XML support, so write it properly SqlXml sm = GetSqlXml(iCol); if (sm == null) { return(null); } // Setup the writer so that we don't close the memory stream and can process fragments // of XML XmlWriterSettings writerSettings = new XmlWriterSettings { CloseOutput = false, // don't close the memory stream ConformanceLevel = ConformanceLevel.Fragment }; using (StringWriterWithMaxCapacity sw = new StringWriterWithMaxCapacity(null, maxCharsToReturn)) using (XmlWriter ww = XmlWriter.Create(sw, writerSettings)) using (XmlReader reader = sm.CreateReader()) { reader.Read(); while (!reader.EOF) { ww.WriteNode(reader, true); } ww.Flush(); return(sw.ToString()); } }
static string GetSQLXmlString <T>(SQLXMLEdm sqlXMLEdm) { SqlXml sqlXml = new SqlXml(); if (sqlXMLEdm != null && !sqlXMLEdm.IsNull && !string.IsNullOrEmpty(sqlXMLEdm.Value)) { var pages = XmlSerializeHelper.DESerializer <List <T> >(sqlXMLEdm.Value); sqlXml = XmlSerializeHelper.ToSqlXml(pages); } if (sqlXml == null || sqlXml.IsNull == true) { return(null); } else { return(sqlXml.Value); } }
public void TestGetValue(TestCaseResult result) { InsertRowText(); VirtuosoCommand cmd = connection.CreateCommand(); cmd.CommandText = "select data from xmlt"; VirtuosoDataReader rdr = cmd.ExecuteReader(); rdr.Read(); object obj = rdr.GetValue(0); result.FailIfNotEqual(typeof(SqlXml).Name, obj.GetType().Name); SqlXml x = (SqlXml)obj; FailIfXmlNotEqual(result, x.ToString(), TheXml); }
public void TestCreateActivityWithMissingMessageElement() { string xml = "<activity xmlns=\"http://ns.opensocial.org/2008/opensocial\"><postedTime>1304533194580</postedTime><body>This is Profiles test activity from ChatterSqlProceduresTest</body></activity>"; var xmlReader = XmlTextReader.Create(new System.IO.StringReader(xml)); SqlXml messageBlob = new SqlXml(xmlReader); try { //ChatterSqlProcedures.CreateActivity(_url, _username, _password, _token, _employeeId, messageBlob, _pmid, _title, _body); Assert.Fail("CreateActivity method should throw and exception if xml is incorrect"); } catch (Exception ex) { Assert.AreEqual("Element {http://ns.opensocial.org/2008/opensocial}title was not found", ex.Message); } }
public static void ProcessJobServerTasks(SqlXml Message, Guid ConversationHandle) { if (Message.IsNull) { SqlContext.Pipe.Send("No message was supplied for processing."); new ServiceBroker("context connection=true;").EndDialog(ConversationHandle); return; } XmlDocument doc = new System.Xml.XmlDocument(); doc.LoadXml(Message.Value); // Execute the requested task IJobServerTask task = JobServerFactory.GetJobServerTask(doc.DocumentElement.Attributes["MessageTypeName"].Value); task.Execute(Message, ConversationHandle); }
/// <summary> /// Creates the SQL XML parameter. /// </summary> /// <param name="name">Parameter name.</param> /// <param name="value">Parameter value.</param> /// <returns>Created <see cref="SqlParameter"/>. Contains DBNull.Value if input value is null.</returns> private SqlParameter CreateSqlXmlParameter(string name, XDocument value) { SqlParameter param = new SqlParameter(name, SqlDbType.Xml); if (value != null) { XmlReader reader = value.CreateReader(); SqlXml xml = new SqlXml(reader); reader.Close(); param.SqlValue = xml; } else { param.Value = DBNull.Value; } return(param); }
public void TestCreateActivityWithIncorrectEmployee() { string xml = "<activity xmlns=\"http://ns.opensocial.org/2008/opensocial\"><postedTime>1304533194580</postedTime><title>This is Profiles test activity from ChatterSqlProceduresTest</title></activity>"; var xmlReader = XmlTextReader.Create(new System.IO.StringReader(xml)); SqlXml messageBlob = new SqlXml(xmlReader); try { //ChatterSqlProcedures.CreateActivity(_url, _username, _password, _token, "1221212", messageBlob, _pmid, _title, _body); Assert.Fail("CreateActivity method should throw and exception if user is not found by employee id"); } catch (Exception ex) { Assert.AreEqual("Object not found, Salesforce.User, keys:1221212", ex.Message); } }
public Task <Result> Visit(StoreDocumentCommand storeDocumentCommand) { var document = storeDocumentCommand.Document; if (document == null) { throw new ArgumentNullException("document"); } if (document.Content == null) { throw new ArgumentException("Document Content cannot be null", "document"); } return(Task.Factory.StartNew <Result>(() => { var xmlElm = (XElement)document.Content.ToXNode(); xmlElm.Add(new XAttribute(XNamespace.Xmlns.GetName("jxml"), JsonXml.JsonXmlSettings.JXmlNamespace), new XAttribute(XNamespace.Xmlns.GetName("jsonx"), JsonXml.JsonXmlSettings.JsonNetXmlNamespace)); using (var conn = new SqlConnection(_connectionString)) using (var cmd = new SqlCommand()) { conn.Open(); cmd.Connection = conn; cmd.CommandType = System.Data.CommandType.StoredProcedure; cmd.CommandText = "dbo.StoreDocument"; if (document.Meta != null) { cmd.Parameters.Add(new SqlParameter("DocumentId", document.Meta.Id)); cmd.Parameters.Add(new SqlParameter("FriendlyId", document.Meta.Name)); cmd.Parameters.Add(new SqlParameter("RevisionEtag", document.Meta.RevisionEtag)); } var xmlContent = new SqlXml(xmlElm.CreateReader()); cmd.Parameters.AddWithValue("Content", xmlContent); using (var sqlReader = cmd.ExecuteReader()) { return MapRecord(sqlReader); } } })); }
public static SqlXml xfnCheckPlanXml( [SqlFacet(MaxSize = 512, IsNullable = true)] SqlString validationConfig, [SqlFacet(MaxSize = 128, IsNullable = false)] SqlString dbName, [SqlFacet(MaxSize = -1, IsNullable = true)] SqlXml planXml ) { if (planXml.IsNull) { return(SqlXml.Null); } var xml = planXml.Value; string config = null; if (!validationConfig.IsNull) { config = validationConfig.Value; } var planValidator = new PlanValidator(config); var results = planValidator.ValidateSqlPlan(xml).ToList(); // ReSharper disable once SimplifyLinqExpression if (!results.Any(r => r.Category != PlanCategory.Trace)) { return(SqlXml.Null); } var resultElement = planValidator.GenerateResultsElement(results); resultElement.Add(new XAttribute("dbName", dbName.Value)); SqlXml ret; using (var reader = new StringReader(resultElement.ToString())) using (var xmlreader = new XmlTextReader(reader)) { ret = new SqlXml(xmlreader); } return(ret); }
public static void _ListQueuesCallback(Object obj, out SqlString name, out SqlString url, out SqlXml metadata) { if (!(obj is ITPCfSQL.Azure.Queue)) { throw new ArgumentException("Expected " + typeof(ITPCfSQL.Azure.Queue).ToString() + ", received " + obj.GetType().ToString()); } ITPCfSQL.Azure.Queue q = (ITPCfSQL.Azure.Queue)obj; name = q.Name; url = q.Url.ToString(); if ((q.Metadata != null) && (q.Metadata.Count > 0)) { System.IO.MemoryStream ms = new System.IO.MemoryStream(); using (System.Xml.XmlWriter wr = System.Xml.XmlWriter.Create(ms)) { wr.WriteStartElement("MetadataList"); foreach (string s in q.Metadata.Keys) { wr.WriteStartElement(s); wr.WriteString(q.Metadata[s]); wr.WriteEndElement(); } wr.WriteEndElement(); wr.Flush(); wr.Close(); } ms.Seek(0, System.IO.SeekOrigin.Begin); metadata = new SqlXml(ms); } else { metadata = null; } }
public bool UpdateFileContent(long fileID, XmlDocument contents) { bool updated = false; using (DbCommand cmd = _db.GetStoredProcCommand("UpdateXmlRepositoryContent")) { if (dbCommandTimeout != null) { cmd.CommandTimeout = dbCommandTimeout.Value; } _db.AddInParameter(cmd, "@FileID", DbType.Int64, fileID); MemoryStream ms = new MemoryStream(); contents.Save(ms); SqlXml sqlXml = new SqlXml(ms); _db.AddInParameter(cmd, "@Contents", DbType.Xml, sqlXml); updated = Convert.ToInt32(_db.ExecuteScalar(cmd)) > 0; } return(updated); }
public static SqlXml ExecXQuery(SqlXml Source, SqlString XQuery) { using (var q = new SqlCommand()) { q.Connection = new SqlConnection("context connection=true"); q.CommandType = CommandType.Text; q.CommandText = String.Format("SELECT @X.query('{0}')", XQuery.Value.Replace("'", "''")); q.Parameters.Add("@X", SqlDbType.Xml).Direction = ParameterDirection.Input; q.Parameters["@X"].Value = Source.Value; q.Connection.Open(); return(new SqlXml(q.ExecuteXmlReader())); } }
public static SqlBoolean ExecXSD(SqlXml Source, SqlXml XSD) { try { var settings = new XmlReaderSettings(); settings.Schemas.Add(null, XSD.CreateReader()); settings.ConformanceLevel = ConformanceLevel.Auto; settings.ValidationType = ValidationType.Schema; var reader = XmlReader.Create(Source.CreateReader(), settings); while (reader.Read()) { } return(true); } catch { return(false); } }
/// <summary> /// Identical to calling GetSqlXml on the SqlDataReader returned /// from SqlCommand.ExecuteReader /// </summary> /// <param name="index"></param> /// <returns></returns> public SqlXml GetSqlXml(int index) { // Fail if the command wasn't executed if (m_reader == null) { throw new LearningComponentsInternalException("LSTR1270"); } // Get the value SqlXml returnValue = m_reader.GetSqlXml(index); // Log if (m_log != null) { LogResultSetValue(index, returnValue); } return(returnValue); }
internal override object ConvertValue(object value) { object ret = null; Debug.WriteLineIf(CLI.FnTrace.Enabled, "BufferTypeSqlXml.ConvertValue (" + value + ")"); if (value is string) { ret = new SqlXml((string)value); } else if (value is XmlReader) { ret = new SqlXml((XmlReader)value); } else { ret = base.ConvertValue(value); } return(ret); }
public static int SqlSafeScalar( SqlString sqlcmd, SqlXml values ){ int n = 0; SqlConnection conn = new SqlConnection("context connection=true"); SqlCommand cmd = new SqlCommand(sqlcmd.ToString(), conn); conn.Open(); cmd.CommandType = CommandType.Text; cmd.CommandTimeout = 0; n = SqlSafeParmsEx( ref cmd, values ); try{ n = (int)cmd.ExecuteScalar(); } catch (Exception ed){ throw new Exception(ed.Message + "\n" + @sqlcmd.ToString() ); } conn.Close(); return n; }//end SqlSafeScalar
public override string GetStringValue(object value) { if (value == DBNull.Value) { return(null); } var array = (byte[])value; if (array.Length <= 0) { return(string.Empty); } using (var ms = new MemoryStream(array)) { var sqlXml = new SqlXml(ms); return(sqlXml.Value); } }
private static void PutXml(WebRequest request, SqlXml xml, NameValueCollection attributes) { var wrs = new XmlWriterSettings() { Encoding = request.ContentType != null?GetContentEncoding(request.ContentType) : SqlRuntime.WebEncoding, CloseOutput = true }; if (attributes != null) { SetProperties(wrs, attributes, WriterPrefix); } using (var xrd = xml.CreateReader()) using (var xwr = XmlWriter.Create(request.GetRequestStream(), wrs)) { xwr.WriteNode(xrd, true); xwr.Flush(); } }
public static System.Collections.IEnumerable XmlToTable(SqlXml xml, string root) { List <xmlToTable.paraVlues> pvList = new List <xmlToTable.paraVlues>(); int count = 1; if (!xml.IsNull) { try { XmlDocument doc = new XmlDocument(); doc.LoadXml(xml.Value); var list = doc.GetElementsByTagName(root); if (list != null && list.Count > 0) { for (int i = 0; i < list.Count; i++) { if (list[i].HasChildNodes) { for (int j = 0; j < list[i].ChildNodes.Count; j++) { var node = list[i].ChildNodes[j]; var pv = new xmlToTable.paraVlues() { id = count++, name = node.Name, value = node.InnerText }; pvList.Add(pv); } } } } } catch (Exception ex) { pvList.Add(new xmlToTable.paraVlues() { id = count++, name = "error", value = ex.Message }); } } // 在此处放置代码 return(pvList); }
public void TestGetSqlXmlReader(TestCaseResult result) { InsertRowText(); VirtuosoCommand cmd = connection.CreateCommand(); cmd.CommandText = "select data from xmlt"; VirtuosoDataReader rdr = cmd.ExecuteReader(); rdr.Read(); SqlXml x = rdr.GetSqlXml(0); XmlDocument doc = new XmlDocument(); doc.Load(x.CreateReader()); FailIfXmlNotEqual(result, doc.OuterXml, TheXml); }
public static XmlDocument GetXmlDocument(this IDataRecord record, string columnName) { SqlDataReader reader = record as SqlDataReader; XmlDocument document = new XmlDocument(); if (reader != null) { SqlXml sqlXml = reader.GetSqlXml(record.GetOrdinal(columnName)); using (XmlReader xmlReader = sqlXml.CreateReader()) { document.Load(xmlReader); return(document); } } return(document); }
public static int SqlSafeExecute( SqlString sqlcmd, SqlXml values ){ int n = 0; SqlConnection conn = new SqlConnection("context connection=true"); SqlCommand cmd = new SqlCommand(sqlcmd.ToString(), conn); conn.Open(); cmd.CommandType = CommandType.Text; cmd.CommandTimeout = 0; n=SqlSafeParmsEx( ref cmd, values ); try{ n = cmd.ExecuteNonQuery(); } catch (Exception ed){ throw new Exception(ed.Message + "\n" + @sqlcmd.ToString() ); // xnav.SelectSingleNode(string.Format("/values/value[{0}]", 19)).Value); } conn.Close(); return n; }//end SqlSafeExecute
public void TestInsertSqlXml(TestCaseResult result) { VirtuosoCommand insert = connection.CreateCommand(); insert.CommandText = "insert into xmlt (id, data) values (1, ?)"; insert.Parameters.Add(new VirtuosoParameter(":0", new SqlXml(TheXml))); insert.ExecuteNonQuery(); insert.Dispose(); VirtuosoCommand cmd = connection.CreateCommand(); cmd.CommandText = "select data from xmlt"; VirtuosoDataReader rdr = cmd.ExecuteReader(); rdr.Read(); SqlXml x = rdr.GetSqlXml(0); FailIfXmlNotEqual(result, x.ToString(), TheXml); }
/// <summary> /// /// </summary> /// <param name="document"></param> /// <returns></returns> SqlXml XmlDocumentToSqlXml(XmlDocument document) { var _sqlXml = (SqlXml)null; if (document.HasChildNodes) { using (var _reader = new XmlNodeReader(document)) { if (!_reader.IsEmptyElement) { _sqlXml = new SqlXml(_reader); } _reader.Close(); _reader.Dispose(); } } return(_sqlXml); }
public static SqlXml Evaluate([SqlFacet(MaxSize = -1)] SqlXml input, [SqlFacet(MaxSize = -1)] SqlString path, SqlString nsMap) { if (input.IsNull || path.IsNull) { return(SqlXml.Null); } using (var reader = input.CreateReader()) { var navigator = new XPathDocument(reader).CreateNavigator(); var resolver = GetNamespaceResolver(navigator.NameTable, !nsMap.IsNull ? nsMap.Value : null); var iterator = navigator.Evaluate(XPathExpression.Compile(path.Value, resolver)) as XPathNodeIterator; if (iterator == null) { return(SqlXml.Null); } var result = iterator.Cast <XPathNavigator>().SingleOrDefault(); return(result != null ? new SqlXml(result.ReadSubtree()) : SqlXml.Null); } }
public void SqlTypes_SqlXml () { NpgsqlParameter parameter; SqlXml value = new SqlXml (new XmlTextReader (new StringReader ("<test>Mono</test>"))); parameter = new NpgsqlParameter (); parameter.NpgsqlValue = value; Assert.AreEqual (NpgsqlDbType.Xml, parameter.NpgsqlDbType, "#A:NpgsqlDbType"); Assert.AreSame (value, parameter.NpgsqlValue, "#A:NpgsqlValue"); Assert.AreSame (value, parameter.Value, "#A:Value"); parameter = new NpgsqlParameter (); parameter.NpgsqlValue = SqlXml.Null; Assert.AreEqual (NpgsqlDbType.Xml, parameter.NpgsqlDbType, "#B:NpgsqlDbType"); Assert.IsNotNull (parameter.NpgsqlValue, "#B:SqlValue1"); Assert.AreEqual (typeof (SqlXml), parameter.NpgsqlValue.GetType (), "#B:SqlValue2"); Assert.IsTrue (((SqlXml) parameter.NpgsqlValue).IsNull, "#B:SqlValue3"); Assert.IsNotNull (parameter.Value, "#B:Value1"); Assert.AreEqual (typeof (SqlXml), parameter.Value.GetType (), "#B:Value2"); Assert.IsTrue (((SqlXml) parameter.Value).IsNull, "#B:Value3"); parameter = new NpgsqlParameter (); parameter.Value = value; Assert.AreEqual (NpgsqlDbType.Xml, parameter.NpgsqlDbType, "#C:NpgsqlDbType"); Assert.AreSame (value, parameter.NpgsqlValue, "#C:NpgsqlValue"); Assert.AreSame (value, parameter.Value, "#C:Value"); }
public void AddXml(SqlString name, SqlXml value) { base.AddParam(name, value); }
internal override object ConvertValue (object value) { object ret = null; Debug.WriteLineIf (CLI.FnTrace.Enabled, "BufferTypeSqlXml.ConvertValue (" + value + ")"); if (value is string) ret = new SqlXml ((string) value); else if (value is XmlReader) ret = new SqlXml ((XmlReader) value); else ret = base.ConvertValue (value); return ret; }