Diese Seite mit anderen teilen ...

Informationen zum Thema:
Forum:
WinDev Forum
Beiträge im Thema:
18
Erster Beitrag:
vor 9 Jahren, 3 Monaten
Letzter Beitrag:
vor 6 Jahren
Beteiligte Autoren:
RAUL2, David Egan, Jimbo, TheDuke, Yogi Yang, GuenterP, Joel, ICI, Allard

HF Classic vs. HFCS

Startbeitrag von Joel am 03.05.2009 14:17

Hi all -

I started a project in HF Classic (Because I didn't understand HFCS). My belief is that HFCS is a better choice - esp. for large projects, with lots of dbases for different clients. At least, that's my understanding.

My question is, is there any downside to converting over to HFCS now, halfway through the project by setting up a connection in the analysis? I think that it's the best way to go, but don't have the experience to be sure.

Opinions?

thanks!
J

Antworten:

Hi Joel, see my project: http://forum.mysnip.de/read.php?27161,17565 where you can switch between HF C/S and HF Classic ... Regards, Guenter

von Jimbo - am 03.05.2009 16:01
Hi Joel.

1. You heft to install and start HFCS Server and start HF Control center to see if your server function properly.
2. Select , into Analysis all files and from Analysis Menu select Convert to HFCS
3. You will be prompted to select server PC and Name for your connection. Also with wizard you can get whole code for your connection which You can use for further connections.
4. I also use INI file to remember server name for connection.
5. OpenConnection() and ChangeConnection() can be very usefull.
6. It is also important if you will have different clients with different data with same project.

I can send you small project if you want to see how I do that, or maybe is better solution to send it into WinDev solution even samples from Jimbo/Gunter are also very usefull and can be used for your need.

von ICI - am 03.05.2009 18:49
Hello ICI,

I am very interest with your example, because I use this system to change Connection.

My problem is :

Is it possible to do the inverse ? Change HFCS to HF

Thanx in advance

von TheDuke - am 04.05.2009 11:21
Hi, if you did look at my example ... the answers are there, but I cannot force you to look ..

von Jimbo - am 04.05.2009 12:25
Hi, Jimbo

Scouza, i check now, and thanx for the share

von TheDuke - am 04.05.2009 16:22
Quote
Jimbo
Hi Joel, see my project: http://forum.mysnip.de/read.php?27161,17565 where you can switch between HF C/S and HF Classic ... Regards, Guenter


Hi. I was searching and reading the forum about this issue. Guenter's code works very very well. I have only a question in order to not to work in vane: If I create a component which will execute (inside) the HChangeConnection() function, declare a connection global var, handle de INI and so on... Will this component work ok??? In "Component Options > Access rights" which should be the chosen options?

I don't know if I'm being clear enough in my questions...

Kind regards.

PS: I don't know what happens with data access because the HF context, which is a concept I don't understand well, to be honest.

von RAUL2 - am 26.07.2012 01:35
If I get what you mean then yes

A project can have several db connections as well. ( hyperfile and mysql etc).

Regards
Allard

von Allard - am 26.07.2012 06:35
Quote
Allard
If I get what you mean then yes

A project can have several db connections as well. ( hyperfile and mysql etc).

Regards
Allard

Thanks for your reply. This component is a whole new project, which is compiled into its own binary. When I insert this component in other project, will this component share the same HF context coming from that main project?

Regards.

von RAUL2 - am 26.07.2012 11:51
Hello guys.
After trying for many days, I have to say that putting the code into a component doesn't work.

Now, it works properly if I keep the set of procs in a directory, and later, I import it into EVERY project. What I was looking for is a solution in order to maintain JUST ONE set of procs. If I import the set of procs in EVERY project and I find a bug (or want to make a change to the code) I have to overwrite EVERY set of procs in EVERY project, of course, because there are many copies.

Any suggestions?

I think that my component doesn't work because the connection var and the HOpenConnection() /HChangeConnection() functions belong to the component, instead of the current project. I've tried to declare the connection var inside the project and pass it to the proc in which the open and change functions are executed, but it doesn't work either.

Regards.

von RAUL2 - am 07.08.2012 00:46
Hi
I recently did something like I think you're trying to achieve. This resulted in a very small program 'stub' which effectively only loaded components. I had a separate component for each functional part of the program, a component for data access which defined the connection and all the classes for the files, a component for the global procedures and a component for all the browse windows (this component also included the global & data access components).

The important thing is that no analysis is declared at the top level & anything to do with data files runs through the data access component. We define the connection & connect to the database in the Initialization code of the data access component & then do finds, saves etc via the classes in this component. Every 'Window' component includes the data access component and the global procedure component.

This actually all worked surprisingly well; if you make any changes to the external interface to the base component you must recompile the modules using it (if nothing else it makes you plan it thoroughly first!) but for any internal changes just copy the component in & away you go.

HTH

David

von David Egan - am 07.08.2012 03:43
Quote
David Egan
Hi
I recently did something like I think you're trying to achieve. This resulted in a very small program 'stub' which effectively only loaded components. I had a separate component for each functional part of the program, a component for data access which defined the connection and all the classes for the files, a component for the global procedures and a component for all the browse windows (this component also included the global & data access components).

The important thing is that no analysis is declared at the top level & anything to do with data files runs through the data access component. We define the connection & connect to the database in the Initialization code of the data access component & then do finds, saves etc via the classes in this component. Every 'Window' component includes the data access component and the global procedure component.

This actually all worked surprisingly well; if you make any changes to the external interface to the base component you must recompile the modules using it (if nothing else it makes you plan it thoroughly first!) but for any internal changes just copy the component in & away you go.

HTH

David


Hi David. Thanks a lot for your reply. So, the clue in this issue is not to have an analysis in main/top project. What I was doing in my project is the following:

1- Create a new project with an analysis (new or a reused one.)
2- Develop everything.
3- Once the project is ready for release, I import the local HF Classic DB created from the declared analysis, into a HFCS DB.
4- Use the set of procs with all the connection stuff. The connection options are saved in an INI file.

In your case, how do you manage the analysis? Where is it? Or you don't use one in your main project...

Kind regards.

von RAUL2 - am 07.08.2012 12:28
Hi Raul
No I don't have an analysis in the main project at all, or even in the components except for the one handling data access.

As I said, it takes a bit of planning but everything outside of the data access component is handled by classes and/or structures which are declared in the data access component. Like you, I couldn't find any way to share the connection or pass it through successfully as a parameter & this was the only way I could think of to get it to work.

Cheers

David

von David Egan - am 07.08.2012 19:00
@David,
Can you share a code sample for this. I am also looking for such a solution to make my software modular and thus easy to maintain.

Regards,

Yogi Yang

Quote
David Egan
Hi
I recently did something like I think you're trying to achieve. This resulted in a very small program 'stub' which effectively only loaded components. I had a separate component for each functional part of the program, a component for data access which defined the connection and all the classes for the files, a component for the global procedures and a component for all the browse windows (this component also included the global & data access components).

The important thing is that no analysis is declared at the top level & anything to do with data files runs through the data access component. We define the connection & connect to the database in the Initialization code of the data access component & then do finds, saves etc via the classes in this component. Every 'Window' component includes the data access component and the global procedure component.

This actually all worked surprisingly well; if you make any changes to the external interface to the base component you must recompile the modules using it (if nothing else it makes you plan it thoroughly first!) but for any internal changes just copy the component in & away you go.

HTH

David


von Yogi Yang - am 08.08.2012 14:40
Hi Yogi
Not much to show!

In the initialization code of the data access component I simply declare the connection & have a call to a global procedure of this component to connect to the database (a fairly standard procedure which reads the detail from an ini file). It is critical that this happen in the initialization code; this then runs when the component is loaded. I tried in global declarations etc but that didn't work.

Initialization of Data Access Component

xct_sql is Connection
ConnectToDatabase() //global proc of this component

Put all your data related classes in this component, with all access using the defined connection. All classes must be set as visible so they can be used by your project

Load this component into your parent project or, as in our case, each other component that will be part of the final project. Because it's a component the initialization code is run as part of the start up so your connection is made immediately.

In your window or whatever simply instanciate the relevant class & that's it.

I should emphasise that we do everything by queries. I don't see why this same approach wouldn't work using H commands but I haven't tested that at all.

David

von David Egan - am 08.08.2012 20:49
Quote
Jimbo
Hi, if you did look at my example ... the answers are there, but I cannot force you to look ..


Hi Guenter. I'm a little curious about how you manage the DB connections with the code you have published here (by the way.. it's great!) I think the main issue here is to have to repeat the code in every new project. I've tried 2 things:

