本文整理汇总了C#中System.Data.SqlTypes.SqlBinary类的典型用法代码示例。如果您正苦于以下问题:C# SqlBinary类的具体用法?C# SqlBinary怎么用?C# SqlBinary使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
SqlBinary类属于System.Data.SqlTypes命名空间,在下文中一共展示了SqlBinary类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: SetCapacity
override public void SetCapacity(int capacity) {
SqlBinary[] newValues = new SqlBinary[capacity];
if (null != values) {
Array.Copy(values, 0, newValues, 0, Math.Min(capacity, values.Length));
}
values = newValues;
}
示例2: ComputeMD5AsBase64
public static SqlString ComputeMD5AsBase64(SqlBinary byteArray)
{
if (byteArray.IsNull)
return SqlString.Null;
System.Security.Cryptography.MD5 sscMD5 = System.Security.Cryptography.MD5.Create();
byte[] mHash = sscMD5.ComputeHash(byteArray.Value);
return Convert.ToBase64String(mHash);
}
示例3: AAM
public static SqlString AAM(SqlBinary reaction, SqlString options, SqlString bingo_schema)
{
using (SqlConnection conn = new SqlConnection("context connection=true"))
{
conn.Open();
prepareContext(conn, bingo_schema.Value, 0, 0);
}
return new SqlString(BingoCore.ringoAAM(reaction.Value, options.Value));
}
示例4: ExtractString
public static SqlString ExtractString(SqlBinary binary)
{
using (var decompressed = new MemoryStream(binary.Value))
{
using (var stream = ExtractStream(decompressed))
{
return MemoryStreamToString(stream as MemoryStream, Encoding.UTF8);
}
}
}
示例5: AAM
public static SqlString AAM(SqlBinary reaction, SqlString options, SqlString bingo_schema)
{
ContextFlags flags = ContextFlags.X_PSEUDO | ContextFlags.IGNORE_CBDM;
using (SqlConnection conn = new SqlConnection("context connection=true"))
{
conn.Open();
prepareContext(conn, bingo_schema.Value, 0, flags);
}
return new SqlString(BingoCore.ringoAAM(reaction.Value, options.Value));
}
示例6: ConvertXmlToObject
public override object ConvertXmlToObject(string s)
{
SqlBinary binary = new SqlBinary();
StringReader input = new StringReader("<col>" + s + "</col>");
IXmlSerializable serializable = binary;
using (XmlTextReader reader = new XmlTextReader(input))
{
serializable.ReadXml(reader);
}
return new SqlBytes((SqlBinary) serializable);
}
示例7: AddInParameterExactSized
internal static SqlParameter AddInParameterExactSized(this SqlCommand cmd, string name, SqlBinary value)
{
var prm = cmd.CreateParameter();
prm.Direction = ParameterDirection.Input;
prm.ParameterName = name;
prm.SqlDbType = SqlDbType.Binary;
prm.SqlValue = value;
prm.Size = value.Length;
cmd.Parameters.Add(prm);
return prm;
}
示例8: SqlBytes
public SqlBytes (SqlBinary value)
{
if (value.IsNull) {
notNull = false;
buffer = null;
}
else {
notNull = true;
buffer = value.Value;
storage = StorageState.Buffer;
}
}
示例9: CanSmiles
public static SqlString CanSmiles(SqlBinary molecule, SqlString bingo_schema)
{
using (BingoSession session = new BingoSession())
{
using (SqlConnection conn = new SqlConnection("context connection=true"))
{
conn.Open();
prepareContext(conn, bingo_schema.Value, 0, 0);
}
return BingoCore.mangoSMILES(molecule.Value, true);
}
}
示例10: ExtractStringWithEncoding
public static SqlString ExtractStringWithEncoding(SqlBinary binary, string encodingName)
{
using (var decompressed = new MemoryStream(binary.Value))
{
using (var stream = ExtractStream(decompressed))
{
if (encodingName == string.Empty || encodingName == null)
encodingName = "utf-8";
return MemoryStreamToString(stream as MemoryStream, Encoding.GetEncoding(encodingName));
}
}
}
示例11: GetReady
public void GetReady()
{
byte [] b1 = new Byte [2];
byte [] b2 = new Byte [3];
byte [] b3 = new Byte [2];
b1 [0] = 240;
b1 [1] = 15;
b2 [0] = 10;
b2 [1] = 10;
b2 [2] = 10;
b3 [0] = 240;
b3 [1] = 15;
Test1 = new SqlBinary(b1);
Test2 = new SqlBinary(b2);
Test3 = new SqlBinary(b3);
}
示例12: SqlBinaryTest
public SqlBinaryTest()
{
byte[] b1 = new byte[2];
byte[] b2 = new byte[3];
byte[] b3 = new byte[2];
b1[0] = 240;
b1[1] = 15;
b2[0] = 10;
b2[1] = 10;
b2[2] = 10;
b3[0] = 240;
b3[1] = 15;
_test1 = new SqlBinary(b1);
_test2 = new SqlBinary(b2);
_test3 = new SqlBinary(b3);
}
示例13: _Match
private static SqlInt32 _Match (SqlBinary target, SqlString query, SqlString options,
SqlString bingo_schema, string search_type,
bingoCallback prepare_match, bingoCallback process_matched)
{
using (BingoSession sessions = new BingoSession())
{
ContextFlags flags = 0;
if (options.Value.Contains("TAU"))
flags |= ContextFlags.TAU_RULES;
if (search_type == "SIM")
flags |= ContextFlags.FINGERPRINTS;
using (SqlConnection conn = new SqlConnection("context connection=true"))
{
conn.Open();
prepareContext(conn, bingo_schema.Value, 0, flags);
}
int res = BingoCore.lib.mangoSetupMatch(search_type, query.Value, options.Value);
if (res < 0)
throw new Exception(BingoCore.lib.bingoGetError());
if (prepare_match != null)
prepare_match();
res = BingoCore.lib.mangoMatchTarget(target.Value, target.Value.Length);
if (res == -2)
throw new Exception(BingoCore.lib.bingoGetError());
if (res == -1)
{
// can not use SqlContext.Pipe from inside the function,
// so just returning NULL without printing the error message
return SqlInt32.Null;
}
if (res == 1 && process_matched != null)
process_matched();
return new SqlInt32(res);
}
}
示例14: Exact
public static SqlInt32 Exact (SqlBinary target, SqlString query, SqlString options, SqlString bingo_schema)
{
return _Match(target, query, options, bingo_schema, "EXACT", null, null);
}
示例15: SMARTS
public static SqlInt32 SMARTS (SqlBinary target, SqlString query, SqlString options, SqlString bingo_schema)
{
return _Match(target, query, options, bingo_schema, "SMARTS", null, null);
}