TDBXCommand *cmd;
cmd= FDBXConnection->CreateCommand();
cmd->CommandType=TDBXCommandTypes_DSServerMethod;
FFindDataSetCommand->Text = "TServerMethods1.FindDataSet";
cmd->Parameters->Parameter[0]->Value->GetDBXReader();
cmd->ExecuteUpdate();
if (FInstanceOwner)
cmd->FreeOnExecute(result);
FreeOnExecute registers the object indicated by Value
, and frees it the next time the command is executed, closed, or freed.
#define TDBXCommandTypes_DbxSQL L"Dbx.SQL" #define TDBXCommandTypes_DbxStoredProcedure L"Dbx.StoredProcedure" #define TDBXCommandTypes_DbxTable L"Dbx.Table" #define TDBXCommandTypes_DbxMetaData L"Dbx.MetaData" #define TDBXCommandTypes_DbxCommand L"Dbx.Command" #define TDBXCommandTypes_DbxPool L"Dbx.Pool" #define TDBXCommandTypes_DSServerMethod L"DataSnap.ServerMethod"
TDBXWritableValue* Value;
Value->GetDBXReader();
TDBXReader *reader;
reader =Value->GetDBXReader();
reader= cmd->ExecuteQuery();
TDBXCommand instances can be created by calling one of the TDBXConnection.CreateCommandmethods. As soon as an application is finished using a command, the TDBXCommand.Free method must be called. This releases memory for the command and any associated resources.
TDBXCommand 应用程序会释放内存,内存释放问题泄露问题也不用担心了!
TDBXReader provides a unidirectional reader for a collection of database rows.
TDBXReader provides a forward only reader for a collection of database rows.
TDBXReader is returned by TDBXCommand.ExecuteQuery. Call TDBXReader.Next to access the first and successive rows in the collection. Row values can be accessed using the Value array property. Value is overloaded so it can be indexed either by ordinal position or by column name.
Note: When an application no longer needs a TDBXReader instance, it should call TDBXReader.Free. This ensures that all resources associated with the TDBXReader are released.
可见TDBXReader 比较简单,单向数据集,只有Next方法,没有Prior()方法,没有RecordCount属性。
并且当应用程序不再使用该实例时会自己释放内存这点比较强。解决了内存释放泄露的问题。
做c++builder不用再担心内存释放的问题了。
【推荐】编程新体验,更懂你的AI,立即体验豆包MarsCode编程助手
【推荐】凌霞软件回馈社区,博客园 & 1Panel & Halo 联合会员上线
【推荐】抖音旗下AI助手豆包,你的智能百科全书,全免费不限次数
【推荐】博客园社区专享云产品让利特惠,阿里云新客6.5折上折
【推荐】轻量又高性能的 SSH 工具 IShell:AI 加持,快人一步
· C++代码改造为UTF-8编码问题的总结
· DeepSeek 解答了困扰我五年的技术问题
· 为什么说在企业级应用开发中,后端往往是效率杀手?
· 用 C# 插值字符串处理器写一个 sscanf
· Java 中堆内存和栈内存上的数据分布和特点
· What?废柴, 还在本地部署DeepSeek吗?Are you kidding?
· 程序员转型AI:行业分析
· 为DeepSeek添加本地知识库
· 深入集成:使用 DeepSeek SDK for .NET 实现自然语言处理功能
· .NET程序员AI开发基座:Microsoft.Extensions.AI
2014-08-20 ListView 操作