from rdb$database
Kamis, 20 Desember 2007
Yesterday, Today, Tomorrow in Firebird
from rdb$database
Rabu, 12 Desember 2007
ZeosDBO 6.6.2 Release Candidate
- 0000079: [dbc] Typo in SQl statement in TZInterbase6Connection.Open; (mdaems)
- 0000070: [general] Missing license files (mdaems)
- 0000033: [interbase/firebird] Fixes a bug in UpdateString procedure for ZDbcInterbase6Utils (mdaems)
- 0000022: [general] Split ZPlainMysql.inc (mdaems)
- 0000019: [interbase/firebird] string parameters don't work for blob fields (mdaems)
- 0000016: [core] Integer field treated as Largeint (mdaems)
- 0000055: [component] Wrong index variable used when doing "refresh" in ZUpdateSQL component , patch included (mdaems)
- 0000056: [component] Protection fault when doing an EAbort exception in BeforeConnect of TZConnection (patch incl.) (mdaems)
- 0)">0000059: [component] ZQuery-DSP-CDS empty field data fetched while using incremental fetching (PacketRecords>0) (mdaems)
- 0000061: [component] Wrong data returning in select (mdaems)
- 0000065: [general] FPC 2.2 doesn't compile (mdaems)
- 0000069: [general] Compiler Warnings in Delphi 2006 (mdaems)
- 0000071: [interbase/firebird] Floating point not display correctly (cipto_kh)
- 0000049: [core] Lookup fields with int64 data type not work in Delphi/C++Builder 5 (mdaems)
- 0000048: [general] TZSQLProcessor does not react when Script text is not properly delimited (mdaems)
- 0000007: [interbase/firebird] TZSequence error, value from prior database (cipto_kh)
- 0000013: [interbase/firebird] can not use a string as parameter value for integer/long parameters (mdaems)
- 0000020: [interbase/firebird] second call to stored proc fail with a parameter mismatch error (cipto_kh)
- 0000034: [interbase/firebird] Lookup field make other field in TZQuery lost the value (disappear from display but still exists in database) (mdaems)
- 0000027: [interbase/firebird] problem handling DEFAULT NULL in domain *AND* in table (mdaems)
- 0000028: [interbase/firebird] TZInterbase6DatabaseMetadata.HasNoWildcards - wrong result (cipto_kh)
- 0000037: [component] ZEOS AND LAZARUS 0.9.23 and FPC 2.1.3 WIN32 ERROR (mdaems)
- 0000038: [component] Can't open sqlite databases with Umlauts like äöü in path (fixed) (mdaems)
- 0000040: [component] Error in conversion int64 to variant in InternalPost on Delphi/C++Builder 5 (ZAbstractDataset.pas) (mdaems)
- 0000046: [component] fpc 2.1.4 cannot compile ZAbstractRODataset.pas (mdaems)
- 0000042: [general] Using the same component (TZStoredProcedure) after ExecProc then using Open it will crash (cipto_kh)
- 0000043: [component] ReadOnlyQuery + TDataSetProvider = Blank fields on details (mdaems)
- 0000063: [component] TZSQLProcessor and comments handling (mdaems)
That list are taken from Zeos Mantis Bug Tracker. For your information ZeosDBO also run on Lazarus
Selasa, 11 Desember 2007
ZeosDBO in Lazarus Project
Get current date time in Firebird
select current_date, current_time, current_timestamp, cast('now' as timestamp)
from rdb$database
The last one that use special keyword (date/time literal) called 'now' that can be cast to timestamp, date, or time. Now the question is, how to get the milisecond in SQL statement? I still don't know, maybe some people arround here can can share to us the answer?
Rabu, 17 Oktober 2007
Firebird 2.1 beta2 is OUT
The release notes of that version is in here. Many new feature that make it more interesting like Common Table Expression, aggregate function LIST, many build in function (that make us not needed to add UDF manually), built in monitoring table, and the cool one "Domain in PSQL"!!. It like FB have a feature plus than M$ SQL Server 2005 :) (CMIIW).
Firebird System Table (Part VI)
CREATE VIEW "vSYS_FindSystemTrigger"(
"triggerName",
"tableName",
"triggerInactive",
"triggerType")
AS
select r.rdb$trigger_name, r.rdb$relation_name, r.rdb$trigger_inactive, r.rdb$trigger_type
from rdb$triggers r
where r.rdb$system_flag = 4;
In that query I don't know the meaning of the "triggerType", so if one of you know the meaning of that field, please add a comment in here. It can give other Firebird users more knowledge :)
Firebird System Table (Part V)
As we know in Delphi if our query make an error then if you trap the exception, it will show the name of the constraint error (if the error caused by constraint error).
CREATE VIEW "vSYS_FindConstraint"(
"consTipe",
"tableName",
"consName",
"indexName")
AS
select c.rdb$constraint_type, c.rdb$relation_name, c.rdb$constraint_name, c.rdb$index_name
from rdb$relation_constraints c
Jumat, 05 Oktober 2007
Firebird System Tables (Part IV)
CREATE VIEW "vSYS_FindProcSource"(
"procName",
"procSource")
AS
select r.rdb$procedure_name, r.rdb$procedure_source
from rdb$procedures r
where r.rdb$system_flag = 0;
Sabtu, 29 September 2007
Firebird 2.0.3 is released
Rabu, 26 September 2007
Installing ZeosDBO in Delphi (rev version)
Firebird System Tables (Part III rev 1)
In this query, it doesn't need anymore to has "case" statement to get the convertion from numeric type_name to more readable name. And I want to say thank you for the supporting comment on this little articles. Once correction from Milan Babuskov that told me "CONTAINING" is in Firebird since the first versions 1.0. Hope all articles in this blog can be usefull for FB community. Wait for the next Firebird System Tables again, stay tune on the same channel he..he..he.. :)
CREATE VIEW "vSYS_FindDependencies"(
"dependentName",
"dependentType",
"dependedOnName",
"dependedOnFieldName",
"dependedOnType")
AS
select d.RDB$DEPENDENT_NAME DEPENDENT_NAME,
(select t.RDB$TYPE_NAME from RDB$TYPES t
where d.RDB$DEPENDENT_TYPE=t.RDB$TYPE
and t.RDB$FIELD_NAME = 'RDB$OBJECT_TYPE'
) DEPENDENT_TYPE,
d.RDB$DEPENDED_ON_NAME DEPENDED_ON_NAME, d.RDB$FIELD_NAME DEPENDED_ON_FIELD_NAME,
(select t.RDB$TYPE_NAME from RDB$TYPES t
where d.RDB$DEPENDED_ON_TYPE=t.RDB$TYPE
and t.RDB$FIELD_NAME = 'RDB$OBJECT_TYPE'
) DEPENDED_ON_TYPE
from RDB$DEPENDENCIES d
Kamis, 20 September 2007
Firebird System Tables (Part III)
CREATE VIEW "vSYS_FindDependencies"(
"dependentName",
"dependentType",
"dependedOnName",
"dependedOnFieldName",
"dependedOnType")
AS
select RDB$DEPENDENT_NAME,
case RDB$DEPENDENT_TYPE
when 0 then 'Table'
when 1 then 'View'
when 2 then 'Trigger'
when 3 then 'Computed field'
when 4 then 'Validation'
when 5 then 'Procedure'
when 6 then 'Expression index'
when 7 then 'Exception'
when 8 then 'User'
when 9 then 'Field'
when 10 then 'Index'
when 14 then 'Generator'
else RDB$DEPENDENT_TYPE
end DEPENDENT_TYPE,
RDB$DEPENDED_ON_NAME, RDB$FIELD_NAME,
case RDB$DEPENDED_ON_TYPE
when 0 then 'Table'
when 1 then 'View'
when 2 then 'Trigger'
when 3 then 'Computed field'
when 4 then 'Validation'
when 5 then 'Procedure'
when 6 then 'Expression index'
when 7 then 'Exception'
when 8 then 'User'
when 9 then 'Field'
when 10 then 'Index'
when 14 then 'Generator'
else RDB$DEPENDED_ON_TYPE
end DEPENDED_ON_TYPE
from RDB$DEPENDENCIES;
The idea is to know the dependency on some entity in the database. Perhaps it is also usefull for everyone.
Rabu, 19 September 2007
Firebird System Table (Part II)
CREATE VIEW "vSYS_FindTriggerSource"(
"triggerName",
"tableName",
"triggerInactive",
"triggerSource")
AS
select r.rdb$trigger_name, r.rdb$relation_name, r.rdb$trigger_inactive, r.rdb$trigger_source
from rdb$triggers r
where r.rdb$system_flag = 0
If you want to seach some text in the trigger source then you can use this simple query:
select *
from "vSYS_FindTriggerSource"
where "triggerSource" containing 'some_field'
The keyword "containing" here (if I'm not forget) is exists from FB 2. The difference between "containing" and "like" is the "like" is case sensitive where "containing" is case insensitive, and also you not need the "%" sign like in "like" keyword.
That view also display the status of the trigger, if the "triggerInactive" field value is zero, then it means that trigger is active and vice versa.
Senin, 17 September 2007
Firebird System Tables (Part I)
I often use this technique when I develop a database that consist of many tables and where there is an error on one of the field and then I must know this field is belong on which table, to solve that problem, I create a view like this:
CREATE VIEW "vSYS_FindField"(
"tableName",
"fieldName",
"default_val")
AS
select r.rdb$relation_name, f.rdb$field_name, f.rdb$default_source
from RDB$RELATIONS r, RDB$RELATION_FIELDS f
where r.rdb$system_flag = 0
and r.rdb$relation_name=f.rdb$relation_name;
The FB System Tables can be known from "RDB$RELATIONS.RDB$SYSTEM_FLAG" greater than 0 (zero). The "RDB$RELATIONS" is a system table for user table and user view (off course it also contain of many things that you can look by yourself ;P) And "RDB$RELATION_FIELDS" is as you may guess is a system table for user field. It's now up to you to improve that query, maybe you want to include some more information, then go ahead :)NB: Thank's Romkin for the correction, now I already applied your correction in this short article :)
Rabu, 15 Agustus 2007
Firebird Won 2 Sourceforge Community Awards
SourceForge unveils the winners of the ‘open-source Oscars’
“…The Firebird relational database was another double winner, being voted both best project for the enterprise and the project providing the best user support.”
Firebird 5th International Conference
There is a public train station nearby conference hotel. A map of the location with traveling infos will be send to all visitors
This year we have a special entry level track on thursday and friday. For advanced visitors you find a seperate thread. In the codecamp, you can ask on both days the experts and let them analyze your real world problem. On saturday you will find more general session topics.
Early bird conference fees (valid until 20th sep 2007):
-Full Conference Package 599 Euro *
3 days conference, 4 nights in the conference hotel
(17.-21.) , breakfast, lunch, dinner, evening events
-Conference Only Package 399 Euro *
3 days conference, lunch
-Main Conference Day only Package 169 Euro *
saturday only conference, 1 night in the conference hotel (20.-21.), breakfast, lunch, dinner, saturday evening event
-Main Conference Day only 99 Euro *, saturday only
conference, lunch
* all prices excl 19% VAT, required for all visitors 2nd visitor discount 10%, 3rd visitor discount 15% Please use the website www.firebird-conference.com or email info@h-k.de or fax +4970042397378 to send us your reservation. We hope to see you in Hamburg.
Naturally, we are still looking for sponsors! If you have been thinking about being a conference sponsor, NOW is the time to act. It is also possible to add special product sponsoring packages. Please contact hklemt@ibexpert.biz as soon as possible.
Taken from Firebird News
New site Firebird FAQ
This site is built by Firebird users, for Firebird users to answer the most frequently ask question (FAQ). It's also has a good index to separate question topic. So if you want to know more about this fenomenal database, check it out :)
Minggu, 08 Juli 2007
Vote for Firebird in Sourceforge Awards
Firebird is a finalist in four categories of the Sourceforge
Community Choice Awards for 2007.
In each category the Firebird project is up against 9 other
projects all selected for excellence from hundreds of thousands of SF
projects. Categories are Best Tool or Utility, Best Project for the
Enterprise, Best User Support and Best Project Overall.
Voting is open until July 20 so take this opportunity to credit
Firebird with your recognition. Full details and links here:
http://sourceforge.net/communit
Kamis, 05 Juli 2007
Nice Function Added in Firebird 2.1 (beta)
Here is the list of built in function in Firebird 2.1 (now, it's still beta). My favourite function:
String function: LPAD, RPAD, LEFT, RIGHT, POSITION, REPLACE, REVERSE
Date function: DATEDIFF, DATEADD
Numeric function: ROUND, TRUNC, ABS, MIN_VALUE, MAX_VALUE, GEN_UUID, HASH
So with this new built in function, my previous article can be achieve with more short statement like this:
select current_date,
right(extract(year from current_date), 2) ||
right('0' || extract(month from current_date), 2) as Year_Month
from rdb$database
But in my opinion it would be nice if Firebird team extend the capability of SUBSTRING function like this: the "length" value can be negative so it can achieve the same result like RIGHT function with the capability of "start position". Example:
Substring('Hello World' from 9 to -3) will result "Wor"
FB Date Manipulation
Last week I have a question from Delphindo (Indonesian Delphi community) thorough YM conference. The question is how to make SQL query for Firebird to obtain the same result as we do this (to_char(sysdate, 'YYMM');) in Oracle. I must admit that Firebird doesn't have this "to_char" built in function, but we can create the same result with the trick like this:
select current_date,
substring(extract(year from current_date) from 3)||
case
when char_length(extract(month from current_date))=1
then '0'||extract(month from current_date)
else
extract(month from current_date)
end as Year_Month
from rdb$database
Thank's to the new feature of Firebird 2, that can make this happen without installing any UDF. I use the "char_length" and "substring" built in function that come in Firebird 2 (version 1.5xx still not support this built in function).
Firebird Date Literals
Firebird 2.1 is in Alpha state
Some cool feature:
- Use of domains for Trigger/SP variable definition (SQL Server or MySQL doesn't have it (CMIIW))
- Global temporary tables
- Common table expressions, recursive queries
- Database Triggers
- Database Monitoring via SQL
- Admin information via select
- Get ODS Version and Dialect via SQL
Backup in Firebird
Firebird 2.0.1 and ZeosDBO 6.6.1 beta
Firebird 2.0.1 is only bug fixed and there is nothing new feature.
ZeosDBO 6.6.1 beta is only bug fixed and there is nothing new feature.
Recomended Page Size in Firebird
FB2.0 New Interesting Feature
select rdb$get_context('SYSTEM', 'NETWORK_PROTOCOL') as protocol
, rdb$get_context('SYSTEM', 'CLIENT_ADDRESS') as client_address
from rdb$database;
Upgrading Firebird 1.5 to 2.0
1. Uninstall Firebird 1.5.3 (if yu wish not to use it again)
2. Install the Firebird 2.0
3. Backup your old database with this new gbak from FB2.0
4. Restore them back with gbak from FB 2.0
5. Now you have the new database with ODS 11
Hope this little article can help you :)
Firebird 2.0 is Out, what about me?
ReInstalling Component That Using ZeosDBO 6.6 beta
The point is this new version has a simple bpl & dcp created. Before version 6.6 there is many bpl & dcp respectively for the "ZComponent", "ZCore", "ZPlain" and others. But in this 6.6 version the bpl & dcp is only "ZComponentDesign.dcp" and "ZComponentDesign70.bpl" so I must delete the requires dcp for my components and replace with this new dcp. That's all and everythings goes well (of course after I fix the property "RequestLive" with "ReadOnly")
Explicit Cursor in Firebird PSQL
DECLARE RNAME CHAR(31);
DECLARE C CURSOR FOR ( SELECT RDB$RELATION_NAME FROM RDB$RELATIONS );
BEGIN
OPEN C;
WHILE (1 = 1) DO
BEGIN
FETCH C INTO :RNAME;
IF (ROW_COUNT = 0) THEN
LEAVE;
SUSPEND;
END
CLOSE C;
END
Implicit Cursor in Firebird PSQL
FOR [select statement] into [local variable that hold the value from select]
DO
BEGIN
[your statement]
END
The local variable is must defined for each of the field that selected and remember the datatype must be the same
Sweeping
Sweeping is NOT just organized garbage collection. What sweeping seeks to do is to move the Oldest Interesting Transaction up, and reduce the size of transaction masks. It does so by changing rolled back transactions to committed transactions.
"What!!!", you say. "The woman is nuts."
But that's what a sweep does. It removes all the changes made by a rolled back transaction then changes it state to committed. (Remember we agreed earlier that a read-only transaction that rolled back could be considered committed for all the harm it did. Remove the damage, and its safe to consider the transaction committed.)
At the same time, sweep garbage collects like any other transaction.
A new thread is started and sweeps the database while everybody else goes about life as normal. Well, more or less normal, where the less is the amount of CPU and I/O bandwidth used by the sweep.
Taken from IBPhoenixOldest Active Transaction
Any record version behind a committed version created by a transaction older than the oldest transaction active when the oldest transaction currently active started is garbage and will never be needed ever again.
That's pretty dense. Lets ignore the commit/rollback question briefly.
Simple case: I'm transaction 20 and I'm the only transaction running. I find a record created and committed by transaction 15. I modify it and commit. You are transaction 25, and when you start, you are also the only transaction active. You read the same record, recognize that all active transactions can use the version of the record created by me, so you garbage collect the original version. In this case, your threshold for garbage collection (aka Oldest Active) is yourself.
Harder case: You continue puttering around, modifying this and that. Another transaction, say 27 starts. You are its oldest active. It too can modify this and that, as long as it doesn't modify anything you modified. It commits. I start a transaction 30. You are also my oldest active transaction, and I can't garbage collect any record version unless the newer version is older than you. I run into a record originally created by transaction 15, modified by transaction 20, then modified again by 27. All three of those transactions are committed, but I can garbage collect only the original version, created by transaction 15. Although the version created by transaction 27 is old enough for me, it is not old enough for you, and being cooperative, I have to consider your needs too.
Hardest case: I'm transaction 87, and when I started, all transactions before 75 had committed, and everybody from 75 on was active. Transaction 77 modifies a record, created originally by transaction 56. I continue to read the 56 version. All is well. Transaction 77 commits. You are transaction 95. When you start, I, number 87, am the oldest active. You read the record created by 56 and modified by 77. You can't garbage collect anything in that record because I can't read records created by any transaction newer than 74.
Maybe you know now why descriptions of the oldest active tend to be a little peculiar.
Taken from IBPhoenixOldest Interesting Transaction
The "transaction mask" is a snapshot of the states of all transactions from the oldest interesting, to the current. The snapshot is made when the transaction starts and is never updated. The snapshot depends on the number of transactions that have started since the oldest interesting transaction.
Taken from IBPhoenix
Garbage Collection
Garbage collection prevents an update-intensive database from filling up with unnecessary back versions of records. It also removes record versions created by transactions that rolled back. Every transaction participates in garbage collection - every transaction, including read-only transactions.
When a client applicaition reads a record from a Firebird database, it gets a record that looks like any record from any database. Two levels lower, somewhere in the server, InterBase/Firebird pulls a string of record versions off the disk. Each version is tagged with the transaction id of the transaction that created it. The first one is the most recently stored. At this point, the server has two goals: 1) produce an appropriate version of the record for the current transaction 2) remove any versions that are garbage - either because they were created by a transaction that rolled back or because they are so old that nobody will ever want to see them again.
Taken from IBPhoenixGarbage
Firebird is a multi-generational database. When a record is updated, a copy of the new values is placed in the database, but the old values remain (usually as a bytewise difference from the new value). The old value is called a "Back Version". The back version is the rollback log - if the transaction that updated the record rolls back, the old version is right there, ready to resume its old place. The back version is also the shadow that provides repeatable reads for long running transactions. The version numbers define which record versions particular tranasctions can see.
When the transaction that updated the record commits and all concurrent transactions finish, the back version is unnecessary. In a database in which records are updated significantly and regularly, unnecessary back versions could eventually take up enough disk space that they would reduce the performance of the database. Thus they are GARBAGE, and should be cleaned out.
Transaction States
Transactions have four states: active, committed, limbo, and rolled back.
Taking these cases in order from the least complex to the most:
Limbo: A transaction that started a two-phase commit by calling the Prepare routine. The transaction may be alive or not. At any point, the transaction may re-appear and ask to commit or rollback. Changes it made can neither be trusted nor ignored, and certainly cannot be removed from the database.
Committed: A transaction is which completed its activity successfully. Either A) it called Commit and the commit completed successfully, or B) it called Rollback but made no changes to the database, or C) it called Rollback and its changes were subsequently undone and its state changed to Committed. This transaction is finished and will never be heard from again, and its remaining changes are now officially part of the database.
Rolled back: A transaction which either: A) called Rollback and requested that its changes be removed from the database, or B) never called Commit so was marked as Active, but discovered to be dead by another transaction which marked it as rolled back. In either case, changes made by this transaction must be ignored and should be removed from the database.
Active: A transaction which: A) hasn't started. B) has started and hasn't finished. C) started and ended without calling any termination routine. (e.g. crashed, lost communication, etc.)
Taken from IBPhoenixThe Firebird Conference 2006
Firebird Developer Day 3
I think in Indonesia we still don't have event like this hehehe
New Business Model for IBDeveloper Magazine
"We’ve come to realise that producing the magazine with only advertising and sponsors to support it is impossible. We’ve decided to change our business model slightly. We are going to run special proprietary editions of each issue with bonus articles. These special editions will be available in electronic (printable PDF) and paper versions. From this issue forward, the latest issue will be available only for purchase for a period—say one or two weeks from publication—and will be fully released afterwards for everyone, minus the bonus articles."
FB Selectable Stored Procedure
The above example can be found on the employee example database when you install firebird. The "INTO" keyword must be followed by the return variable (declare in the header of the SP) then we must put the keyword "SUSPEND" after that. The advantage of this selectable SP is we can make it more complex that include some business rule before we return the value that can be selectable, and we can also has a parameters to output different result based on that parameters. As I know there is no much database that has this ability (I only know Oracle, Firebird/Interbase that can do that, perhaps PostgreeSQL).
CREATE PROCEDURE GET_EMP_PROJ(
EMP_NO SMALLINT)
RETURNS (
PROJ_ID CHAR(5))
AS
BEGIN
FOR SELECT proj_id
FROM employee_project
WHERE emp_no = :emp_no
INTO :proj_id
DO
SUSPEND;
END
We can make this selectable as the usual table, it means we can join it with the other table, view or selectable SP. Before Firebird version 2, we often used it as the solution to make derived table as we know before version 2 the derived table is not supported in FB.
Installing ZeosDBO
1. Unzip the .zip file of ZeosDBO and copy into your Delphi directory like this:
[Delphi_Directory]\ZeosDBO6.1.5
2. Goto directory: [Delphi_Directory]\ZeosDBO6.1.5\package\delphi7
(if your Delphi version is 5 then goto "delphi5")
3. Double click the ZeosDbo.bpg and then it will opened in your Delphi program
4. Click View->Project Manager menu on Delphi
5. Right click your mouse on one of the .bpl that appear on Project Manager, and then click "Build All From Here"
6. Click the ZComponentDesignXX.bpl on Project Manager, right click mouse and choose "Install"
7. Goto "Tools->Environment Option" of your Delphi's menu and then choose the Library tab
8. On the "Library path" click the elipsis button (browse), type:
$(DELPHI)\zeosdbo-6.1.5\packages\delphi7\build
And then click the add button, then click OK button to finish it
9. Your Zeos component are ready to use
If you already have the previous version of ZeosDBO then before start the 9 steps above, you must delete all the ZXXX.bpl and Zxxxx.dcp files from the [Delphi folder]\Projects\Bpl
FB Partial Select
"SELECT [FIRST N] [SKIP M] * FROM [TABLE/ VIEW/ STORED PROCEDURE]"
For example, if we want to get the 5 top employee by their salary then we can do
"SELECT FIRST 5 * FROM EMPLOYEE ORDER BY SALARY DESC"
The "skip" keyword is functioned to skip M data from the top of data that we retrieve through query. For example if we want to get the runner up position for some contestant we can do
"SELECT FIRST 1 SKIP 1 FROM CONTESTANT ORDER BY SCORE DESC"
Indonesian Delphi Blog
You also can be a contributor in this Delphindo (the name for Indonesian Delphi community) blog by sending email to the moderator to let them know that you want to be a contributor, then they will give you a hint how to be a contributor (because I am not a Delphindo blog moderator so I don't know the detail, but if one of the moderator read this article, feel free to add a comment how to be a contributor to Delphindo blog)
Indonesian Delphi Community
World Class Firebird Support
ZeosDBO setting for Firebird & ADO
The one that special for this component is that you can connect through ADO using "protocol" ADO and then you can select the database through the "database" property with the user interface that is the same when you use the TADOConnection.
Firebird locking
"select * from employee where id>30 with lock"
You can found a lot of explanation about that explicit locking by reading the release notes of Firebird 1.5.3 page 33
ZeosDBO
One that I like from this component is, it's free, open source and can run on Kylix (the Linux version of Delphi) and also ported for Lazarus. But maybe in this time the development of this component is going slowly, it's because this development need more serious people to develop, and from this blog I want to invite you to join to develop this good component. I feel pitty if this good component become dead component.
Dummy table
Generator (FB) vs Sequence(Oracle)
Example: "select gen_id(gen_tb_barang, 1) from rdb$database"
This "gen_id" function is also very flexible that we can reset the generator value to zero.
Example: "select gen_id(gen_tb_barang, -gen_id(gen_tb_barang,0)) from rdb$database"
And we can also get last generator value with this SQL:
We can get the value of sequence in Oracle with "select sq_tb_barang.nextval from dual". The "nextval" method is increment by 1 by default, we can change the increment step by this SQL command "alter sequence
To reset sequence to become zero in Oracle is more complex, we can drop that sequence and then create it again for simple but other say this (although I never success with this procedure to make my sequence become zero):
1) get the curval from the sequence
2) alter the sequence to have increment as the curval * -1
3) get the nextval from the sequence
4) alter the sequnce to have increment as 1
The code is:
declare Handle Integer;
SqlText varchar2(2000);
Temp Integer;
Begin
select sq_barang.nextval into temp from dual;
temp := temp * -1;
SqlText := 'Alter Sequence sq_barang increment by ' || to_char(temp);
Handle := dbms_sql.open_cursor;
dbms_sql.parse(handle, SqlText, DBMS_SQL.NATIVE);
select sq_barang.nextval into temp from dual;
SqlText := 'Alter Sequence sq_barang increment by 1' ;
dbms_sql.parse(handle, SqlText, DBMS_SQL.NATIVE);
End;
Why using Firebird?
Firebird 1.5.3 is launched
This 1.5.3 version also include Release Notes in PDF that I think more complete version (including release notes from version 1.5.0 until 1.5.3)
Now version 2.0 is still in Beta 2 version. Hope this will be released in March.
For small to midsize company, I think this database will rock you. (Also available for Linux version)