<quote author='4D Tech mailing list'> Hi, I understand that if a component needs to have access to 1 or more tables there are 2 ways to do this: - Inject the table definition(s) into the host - USE DATABASE and connect to an external database/datafile.
I have some questions about using external databases in the context of a component. Given the following situation: [Host_Database] <- [component] -> [external_for_Component] - in the case of client/server how is the external database managed? -- would I place it in the component's resource folder? -- is it automagically moved to the client via some other mechanism? -- or is the component's external database call passed back to the server, call(s) made and then data transferred to client from server? -- something else - As I read the 4D docs it seems that the external database can NOT have/use a field of type C_Object as this is not supported by SQL, and access is done to the external database only through SQL. -- Is this a correct interpretation? - In a component with an external database, would I need to switch back and forth between access to the external database and the host system? ex: method call from host includes pointer to table or field of host. To satisfy the method call, data from the external database needs to be accessed. I USE DATABASE(External) to the external database do query, get data. - do I need to place the retrieved external database data into variable(s)? - do I need to then USE DATABASE(Host) before working with the host table/field(s)? Thanks for answering, and any other tips you may have regarding external databases and components. Chip We have done so much, with so little, for so long; We are now qualified to anything with nothing <sigh> - unknown ********************************************************************** 4D Internet Users Group (4D iNUG) Archive: http://lists.4d.com/archives.html Options: https://lists.4d.com/mailman/options/4d_tech Unsub: mailto:[email protected] ********************************************************************** </quote> Hi Chip, I use this mecanism every time in QS Toolbox and will speak about this during the presentation planned next January. You really pointed out how to manage. Now, about C_OBJECT, I don't save them. One trick could be to Jsonify it as text and perform the reverse action when you need to get access to the information. So, I manage action on server with the option 'Execute on server' as method's property and for variable, I use GET/SET VARIABLE TO VARIABLE commands. Here is a SQL code on how to manage action executed on external database and internal one: Begin SQL USE REMOTE DATABASE DATAFILE :[$QS_VCS_COMP_DB_PATH] AUTO_CLOSE; SELECT count(*) from VCS INTO :[$Count]; USE DATABASE SQL_INTERNAL; End SQL You can ping me directly at: pat.emanuel67 @ gmail. com Patrick _____________________________________ Sent from http://4d.1045681.n5.nabble.com ********************************************************************** 4D Internet Users Group (4D iNUG) Archive: http://lists.4d.com/archives.html Options: https://lists.4d.com/mailman/options/4d_tech Unsub: mailto:[email protected] **********************************************************************

