MySQL and HMG

General Help regarding HMG, Compilation, Linking, Samples

Moderator: Rathinagiri

User avatar
Rathinagiri
Posts: 5482
Joined: Tue Jul 29, 2008 6:30 pm
DBs Used: MariaDB, SQLite, SQLCipher and MySQL
Location: Sivakasi, India
Contact:

Re: MySQL and HMG

Post by Rathinagiri »

Yes. On the other hand, the user can request whenever he wants.

Like our forum, which is maintained in a MySQL server, is not automatically refreshed for each member. If he wants to know about the recent posts, he has to refresh the browser once in a while. Even if we put an Ajax control, that would also refresh from the server in a particular frequency.

In the recent period, network resources are easy to obtain. :)
East or West HMG is the Best.
South or North HMG is worth.
...the possibilities are endless.
User avatar
swapan
Posts: 242
Joined: Mon Mar 16, 2009 4:23 am
Location: Kolkata, India
Contact:

Re: MySQL and HMG

Post by swapan »

Dear Sudip,

I'm not sure whether I should put my this view right here or not. Its good to see that you are on way to HMG+MySQL I've one input from my side which can help us a lot:

We can have one INI file for our application which will hold certain basic info. related to our application. Like:
SERVERNAME
DATABASENAME


Now on every client's system our application will be installed and MySQL will be installed at the server. When the application gets invoked it will first read this file, this will "direct" the application to connect to which server and which database. The server can contain our database along with many other databases. So there's no "hard coding" in the connection string of our application with respect to servername & database name.

If you want to test something and don't want to play with the actual live database, just take a backup of the original database and restore it with another name. And supply this new name in the INI file. And get connected to this backup database without any change in your Application code (infact EXE will be running at the client site).

I'm sorry to put my views without going through all the pages of this thread and having a zero knowledge of MySQL.

With regards,

Swapan
Thanks & Regards,
Swapan Das

http://www.swapandas.com/
User avatar
Rathinagiri
Posts: 5482
Joined: Tue Jul 29, 2008 6:30 pm
DBs Used: MariaDB, SQLite, SQLCipher and MySQL
Location: Sivakasi, India
Contact:

Re: MySQL and HMG

Post by Rathinagiri »

Nice way of doing Swapan. :)
East or West HMG is the Best.
South or North HMG is worth.
...the possibilities are endless.
User avatar
sudip
Posts: 1456
Joined: Sat Mar 07, 2009 11:52 am
Location: Kolkata, WB, India

Re: MySQL and HMG

Post by sudip »

Swapan,

Great thinking. I also thought in this way, but some difference. As I am an old fashioned programmer, I thought about .mem file instead of .ini file.

Fact is that, I never used .ini file with HMG ;)

I also planed to store it in Windows registry. I am not sure, whether we can store something in registry or not with HMG. But, IMHO, .ini is a better solution. :)

Thanks for the idea.

Regards.

Sudip
With best regards,
Sudip
User avatar
swapan
Posts: 242
Joined: Mon Mar 16, 2009 4:23 am
Location: Kolkata, India
Contact:

Re: MySQL and HMG

Post by swapan »

sudip wrote:Swapan,

Great thinking. I also thought in this way, but some difference. As I am an old fashioned programmer, I thought about .mem file instead of .ini file.

Fact is that, I never used .ini file with HMG ;)

I also planed to store it in Windows registry. I am not sure, whether we can store something in registry or not with HMG. But, IMHO, .ini is a better solution. :)

Thanks for the idea.

Regards.

Sudip
MEM FILES:
Have u used them in xHarbour/Harbour? Actually I got errors while reading mem files during my very initial days with xHarbour. I posted posts also regarding this in xHarbour group of google.

INI FILES:
Now don't laugh on me. I thought on more "simple" or "idiotic" way! By ini file I meant a plain, simple text file which we will keep in our application directory (oops! "folder"!, old habit!! :D). The EXE will read info. from this text file (aka "INI" file). No need to keep info. in windows registry or in the windows folder. If the client's system is to be formatted, then the engineer or the user will take the backup of this application folder. It holds everything - the exe, the ini file and other related files and sub-folders. After the system is Ok, just paste this folder. Your user is again @ work......

BTW, these are not my suggestions....actually my "wishes".

Regards,

Swapan
Thanks & Regards,
Swapan Das

http://www.swapandas.com/
User avatar
swapan
Posts: 242
Joined: Mon Mar 16, 2009 4:23 am
Location: Kolkata, India
Contact:

