Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
SET DATABASE command
Message
 
 
To
06/12/2005 02:41:41
General information
Forum:
Visual FoxPro
Category:
Coding, syntax & commands
Environment versions
Visual FoxPro:
VFP 9
OS:
Windows XP SP2
Database:
Visual FoxPro
Miscellaneous
Thread ID:
01074980
Message ID:
01075270
Views:
28
>>Here is what I just found and it's very depressing:
>>
>>I have a form with three business objects. Two of them are using views and one is not using data environment. Here is one of the view's SQL:
>>
>>
>>SELECT DISTINCT Employee_queue_activity.cemployee_queue_activity_pk,;
>>  Employee_queue_activity.ctrans_employees_queues_fk,;
>>  Employee_queue_activity.inumber_of_items_worked_count,;
>>  Employee_queue_activity.iminutes_per_account_count,;
>>  Employee_queue_activity.istatus_changes_count,;
>>  Employee_queue_activity.iresolved_accounts_count,;
>>  Employee_queue_activity.irequeued_accounts_count,;
>>  Employee_queue_activity.tentered_date,;
>>  Employee_queue_activity.centered_user,;
>>  Employee_queue_activity.tlast_updated_date,;
>>  Employee_queue_activity.clast_updated_user;
>> FROM ;
>>     MMVISCOLLECT!TRANS_EMPLOYEES_QUEUES ;
>>    INNER JOIN MMVISCOLLECT!EMPLOYEE_QUEUE_ACTIVITY ;
>>   ON  Trans_employees_queues.ctrans_employees_queues_pk = Employee_queue_activity.ctrans_employees_queues_fk ;
>>    INNER JOIN MMVISCOLLECT!QUEUE_NAMES ;
>>   ON  Queue_names.cqueue_names_pk = Trans_employees_queues.cqueue_names_fk ;
>>    INNER JOIN MMVISCOLLECT!EMPLOYEE_QUEUE_PROFILES ;
>>   ON  Queue_names.cqueue_names_pk = Employee_queue_profiles.cqueue_names_fk;
>> WHERE  Queue_names.cqueue_names_pk LIKE ( ?VP_CQUEUE_NAMES_PK );
>>   AND  (  Employee_queue_activity.tentered_date BETWEEN DATE() AND DTOT(DATE()+1)-1;
>>   AND  Trans_employees_queues.ccommission_owner_usgrlink_fk = ( ?VP_CUSGRLINK_FK ) )
>>
>>
>>I'm also using several select statements from database using our funciton RunSQL which Sets database to the correct database.
>>
>>Now, I found that tables which are not used in the view and opened by SQL are used from the T drive. But the View tables are used from the local drive. Therefore the result is wrong...
>
>Remember, SET DATABASE TO it is datasession scoped, but OPEN DATABASE is not,
>and same is true for tables/views file handle.
>
>If you want a reliable code, you must :
>
>1: doesn't put database into the SET("DIRECTORY"),
>
>2:  SET PATH TO <EMPTY>
>
>3: when you want change the database context:
> - close all datasessions
> - reset the databases context
>*** RESET
>CLOSE DATABASES ALL
>CLOSE TABLES ALL
>
In other words, you're suggesting to exclude database from the path. BTW, the database is included in the project (it's excluded, but it's part of the project). This seems like the easiest thing to implement and may solve our problems. I'll discuss this idea with my colleagues.
If it's not broken, fix it until it is.


My Blog
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform