• <ins id="pjuwb"></ins>
    <blockquote id="pjuwb"><pre id="pjuwb"></pre></blockquote>
    <noscript id="pjuwb"></noscript>
          <sup id="pjuwb"><pre id="pjuwb"></pre></sup>
            <dd id="pjuwb"></dd>
            <abbr id="pjuwb"></abbr>
            [意譯]Berkeley DB 文檔 - C++入門篇 - 1.2節 - Berkeley DB 概述

            譯者序(轉載 -- Berkeley DB簡介):

                Berkeley DB是由美國Sleepycat Software公司開發的一套開放源碼的嵌入式數據庫的程序庫(database library),它為應用程序提供可伸縮的、高性能的、有事務保護功能的數據管理服務。Berkeley DB為數據的存取和管理提供了一組簡潔的函數調用API接口。
                
                它是一個經典的C-library模式的toolkit,為程序員提供廣泛豐富的函數集,是為應用程序開發者提供工業級強度的數據庫服務而設計的。其主要特點如下:

                嵌入式(Embedded):它直接鏈接到應用程序中,與應用程序運行于同樣的地址空間中,因此,無論是在網絡上不同計算機之間還是在同一臺計算機的不同進程之間,數據庫操作并不要求進程間通訊。

                Berkeley DB為多種編程語言提供了API接口,其中包括C、C++、Java、Perl、Tcl、Python和PHP,所有的數據庫操作都在程序庫內部發生。多個進程,或者同一進程的多個線程可同時使用數據庫,有如各自單獨使用,底層的服務如加鎖、事務日志、共享緩沖區管理、內存管理等等都由程序庫透明地執行。

                輕便靈活(Portable):它可以運行于幾乎所有的UNIX和Linux系統及其變種系統、Windows操作系統以及多種嵌入式實時操作系統之下。它在32位和64位系統上均可運行,已經被好多高端的因特網服務器、臺式機、掌上電腦、機頂盒、網絡交換機以及其他一些應用領域所采用。一旦 Berkeley DB被鏈接到應用程序中,終端用戶一般根本感覺不到有一個數據庫系統存在。

                可伸縮(Scalable):這一點表現在很多方面。Database library本身是很精簡的(少于300KB的文本空間),但它能夠管理規模高達256TB的數據庫。它支持高并發度,成千上萬個用戶可同時操縱同一個數據庫。Berkeley DB能以足夠小的空間占用量運行于有嚴格約束的嵌入式系統,也可以在高端服務器上耗用若干GB的內存和若干TB的磁盤空間。

                Berkeley DB在嵌入式應用中比關系數據庫和面向對象數據庫要好,有以下兩點原因:

                (1)因為數據庫程序庫同應用程序在相同的地址空間中運行,所以數據庫操作不需要進程間的通訊。在一臺機器的不同進程間或在網絡中不同機器間進行進程通訊所花費的開銷,要遠遠大于函數調用的開銷;

                (2)因為Berkeley DB對所有操作都使用一組API接口,因此不需要對某種查詢語言進行解析,也不用生成執行計劃,大大提高了運行效.

            正文

            Berkeley DB Documentation -- C++ Getting Started Guide
            Berkeley DB 文檔 -- C++入門篇

            Berkeley DB Concepts
            Berkeley DB 概述

            Before continuing, it is useful to describe some of the larger concepts that you will encounter when building a DB application.

            先看看構建一個DB應用時你可能遇到的一些概念.

            Conceptually, DB databases contain records. Logically each record represents a single entry in the database. Each such record contains two pieces of information: a key and a data. This manual will on occasion describe a a record's key or a record's data when it is necessary to speak to one or the other portion of a database record.

            概念上說,DB數據庫包含了記錄(records),每條技術是一個邏輯上的實體.這種記錄通常包含兩部分的信息,鍵和值.本手冊會適當的時候來進一步說明.

            Because of the key/data pairing used for DB databases, they are sometimes thought of as a two-column table. However, data (and sometimes keys, depending on the access method) can hold arbitrarily complex data. Frequently, C structures and other such mechanisms are stored in the record. This effectively turns a 2-column table into a table with n columns, where n-1 of those columns are provided by the structure's fields.

            根據鍵值對的DB數據庫模型,我們有時會認為它是一個只有兩列的表.然而,值(有時也可以是鍵,這由訪問的方式決定)可以是一種復雜的數據結構.通常,記錄中保存的是C的結構體或一些類似的東西.這種方式有效的把2列的表轉變為n列的表,其中n-1列是由結構體提供.

            Note that a DB database is very much like a table in a relational database system in that most DB applications use more than one database (just as most relational databases use more than one table).

            注意,我們這里的DB數據庫和關系數據庫中的表十分類似,絕大部分DB應用使用不只一個數據庫(正如大部分關系數據庫不只一個表).

            Unlike relational systems, however, a DB database contains a single collection of records organized according to a given access method (BTree, Queue, Hash, and so forth). In a relational database system, the underlying access method is generally hidden from you.

            但與關系系統不同的是,DB數據庫可以通過指定方式(B樹,隊列,哈希,諸如此類)訪問一個的數據集.在關系數據庫系統中,這些隱藏的訪問方式通常是用戶不可見的.

            In any case, frequently DB applications are designed so that a single database stores a specific type of data (just as in a relational database system, a single table holds entries containing a specific set of fields). Because most applications are required to manage multiple kinds of data, a DB application will often use multiple databases.

            基本上,常用的DB應用設計是一個單獨的數據庫來保存一個特定的數據類型(正如關系數據庫中,一張單獨的表包含一種特定的集合).由于一個程序通常要包含多種數據類型,一個DB應用通常也使用多個數據庫.

            For example, consider an accounting application. This kind of an application may manage data based on bank accounts, checking accounts, stocks, bonds, loans, and so forth. An accounting application will also have to manage information about people, banking institutions, customer accounts, and so on. In a traditional relational database, all of these different kinds of information would be stored and managed using a (probably very) complex series of tables. In a DB application, all of this information would instead be divided out and managed using multiple databases.

            比如,想像一個賬目程序.這種程序可以管理銀行帳號,支票帳號,股票,債券,貸款等等.一個賬目程序還需要管理用戶,用戶帳戶,銀行等等的信息.在傳統的關系數據庫中,所有的這些信息可能通過一系列(也許非常非常)復雜的表來保存和管理.在DB應用中,所有的這些信息則被分離,用多個數據庫來管理.

            DB applications can efficiently use multiple databases using an optional mechanism called an environment. For more information, see Environments.

            DB應用可以通過一種可選的叫做"環境(environment)"機制來有效的使用多個數據庫.更多內容參見"Environments"章節.

            You interact with most DB APIs using special structures that contain pointers to functions. These callbacks are called methods because they look so much like a method on a C++ class. The variable that you use to access these methods is often referred to as a handle. For example, to use a database you will obtain a handle to that database.

            你通過使用特定包含指針和函數的結構體和DB的API互交.這些回調和C++中類的method看上去很像,因此被稱為方法(methods).
            用來訪問方法的變量通常是一個句柄(handle).比如,使用一個數據庫,你必須獲得一個數據庫的句柄.

            Retrieving a record from a database is sometimes called getting the record because the method that you use to retrieve the records is called get(). Similarly, storing database records is sometimes called putting the record because you use the put() method to do this.

            從數據庫中找回一條記錄有時被稱為get一條記錄,原因是找回記錄的方法是get().類似保存一條記錄有時被稱為put一條記錄,因為相應的方法是put().

            When you store, or put, a record to a database using its handle, the record is stored according to whatever sort order is in use by the database. Sorting is mostly performed based on the key, but sometimes the data is considered too. If you put a record using a key that already exists in the database, then the existing record is replaced with the new data. However, if the database supports duplicate records (that is, records with identical keys but different data), then that new record is stored as a duplicate record and any existing records are not overwritten.

            當你通過句柄保存,或者說是put一條記錄,這條記錄通過數據庫指定的順序被插入.順序主要是由鍵來確定,但有時值也是被考慮的因素.如果你put了一個鍵已經存在的記錄,它會用新的數據替換原有數據.然而,如果數據庫支持多重(duplicate)記錄(也就是說鍵同值不同),那么新的記錄會作為另一個副本保存.

            If a database supports duplicate records, then you can use a database handle to retrieve only the first record in a set of duplicate records.

            如果數據庫支持多重記錄,你可以通過數據庫找回多重記錄集中的第一條記錄.

            In addition to using a database handle, you can also read and write data using a special mechanism called a cursor. Cursors are essentially iterators that you can use to walk over the records in a database. You can use cursors to iterate over a database from the first record to the last, and from the last to the first. You can also use cursors to seek to a record. In the event that a database supports duplicate records, cursors are the only way you can access all the records in a set of duplicates.

            再提一點關于數據庫句柄使用,你可以通過一種叫做游標(cursor)的特定機制來讀/寫數據.游標本質上是用來遍歷數據庫中記錄的迭代器(iterator).你可以使用游標來查詢記錄.在數據庫支持多重記錄的情況下,游標是唯一可以訪問這些記錄副本集的方式.

            Finally, DB provides a special kind of a database called a secondary database. Secondary databases serve as an index into normal databases (called primary database to distinguish them from secondaries). Secondary databases are interesting because DB records can hold complex data types, but seeking to a given record is performed only based on that record's key. If you wanted to be able to seek to a record based on some piece of information that is not the key, then you enable this through the use of secondary databases.

            最后,DB提供了一種特殊的數據庫叫做次級(secondary)數據庫.次級數據庫作為普通數據庫(為了區別,稱他為主數據庫)的索引而存在.由于DB數據庫可以保存復雜的數據結構,但是查詢時只能通過記錄的鍵.如果你想通過不是鍵的部分進行查詢,就需要通過次級數據庫來實現了.
            posted on 2007-05-10 10:49 張沈鵬 閱讀(865) 評論(0)  編輯 收藏 引用 所屬分類: C++
             
            99久久伊人精品综合观看| 色综合久久无码五十路人妻| 青青草国产精品久久| 国产精品VIDEOSSEX久久发布| 丁香久久婷婷国产午夜视频| 久久精品这里只有精99品| 成人久久免费网站| 国产精品免费看久久久| 91麻豆精品国产91久久久久久| 久久有码中文字幕| 欧美大香线蕉线伊人久久| 99久久精品国产一区二区三区| 久久婷婷五月综合成人D啪| 国内精品久久国产大陆| 思思久久99热只有频精品66| 精品久久久久久久久午夜福利| 久久久久一本毛久久久| 久久人人爽爽爽人久久久| 久久精品国产一区二区三区不卡 | 国产精品久久久久久久久鸭| 久久国产精品免费一区二区三区| 99精品国产综合久久久久五月天| 日韩精品久久久久久| 亚洲国产精品无码久久久秋霞2| 久久99热这里只有精品国产| 狠狠色婷婷综合天天久久丁香| 久久久一本精品99久久精品88| 97久久精品人人澡人人爽| 久久精品人人做人人爽97| 2021国内久久精品| 综合久久精品色| 久久无码精品一区二区三区| 国产农村妇女毛片精品久久| 东京热TOKYO综合久久精品| 久久夜色精品国产噜噜亚洲AV| 欧美伊人久久大香线蕉综合| 久久中文字幕视频、最近更新 | 日本亚洲色大成网站WWW久久| 99久久免费国产精品| 国产精品女同一区二区久久| 激情久久久久久久久久|