Re: MySQL and HMG

Post by swapan »

sudip wrote:Swapan,

Fact is that, I never used .ini file with HMG ;)

Sudip
A plain text file with an INI extension was just to give a bit of "status" to that file and to the application! :D

BTW something different and a really a Q in MySQL:

In MSSQL, the database contains two files physically -
a) mdf
b) ldf

What's the case in MySQL? Don't suggest me to google it! ;)
Thanks & Regards,
Swapan Das

http://www.swapandas.com/
User avatar
sudip
Posts: 1456
Joined: Sat Mar 07, 2009 11:52 am
Location: Kolkata, WB, India

Re: MySQL and HMG

Post by sudip »

Dear Swapan,

Syntax for Ini file handling is as follows:-

Code: Select all

BEGIN INI [ FILENAME | FILE | DISK <cIniFile> ] 

GET <uVar> 
[ SECTION <cSection> ] 
[ ENTRY <cEntry> ] 
[ DEFAULT <uDefault> ] 

SET [ SECTION <cSection> ] 
[ ENTRY <cEntry> ] 
[ TO <uVal> ] 

DEL SECTION <cSection> 
[ ENTRY <cEntry> ]

END INI

Thanks a lot! I learned it for you :-)

Regards.

Sudip
With best regards,
Sudip
User avatar
mol
Posts: 3825
Joined: Thu Sep 11, 2008 5:31 am
Location: Myszków, Poland
Contact:

Re: MySQL and HMG

Post by mol »

I started to use INI files with HMG. I think it's better than MEM file, because of text format of file. You can edit it with just a notepad, without building special screens for settings (of course it is more professional, bu takes a lot of time and can be done later).

Marek
User avatar
swapan
Posts: 242
Joined: Mon Mar 16, 2009 4:23 am
Location: Kolkata, India
Contact:

Re: MySQL and HMG

Post by swapan »

sudip wrote: Syntax for Ini file handling is as follows:-

Code: Select all

BEGIN INI [ FILENAME | FILE | DISK <cIniFile> ] 

GET <uVar> 
[ SECTION <cSection> ] 
[ ENTRY <cEntry> ] 
[ DEFAULT <uDefault> ] 

SET [ SECTION <cSection> ] 
[ ENTRY <cEntry> ] 
[ TO <uVal> ] 

DEL SECTION <cSection> 
[ ENTRY <cEntry> ]

END INI

Thanks for sharing!
Thanks & Regards,
Swapan Das

http://www.swapandas.com/
User avatar
sudip
Posts: 1456
Joined: Sat Mar 07, 2009 11:52 am
Location: Kolkata, WB, India

Re: MySQL and HMG

Post by sudip »

Hi,

I am running a query as follows: (Accyrid: char(10), Accfrom: Date, Accto: Date)

Code: Select all

function get_data()
   local aRec := {}, i
   aRec := sql(dbo, "select Accyrid, Accfrom, Accto from Accyr order by Accfrom")
   frmAccyr.grdAccyr.DeleteAllItems()
   for i := 1 to len(aRec)
   	//msgbox(valtype(aRec[i, 2])) // shows valtype of aRec[i, 2] is C
      frmAccyr.grdAccyr.additem({aRec[i, 1], dtoc(aRec[i, 2]), dtoc(aRec[i, 3])}) // giving error this line
   next
   form_resize()
return nil
, where sql() function is as follows (written by Rahinagiri):

Code: Select all

function sql(dbo1,qstr)
   local i, j
   local table := nil
   local currow := nil
   local tablearr := {}
   local rowarr := {}
   local curdateformat := set(_SET_DATEFORMAT)
   set date ansi
   table := dbo1:query(qstr)
   set(_SET_DATEFORMAT,curdateformat)
   if table:neterr()
      msgstop(table:error())
      table:destroy()
      return tablearr
   else
      if table:lastrec() > 0
         asize(tablearr,0)
         for i := 1 to table:lastrec()
            asize(rowarr,0)
            currow := table:getrow(i)
            for j := 1 to table:fcount()
               aadd(rowarr,currow:fieldget(j))
            next j
            aadd(tablearr,aclone(rowarr))
         next i
      endif
      table:destroy()
      return tablearr
   endif
return tablearr
Now, the array returned by the query contains blank strings only, in place of date fields!!! :?

So, how can I get data for date fields?

TIA.

With best regards.

Sudip
With best regards,
Sudip
Post Reply