|
Log in |
FAQ | Members List | Calendar | Search | Today's Posts | Mark Forums Read |
|
Thread Tools | Display Modes |
#1
|
|||
|
|||
![]() I'm trying to convert this line of Delphi code to BCB5:
FileDescriptorIndex:=0; indexdescriptor:=dict.AddIndex('ID',filedescriptor index, True,'',TnxCompKeyDescriptor); indexdescriptor.desc:=''; indexdescriptor.indexfile.blocksize:=nxbs4k; kfd:=TnxCompKeyDescriptor(indexdescriptor.keydescr iptor) .Add(dict.GetFieldFromName('ID')); I came up with: ID = Dict->AddIndex("ID", 0, True, "", __classid(TnxCompKeyDescriptor), NULL); ID->Desc = ""; ID->IndexFile->BlockSize = nxbs64k; TnxCompKeyDescriptor *CFD = dynamic_cast <TnxCompKeyDescriptor *>(ID->KeyDescriptor); CFD->Add(Dict->GetFieldFromName("ID"), NULL); The final NULL in the Add call is required because the initialization is missing from the function prototype. Looking at the Delphi code, nil is the default value I find so NULL should be OK here. Although I don't check CFD for NULL in this code, I've verified that it is not in the debugger. A test call to CFD->ClassName() returns TnxCompKeyDescriptor, the expected object type. If I run this code, I get an AV in the CFD->Add call. I'm not much of a Delphi programmer so I'm not sure that my code is equivalent to the Delphi code and I'm having a bit of trouble figuring out what I'm doing wrong. TIA! |
#2
|
|||
|
|||
![]() Can you please post a small demo app to debug it tracing into the Delphi
source? The simplest thing you can make fail. -- Rodrigo Gómez [NDX] rgomezNO@SPAMndx.nexusdb.com (remove NO and SPAM from the address) "Leroy Casterline" <casterle@ccltd.com> escribió en el mensaje news:mdpg00puenmep47recakp73p9haadc5gq4@4ax.com... > I'm trying to convert this line of Delphi code to BCB5: > > FileDescriptorIndex:=0; > indexdescriptor:=dict.AddIndex('ID',filedescriptor index, > True,'',TnxCompKeyDescriptor); > indexdescriptor.desc:=''; > indexdescriptor.indexfile.blocksize:=nxbs4k; > > kfd:=TnxCompKeyDescriptor(indexdescriptor.keydescr iptor) > .Add(dict.GetFieldFromName('ID')); > > I came up with: > > ID = Dict->AddIndex("ID", 0, True, "", > __classid(TnxCompKeyDescriptor), NULL); > ID->Desc = ""; > ID->IndexFile->BlockSize = nxbs64k; > > TnxCompKeyDescriptor *CFD = dynamic_cast > <TnxCompKeyDescriptor *>(ID->KeyDescriptor); > > CFD->Add(Dict->GetFieldFromName("ID"), NULL); > > The final NULL in the Add call is required because the initialization is > missing from the function prototype. Looking at the Delphi code, nil is > the default value I find so NULL should be OK here. > > Although I don't check CFD for NULL in this code, I've verified that it > is not in the debugger. A test call to CFD->ClassName() returns > TnxCompKeyDescriptor, the expected object type. > > If I run this code, I get an AV in the CFD->Add call. I'm not much of a > Delphi programmer so I'm not sure that my code is equivalent to the > Delphi code and I'm having a bit of trouble figuring out what I'm doing > wrong. > > TIA! |
#3
|
|||
|
|||
![]() "Rodrigo Gómez [NDX]" <rgomezREMOVECAPS@PLEASEmsa.com.mx> wrote:
>Can you please post a small demo app to debug it tracing into the Delphi >source? The simplest thing you can make fail. OK, I've uploaded a small sample project to the binaries NG. I've combined functions from a couple of different file into Main.cpp (I think I've removed all the unnecessary stuff). I've got a radiobutton on the form that allows you to create the table using either the Delphi code (from SourceMaker, in the CreateTables subdirectory) or my BCB code. The CreateTableBCB function at the bottom of Main.cpp is the function I've translated. The index creation lines are commented out, so it will create an unindexed table as it is now. Uncomment the commented lines to see what happens when I try to create the index. Tables are placed in the DataSets subdirectory. I'm using BCB5 w/the latest patch. Thanks for taking a look! |
#4
|
|||
|
|||
![]() Hello Leroy.
Sorry for being so late. I didn't have the time to check this in the weekend. I have added some lines to the code you sent me, and I think I know what is causing the problem. And it seem to be the same problem as the experienced with the TnxAbastractTaskInfo->GetStatus(). The calls are mapped incorrectly. I added the following: int num_field = Dict->GetFieldFromName("ID"); int key_count = CFD->KeyFieldCount; CFD->CheckValid(); CFD->Add(num_field, NULL); And the call to CheckValid ends up in the IsEqual function, wich, AFAIK, doesn't have anything to do here. I guess, but I haven't been able to trace into the call, that the Add ends up in some other place (it doesn't seem to end up in the Delete function). So, what are the options here... As Eric mentioned, maybe adding a second copy of the functions will help, or trying the Eivind's suggestion to remove the "double" protected or moving around the class to see if it helps. Or, as Holger ended up doing, doing the DDL work in SQL. I don't know if that's valid in your case. I haven't tryed the code in BCB6, but my wild guess is that it may work in BCB6. I know that moving from BCB5 to BCB6 is not an option in all cases, or in the best case, a quick solution. -- Rodrigo Gómez [NDX] rgomezNO@SPAMndx.nexusdb.com (remove NO and SPAM from the address) "Leroy Casterline" <casterle@ccltd.com> escribió en el mensaje news ![]() > "Rodrigo Gómez [NDX]" <rgomezREMOVECAPS@PLEASEmsa.com.mx> wrote: > > >Can you please post a small demo app to debug it tracing into the Delphi > >source? The simplest thing you can make fail. > > OK, I've uploaded a small sample project to the binaries NG. > > I've combined functions from a couple of different file into Main.cpp (I > think I've removed all the unnecessary stuff). > > I've got a radiobutton on the form that allows you to create the table > using either the Delphi code (from SourceMaker, in the CreateTables > subdirectory) or my BCB code. > > The CreateTableBCB function at the bottom of Main.cpp is the function > I've translated. The index creation lines are commented out, so it will > create an unindexed table as it is now. Uncomment the commented lines to > see what happens when I try to create the index. > > Tables are placed in the DataSets subdirectory. I'm using BCB5 w/the > latest patch. > > Thanks for taking a look! > |
#5
|
|||
|
|||
![]() I added "CFD->Delete(0)" after the CheckValid and the call to Delete ends up
correclty in the Delete function... I'll try moving around the code, to see if it helps. -- Rodrigo Gómez [NDX] rgomezNO@SPAMndx.nexusdb.com (remove NO and SPAM from the address) "Rodrigo Gómez [NDX]" <rgomezREMOVECAPS@PLEASEmsa.com.mx> escribió en el mensaje news:400bf1b3@wic040d.... > Hello Leroy. > > Sorry for being so late. I didn't have the time to check this in the > weekend. > > I have added some lines to the code you sent me, and I think I know what is > causing the problem. And it seem to be the same problem as the experienced > with the TnxAbastractTaskInfo->GetStatus(). The calls are mapped > incorrectly. I added the following: > > int num_field = Dict->GetFieldFromName("ID"); > > int key_count = CFD->KeyFieldCount; > > CFD->CheckValid(); > > CFD->Add(num_field, NULL); > > And the call to CheckValid ends up in the IsEqual function, wich, AFAIK, > doesn't have anything to do here. I guess, but I haven't been able to trace > into the call, that the Add ends up in some other place (it doesn't seem to > end up in the Delete function). > > So, what are the options here... As Eric mentioned, maybe adding a second > copy of the functions will help, or trying the Eivind's suggestion to remove > the "double" protected or moving around the class to see if it helps. Or, as > Holger ended up doing, doing the DDL work in SQL. I don't know if that's > valid in your case. > > I haven't tryed the code in BCB6, but my wild guess is that it may work in > BCB6. I know that moving from BCB5 to BCB6 is not an option in all cases, or > in the best case, a quick solution. > > -- > Rodrigo Gómez [NDX] > rgomezNO@SPAMndx.nexusdb.com > (remove NO and SPAM from the address) > > > "Leroy Casterline" <casterle@ccltd.com> escribió en el mensaje > news ![]() > > "Rodrigo Gómez [NDX]" <rgomezREMOVECAPS@PLEASEmsa.com.mx> wrote: > > > > >Can you please post a small demo app to debug it tracing into the Delphi > > >source? The simplest thing you can make fail. > > > > OK, I've uploaded a small sample project to the binaries NG. > > > > I've combined functions from a couple of different file into Main.cpp (I > > think I've removed all the unnecessary stuff). > > > > I've got a radiobutton on the form that allows you to create the table > > using either the Delphi code (from SourceMaker, in the CreateTables > > subdirectory) or my BCB code. > > > > The CreateTableBCB function at the bottom of Main.cpp is the function > > I've translated. The index creation lines are commented out, so it will > > create an unindexed table as it is now. Uncomment the commented lines to > > see what happens when I try to create the index. > > > > Tables are placed in the DataSets subdirectory. I'm using BCB5 w/the > > latest patch. > > > > Thanks for taking a look! > > > > |
#6
|
|||
|
|||
![]() I found the same message in tamaracka:
http://216.101.185.148/scripts/isapi...rticle=4161857 This may be related, I don't know. Right now, I'm fighting with the header generation so it can generate the header files correctly... -- Rodrigo Gómez [NDX] rgomezNO@SPAMndx.nexusdb.com (remove NO and SPAM from the address) "Rodrigo Gómez [NDX]" <rgomezREMOVECAPS@PLEASEmsa.com.mx> escribió en el mensaje news:400bf3a8$1@wic040d.... > I added "CFD->Delete(0)" after the CheckValid and the call to Delete ends up > correclty in the Delete function... I'll try moving around the code, to see > if it helps. > > -- > Rodrigo Gómez [NDX] > rgomezNO@SPAMndx.nexusdb.com > (remove NO and SPAM from the address) > > > "Rodrigo Gómez [NDX]" <rgomezREMOVECAPS@PLEASEmsa.com.mx> escribió en el > mensaje news:400bf1b3@wic040d.... > > Hello Leroy. > > > > Sorry for being so late. I didn't have the time to check this in the > > weekend. > > > > I have added some lines to the code you sent me, and I think I know what > is > > causing the problem. And it seem to be the same problem as the experienced > > with the TnxAbastractTaskInfo->GetStatus(). The calls are mapped > > incorrectly. I added the following: > > > > int num_field = Dict->GetFieldFromName("ID"); > > > > int key_count = CFD->KeyFieldCount; > > > > CFD->CheckValid(); > > > > CFD->Add(num_field, NULL); > > > > And the call to CheckValid ends up in the IsEqual function, wich, AFAIK, > > doesn't have anything to do here. I guess, but I haven't been able to > trace > > into the call, that the Add ends up in some other place (it doesn't seem > to > > end up in the Delete function). > > > > So, what are the options here... As Eric mentioned, maybe adding a second > > copy of the functions will help, or trying the Eivind's suggestion to > remove > > the "double" protected or moving around the class to see if it helps. Or, > as > > Holger ended up doing, doing the DDL work in SQL. I don't know if that's > > valid in your case. > > > > I haven't tryed the code in BCB6, but my wild guess is that it may work in > > BCB6. I know that moving from BCB5 to BCB6 is not an option in all cases, > or > > in the best case, a quick solution. > > > > -- > > Rodrigo Gómez [NDX] > > rgomezNO@SPAMndx.nexusdb.com > > (remove NO and SPAM from the address) > > > > > > "Leroy Casterline" <casterle@ccltd.com> escribió en el mensaje > > news ![]() > > > "Rodrigo Gómez [NDX]" <rgomezREMOVECAPS@PLEASEmsa.com.mx> wrote: > > > > > > >Can you please post a small demo app to debug it tracing into the > Delphi > > > >source? The simplest thing you can make fail. > > > > > > OK, I've uploaded a small sample project to the binaries NG. > > > > > > I've combined functions from a couple of different file into Main.cpp (I > > > think I've removed all the unnecessary stuff). > > > > > > I've got a radiobutton on the form that allows you to create the table > > > using either the Delphi code (from SourceMaker, in the CreateTables > > > subdirectory) or my BCB code. > > > > > > The CreateTableBCB function at the bottom of Main.cpp is the function > > > I've translated. The index creation lines are commented out, so it will > > > create an unindexed table as it is now. Uncomment the commented lines to > > > see what happens when I try to create the index. > > > > > > Tables are placed in the DataSets subdirectory. I'm using BCB5 w/the > > > latest patch. > > > > > > Thanks for taking a look! > > > > > > > > > |
#7
|
|||
|
|||
![]() > I found the same message in tamaracka:
It's not the same, of course... I try to said a related message or something like that... -- Rodrigo Gómez [NDX] rgomezNO@SPAMndx.nexusdb.com (remove NO and SPAM from the address) "Rodrigo Gómez [NDX]" <rgomezREMOVECAPS@PLEASEmsa.com.mx> escribió en el mensaje news:400c01bb@wic040d.... > I found the same message in tamaracka: > > http://216.101.185.148/scripts/isapi...rticle=4161857 > > This may be related, I don't know. Right now, I'm fighting with the header > generation so it can generate the header files correctly... > > -- > Rodrigo Gómez [NDX] > rgomezNO@SPAMndx.nexusdb.com > (remove NO and SPAM from the address) > > > "Rodrigo Gómez [NDX]" <rgomezREMOVECAPS@PLEASEmsa.com.mx> escribió en el > mensaje news:400bf3a8$1@wic040d.... > > I added "CFD->Delete(0)" after the CheckValid and the call to Delete ends > up > > correclty in the Delete function... I'll try moving around the code, to > see > > if it helps. > > > > -- > > Rodrigo Gómez [NDX] > > rgomezNO@SPAMndx.nexusdb.com > > (remove NO and SPAM from the address) > > > > > > "Rodrigo Gómez [NDX]" <rgomezREMOVECAPS@PLEASEmsa.com.mx> escribió en el > > mensaje news:400bf1b3@wic040d.... > > > Hello Leroy. > > > > > > Sorry for being so late. I didn't have the time to check this in the > > > weekend. > > > > > > I have added some lines to the code you sent me, and I think I know what > > is > > > causing the problem. And it seem to be the same problem as the > experienced > > > with the TnxAbastractTaskInfo->GetStatus(). The calls are mapped > > > incorrectly. I added the following: > > > > > > int num_field = Dict->GetFieldFromName("ID"); > > > > > > int key_count = CFD->KeyFieldCount; > > > > > > CFD->CheckValid(); > > > > > > CFD->Add(num_field, NULL); > > > > > > And the call to CheckValid ends up in the IsEqual function, wich, AFAIK, > > > doesn't have anything to do here. I guess, but I haven't been able to > > trace > > > into the call, that the Add ends up in some other place (it doesn't seem > > to > > > end up in the Delete function). > > > > > > So, what are the options here... As Eric mentioned, maybe adding a > second > > > copy of the functions will help, or trying the Eivind's suggestion to > > remove > > > the "double" protected or moving around the class to see if it helps. > Or, > > as > > > Holger ended up doing, doing the DDL work in SQL. I don't know if that's > > > valid in your case. > > > > > > I haven't tryed the code in BCB6, but my wild guess is that it may work > in > > > BCB6. I know that moving from BCB5 to BCB6 is not an option in all > cases, > > or > > > in the best case, a quick solution. > > > > > > -- > > > Rodrigo Gómez [NDX] > > > rgomezNO@SPAMndx.nexusdb.com > > > (remove NO and SPAM from the address) > > > > > > > > > "Leroy Casterline" <casterle@ccltd.com> escribió en el mensaje > > > news ![]() > > > > "Rodrigo Gómez [NDX]" <rgomezREMOVECAPS@PLEASEmsa.com.mx> wrote: > > > > > > > > >Can you please post a small demo app to debug it tracing into the > > Delphi > > > > >source? The simplest thing you can make fail. > > > > > > > > OK, I've uploaded a small sample project to the binaries NG. > > > > > > > > I've combined functions from a couple of different file into Main.cpp > (I > > > > think I've removed all the unnecessary stuff). > > > > > > > > I've got a radiobutton on the form that allows you to create the table > > > > using either the Delphi code (from SourceMaker, in the CreateTables > > > > subdirectory) or my BCB code. > > > > > > > > The CreateTableBCB function at the bottom of Main.cpp is the function > > > > I've translated. The index creation lines are commented out, so it > will > > > > create an unindexed table as it is now. Uncomment the commented lines > to > > > > see what happens when I try to create the index. > > > > > > > > Tables are placed in the DataSets subdirectory. I'm using BCB5 w/the > > > > latest patch. > > > > > > > > Thanks for taking a look! > > > > > > > > > > > > > > > > |
#8
|
|||
|
|||
![]() I decided to try to remove the duplicated 'protected' sections from the
TnxCompKeyDescriptor class declaration in nxsdDataDictionary.pas. <RANT> This isn't a Nexus problem, just thought I'd mention it 'cause it's wickedly (not)funny. I can't build the entire program group 'cause BCB5 craps out part way through, presenting a blank error message. Repeatedly clicking on the error message eventually reveals the message text "Out of system resources"! I running WinXP, 1GB of RAM. I can't remember the last time I've seen a system resources error, but I don't think I've seen one since Win98. Same thing happens when I build the projects individually after I've done a few of them. I can get them all built if I do a few, shut down BCB5 and restart, then do a few more. </RANT> I get a couple when rebuilding NexusDB in BCB5. I'm not sure if these are important or not, but wanted to run them by you: 1) [Pascal Warning] nxllTypes.pas(190): Unsupported language feature: 'Comp' Looking up the warning via F1: "You are attempting to translate a Pascal unit to a C++ header file which contains unsupported language features. "You must remove the offending construct from the interface section before the unit can be translated." This occurs in most (all?) of the packages. 2) [Pascal Warning] nxsqlCondExp.pas(6529): Constant expression violates subrange bounds Looking up the warning via F1: "This error message occurs when the compiler can determine that a constant is outside the legal range." Unfortunately eliminating the redundant protected keyword did not fix the problem. If I inspect the CFD object just before calling Add(), I see that the address for that method is 0x786E5414. All of the other methods are in the 0x004xxxxx and 0x005xxxxx area. I can call, for example, CFD->ClassName() and get the expected result. I can't imagine why this one method has such a bizarre address. The solution to the problem was to follow vavan's advice in the TnxAbstractTaskInfo thread and change the Add method from virtual to dynamic and rebuild the package. But now I wonder if I must find every virtual method in all of the Nexus files and make them dynamic? Or does it only matter for public methods? Or can I just ignore the other virtuals until I have another addressing problem? |
#9
|
|||
|
|||
![]() > <RANT> </RANT>
Yes... Builder is just fantastic. I have to run my apps outside (my fingers are now too used to Windows+R, down arrow some times, press enter, Alt+Tab to builder, Run, Attach To, select, Enter, F9) because BCB just keeps loosing the debug info when running inside the IDE. Or checking the paths almost every day, etc., etc., etc. It's really a shame that Borland didn't put enough resources in this product to make it shine as it had the potential, IMHO. Lack of customers because of that, or, that because of lack of customers? who knows... > The solution to the problem was to follow vavan's advice in the > TnxAbstractTaskInfo thread and change the Add method from virtual to > dynamic and rebuild the package. Great! so chaning them to dynamic sovled the problem?? That's great. I just need to ask the Delphi gurus, and Big Mr. T. about what a "dynamic" means... <vbg> to see if it can be changed without changing what the code should really do. > But now I wonder if I must find every virtual method in all of the Nexus > files and make them dynamic? Or does it only matter for public methods? > Or can I just ignore the other virtuals until I have another addressing > problem? Well... the frist thing to do here is, IMO, to wait for the Mr. T. et al clarification about that. I don't know Delphi enough to know if that change will affect in some way the behaivour of the code. -- Rodrigo Gómez [NDX] rgomezNO@SPAMndx.nexusdb.com (remove NO and SPAM from the address) "Leroy Casterline" <casterle@ccltd.com> escribió en el mensaje news:35bo001pcslc062h2ji0eblqkik0529qek@4ax.com... > I decided to try to remove the duplicated 'protected' sections from the > TnxCompKeyDescriptor class declaration in nxsdDataDictionary.pas. > > <RANT> > > This isn't a Nexus problem, just thought I'd mention it 'cause it's > wickedly (not)funny. > > I can't build the entire program group 'cause BCB5 craps out part way > through, presenting a blank error message. Repeatedly clicking on the > error message eventually reveals the message text "Out of system > resources"! > > I running WinXP, 1GB of RAM. I can't remember the last time I've seen a > system resources error, but I don't think I've seen one since Win98. > > Same thing happens when I build the projects individually after I've > done a few of them. I can get them all built if I do a few, shut down > BCB5 and restart, then do a few more. > > </RANT> > > I get a couple when rebuilding NexusDB in BCB5. I'm not sure if these > are important or not, but wanted to run them by you: > > 1) [Pascal Warning] nxllTypes.pas(190): > Unsupported language feature: 'Comp' > > Looking up the warning via F1: > > "You are attempting to translate a Pascal unit to a > C++ header file which contains unsupported language > features. > > "You must remove the offending construct from the > interface section before the unit can be translated." > > This occurs in most (all?) of the packages. > > 2) [Pascal Warning] nxsqlCondExp.pas(6529): Constant > expression violates subrange bounds > > Looking up the warning via F1: > > "This error message occurs when the compiler can > determine that a constant is outside the legal range." > > > Unfortunately eliminating the redundant protected keyword did not fix > the problem. > > If I inspect the CFD object just before calling Add(), I see that the > address for that method is 0x786E5414. All of the other methods are in > the 0x004xxxxx and 0x005xxxxx area. I can call, for example, > CFD->ClassName() and get the expected result. > > I can't imagine why this one method has such a bizarre address. > > The solution to the problem was to follow vavan's advice in the > TnxAbstractTaskInfo thread and change the Add method from virtual to > dynamic and rebuild the package. > > But now I wonder if I must find every virtual method in all of the Nexus > files and make them dynamic? Or does it only matter for public methods? > Or can I just ignore the other virtuals until I have another addressing > problem? |
#10
|
|||
|
|||
![]() "Rodrigo Gómez [NDX]" <rgomezREMOVECAPS@PLEASEmsa.com.mx> ÓÏÏÂÝÉÌ/ÓÏÏÂÝÉÌÁ ×
ÎÏ×ÏÓÔÑÈ ÓÌÅÄÕÀÝÅÅ: news:400c4b5d@wic040d.... > > The solution to the problem was to follow vavan's advice in the > > TnxAbstractTaskInfo thread and change the Add method from virtual to > > dynamic and rebuild the package. > > Great! so chaning them to dynamic sovled the problem?? That's great. I just > need to ask the Delphi gurus, and Big Mr. T. about what a "dynamic" means... > <vbg> to see if it can be changed without changing what the code should > really do. glad that solved it last time my suggestion provided the same help to another great component kbmMemTable and it worked too Kim just put the following macro after every virtual method {$IFDEF BCB}dynamic{$ELSE}virtual{$ENDIF} > > But now I wonder if I must find every virtual method in all of the Nexus > > files and make them dynamic? Or does it only matter for public methods? > > Or can I just ignore the other virtuals until I have another addressing > > problem? I am afraid you'll find it when you not expect it so better go ahead and modify the sources completely I wonder how bcb users (and me amongst them!) can use delphi written components at all ![]() |
Thread Tools | |
Display Modes | |
|
|
![]() |
||||
Thread | Thread Starter | Forum | Replies | Last Post |
ANN: My Delphi success story (15 years Delphi anniversary) ... | Danijel Tkalcec | nexusdb.public.discussions | 10 | 6th February 2010 04:45 AM |
v1 > v2: conversion needed ?? | Gs | nexusdb.public.support | 5 | 6th October 2008 11:02 PM |
Delphi to BCB conversion help please? | Leroy Casterline | Support Newsgroups | 24 | 25th February 2004 05:53 PM |
Conversion Help Part 3 | Darren Stephens | nexusdb.public.support | 0 | 21st October 2003 02:11 PM |
Conversion from other DBMS than FF? | Pierre Demers | nexusdb.public.discussions | 4 | 2nd September 2003 12:30 PM |