Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 46e2ad5

Browse files
committed
Fix for an Issue #331
1 parent ac407ae commit 46e2ad5

1 file changed

Lines changed: 2 additions & 4 deletions

File tree

plugins/generic/filesystem.py

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -48,10 +48,8 @@ def _checkFileLength(self, localFile, remoteFile, fileRead=False):
4848
lengthQuery = "SELECT LENGTH(data) FROM pg_largeobject WHERE loid=%d" % self.oid
4949

5050
elif Backend.isDbms(DBMS.MSSQL):
51-
self.createSupportTbl(self.fileTblName, self.tblField, "text")
52-
53-
# Reference: http://msdn.microsoft.com/en-us/library/ms188365.aspx
54-
inject.goStacked("BULK INSERT %s FROM '%s' WITH (CODEPAGE='RAW', FIELDTERMINATOR='%s', ROWTERMINATOR='%s')" % (self.fileTblName, remoteFile, randomStr(10), randomStr(10)))
51+
self.createSupportTbl(self.fileTblName, self.tblField, "VARBINARY(MAX)")
52+
inject.goStacked("INSERT INTO %s(%s) SELECT %s FROM OPENROWSET(BULK '%s', SINGLE_BLOB) AS %s(%s)" % (self.fileTblName, self.tblField, self.tblField, remoteFile, self.fileTblName, self.tblField));
5553

5654
lengthQuery = "SELECT DATALENGTH(%s) FROM %s" % (self.tblField, self.fileTblName)
5755

0 commit comments

Comments
 (0)