The InterBase and Firebird Developer Magazine, Issue 3, 2005
The InterBase and Firebird Developer Magazine, Issue 3, 2005
in DBMS
Keep on watching
www.ibdeveloper.com
We're preparing
special
Christmas
surprises and bonuses
for all InterBase
and Firebird fans!
THE INTERBASE
& FIREBIRD
Contents
DEVELOPER Editor notes
MAGAZINE by Alexey Kovyazin
Back to the Future ................................................................. 4
Oldest Active
by Helen Borrie
Connecting Remotely .............................................................. 5
Cover Story
Roman Rokytskyy
Full Text Search in DBMS .......................................................... 6
Credits InterBase
Alexey Kovyazin, by Bill Todd
Chief Editor New Cache Options In InterBase 7.5 ............................................16
Dmitri Kouzmenko, Development area
Editor by Vladimir Kotlyarevsky
Helen Borrie, Object-oriented development and RDBMS, Part 2 ............................. 18
Editor
Development area
Noel Cosgrave, by Roman Rokytskyy
Sub-editor JayBird 2.0, a JCA/JDBC driver for Firebird ................................... 30
Lev Tashchilin,
Designer
Development area
Natalya Polyanskaya, by Vladimir Kotlyarevsky
Blog editor How I started to work with MS SQL Server and ADO ........................... 31
Editorial Office
IBase IBDeveloper, office 5, TestBed
1-st Novokuznetsky lane, 10
by Alexey Kovyazin
zip: 115184 TPC based tests for InterBase & Firebird....................................... 39
Moscow, Russia
Phone: +7095 6869763
Fax: +7095 9531334
Email: [email protected]
www.ibdeveloper.com
© Copyright 2005 by IB Developer.
All rights reserved.
No part of this publication may be
reproduced or transmitted in any form
of or by any means, electronic or
mechanical, including photocopy or any
information storage and retrieval sys-
tem, without permission.
For promotional reprints, contact
reprint coordinator Alexey Kovyazin,
[email protected].
IBDeveloper reserves the right to revise,
republish and authorize its readers to
use the articles submitted for publica-
tion. All brand and product names used
in on these pages are trade names, serv-
ice marks or trademarks of their respec-
tive owners.
Connecting Remotely
he rave of the month has been, of Well, the upshot of it all was that a
in the Czech Republic, in beautiful, his- were not convened at Hotel Olsanka!
toric Prague. The blogs and photo Now, who am I to be waxing lyrical
albums tell it all: the fun bits as well as about the Prague conference? I wasn't drink...While in New Zealand at mid-
the serious bits. There was plenty of there. Too sad! There were many year, I bought a replica of the Famous
beer—a traditional element, given that moments during those four days that I Coffee Plunger, intending to put it up
the two preceding conferences took wished it were otherwise. What made it for the auction, with the hopeful inten-
place in the homeland of German “happen” for me were the blogs. tion of being permitted to keep mine. I
hops!—not to mention cake and cuck- Martijn Tonies, from the Netherlands, totally forgot to mail it over for the
oo clocks and confrontations with started blogging the conference before auction. Mea culpa! But it will keep
armed soldiers and hotel maids. it even began. Thanks to Holger Klemt for next year.
People came from far and wide—Brazil, and his team of techos from Germany, Amazingly, Luc's famous auction—
South Africa, Russia, Central Europe, the conference attendees had Internet which nobody can deny is a total rip-
Japan, North America, even New by wireless in one and only one place— off—netted about 3000 Euros for the
Zealand, which is about as far away the bar. So, while I was visualising Firebird Foundation's coffers. That
from Prague as you can go and still lonely Martijn slaving over a hot key- translates neatly into a grant alloca-
have running tapwater. It was great to board in his hotel room at every spare tion for a part-time QA person for
have Russians there for the first time: moment, in fact he was slaving over a Firebirds 2 and 3. Deep pockets are a
it's been so hard in the past to get them cool beer and a hot keyboard in the bar wonderful thing for open source soft-
to Germany. at every spare moment! It was a good ware development.
The reasons for choosing Prague were formula.
Oh and—yes, it's true, Prague in
several. Our past venue in Fulda had Stefan Heymann, from Germany, also November is too cold for this sub-trop-
been great but it was also expensive, blogged, although not with the intensi- ical dweller. I don't own an overcoat
especially for visitors from outside the ty and frequency exhibited by Martijn. and I live in a part of Australia where a
Euro currency zone. There had been Make a note, all you bloggers, for next winter coat would be a collector's item
persistent difficulties for some would- year: there is no such thing as Too Many if it were available at all and would be
be participants to get visas. Prague Blogs. priced accordingly. Add the shortcom-
appeared a good candidate to address Another conference tradition is for ings of my cold-climate wardrobe to the
both of those problems, with the added Lucas Franzen to kidnap my coffee overwhelming cost of airfares from here
benefit of Very Cheap Beer, or so we plunger and force me to pay a ridicu- to anywhere—the speaker's fee would
were told by the locals. Was it true? lous price at his mad auction to get it have got me about as far as Tokyo, one
Apparently—if the volume of empty back in order to survive the rest of my way—and one has fairly compelling
beer bottles visible in nearly every journey with proper coffee to reasons to stay put.
photo is any kind of indicator.
INDEXTYPE IS CTXSYS.CONTEXT
very well when used
tion and let Google index it. It will be = “Exact match”. Corresponds to the “term query”, without the tokenizer in our clas-
which people can store their informa-
an interesting task to discover its sification; matches only those documents that contain exactly the specified term;
behavior in case of simple text files and = “Word positioning”. Corresponds to the “phrase query” and “sloppy phrase”
© Copyright 2005-2006, All right reserved www.ibdeveloper.com 9 www.ibdeveloper.com
COVER STORY 2005 ISSUE 3
query; it matches documents that contain a specified phrase, words near to each other, but also searching for documents
that contain the discrete words of the phrase in the same sentence or paragraph.
= “Inexact match”. Sort of combination of the “predicate query” and “fuzzy query” with different matching algorithms, like
“SOUNDEX”, stemming, prefix matching, thesaurus matching.
= “Intelligent match”. This corresponds to the “fuzzy query” with the matching algorithm backed by some knowledgebase
that can determine ontological similarity of the query terms and terms found in documents.
= “Boolean combination”. Corresponds to “Boolean query” in our classification, allows other queries to be combined by
means of AND, OR, NOT operators.
The query specification (Illustration 4) is somewhat unusual and requires explanation.
llustration 4.: Example of a full-text query in Oracle
SELECT
score(1), product_id, product_name
FROM product_information
WHERE
CONTAINS (product_description, 'monitor NEAR high resolution', 1) > 0
ORDER BY score(1) DESC;
First, the CONTAINS query operator. It takes two mandatory parameters – column name and query expression. It returns a value
greater than 0 for all records where the specified column matches the query expression. The third optional parameter assigns
a label to the score returned for each record which can be later accessed by the SCORE function, which takes the label as
parameter. Applications can use multiple CONTAINS clauses in one statement and combine corresponding scores with boost
factors or other arithmetic to obtain better document ranking.
The technical side of the story looks not so bright. In fact, despite the white papers, even in Oracle 10g full-text search works
rather more like an add-on than an architectural feature. First, the full-text search parameters can be changed only via proce-
dure calls from the CTXSYS schema. The actual syntax for the call is a mix of Oracle SQL and the component-specific commands.
The full-text index itself is a potential bottleneck. As you can see from [3], when index synchronization is set to “sync on com-
mit”, Oracle effectively serializes all transactions. Additionally, the synchronization happens only after commit, causing a gap
between when documents that were added or updated become visible to other transactions and when they become search-
able. And, in the worst case, error/failure in the full-text index has no influence on the outcome of the transaction.
-- [APPROACH 2:]
-- works, but can backfire and become slow or return inaccurate results:
-- perform filtering via Full-Text and only extract key and rank
-- (processing done at web server level)
SELECT [key], [rank]
FROM CONTAINSTABLE(Articles, *, 'FORMSOF(INFLECTIONAL('Ichiro')
AND "sports"')
Netfrastructure
Netfrastructure is not positioned as pure database system, but as a web application development environment.
Netfrastructure is designed and developed by Jim Starkey, the person who created InterBase, but targets a different appli-
cation domain. Unfortunately, not much information about its full-text search feature can be found in public sources [5].
However, the approach used there is quite interesting and worth discussing here. All of the detail below was obtained either
from posts by Jim Starkey in Firebird-Architect list or from the private correspondence with him.
There is no separate command to create a full-text search repository, since it comes into existence with the creation of the
database. The only thing required is to define the fields of the tables as searchable, as shown on Illustration 6.
Illustration 6.: Definition of the searchable column in Netfrastructure
CREATE TABLE product_information(
id INTEGER NOT NULL PRIMARY KEY,
product_description VARCHAR(2000) SEARCHABLE);
Adding the SEARCHABLE keyword after the text or CLOB column definition is enough to tell the engine to index the contents of
the field on each INSERT or UPDATE. The added documents are directly searchable within the same transaction and rollback
removes added items from the index. Currently development is done to allow applications to move the updating of the indexes
to a separate thread. In this case, added documents might not be directly searchable in the current transaction.
There are two options for the full-text query. The first uses the MATCHING operator within the SELECT statement (Illustration 7);
the second one requires use of the API and, according to Jim Starkey, is exactly what application developers are interested in.
Illustration 7.: Example of a SELECT-based full-text search in Netfrastructure
SELECT * FROM product_information
WHERE
product_description MATCHING '+monitor +”high resolution”';
The most interesting part of the full-text search using the API is that the search query returns all hits in all tables and all
fields. Each hit is ranked by the scoring algorithm (currently hardcoded) and is returned in the ResultList structure, represent-
ing a list of java.sql.ResultSet instances, each of them containing one record.
Additionally, a ResultList object provides schema and table names and the score of the hit. The key message here is that peo-
ple looking for something in the database are not interested in hits in a single table, but most likely in all tables. Naturally,
the search API allows the search scope to be limited to specified tables.
An example of using the Netfrastructure search API from Java is shown in Illustration 8.
llustration 8.: Example of using search API from Java in Netfrastructure
Statement stmt = connection.createStatement();
ResultList rl = stmt.search("+monitor +\"high resolution\"");
while (rl.next()) {
String tableName = rl.getTableName();
double score = rl.getScore();
ResultSet rs = rl.fetchRecord();
... // process ResultSet object
}
Stops words in Netfrastructure are indexed but skipped during the scan. After a hit, the search engine goes back and checks
that the word was actually there. The phrase "Alexander the Great" scans for "Alexander" and "Great" with an intervening
word. When it finds an instance, it checks for "the" in between.
Netfrastructure supports the following atomic queries:
= Term or list of terms. Hitting more terms in the query is better than hitting few. Upper case letter matches uppercase let-
ter; lower case letter matches either case;
= Specifying the required term and the term that should not be contained in a document. This is somewhat similar to the
“Boolean query” described above, especially if we consider that the simple list of terms is combined with OR operator;
= Phrase search, which was explained above;
= Wildcard and prefix queries.
In addition to the standard scoring factors already mentioned, Netfrastructure Happy New Year Wishes
supports “distance from the beginning of the document”. No information about
the reasons for this factor was found, however. Marina Novikova:
What do you think were the greatest
MySQL FB project achievements in 2005 in
MySQL's solution is somewhat similar to the solution used in Oracle, but has also general?
some interesting differences. It must be mentioned that full-text search is sup- Helen Borrie:
ported only on MyISAM tables, which is pretty strong limitation. Getting the Fb 2.0 Beta out was
An application can define a full-text index for a selected table and list of columns more of an achievement than it is
to index (Illustration 9). The FULLTEXT “constraint” takes the list of columns that givencredit for. The guys have
will be automatically indexed. done a fantastic job of cleaning up
some serious messes and making a
Illustration 9.: Example of creating the full-text index for two columns in MySQL
lot of things work better. The
CREATE TABLE articles (
id INT UNSIGNED AUTO_INCREMENT NOT NULL PRIMARY KEY,
record of serious, thoughtful work
title VARCHAR(200),
is there for all to see, whether you
body TEXT,
read the core devs' reports at the
FULLTEXT (title,body)
website:
);
http://firebird.sourceforge.net/
index.php?op=devel?sub=engine
or whether you test Fb 2.0 against
MySQL supports all basic query types except the fuzzy queries. A typical MySQL predecessors and competitors.
query using full text search (query 1 in Illustration 10) performs only record fil-
Paul Ruizendaal:
tering according to the specified query. In order to obtain the score of the hit,
We have achieved so much in 2005,
quite a strange construct is used where the MATCHING ... AGAINST clause is used
it is hard to pick something.
in the column list section of the SELECT statement as well as in its WHERE clause
Perhaps our greatest achievement
(query 2 on Illustration 10). The query optimizer detects such a usage pattern and
is that we are now recognised as
the actual full-text query is executed only once.
one of a few leading open source
Illustration 10.: Example full-text search queries in MySQL
-- query 1
databases, winning prestigious
-- query 2
also because we have gained a lot
articles
There have been many events this
WHERE
year, but speaking about achieve-
-- step 2
CREATE TRIGGER t_bi_customer_fts FOR customer ACTIVE BEFORE INSERT AS
DECLARE VARIABLE parser INTEGER;
DECLARE VARIABLE i INTEGER;
BEGIN
IF (EXISTS(SELECT * FROM ts$opt WHERE enable > 0)) THEN BEGIN
parser = parser_create();
i = parser_add(parser, new.CUSTOMER);
i = parser_add(parser, new.CONTACT_FIRST);
i = parser_add(parser, new.CONTACT_LAST);
i = parser_add(parser, new.ADDRESS_LINE1);
i = parser_add(parser, new.ADDRESS_LINE2);
i = parser_add(parser, new.CITY);
i = parser_add(parser, new.COUNTRY);
i = parser_free(parser);
END
END
These functions are shipped in a precomit has to use BLOB fields, the content of which is processed by the proprietary UDF.
Because of the restrictions described, the FastTextSeach component requires changes to the existing schema. First of all, in
all tables that are to be indexed, a new integer field has to be added. This field will contain a “document ID” that is gener-
ated by the indexing component when the document is added to the index. Next, the application has to define triggers that
perform mapping from the table record to an abstract, multi-field document.
2 In old versions of Firebird three triggers has to be defined, BEFORE INSERT, BEFORE UPDATE and BEFORE DELETE. Since Firebird 1.5 appli-
cation can use universal triggers and put all logic into one PSQL block.
3 Warning: The C/C++ external procedure interface is not yet stable, significant changes are possible in the future, especially when this
feature will be ported to Firebird main code base. Therefore, those who will start development against the existing external procedure facil-
ity, be prepared to update the interface part.
References
1. Justin Zobel, Alaister Moffat, and Kotagiri Ramamohanarao. Inverted File versus Signature Files for Text Indexing.
ACM Transactions on Database Systems (TODS), Volume 23 , Issue 4 (December 1998), Pages: 453 – 490
2. David Grossman and Ophir Frieder. Integrating Structured Data and Text.
Intelligent Enterprise Magazine, September 18, 2001, Vol 4 No 14
http://www.intelligententerprise.com/010918/414analytic1_1.jhtml
and October 24, 2001, Vol 4 No 16 http://www.intelligententerprise.com/011024/416analytic1_2.jhtml.
3. Oracle Text 10g. Technical Overview. http://www.oracle.com/technology/products/text/x/10g_tech_overview.html
4. Andrew B. Cencini. Building Search Applications for the Web Using Microsoft SQL Server 2000 Full-Text Search.
Microsoft Corporation, December 2002.
http://msdn.microsoft.com/library/default.asp?url=/library/en-us/dnsql2k/html/sql_fulltextsearch.asp
5. Netfrastructure Inc., http://netfrastructure.com/
6. MySQL 5.0 Reference Manual. Chapter 12.7. Full-Text Search Functions.
http://dev.mysql.com/doc/refman/5.0/en/fulltext-search.html
7. FastTextSearch for InterBase. http://www.textolution.com/ftsib.asp
8. IBObjects. Full Text Search Module. http://www.ibobjects.com/ibofts.html
9. Fyracle: Oracle-mode Firebird. http://www.janus-software.com/fb_fyracle.html
ALTER DATATBASE
Although you can have group commit command:
ALTER DATABASE
lowing command:
Database Flush
If you want better performance than SET NO FLUSH INTERVAL
forced writes with group commit offers
and you are willing to take some addi- Which Option Should You Use?
tional risk, then database flush may be You now have five options for control-
right for your environment. Database ling physical writes to disk. The follow-
flush is an option you can use when ing two options are very safe because
forced writes are off. they use careful write order and
The problem with turning forced writes because they take place under transac-
off is that there is no way to predict tion control. Any transaction that has
when the operating system will actual- not been completely written to disk
ly flush writes in its cache to disk. This before a server crash will be rolled back
means that there is no way to estimate when InterBase restarts.
how many writes you may lose if the = Forced writes on (also known as syn-
database server crashes. chronous writes)
The new database flush option lets you = Forced writes + group commit
tell InterBase when it should flush all The last three options carry much more
cached writes to disk. You do this by risk because careful write order is not
setting the flush interval. The safest used and the changes made by a single
flush interval is zero. When the flush transaction may be partially written to
interval is set to zero InterBase flushes disk. This can cause logical or physical
the cache to disk each time a transac- database corruption.
tion commits. If multiple transactions
commit at the same time the cache is = Forced writes off + database flush
flushed once after all of the transac- after each commit
tions have committed. This is fairly = Forced writes off + database flush at
safe because the cache is flushed a fixed interval
= Forced writes off
immediately after each commit.
Nevertheless, because careful write
order is not used, a crash while the Choosing the best option is easy. Pick
cache manager is writing can still cor- the safest option that gives you the
rupt your database. performance you need. If choose any
option that does not include forced
For better performance you can set the
writes on, make sure your server is as
database flush interval to a positive
stable as possible by using a dedicated
integer that is the number of seconds
database server in a physically secure
between flushes. In this mode the
location with a UPS. This will reduce
InterBase cache writer thread ignores
the chance of a database crash.
transactions and tells the operating
system to flush the cache every N sec- If you use user defined function
onds. This is almost as risky as running libraries, and particularly if you write
with forced writes off and database your own UDFs, test them very careful-
Database Linger
If at least one user is always connected to your database or if your client applica-
tion(s) use connection pooling so that one or more pooled connections are always
connected to the database, there is no reason to use database linger.
When the last user disconnects from a database the database is removed from
memory. This causes several problems. First, it may not give the garbage collector
thread enough time to delete old record versions that have been queued for dele-
tion. Second, when the first user connects to the database, memory for the cache
must be allocated and initialized and the database metadata must be loaded into
memory. This makes the first connection much slower than subsequent connec-
tions.
The first user to connect is not the only one that will pay a performance penalty.
Consider the case where user A runs a SELECT statement. When the SELECT is exe-
cuted, all of the required index and data pages are read from disk and placed in the
cache. If user B runs the same SELECT he/she will get better performance because
the index and data pages will be read from the cache instead of from disk. Now,
suppose that users A and B disconnect and the database is removed from memo-
ry. A few seconds latter user C connects and has to wait while the cache is allocat-
ed and the metadata loaded. Next user D connects and runs the same SELECT that
was run earlier by users A and B. However, user D does not get the fast execution
that user B experienced because the newly created cache is empty. All of the
index and data pages must be read from disk again.
Database linger keeps the database in memory for a specified period of time after
the last user disconnects. It has the same effect as always keeping a connection
open but it is safer because there is no risk of leaving a transaction open.
This command tells InterBase to keep the database in memory for 600 seconds (10
minutes) after the last user disconnects. Of course you can use any linger interval
you choose.
Links between objects a standard projecting method, can we figure out the cus-
(See also [5], the "Links" chapter) tomer’s name (the most frequently used attribute)? To do that,
one would need to know where and how the customer list is
Links as object attributes stored, how the relationship between an “order” and a “customer” is organized.
n my opinion, the traditional Moreover, one must be sure that such a relationship exists ?, and, in addition, be
select ClassId
“Name.” In a case where RTTI is sup-
from OBJECTS
ported, we can find out everything else.
where OID = :id
Name of the type:
We can get all this information with the
link_type TOID,
pieces that don't measure up to
left TOID,
standard. Claudio spends many
right TOID,
hours also writing detailed and
Objects
OID Name Description ClassId
0 Root Root folder 100
The content of any folder with a known OID is selected by the query:
select o.*
from objects o, links l
where l.link_type = 0 and
o.OID = l.right and
l.left = :folder_id
from OBJECTS o
many of them and they are obvious.
inner join Links l on l.right = o.OID and
l.link_type = 0
Finding an object OID by a path can be
o.ClassId = 100
possibility to use the pathnames in
queries and other stored procedures
and triggers, thus increasing database’s
This query will return the first level of the hierarchical directory, which begins logicality and cohesion. To realize such
with the OID LookupRoot folder and contains all the sub-objects (in the catalog a procedure in Interbase, you would
hierarchy) with ClassId = LookupClassId. The query to open any first-level folder, need to write a simple UDF for the path
will be similar, but LookupRoot should be substituted by the OID of that folder. line analysis; for MS SQL, TransactSQL’s
It is a matter for the computer to display the result of this query in the dialog win- capabilities would be enough.
dow in a usual form (with folders opening by double-clicking and selectable
objects inside these folders). Other types of links
For example, this dialog may be exactly the same as a standard “Open file” system Using the features provided by the
dialog. Given this dialog and a controlling run-time object (I call it “Links” table, you can build a lot of
DirectoryBrowser), we will get a universal user interface for most of the directo- useful structures for joining database
ries in the system. objects, in addition to the described
global logical catalog. For example, you
Actually, this is true not only for the directories. In fact, we will get a universal API
can solve a problem of a linked busi-
and user interface for browsing a catalog of any objects in the database, which is
ness process (BP), which is described at
functionally similar to the Win dows Shell API (IShellFolder, IShellBrowser etc) bun-
the end of the previous chapter. The
dled with Windows Explorer. You can also try to embed your mechanism into Windows
object type defining a certain BP type
Explorer, and make the objects accessible from anormal Explorer window. Without
(for example, the already-described
naming names, I know who tried to do it, and even succeeded in it!?
long-term attendance), in this case, is a
A new directory type will be created by two clicks, setting LookupRoot and set of possible links between document
LookupClassId for it (it is possible to use several “ClassId”s, if the directory can types, which can be created in its con-
contain several types). For example, a contractor list may contain both suppliers text. The object, which describes a par-
and purchasers (which can be divided into other directories). ticular BP (attendance contract #10),
About how to create a directory, which requires an extra field (in addition to those contains a set of the existing links
stored in Objects) for sampling I will tell later, in the chapter about realization of between the already created docu-
access library organization. ments in the BP chain, and also is a
central link during a visual presenta-
Pathname in a Catalog tion of the chain of documents and
objects in the general network, i.e.
Since we can build a structure of catalog type in our database, it would be reason-
parts of this BP. In this case we would
able to use another “good old” abstraction: we can access the objects with the
need a new link type (link_type), with
help of a pathname. For our example, the path to the Order0001 object (actually,
its own creation rules and restrictions,
it is one of several possible ways) can be written as
for example, link_type = 1.
/Documents/Orders/Order0001 or /PrivateFolders/Smith/Order0001. Indeed, in a
catalog, the path to a certain object, which starts from a particular unit (root or And so on. Everyone can create their
something else), unambiguously identifies an object on condition that we provid- own types. I can suggest the following
ed for uniqueness of the object names within the catalog. The expression "unam- two: a type for class hierarchy presen-
biguously identify an object by a path" in our case means that, with the help of tation, and a type for account hierarchy
such a path, one can find the OID of the object. Indeed, there can be many paths from the accounting card and some
to one and the same object (since you can have as many links to the object as you other directories.
want); each path would point to only one object. The Links table can be used for links of
Uniqueness of the names within a catalog can be provided by imposing a con- the “master-detail” type, if a
straint on the “Links” table with the help of a trigger that responds when “detail”set is an object list. For exam-
link_type = 0. ple, the table part of a bank extract is a
set of pay-sheets. The advantage link-
We will not discuss here the well-known problem concerning the impossibility to
ing such links relationships via the
fully support such restrictions with the help of a trigger, especially because we
Links table is that you would not need
can avoid this problem in our case.?
to realize the full function and field
end
documentation and applications. I
am impressed by IBPhoenix' dona-
Two fields (“read_group integer” and “write_group integer” are added to the tion of their doc set to the Firebird
“Objects” table. These fields are the links to the “groups” field. Foundation and hope that prelimi-
nary docs for the community to
A presentation is created
create view s_objects as
work with and on will be available
select o.*
soon.
The “acl_id integer not null” field is added to the “Objects” table as a link to acl.acl_id. The query
select a.uid, a.right
from acl a, objects o
where acl_id = o.acl_id and o.OID = :oid
will return the ACL for any of the objects from objects. The number of the lists themselves may be significantly lower than the
number of the objects, due to the fact that several objects may share a single list, the way some file systems, such as NTFS, do.
The access control itself is accomplished in almost the same way as in the first example, except that the “s_objects” presen-
tation and access rights checking triggers become more complex and slower. I will not cite a definition of the s_objects pres-
entation. Even though it is quite complex, it is problem-dependent, i.e. it depends on the access rights set specified in the
particular system.
Advantages and disadvantages. The advantages of the first way are simplicity of realization and speed of the relational sam-
pling with s_objects, since s_objects is a simple link, and its sampling is not significantly slower than sampling directly from
objects. The disadvantage is the low flexibility (the features provided by this method are not always enough). The second
method is much more flexible, but it is harder to realize. Moreover, using it in sampling with s_objects would possibly be com-
plicated due to a slower read rights verification procedure. In conclusion, the common disadvantages of both methods are:
a) necessity to create triggers for every new additional attributes storage table
b) neither way guarantees reading security for the additional tables of object
attributes if such a reading passes over s_objects. However, it is possible to take
certain extra actions, so that reading of attributes tables would be of no use to Happy New Year Wishes
malefactors. For example, you can store one or two essential items in objects,
without which most of the objects would serve no purpose. Vlad Horsun:
In my opinion, beta-testing might
have begun half a year earlier. I
hope we shall reduce a release-cycle
Bibliography
next year. And the roadmap from DY
1. Mapping Objects to Relational Databases - White Paper. confirms it :)
Scott W. Ambler. 26-FEB-1999 Dmitry Yemanov:
http://www.AmbySoft.com/mappingObjects.pdf First, we could move faster. The
2. "A Description of the Ultima-S System" by Vladimir Ivanov. v2.0 Alpha testing stage was per-
http://ivn73.tripod.com/ultima_overview.htm formed not as active as it could be.
Second, we need to learn making
3. The Design of a Robust Persistence Layer For Relational Databases -
decisions in time. Too many things
Scott W. Ambler http://www.ambysoft.com/persistenceLayer.pdf. 28-NOV-2000
were discussed but an agreement
4. “Natural Keys vs. Artificial Keys”. Anatoliy Tentser. July 20, 1999. has been defered till it's too late to
http://www.ibase.ru/devinfo/NaturalKeysVersusAtrificialKeysByTentser.html do something in the current ver-
5. A Database as Objects Storage. Anatoliy Tentser. sion.
http://www.compress.ru/Article.asp?id=2006 These issues are hopefully to be
6.“Tree-Type (Hierarchical) Data Structures in Relational Databses”, improved over the next years.
Dmitriy Kuzmenko, iBase - Alex Peshkov:
http://www.ibase.ru/devinfo/treedb.htm. and other articles about trees and I think Vulcan was divided for
objects at http://www.ibase.ru/develop.htm nothing. If firebird/Vulcan were
not divided, we would have a single
system of better quality.
SELECT ‘test’
we also have well-known excellent Third surprise – you can write something like
IBExpert (http://www.ibexpert.com/),
which has similar look, though is much without any FROM clause! – and client will get a recordset with one record, con-
end;
There is also “differential backup” in
SQL Server – it creates not a complete
function TmyServerObject GetSomeData: Recordset;
database backup, but just the changes
begin
Result := CreateOleObject(‘ADODB.Recordset’);
from some point. I haven’t used this
end;
large databases, when you just have not
enough space for, say, complete “six
revolver” backups. (Editor note:
Firebird 2.0 has an incremental backup Client:
Var
facility. Its name is Nbackup.)
rs: Recordset;
SQL Server also has a “shrink database”
serverObject: IMyServerObject;
function to remove empty pages from
begin
serverObject := CreateRemoteComObject(‘remote_host’,
database files. If you often do batch
MyServerObjectGUID,) as IMyServerObject;
DELETEs, this function can decrease
rs := serverObject.GetSomeData();
database size by up to two or three
Rs.MoveNext();
end;
SQL Server allows a client to cancel a
end;
long-running batch. It is a useful fea-
ture, not available in Firebird or older
versions of IB.
SQL Server has Windows-based authen- If you need to run MS Excel (or any other OLE server) from your application and to
tication along with its own internal pass it a recordset that it should process in VBA or just add data to its sheet, you
autherntication, useful if your applica- do almost the same – just pass the ADO recordset as a parameter of the method
tion works in a LAN with Windows call. Behind the scenes, it performs transparent marshalling – it serializes the
Domain or Active Directory installed. data into a binary stream, sends the stream on to another process or to a remote
It simplifies the lives of developers host, then deserializes the stream back into a Recordset, all without you needing
(they don’t need to think much about to be concerned about any of it. – but you don’t need to care about all this. Thus,
login dialogs and authentication) and you can use the Recordset to implement the “Data Transfer Object” pattern. The
users (they don’t need to enter a pass- VCL ClientDataSet has similar functionality but, of course, you can use it only in
word to connect to SQL Server). The Delphi.
only person who would possibly be not You can also construct an ADO Recordset and fill it with data by hand, without any
too happy is Domain admin ?, because database. You just define fields, open it, insert data rows and it works.