Install Packages

My Description of Problem

=====Relational Reference====

Install Packages

From Lazarus-ccr

Deutsch (de) English (en) Español (es)

Table of contents <script type="text/javascript">showTocToggle("show","hide")</script>[hide]

Overview

Due to popular demand here is a first attempt to create a small "Install package HOW-TO".


After installation of Lazarus a lot of starters wonder where the components for Database manipulation are. You can see a datasource and some data aware components, but where are the compontents to connect to a database (server) and to retreive data from this server?

Well let's have a look if we can find some of this stuff.

Files installed with Lazarus

Under Linux Lazarus gets installed by default in /usr/share/lazarus, in Windows the installer gives you a choice where to install the files, as long as there are no spaces in its path. On my Windows PC Lazarus got installed in G:/Lazarus. Whatever the base path of your Lazarus installation is, there you will find some subdirectories. In this case the first (alphabetically) sub directory looks rather promising to our goal as it is called components.

As you can see there are a few subdirectories there, which remind us of databases. One sees an Interbase, a mysql, a sqlite and a sqldb directory. 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. In this article we will install the sqldb-package together with the connection for Interbase.

The real work

First: the why

Before we start installing a package I like to discuss the why of Lazarus not installing database connection components. Database connection components need the client libraries to be available on the PC where the components are used. Because of the fact that at the moment Lazarus does not support dynamic linking, all libraries have to be compiled into the IDE. As you cannot expect every developer to have all databases installed it is not possible to install the connection components by default.

Second: But Delphi ...?

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.

Third: Lets install some stuff

To install a package one goes to "Components -> Open Package File (.lpk)" In the following dialog you navigate to /usr/share/lazarus/components/sqldb or the corresponding directory under 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. Nothing to worry about let's just press Compile and when the compilation is finished 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.

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. :)

Next time Lazarus is started the SQLdb tab also contains a component TIBConnection.

Anything else?

Well 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 with 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.

Compile an IDE with packages at command line

There 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. But the rest can be done on command line:

First build a normal IDE and LCL

 make clean all

Then compile the packages

The IDE can create a Makefile for a package (package editor -> compiler options -> compilation). The Makefile is updated on every compile of the package. Once you have this Makefile, go to every package directory and type 'make'.

Finally compile the IDE with the packages

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值