本文整理汇总了C#中ITypedSettersV3.SetDBNull方法的典型用法代码示例。如果您正苦于以下问题:C# ITypedSettersV3.SetDBNull方法的具体用法?C# ITypedSettersV3.SetDBNull怎么用?C# ITypedSettersV3.SetDBNull使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类ITypedSettersV3
的用法示例。
在下文中一共展示了ITypedSettersV3.SetDBNull方法的11个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: SetSqlString_Unchecked
private static void SetSqlString_Unchecked( SmiEventSink_Default sink, ITypedSettersV3 setters, int ordinal, SmiMetaData metaData, SqlString value, int offset, int length ) {
if ( value.IsNull ) {
setters.SetDBNull( sink, ordinal );
sink.ProcessMessagesAndThrow();
}
else {
if (SqlDbType.Variant == metaData.SqlDbType) {
// Set up a NVarChar metadata with correct LCID/Collation
metaData = new SmiMetaData(
SqlDbType.NVarChar,
SmiMetaData.MaxUnicodeCharacters,
0,
0,
value.LCID,
value.SqlCompareOptions,
null);
setters.SetVariantMetaData( sink, ordinal, metaData );
sink.ProcessMessagesAndThrow();
}
SetString_Unchecked( sink, setters, ordinal, value.Value, offset, length );
}
}
示例2: SetSqlXml_Unchecked
private static void SetSqlXml_Unchecked(SmiEventSink_Default sink, ITypedSettersV3 setters, int ordinal, SqlXml value) {
if (value.IsNull) {
setters.SetDBNull(sink, ordinal);
sink.ProcessMessagesAndThrow();
}
else {
SetXmlReader_Unchecked(sink, setters, ordinal, value.CreateReader());
}
}
示例3: SetSqlMoney_Unchecked
private static void SetSqlMoney_Unchecked( SmiEventSink_Default sink, ITypedSettersV3 setters, int ordinal, SmiMetaData metaData, SqlMoney value ) {
if ( value.IsNull ) {
setters.SetDBNull( sink, ordinal );
}
else {
if ( SqlDbType.Variant == metaData.SqlDbType ) {
setters.SetVariantMetaData( sink, ordinal, SmiMetaData.DefaultMoney );
sink.ProcessMessagesAndThrow();
}
setters.SetInt64( sink, ordinal, value.ToSqlInternalRepresentation() );
}
sink.ProcessMessagesAndThrow();
}
示例4: SetSqlSingle_Unchecked
private static void SetSqlSingle_Unchecked( SmiEventSink_Default sink, ITypedSettersV3 setters, int ordinal, SqlSingle value ) {
if ( value.IsNull ) {
setters.SetDBNull( sink, ordinal );
}
else {
setters.SetSingle( sink, ordinal, value.Value );
}
sink.ProcessMessagesAndThrow();
}
示例5: SetSqlBinary_Unchecked
private static void SetSqlBinary_Unchecked( SmiEventSink_Default sink, ITypedSettersV3 setters, int ordinal, SqlBinary value, int offset, int length ) {
if ( value.IsNull ) {
setters.SetDBNull( sink, ordinal );
}
else {
SetByteArray_Unchecked( sink, setters, ordinal, value.Value, offset, length );
}
sink.ProcessMessagesAndThrow();
}
示例6: SetSqlChars_Unchecked
private static void SetSqlChars_Unchecked( SmiEventSink_Default sink, ITypedSettersV3 setters, int ordinal, SqlChars value, int offset, int length ) {
if ( value.IsNull ) {
setters.SetDBNull( sink, ordinal );
sink.ProcessMessagesAndThrow();
}
else {
int chunkSize;
if ( length > __maxCharChunkSize || length < 0 ) {
chunkSize = __maxCharChunkSize;
}
else {
chunkSize = checked( (int)length );
}
char[] buffer = new char[ chunkSize ];
long charsRead;
long charsWritten = 1; // prime value to get into write loop
long currentOffset = offset;
long lengthWritten = 0;
while ( (length < 0 || lengthWritten < length) &&
0 != ( charsRead = value.Read( currentOffset, buffer, 0, chunkSize ) ) &&
0 != charsWritten ) {
charsWritten = setters.SetChars( sink, ordinal, currentOffset, buffer, 0, checked( (int) charsRead ) );
sink.ProcessMessagesAndThrow();
checked{ currentOffset += charsWritten; }
checked{ lengthWritten += charsWritten;}
}
// Make sure to trim any left-over data
setters.SetCharsLength( sink, ordinal, currentOffset );
sink.ProcessMessagesAndThrow();
}
}
示例7: SetDBNull_Unchecked
private static void SetDBNull_Unchecked( SmiEventSink_Default sink, ITypedSettersV3 setters, int ordinal ) {
setters.SetDBNull( sink, ordinal );
sink.ProcessMessagesAndThrow();
}
示例8: SetUdt_LengthChecked
private static void SetUdt_LengthChecked( SmiEventSink_Default sink, ITypedSettersV3 setters, int ordinal, SmiMetaData metaData, object value ) {
if ( ADP.IsNull( value ) ) {
setters.SetDBNull( sink, ordinal );
sink.ProcessMessagesAndThrow();
}
else {
System.IO.Stream target = new SmiSettersStream( sink, setters, ordinal, metaData );
SerializationHelperSql9.Serialize( target, value );
}
}
示例9: SetSqlXml_Unchecked
private static void SetSqlXml_Unchecked(SmiEventSink_Default sink, ITypedSettersV3 setters, int ordinal, SqlXml value)
{
if (value.IsNull)
{
setters.SetDBNull(sink, ordinal);
}
else
{
XmlReader reader = value.CreateReader();
XmlWriterSettings settings = new XmlWriterSettings {
CloseOutput = false,
ConformanceLevel = ConformanceLevel.Fragment,
Encoding = Encoding.Unicode,
OmitXmlDeclaration = true
};
Stream output = new SmiSettersStream(sink, setters, ordinal, SmiMetaData.DefaultXml);
XmlWriter writer = XmlWriter.Create(output, settings);
reader.Read();
while (!reader.EOF)
{
writer.WriteNode(reader, true);
}
writer.Flush();
}
sink.ProcessMessagesAndThrow();
}
示例10: SetSqlString_Unchecked
private static void SetSqlString_Unchecked(SmiEventSink_Default sink, ITypedSettersV3 setters, int ordinal, SmiMetaData metaData, SqlString value, int offset, int length)
{
if (value.IsNull)
{
setters.SetDBNull(sink, ordinal);
sink.ProcessMessagesAndThrow();
}
else
{
if (SqlDbType.Variant == metaData.SqlDbType)
{
metaData = new SmiMetaData(SqlDbType.NVarChar, 0xfa0L, 0, 0, (long) value.LCID, value.SqlCompareOptions, null);
setters.SetVariantMetaData(sink, ordinal, metaData);
sink.ProcessMessagesAndThrow();
}
SetString_Unchecked(sink, setters, ordinal, value.Value, offset, length);
}
}
示例11: SetSqlChars_Unchecked
private static void SetSqlChars_Unchecked(SmiEventSink_Default sink, ITypedSettersV3 setters, int ordinal, SqlChars value, int offset, int length)
{
if (value.IsNull)
{
setters.SetDBNull(sink, ordinal);
sink.ProcessMessagesAndThrow();
}
else
{
int num4;
long num5;
if ((length > 0xfa0) || (length < 0))
{
num4 = 0xfa0;
}
else
{
num4 = length;
}
char[] buffer = new char[num4];
long num2 = 1L;
long num = offset;
for (long i = 0L; ((length < 0) || (i < length)) && ((0L != (num5 = value.Read(num, buffer, 0, num4))) && (0L != num2)); i += num2)
{
num2 = setters.SetChars(sink, ordinal, num, buffer, 0, (int) num5);
sink.ProcessMessagesAndThrow();
num += num2;
}
setters.SetCharsLength(sink, ordinal, num);
sink.ProcessMessagesAndThrow();
}
}