1- I wanted to generate a component to encapsulate the HCreateConnection() / HChangeConnection() functions in order to easyly reuse the connection code. It didn't work...
2- Use the Reusability Center, but something happened (I don't remember what was that...) It didn't work.

Conclusion: I have to import a set of procs on every new project. If I make a change on the code (e.g. bug fixing), I have to update manually the SOP file in every project. If I only could compile the code into a component, the updating process would be very easy... How do you do all these stuff??

Kind regards.

von RAUL2 - am 08.08.2012 21:39
Quote
RAUL2
Quote
Jimbo
Hi, if you did look at my example ... the answers are there, but I cannot force you to look ..


Hi Guenter. I'm a little curious about how you manage the DB connections with the code you have published here (by the way.. it's great!) I think the main issue here is to have to repeat the code in every new project. I've tried 2 things:

1- I wanted to generate a component to encapsulate the HCreateConnection() / HChangeConnection() functions in order to easyly reuse the connection code. It didn't work...
2- Use the Reusability Center, but something happened (I don't remember what was that...) It didn't work.

Conclusion: I have to import a set of procs on every new project. If I make a change on the code (e.g. bug fixing), I have to update manually the SOP file in every project. If I only could compile the code into a component, the updating process would be very easy... How do you do all these stuff??

Kind regards.


Hi Raul2,

this is an example only, not the real thing, of course. I have a framework that includes
- the connection to the database. Managed by a computer-admin. (much like what you've seen but password-protected)
- an access control system for small companies. Files are users, computers, window-elements, an access-permit file (who may use which computer at which days and what time), a user log which notes each log-on and log-off, a system much like in PC Soft's Groupware for defining which controls are invisible / grayed / inactive for which users, tailoring the rights of each user.
- a main menu with a calendar in a sidebar showing local holidays and a memo-file. Memos can be directed at all users, a single user or for a customer, whenever orders / invoices etc are managed for this customer, the memo will show up.
- a quick-access-menu in the sidebar. Admin/s can put together up to 20 different windows for each user.
plus some other small things.

This framework is just to be copied and gives a starting point for new projects.

KInd regards,
Guenter

von GuenterP - am 09.08.2012 05:20
Quote
GuenterP
Quote
RAUL2
Quote
Jimbo
Hi, if you did look at my example ... the answers are there, but I cannot force you to look ..


Hi Guenter. I'm a little curious about how you manage the DB connections with the code you have published here (by the way.. it's great!) I think the main issue here is to have to repeat the code in every new project. I've tried 2 things:

1- I wanted to generate a component to encapsulate the HCreateConnection() / HChangeConnection() functions in order to easyly reuse the connection code. It didn't work...
2- Use the Reusability Center, but something happened (I don't remember what was that...) It didn't work.

Conclusion: I have to import a set of procs on every new project. If I make a change on the code (e.g. bug fixing), I have to update manually the SOP file in every project. If I only could compile the code into a component, the updating process would be very easy... How do you do all these stuff??

Kind regards.


Hi Raul2,

this is an example only, not the real thing, of course. I have a framework that includes
- the connection to the database. Managed by a computer-admin. (much like what you've seen but password-protected)
- an access control system for small companies. Files are users, computers, window-elements, an access-permit file (who may use which computer at which days and what time), a user log which notes each log-on and log-off, a system much like in PC Soft's Groupware for defining which controls are invisible / grayed / inactive for which users, tailoring the rights of each user.
- a main menu with a calendar in a sidebar showing local holidays and a memo-file. Memos can be directed at all users, a single user or for a customer, whenever orders / invoices etc are managed for this customer, the memo will show up.
- a quick-access-menu in the sidebar. Admin/s can put together up to 20 different windows for each user.
plus some other small things.

This framework is just to be copied and gives a starting point for new projects.

KInd regards,
Guenter


Hi, thanks a lot for your remarks.
You have a very complete framework! So, this framework is a kind of "project template"? If you have to make a bug fixing, you have to copy/paste the code on every project? The question is: whatever code you have for doing repetitive tasks, how do you reuse that code without copying/pasting anything? I can't find an efficient way to reuse code. Componentes, of course, are a good way, but in this specific case (HFCS/Classic selecction) I couldn't make it work.

Did you find a simple way to reuse your code? (Being that code on a single directory in you PC.) An example: in Visual FoxPro, you could use a Set command to tell to the app a path from which it should search for programs. With a simple "set path to C:\VFP\MyLibrary" the app includes any set of procs, reports, classes, etc etc from that directory. If I make a change to a procedure, the only thing I have to do is to compile te app (or the component) again and that's it. No copy/paste at all.

Best regards.

von RAUL2 - am 12.08.2012 23:16
Zur Information:
MySnip.de hat keinen Einfluss auf die Inhalte der Beiträge. Bitte kontaktieren Sie den Administrator des Forums bei Problemen oder Löschforderungen über die Kontaktseite.
Falls die Kontaktaufnahme mit dem Administrator des Forums fehlschlägt, kontaktieren Sie uns bitte über die in unserem Impressum angegebenen Daten.