TZSequence Problem

Forum related to version 6.5.1 (alpha) and 6.6.x (beta) of ZeosLib's DBOs

Moderators: gto, cipto_kh, EgonHugeist

Post Reply
FireBlade
Fresh Boarder
Fresh Boarder
Posts: 13
Joined: 03.11.2005, 18:52

TZSequence Problem

Post by FireBlade »

Hi... again... :)

So I managed transfer to ZeosDBO 6.5.1alpha
(6.1.5 before).
I use Delphi 7 (using CLX), Firebird 1.5.3
and ZeosDBO 6.5.1 cvs from oct. 13th.

Basicly the problem goes like this:
Sequenced fields do not work anymore,
whether I try with TZSequence components or not.
I set up everything properly (I belive so), I got error when I try to post
a new record, which says that I'm breaking primary key.
Sequnced field is also primary key.
I supposed that I don't have to put any code at
"BeforePost", but then I tried to
generate the value manualy, but no way... :(

Please, I'm stuck and I don't feel like going back to 6.1.5 again.

Can anyone describe shortly how to use TZSequence
and drop a few lines of code.

Why it doesn't old way, without using TZSequence?

Or... is this some known bug?

I hope someone will get to help me soon,
cause I'm in trouble now!

Thanks a lot. Best regards!
(and still... zeos rocks!) :)
User avatar
ste_ba
Zeos Dev Team
Zeos Dev Team
Posts: 29
Joined: 15.02.2006, 20:26
Location: Lahntal
Contact:

Post by ste_ba »

Hi,

what DBMS do you use? What's your "old way"? Have you checked the generator/sequence value? What's the value, what's the actual maximum ID value of the table that uses the generator?

Regards,
Stefan
FireBlade
Fresh Boarder
Fresh Boarder
Posts: 13
Joined: 03.11.2005, 18:52

Post by FireBlade »

Here is what I use:
1. Delphi 7 Ent. and Kylix 3 - using CLX only at the moment
2. Firebird 1.5.3 (for now on win32 platform only)
3. For DB management I use EMS Interbase/Firebird Manager Lite
4. Zeos DBO 6.5.1 cvs - oct 13th 2006.

When I said old way I meant using ZQuery and ZTable only,
without TZSequence... it worked normally with Zeos 6.1.5,
but does not work with Zeos 6.5.1.
Then I tried with TZSequence component, cause I thought
that using it was obligatory now, but it also didn't work.

I'm pretty sure I set it all properly, I checked 10 times,
I even make an empty DB with single simple table, and
a simple test project with only one TQuery, TZSequence and
TZConnection.

Sequence field in my Firebird table is plain integer and it is also
primary key for that table. The field is autogenerated by
Firebird server, so there is no need to directly accessing to it
when appending a new record - and it worked with 6.1.5.

With 6.5.1 I got an error when posting a new record
(both: with using TZSequence and without):
"Tryng to break primary (or unique) key"
So the value of primary (and sequence) field is not generated
or is generated wrongly.
It seems that something doesn't let the server to generate
the field value, something seems to override it, and
then it doesn't give back the correct value.

I tried reinstalling Firebird and I tried with previous version of Firebird
but the result is the same.

Yesterday and removed 6.5.1 and went back to 6.1.5
and I tried my little test app... and it worked great!

I can post a zip file with my small test database and src of test app
if needed, but there is no code inside at all, just componets
I set up as I described.

Sorry if I bother you too much,
I just wanna figure out what turned wrong.
I tried to dig in the Zeos source code, but I couldn't find
anything wrong with these functions,
but I guess I am not skilled enough anyway.

Thank you so much for your effort!

Peter

PS
I deceided to make a little parser that would check
up a few thigns for people that are switching from
6.1.5 to 6.5.1, but first I must make my project to work.
When I get it done I will post it. :) Cya!
User avatar
ste_ba
Zeos Dev Team
Zeos Dev Team
Posts: 29
Joined: 15.02.2006, 20:26
Location: Lahntal
Contact:

Post by ste_ba »

Could you post your code? SQL code for creating table, generator and trigger, and Delphi code for inserting? Do you use ZUpdateSQL?

Stefan
FireBlade
Fresh Boarder
Fresh Boarder
Posts: 13
Joined: 03.11.2005, 18:52

here's some demo

Post by FireBlade »

Here is everything.
Delphi 7 with use of CLX, Firebird, Zeos 6.5.1.

It is very possible that I made something wrong,
and if that's the case, then I'm really sorry
for taking your time.
But I just can't see what is wrong.
Yesterday I made another test prog, and another
test db, all from scratch, and it worked.
But with this example it doesn't work.
I can't see the essential diference beetwin
working and failing examples.

Try this:
1. TZSequence is on - and it does not work.
2. When you remove TZSequence - the same.
3. Now use it with 6.1.5 - and it works.

I'm confused, and I got headaches. :(

Thank you so much!
You do not have the required permissions to view the files attached to this post.
FireBlade
Fresh Boarder
Fresh Boarder
Posts: 13
Joined: 03.11.2005, 18:52

Sequence generating problem - demo

Post by FireBlade »

Here is everything.
Delphi 7 with use of CLX, Firebird, Zeos 6.5.1.

It is very possible that I made something wrong,
and if that's the case, then I'm really sorry
for taking your time.
But I just can't see what is wrong.
Yesterday I made another test prog, and another
test db, all from scratch, and it worked.
But with this example it doesn't work.
I can't see the essential diference beetwin
working and failing examples.

Try this:
1. TZSequence is on - and it does not work.
2. When you remove TZSequence - the same.
3. Now use it with 6.1.5 - and it works.

I'm confused, and I got headaches. :(

Thank you so much!
You do not have the required permissions to view the files attached to this post.
FireBlade
Fresh Boarder
Fresh Boarder
Posts: 13
Joined: 03.11.2005, 18:52

Post by FireBlade »

oops, sorry for double post, it's because of my "wonderful"
internet connection. yikes!
wietsehagoort
Fresh Boarder
Fresh Boarder
Posts: 6
Joined: 28.08.2006, 12:42

Post by wietsehagoort »

I'm kicking this topic up, because his question is still unanswered.

I have the same problem, except that i'am using Postgresql and i am not using CLX.
With Zeos 6.1.5 I worked as following:
- Open a tzquery with a simple query
- I did my insert
- I did my post
- Now the record was saved and the sequence was used automaticly by postgres

With Zeos 6.5.1 it seems that i need to add a tzsequence on every query where i'm using.
That something i really don't want, because it will cost me a lot of time.

Why did this behaviour change?
Post Reply