Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Crash making a C++ OLEDB consumer of VFP DB
Message
From
20/10/2006 08:53:45
Cetin Basoz
Engineerica Inc.
Izmir, Turkey
 
General information
Forum:
Visual FoxPro
Category:
COM/DCOM and OLE Automation
Environment versions
Visual FoxPro:
VFP 9 SP1
OS:
Windows XP SP2
Network:
Windows 2003 Server
Database:
Visual FoxPro
Miscellaneous
Thread ID:
01160912
Message ID:
01163620
Views:
23
>I think I might have found the problem that is causing GENDBC to fail.
>
>I have pasted portions of the PRG file generated by GENDBC into another PRG file and compiled that. I repeated this until I found the code that was causing the compile to fail.
>
>It appears to me that one of the CREATE TABLE statements has too many characters in it. This database includes about 176 tables. 2 of them are quite large, but do fit within the number of allowed field.
>
>I copied the each of the questionable CREATE TABLE statements into Microsoft Word as a way of getting a character count.
>
>One CREATE TABLE statement had 6963 characters (not counting spaces), or 13834 characters if you counted spaces. The PRG file with this CREATE TABLE statement in it compiles OK.
>
>The other CREATE TABLE statement has 7654 chars (not counting spaces), or 15,284 chars counting spaces. When this statement is in the PRG file, the compile fails.
>
>Does this sound like what might be causing my problems?
>
>Jim

Looks like you passed part 1. VFP commandline limit is 8K - 8192bytes. But that's just part 1. Working that around is easy. Currently it looks like:
create table ... ( fieldname1 ..., ;
  fieldname2 ..., ;
  ...
  fieldnameN ...)
(You have roughly 32 bytes per field declaration here on the average which is possible to exceed). To work this around you could cut some fields from bottom (say you have 250 fields, cut last 20 fields and it fits in commandline length) and execute create command. Followed by:
Alter table < tablename > ;
 add column < fieldname231 c(20) > ; && warning no comma
 add column < fieldname232 ... > ;  
 add column < fieldname233 ... > ;  
 ... ;  
 add column < fieldname232 ... > 
To add remamining columns w/o getting the error.
Another one might be:
* again cut some fields
Create table temp1 { ... ;
*...
fieldName230 type )

* create rest as if another table
Create table temp2 { fieldname231 ... ;
*...
fieldName250 type )

select * from temp1 full join temp2 on .t. ;
 into table < realTableName > ;
 database < databaseName to ensure it gets into right db >

*drop 2 temp tables
That is only for part 1, to pass creation via code.

Now that you have fresh db created now you need to test it original problem. I'd follow these steps (I expect it might fail on 1st and narrow the problem there):

1) Do not add any data yet. Go VS and try consumer now. Does it fail?
2) Add data from existing. In a loop you could do this:
local ix, lcOldPath,lcNewPath
lcOldPath = addbs("c:\myOldDataPath")
lcNewPath = addbs("c:\myNewDataPath")
for ix =1 to adir(aTables,m.lcNewPath+'*.dbf')
  use (m.lcNewPath+aTables[m.ix])
  append from (m.lcOldPath+aTables[m.ix])
  use
endfor
And once again test consumer. Does it fail?
etc.

My guess is that it's failing tryng to create schema (a long select exceeding limits?). Not sure, never had one to test.
Good luck.
Cetin
Çetin Basöz

The way to Go
Flutter - For mobile, web and desktop.
World's most advanced open source relational database.
.Net for foxheads - Blog (main)
FoxSharp - Blog (mirror)
Welcome to FoxyClasses

LinqPad - C#,VB,F#,SQL,eSQL ... scratchpad
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform