ddd
根据大佬的测试 https://developer.aliyun.com/ask/54534,copy命令的效率是很高的。
但copy 命令只能操作本机的文件,所以浏览器上传的文件需要通过共享文件夹上传部署PGSQL服务器(测试IP为:192.168.1.11)中。
// Upload entire file UploadWholeFile.ashx
private void UploadWholeFile(HttpContext context, List<FilesStatus> statuses)
{
for (int i = 0; i < context.Request.Files.Count; i++)
{
var file = context.Request.Files[i];
var fileName = GetGuidFilename(file.FileName);
var testtemp = @"\\192.168.1.11\publicfile\aa_test.csv";
/file.SaveAs(testtemp);
}
}
然后直接执行即可
var dtgrade2 = DbHelper.ExecuteNonQuery(@" COPY aa_test FROM 'E:/publicfile/aa_test.csv' WITH csv ");
官方文档中,貌似阔以返回到客户端,有兴趣的研究下
COPY country TO STDOUT (DELIMITER '|');
标签:aa,context,PGSQL,命令,test,file,var,COPY From: https://www.cnblogs.com/j2ee-web-01/p/18087862