Install Packages/zh CN: what changed
Revision 0 to 1. Removed lines have a minus sign; added lines have a plus sign.
Title: Install Packages/zh CN
| Old | New | Line | |
|---|---|---|---|
| 1 | + | ## 概览 | |
| 2 | + | ||
| 3 | + | Due to popular demand here is a first attempt to create a small "Install package HOW-TO". 由于普遍的需求,这里有一个最初的尝试,建立一个小的“包如何安装”。 | |
| 4 | + | ||
| 5 | + | 在安装辣子之后,很多新手想知道,哪里的组件能够操作数据库。你能看到一个数据源和一些数据感知组件,但是,哪里才是组件连接到数据库(服务器)和从数据库检索数据的地方呢? | |
| 6 | + | ||
| 7 | + | 好的,让我们看一看,是否我们能找到这些东西。 | |
| 8 | + | ||
| 9 | + | ## Lazarus安装的文件 | |
| 10 | + | ||
| 11 | + | 在Linux下,Lazarus默认安装在**/usr/share/lazarus**位置;在Mac OS X上,Lazarus默认安装在**/usr/local/share/lazarus**,在Windows上,安装位置你可以选择,比如**G:/Lazarus**。不管你把Lazarus安装在哪里,你总能发现一些子文件夹。就是这样,(按字母顺序排列)子目录看起来类似**components**这样的。 | |
| 12 | + | ||
| 13 | + | 就像你看到的,那儿也有一些子目录,看起来是一些数据库相关的文件。一个**Interbase**,一个**mysql**,一个**sqlite**和**sqldb**目录。The first three contain database connection components and TDataset descendants for the respective databases. The last one, **sqldb**, is more generic, as it consists of TSQLQuery (a TDataset) and TSQLTransaction which are used for all types of databases and a T??Connection to make the connection to the database. 如同你能看到的,那儿还有一些子目录,使我们联想起数据库。一个看起来是**Interbase**, 一个 **mysql**,一个 **sqlite** 还有一个 **sqldb** 文件夹。(译注:看不到这么多了,好几个组件被并入**sqldb**)。前三个是数据库连接组件,还有各自数据库的 Tdataset descendants。最后一个,**sqldb**,更普通,它有几部分组成:TSQLQuery (一个 TDataset) 和 TSQLTransaction 用来给所有数据库类型做连接的 TConnection。 | |
| 14 | + | ||
| 15 | + | 本章内,我们要安装一个sqldb包,连同连接 Interbase。 | |
| 16 | + | ||
| 17 | + | ## The real work 实际工作 | |
| 18 | + | ||
| 19 | + | ### 首先:为什么 | |
| 20 | + | ||
| 21 | + | 在我们开始安装一个包之前,我要先讨论,为什么Lazarus不安装数据库连接组件。数据库连接组件需要客户端运行库(lib)可用,就是组件被应用的那台电脑。因为辣子并不支持动态连接(dynamic linking),所有库必须编译入IDE。这样,你不能指望每一个开发者都安装所有的数据库,默认(辣子)安装所有的连接组件并不现实。 | |
| 22 | + | ||
| 23 | + | ### 其次:不过Delphi…… | |
| 24 | + | ||
| 25 | + | Delphi also only installs the database components which are readily available on the computer (ADO components) and components which do not need any client libraries (BDE: Paradox, DBase) to be installed. | |
| 26 | + | ||
| 27 | + | Delphi也仅仅安装了一些数据库组件,那些在电脑上容易得到(ADO组件)和无需任何客户端运行库的组件(BDE:Paradox, DBase)会被安装。 | |
| 28 | + | ||
| 29 | + | ### 第三点:让我们装点东西 | |
| 30 | + | ||
| 31 | + | `要安装一个包,请点击菜单:“组件 -> 打开包文件 (.lpk)”。` | |
| 32 | + | ||
| 33 | + | 在接下来的对话框中,你选定到**.../lazarus/components/sqldb**位置,或者其它OS下相应的位置,然后选择**sqldblaz.lpk**文件。如果一切正常,你将看到’包管理器‘窗口。这个包管理器会显示树状图,关于包内(所指)文件和所需包。 | |
| 34 | + | ||
| 35 | + | 现在,点击 **编译** ,如果你不想安装组件进入IDE,否则你应该点击**安装**。下一步,我们会得到一个警告,Lazarus仅支持静态连接(static linked),辣子将重建(rebuilt),并且,依据你的配置重启。 | |
| 36 | + | ||
| 37 | + | 如果一切进展顺利,你将看到一个叫做**SQLdb**的标签。该标签(组件)将包括~~两个部分组件,一个 TSQLConnection 和一个 TSQLQuery。我们下一步需要的是连接组件。再次单击菜单:组件 -\> 打开包文件,然后选定 **.../lazarus/components/sqldb/interbase**。打开 ibconnectionlaz.lpk 文件并再次点击编译或安装,就好了。 :) 下一次辣子启动时,SQLdb 标签也会包含一个组件 TIBConnection。~~(译注:在0.924版本中,后两个组件都已经安装了,第一个TSQLConnection没有找到)。 | |
| 38 | + | ||
| 39 | + | in the meantime all supported components. | |
| 40 | + | ||
| 41 | + | ## 还有别的吗? | |
| 42 | + | ||
| 43 | + | 好了,就这些。你现在可以开动你的第一个程序,连接到Interbase服务器。(译注:InterBase由Borland软件公司开发的单文件数据库,曾经在6.0开放源代码,后开源社区基于InterBase 6.0的C语言C源代码,用C++重写为 FireBird 数据库)。 | |
| 44 | + | ||
| 45 | + | 参见这里[sources](http://prdownloads.sourceforge.net/lazarus-ccr/IBdemo-20050328.zip?download) ,下载一个小例子。如果你有任何问题,到辣子论坛来:[forum](http://www.lazarus.freepascal.org/index.php?name=PNphpBB2&file=index) 或者张贴到辣子的邮件列表。 | |
| 46 | + | ||
| 47 | + | ## 在命令行把包编译入IDE | |
| 48 | + | ||
| 49 | + | 这里还没有命令行工具,要配置并安装IDE的配置文件,来增/删包。你必须安装这些到IDE,拷贝配置文件并调整路径。详情请见:[[Install IDE packages without the IDE]]。但是,在命令行下还能做一些事情(the rest can be done): | |
| 50 | + | ||
| 51 | + | - 首先建立一个普通IDE和LCL | |
| 52 | + | ||
| 53 | + | ` make clean all` | |
| 54 | + | ||
| 55 | + | - 然后编译包 | |
| 56 | + | ||
| 57 | + | IDE能够为一个包 创建一个 Makefile(包编辑器 -\> 编译选项 -\> 编译compilation)(译注:在哪里?找不到啊。package editor -\> compiler options -\> compilation)。一旦你得到Makefile(连接文件?),到每个包的目录下键入'make'。 | |
| 58 | + | ||
| 59 | + | - 最后编译包进入IDE | |
| 60 | + | ||
| 61 | + | ` make idepkg` | |
| 62 | + | ||
| 63 | + | --- | |
| 64 | + | *From the Free Pascal wiki, page "Install Packages/zh CN", as it stood on 2014-02-02 after a change by Chaobs, 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).* | |
| 65 | + | Category: zh |
