首次推送

This commit is contained in:
lym
2026-03-09 00:13:46 +08:00
commit b19613bb31
13974 changed files with 2767735 additions and 0 deletions

View File

@@ -0,0 +1,90 @@
using System.Text;
using COSXML.Common;
using COSXML.Network;
using COSXML.Model.Tag;
using COSXML.CosException;
namespace COSXML.Model.Object
{
public sealed class SelectObjectRequest : ObjectRequest
{
private string expression;
private string expressionType = "SQL";
private ObjectSelectionFormat inputFormat;
private ObjectSelectionFormat outputFormat;
internal COSXML.Callback.OnProgressCallback progressCallback;
internal string outputFilePath;
public SelectObjectRequest(string bucket, string key)
: base(bucket, key)
{
this.method = CosRequestMethod.POST;
this.queryParameters.Add("select", null);
this.queryParameters.Add("select-type", "2");
}
public SelectObjectRequest outputToFile(string filePath) {
outputFilePath = filePath;
return this;
}
public SelectObjectRequest setExpression(string expression) {
this.expression = expression;
return this;
}
public SelectObjectRequest setExpressionType(string expressionType) {
this.expressionType = expressionType;
return this;
}
public SelectObjectRequest setInputFormat(ObjectSelectionFormat inputFormat) {
this.inputFormat = inputFormat;
return this;
}
public SelectObjectRequest setOutputFormat(ObjectSelectionFormat outputFormat) {
this.outputFormat = outputFormat;
return this;
}
public SelectObjectRequest SetCosProgressCallback(COSXML.Callback.OnProgressCallback progressCallback)
{
this.progressCallback = progressCallback;
return this;
}
public override void CheckParameters()
{
base.CheckParameters();
if (expression == null) {
throw new CosClientException((int)CosClientError.INVALID_ARGUMENT,
"expression is null");
}
if (inputFormat == null) {
throw new CosClientException((int)CosClientError.INVALID_ARGUMENT,
"inputFormat is null");
}
if (outputFormat == null) {
throw new CosClientException((int)CosClientError.INVALID_ARGUMENT,
"outputFormat is null");
}
}
public override Network.RequestBody GetRequestBody()
{
string content = Transfer.XmlBuilder.BuildSelection(expression, expressionType, inputFormat,
outputFormat, progressCallback != null);
byte[] data = Encoding.UTF8.GetBytes(content);
ByteRequestBody body = new ByteRequestBody(data);
return body;
}
}
}