Subject Re: Bug? My Mistake? gbak metadata generators go haywire
Author Namit Nathwani
Hi Helen

At 03:30 am 03/11/2004, you wrote:
>Nothing wrong. This is simply the maximum value of a BigInt. When
>generators reach this number (i.e. when pigs do fly) they "roll over" and
>start again from 1.
>
>So the first time any of your generators is invoked, it will roll over and
>the number will be 1. Try it.

Thanks for your response but when I try to create new records (in a using
VFP as the front end) I get the following error:

Error #: 39
Message: Numeric overflow. Data was lost.
Line #: 32
Method: setnewpk
Object: idatabehavior

followed by

Error #: 39
Message: Numeric overflow. Data was lost.
Line #: 17
Method: createrecord
Object: abo_maccounts

followed by a message

violation of PRIMARY or UNIQUE KEY constraint "PK_MACCOUNTS_IID" on table
"MACCOUNTS"

for each accounts I am trying to create.

-2147483648 this was the iId value which was assigned to one record that
was created. I have also set the generators manually to 0 and the app
works perfectly alright.


From the VFP help file

<mk:@MSITStore:C:\Program%20Files\Microsoft%20Visual%20Studio\MSDN98\98VSa\1033\foxhelp.chm::/html/coninteger_field_type.htm>Integer
Integer values 4 bytes -2147483647 to 2147483647

So I guess the flying pigs value can't fit <g>. Also from the VFP help

<mk:@MSITStore:C:\Program%20Files\Microsoft%20Visual%20Studio\MSDN98\98VSa\1033\foxhelp.chm::/html/condouble_field_type.htm>Double
A double-precision floating-point number 8 bytes +/-4.94065645841247E-324
to +/-8.9884656743115E307
<mk:@MSITStore:C:\Program%20Files\Microsoft%20Visual%20Studio\MSDN98\98VSa\1033\foxhelp.chm::/html/confloat_field_type.htm>Float
Same as Numeric 8 bytes in memory;
1 to 20 bytes in table - .9999999999E+19 to .9999999999E+20

But I guess making the whole thing dependent on any of these 2 may create a
lot of problems?!?

Currently I have put in the following VFP code to hopefully solve the
immediate problem.

lnOldArea = SELECT(0)

lnConnHnd = CURSORGETPROP("ConnectHandle")

= SQLEXEC(lnConnHnd , [SELECT gen_id(GEN_] + STRTRAN(tcBaseTable, "DBO.", "") ;
+ [_IID, 1) AS nNextId from rdb$database])

luRetVal = VAL(sqlResult.nNextID)

*** If going beyond the Integer values
IF NOT BETWEEN(luRetVal, -2147483647, 2147483647)
luRetVal = 1

= SQLEXEC(lnConnHnd , [SET GENERATOR GEN_] + STRTRAN(tcBaseTable,
"DBO.", "") ;
+ [_IID TO 1])
ENDIF

USE IN sqlResult

SELECT (lnOldArea)

Please advise.



Regards
Bhavbhuti
___________________________________________
Softwares for Indian Businesses at:
http://ahmedabad.sancharnet.in/vso_ad1/
namitbn@...
___________________________________________


----------


---
Outgoing mail is certified Virus Free.
Checked by AVG anti-virus system (http://www.grisoft.com).
Version: 6.0.788 / Virus Database: 533 - Release Date: 01/11/2004


[Non-text portions of this message have been removed]