Q:
Generally we write our apps to hit more than one backend.
Various of our routines (e.g., "what is the current database") have to know the backend type in order to use the appropriate command to return the database name.
To do that, we need to know the connection type before we have created a cursor (if we have created one, the cursoradapter dbtype property does the trick). Note that from the application's perspective, it was given a connection string and create a connection with it.
To summarize:
1) how to use a handle to find the dbtype in the absence of a cursor?
2) with regard to Lianja ODBC, how to find the current database? Essentially, return database() from the Lianja SQL Server. Note that if the Catalog Column from systables is always the name of the database, this one is solved. If not, then I need another way. IOW: is there a 1:1 correspondence between the database directory name and the .cat file name?
A:
There is no way with ODBC to determine the type of data that you are connected to.
Lianja uses heuristics to do this internally and then sets dbtype as you mentioned.
There is also no way to determine the database that is specified in the ODBC connection string. You can however evaluate an expression and get its value e.g.
select database() from sysresultset
Yes the database directory name and the .cat file are the same.
Q:
I need to be able to do select statements from Lianja against the vfp table created by xcase so I can scan though and do the work needed to crate / update table, create indexes in Lianja etc.
Since the tables don't belong to a datatbase what is the best way to do this? I assume I have to have database to use ODBC?
I have tried with a test table ( this one does belong to a database)
Code:
select * from c:\1temp\daddress into cursor temp1
and get an error
Fri Apr 7 18:12:12 2017
**** Lianja error ****
DADDRESS.LA10AUTHOR
^
Fatal I/O error writing record 1 to table - errno 22
Q2:
I've just tried to copy one of the tables to a Lianja table using
Code:
use c:\1temp\ddent noupdate
copy to c:\1temp\l_ddent with production
and get
Fri Apr 7 21:10:46 2017
**** Lianja error ****
copy to c:\1temp\l_ddent with production
^
ERROR - invalid record length
Hank tells me that the Xcase case tables are in foxpro 2.x rather than VFP type so maybe that is an issue.
A:
I am able to USE that table and COPY TO another_name to put it in Lianja format.
SQL SELECT is working Ok in 3,.4 with that table too although its not really supported as you need to convert to Lianja format so that the query optimizer can do its work.
Just USE tablename ALIAS whatever then perform your SQL SELECTSs.
Just an FYI, Lianja supports the following XBase file formats natively readonly.
VFP
FoxPro 2.x
Clipper
A2:
in my opinion, the best thing is to create an ODBC link to your xcase table, then create a VT on that table.
With a old FoxPro table, I do that.
Q:
Can you make ODBC links to tables that are not part of a database?
The code I have looked at for the ODBC connection wants the name of the database
A:
For free VFP table you need VFP ODBC driver.
All topics in [Answers] alphabetically: https://www.lianja.com/community/sho...ll=1#post13748
These answers are also systematized on the site "Lianja developer": https://lianjadeveloper.wordpress.co...p-odbc-driver/
Bookmarks