Open Numerabilis opened 1 year ago
I found out there is a function to work around SET DEFAULT TO:
LETO_SETPATH(xPATH)
Now it´s working!
Working example:
xPath := "//127.0.0.1:2812/"
SET DEFAULT TO (xPATH)
LETO_SETPATH(xPATH)
leto_Connect( xPath, , , 6000, 100)
USE CADASTRO ALIAS CAD SHARED New
SET INDEX TO ("CADASTRO"+INDEXEXT())
Problem solved with function LETO_SETPATH()
Hi Numerabilis,
Working example: NO!
xPath := "//127.0.0.1:2812/" LETO_IP_ADDRESS = "//127.0.0.1:2812/"
SET DEFAULT TO SubDir This should be set, if anyway needed !, beforehand the Leto_Connect()
LETO_SETPATH( "OneDir;TwoDir;" ) This can be applied also afterwards a Leto_Connect()
Check Clpper/Harbour documentation about SET PATH TO // SET DEFAULT TO The root directory at server is detemined with the server config file "letodb.ini": DataPath and above settings are then relative to that root directory. IF 'DataPath' in letodb.ini is "D:\MyData", then after your settings the files would be searched in directory*: D:\MyData\127.0.0.1...." I'm sure this directory does not exist ;-) After all is correct set up, you do NOT need to add any path for your dbf / index files:
leto_Connect( LETO_IP_ADDRESS ) USE CADASTRO ALIAS CAD SHARED New SET INDEX TO ("CADASTRO"+INDEXEXT())
letodb.ini:
Port = 2812
DataPath = C:\DATABASE\
The databases of my aplication is at C:\DATABASE\CONTROLI In my aplication:
// servidor LETODBf
#include "rddleto.ch" // defines do RDD
#include "dbinfo.ch" // Header file for the RDD API Index OrderInfo and DBInfo support
#include "leto_std.ch" // traduz os comandos para o LETO
#define __LETO_TRANSLATE_FILE_ALL // traduz todas as funções para o LETO
#include "letofile.ch" // traduz as funções para o LETO
REQUEST LETO
REQUEST RDDLETO
REQUEST RDDInfo
LETO_IP_ADDRESS := "//127.0.0.1:2812/"
cDATABASE := "CONTROLI/"
SET DEFAULT TO (cDATABASE)
IF leto_Connect( LETO_IP_ADDRESS ) == -1
ALERT("Nenhum LetoDBF Server encontrado - Erro: " + leto_Connect_Err( .T. ) )
QUIT
ENDIF
LETO_SETPATH(cDATABASE) // actually no effect
? FILE("UNIDADE.DBF") // RETURNs .F.
? FILE("CONTROLI/UNIDADE.DBF") // RETURNs .T.
SET DEFAULT is not working nether LETO_SETPATH(). It only finds databases if in letodb.ini I put DATAPATH = C:\DATABASE\CONTROLI This way it would run only one aplication because if I have more aplications it would have to share the same folder... what a mess!
Hi, Elchs
I use SET DEFAULT TO point my databases so instead I set to localhost but the command USE is not working. Example:
This should work but in the example above Leto can´t find the database. So I made this test below that works:
The problem is SET DEFAULT TO is not working as expected and I would have to change several lines of my program to work out the problem. Why SET DEFAULT TO is not working with Leto? Am I missing something? Is there something that could be done?