Imported Upstream version 3.12.0

Former-commit-id: cf92446697332992ec36726e78eb8703e1f259d7
This commit is contained in:
Jo Shields
2015-01-13 10:44:36 +00:00
parent 8b9b85e7f5
commit 181b81b4a4
659 changed files with 12743 additions and 16300 deletions

View File

@@ -37,6 +37,7 @@
using System;
using System.Globalization;
using System.Text;
using System.Security;
using Mono.Security.Protocol.Ntlm;
@@ -392,11 +393,12 @@ namespace Mono.Data.Tds.Protocol
return IsConnected;
}
private static string EncryptPassword (string pass)
private static string EncryptPassword (SecureString secPass)
{
int xormask = 0x5a5a;
int len = pass.Length;
int len = secPass.Length;
char[] chars = new char[len];
string pass = GetPlainPassword(secPass);
for (int i = 0; i < len; ++i) {
int c = ((int) (pass[i])) ^ xormask;
@@ -487,6 +489,19 @@ namespace Mono.Data.Tds.Protocol
Comm.Append ((byte) 0x00); // no param meta data name
Comm.Append ((byte) 0x00); // no status flags
// Convert BigNVarChar values larger than 4000 chars to nvarchar(max)
// Need to do this here so WritePreparedParameterInfo emit the
// correct data type
foreach (TdsMetaParameter param2 in parameters) {
var colType = param2.GetMetaType ();
if (colType == TdsColumnType.BigNVarChar) {
int size = param2.GetActualSize ();
if ((size >> 1) > 4000)
param2.Size = -1;
}
}
// Write sql as a parameter value - UCS2
TdsMetaParameter param = new TdsMetaParameter ("sql",