Sign in Join
Wiki copytemporary

Install Packages/zh TW: what changed

Revision 1 to 2. Removed lines have a minus sign; added lines have a plus sign.

OldNewLine
11## 概述
22
33基於大眾的需求,所以特此在此寫一篇簡短的 "安裝套件 HOW-TO"。
44
55在安裝完 Lazarus 後很多新手常覺得奇怪找不到資料庫的元件使用。你可以參考一些[資料庫來源]的元件,但一般我們要用來連結資料庫的元件怎麼都不見了,何況是要從資料庫取出資料來?
66
77好吧,讓我們來看看如何找到讓這可行的方法。
88
99## Lazarus 安裝的檔案
1010
1111在 Linux 下你的 Lazarus 會安裝在 **/usr/bin/lazarus** 這個目錄,Mac OS X 下 Lazarus 是安裝在 **/usr/local/share/lazarus**,而 Windows 裡安裝程式會在安裝的時候給你自己挑,而且目錄裡不能有空白。在我的 Windows 下 Lazarus 安裝在 **G:/Lazarus**。然而這是 Lazarus 的根目錄,在底下你會找到一些子目錄,其中第一個 (依字母排序) 是 **components**。
1212
1313當你看到幾個子目錄後,就能讓我們聯想起幾個資料庫,像是**Interbase**,**mysql**,**sqlite** 和 **sqldb** 的目錄。前三個包含了該資料庫連線的元件,而 TDataset 提供給各別系列的資料庫。最後一個 **sqldb** 比較廣泛,除了包含 TSQLQuery (TDataset) 與 TSQLTransaction 可以支援各類型的資料,TSQLConnection 則用於連線。
1414
1515此文我們連同 Interbase 和 sqldb 套件一起安裝。
1616
1717## 玩真的了
1818
1919### 首先:為什麼
2020
2121在我們安裝套件之前,我們先來討論一下為什麼 Lazarus 不事先安裝好這些資料庫元件。資料庫連線元件需要使用者端有這些資料庫的函式庫才行,因為 Lazarus 目前不支援動熊連結的函式庫,所有的函式庫都必須編譯進 IDE 才行。所以你無法預期程式師能夠安裝有所有資料庫的函式庫,所以預設情況下也無法安裝所有資料庫的連線元件。
2222
2323### 第二: 但 Delphi 呢...?
2424
2525Delphi 其實也只有安裝一些在 PC 上一定會有的資料庫連線元件 (ADO 元件),或是一些不需要函式庫的 (BDE: Paradox, DBase) 才有安裝。
2626
2727### 第三: 讓我們安裝一些東西
2828
2929要安裝套件,來到 "元件 -\> 開啟套件檔 (.lpk)"。 In the following dialog you navigate to **/usr/share/lazarus/components/sqldb** or the corresponding directory under OS X or Windows and choose the **sqldblaz.lpk** file. If everything works out as planned you will see the Package Manager. The Package Manager is showing a treeview with the files in the package and the required packages. Now press **Compile** if you don't want to install the component into the IDE, otherwise you should press **Install**. Next we get a warning about Lazarus only supporting static linked libraries and the question if you want to rebuild Lazarus. Just press Yes and sit back. Lazarus will be rebuilt, and depending on your configuration restarted.
3030
31-If everything went well you'll see a new tab called **SQLdb**. This tab will contain <strike>two components a TSQLConnection and a TSQLQuery. What we need next is a Connection component. Once again go to Components -\> Open Package File and navigate to **/usr/share/lazarus/components/sqldb/interbase**. Open the ibconnectionlaz.lpk file and again press Compile and Install and Yes. :)
31+If everything went well you'll see a new tab called **SQLdb**. This tab will contain two components a TSQLConnection and a TSQLQuery. What we need next is a Connection component. Once again go to Components -\> Open Package File and navigate to **/usr/share/lazarus/components/sqldb/interbase**. Open the ibconnectionlaz.lpk file and again press Compile and Install and Yes. :)
3232
33-Next time Lazarus is started the SQLdb tab also contains a component TIBConnection. </strike>
33+Next time Lazarus is started the SQLdb tab also contains a component TIBConnection.
3434
3535in the meantime all supported components.
3636
3737## Anything else?
3838
3939Well that is all there is to it. You're now set to make your first program connecting to an Interbase server. See this [sources](http://prdownloads.sourceforge.net/lazarus-ccr/IBdemo-20050328.zip?download) to download a small example. If you have any questions, go to the lazarus [forum](http://www.lazarus.freepascal.org/index.php?name=PNphpBB2&file=index) or post it to the lazarus mailing list.
4040
4141## Compile an IDE with packages at command line
4242
4343There is no command line tool yet, to configure and setup the IDE config files to add/remove packages. You must setup this with an IDE, copy the configs and adapt the path. See here for details: [[Install IDE packages without the IDE]]. But the rest can be done on command line:
4444
4545### First build a normal IDE and LCL
4646
4747` make clean all`
4848
4949### Then compile the IDE with packages
5050
5151This will build the packages to be installed, then the IDE and finally link all together:
5252
5353`lazbuild --build-ide=`
5454
5555The *--build-ide* parameter can take some options, for example -gh for heaptrc or '-gh -gt'.
5656
5757## See also
5858
5959- [[Lazarus Packages]]
6060
6161---
6262*From the Free Pascal wiki, page "Install Packages/zh TW", as it stood on 2011-08-03 after a change by Chronos, out of the wiki's dump of 2024-05-26. Copyright stays with the author who wrote it, according to the old wiki's [[Licensing]] page. If you have concerns about this material, [message the admin](/wiki-contact).*
6363Category: Lazarus/zh TW
6464Category: Tutorials/zh TW

Back to history