全國最多中醫師線上諮詢網站-台灣中醫網
發文 回覆 瀏覽次數:1326
推到 Plurk!
推到 Facebook!

請問Delphi 5中TSession有甚麼用途?

答題得分者是:Justmade
SuperLowB
初階會員


發表:96
回覆:77
積分:34
註冊:2003-06-11

發送簡訊給我
#1 引用回覆 回覆 發表時間:2003-06-17 10:48:45 IP:203.198.xxx.xxx 未訂閱
如題
Justmade
版主


發表:94
回覆:1934
積分:2030
註冊:2003-03-12

發送簡訊給我
#2 引用回覆 回覆 發表時間:2003-06-17 11:09:11 IP:218.16.xxx.xxx 未訂閱
BDE 數據庫用 最主要是以不同 Thread 連上同一組 Tables 之用 例如放在 ISAPI 程式裡,每個連上的 User 可有自己的 session 存取數據庫不會互相混亂了。 當然還有其他的作用請參考 Help File 或 所附的 Developer Guild From Delphi Help FIle : An BDE-based application's database connections, drivers, cursors, queries, and so on are maintained within the context of one or more BDE sessions. Sessions isolate a set of database access operations, such as database connections, without the need to start another instance of the application. All BDE-based database applications automatically include a default session component, named Session , that encapsulates the default BDE session. When database components are added to the application, they are automatically associated with the default session (note that its SessionName is "Default"). The default session provides global control over all database components not associated with another session, whether they are implicit (created by the session at runtime when you open a dataset that is not associated with a database component you create) or persistent (explicitly created by your application). The default session is not visible in your data module or form at design time, but you can access its properties and methods in your code at runtime. To use the default session, you need write no code unless your application must Explicitly activate or deactivate a session, enabling or disabling the session's databases' ability to open. Modify the properties of the session, such as specifying default properties for implicitly generated database components . Execute a session's methods, such as managing database connections (for example opening and closing database connections in response to user actions). Respond to session events, such as when the application attempts to access a password-protected Paradox or dBASE table. Set Paradox directory locations such as the NetFileDir property to access Paradox tables on a network and the PrivateDir property to a local hard drive to speed performance. Manage the BDE aliases that describe possible database connection configurations for databases and datasets that use the session. Whether you add database components to an application at design time or create them dynamically at runtime, they are automatically associated with the default session unless you specifically assign them to a different session . If you open a dataset that is not associated with a database component, Delphi automatically Creates a database component for it at runtime. Associates the database component with the default session. Initializes some of the database component's key properties based on the default session's properties. Among the most important of these properties is KeepConnections, which determines when database connections are maintained or dropped by an application. The default session provides a widely applicable set of defaults that can be used as is by most applications. You need only associate a database component with an explicitly named session if the component performs a simultaneous query against a database already opened by the default session. In this case, each concurrent query must run under its own session. Multi-threaded database applications also require multiple sessions, where each thread has its own session. Applications can create additional session components as needed. BDE-based database applications automatically include a session list component, named Sessions , that you can use to manage all of your session components. For more information about managing multiple sessions see, Managing multiple sessions. You can safely place session components in data modules. If you put a data module that contains one or more session components into the Object Repository, however, make sure to set the AutoSessionName property to True to avoid namespace conflicts when users inherit from it.
系統時間:2024-11-23 12:45:05
聯絡我們 | Delphi K.Top討論版
本站聲明
1. 本論壇為無營利行為之開放平台,所有文章都是由網友自行張貼,如牽涉到法律糾紛一切與本站無關。
2. 假如網友發表之內容涉及侵權,而損及您的利益,請立即通知版主刪除。
3. 請勿批評中華民國元首及政府或批評各政黨,是藍是綠本站無權干涉,但這裡不是政治性論壇!