HMGSCRIPT RELOADED!

HMG announcements; Latest HMG-related news, releases, fixes and updates.

Moderator: Rathinagiri

User avatar
Rathinagiri
Posts: 5263
Joined: Tue Jul 29, 2008 6:30 pm
DBs Used: MariaDB, SQLite, SQLCipher and MySQL
Location: Sivakasi, India
Has thanked: 169 times
Been thanked: 172 times
Contact:

Re: HMGSCRIPT RELOADED!

Post by Rathinagiri » Fri Jan 30, 2009 3:08 am

Yes. This we have already discussed. :)

Is there a sample to send queries to a MySQL database maintained in a web server? Please help.
East or West HMG is the Best.
South or North HMG is worth.
...the possibilities are endless.

User avatar
Roberto Lopez
HMG Founder
Posts: 3980
Joined: Wed Jul 30, 2008 6:43 pm
Has thanked: 27 times
Been thanked: 168 times

Post by Roberto Lopez » Fri Jan 30, 2009 11:14 am

rathinagiri wrote:Yes. This we have already discussed. :)

Is there a sample to send queries to a MySQL database maintained in a web server? Please help.
My own code is not good to teach about this since, it handles tables with lots of fields and other complications, but, you can found useful simple code here:

http://www.freewebmasterhelp.com/tutorials/phpmysql/1

more specifically:

http://www.freewebmasterhelp.com/tutorials/phpmysql/4

Regards,
Regards/Saludos,

Roberto


(Veritas Filia Temporis)

User avatar
Roberto Lopez
HMG Founder
Posts: 3980
Joined: Wed Jul 30, 2008 6:43 pm
Has thanked: 27 times
Been thanked: 168 times

Post by Roberto Lopez » Fri Jan 30, 2009 11:17 am

Roberto Lopez wrote: more specifically:

http://www.freewebmasterhelp.com/tutorials/phpmysql/4

Regards,
And, if you don't have access to a 'real' server, you can install EasyPHP (preconfigured apache php and mysql) and test locally.

Be aware that your firewall could impede the work of any of the components, so you must give right access privileges.

Regards,

Roberto.
Regards/Saludos,

Roberto


(Veritas Filia Temporis)

User avatar
Rathinagiri
Posts: 5263
Joined: Tue Jul 29, 2008 6:30 pm
DBs Used: MariaDB, SQLite, SQLCipher and MySQL
Location: Sivakasi, India
Has thanked: 169 times
Been thanked: 172 times
Contact:

Post by Rathinagiri » Fri Jan 30, 2009 11:34 am

Thanks Roberto, I will check on this.

I am accessing real server only. :)
East or West HMG is the Best.
South or North HMG is worth.
...the possibilities are endless.

User avatar
Rathinagiri
Posts: 5263
Joined: Tue Jul 29, 2008 6:30 pm
DBs Used: MariaDB, SQLite, SQLCipher and MySQL
Location: Sivakasi, India
Has thanked: 169 times
Been thanked: 172 times
Contact:

Post by Rathinagiri » Fri Jan 30, 2009 1:57 pm

Thanks for throwing some light on the subject Roberto.

I can now create a html file by sending a query. Now, how to get the data in a grid/array (xBase) format? Should we convert from that html file?
East or West HMG is the Best.
South or North HMG is worth.
...the possibilities are endless.

User avatar
Rathinagiri
Posts: 5263
Joined: Tue Jul 29, 2008 6:30 pm
DBs Used: MariaDB, SQLite, SQLCipher and MySQL
Location: Sivakasi, India
Has thanked: 169 times
Been thanked: 172 times
Contact:

Post by Rathinagiri » Fri Jan 30, 2009 1:58 pm

Now I am happy that, HMGScript is having native support for unicode. :)

It is an added advantage for HMGScript.
East or West HMG is the Best.
South or North HMG is worth.
...the possibilities are endless.

User avatar
Roberto Lopez
HMG Founder
Posts: 3980
Joined: Wed Jul 30, 2008 6:43 pm
Has thanked: 27 times
Been thanked: 168 times

Post by Roberto Lopez » Fri Jan 30, 2009 2:40 pm

rathinagiri wrote:Thanks for throwing some light on the subject Roberto.

I can now create a html file by sending a query. Now, how to get the data in a grid/array (xBase) format? Should we convert from that html file?
The basic php samples that I've linked to in the previous message, send back to the browser a new html page that will be loaded automatically.

This is not useful to recover the data only, but, it is useful for displaying it.

If you want to recover data only (without page reloading), you must make your php scripts to return plain text or xml containing the data only. Here is when the AJAX concept come to help us :).

Basically you should use xmlhttprequest javascript object to execute your php script without page reloading.

the data sent by your php script is stored in 'responsetext' or 'responsexml' properties and you can do with it whatever you want.

This is I want to do to handle data requests in HMGSCRIPT.

Regards,

Roberto.
Regards/Saludos,

Roberto


(Veritas Filia Temporis)

User avatar
apais
Posts: 309
Joined: Fri Aug 01, 2008 6:03 pm
Location: uruguay
Has thanked: 50 times
Been thanked: 28 times
Contact:

Post by apais » Fri Jan 30, 2009 9:02 pm

Hola Roberto...

I'm wondering if you are considering the js->json->php->json->js chain for communications exchange.
Another one: will you use arrays as recordsets or build a specific object for that ?
Also: Sqlite would be a non-need-to-setup database for preliminar tests and proof of concept don't you think ?

Just trying to shed some light into the project ;)

Regards
Angel

User avatar
Rathinagiri
Posts: 5263
Joined: Tue Jul 29, 2008 6:30 pm
DBs Used: MariaDB, SQLite, SQLCipher and MySQL
Location: Sivakasi, India
Has thanked: 169 times
Been thanked: 172 times
Contact:

Post by Rathinagiri » Sat Jan 31, 2009 12:12 am

I had tried SQLite in our present HMG version.

IMHO MySQL is far better than SQLite. The important problem is that, SQLite doesn't have Logical, Date fields and everything except numbers is saved as char.

However, it can be used as an alternative.

Thank you apais.
East or West HMG is the Best.
South or North HMG is worth.
...the possibilities are endless.

User avatar
Roberto Lopez
HMG Founder
Posts: 3980
Joined: Wed Jul 30, 2008 6:43 pm
Has thanked: 27 times
Been thanked: 168 times

Post by Roberto Lopez » Sat Jan 31, 2009 12:44 pm

apais wrote:Hola Roberto...

I'm wondering if you are considering the js->json->php->json->js chain for communications exchange.
Another one: will you use arrays as recordsets or build a specific object for that ?
Also: Sqlite would be a non-need-to-setup database for preliminar tests and proof of concept don't you think ?

Just trying to shed some light into the project ;)

Regards
Angel
I've been working on this for the last two days and I already have a working mode, but, without an xbase interface yet.

I've wrote a JavaScript function that receive connection parameters (user,pass,server) and a SQL query (a SELECT command).

This function executes a PHP script that do the query (using MySql) and returns a recordset as text with field and record delimiters.

In the client, I receive the recordset as plain text via 'responseText' xmlhttprequest property.

Then, I split two times. One to obtain a records array and again on each record to obtain a fields subarray.

The result is a two dimensional array representing the recordset.

The basic (read-only) xbase functionality is pretty easy to implement on a recordset array (go, seek, locate, fieldget, etc.).

To write on this recordset will require to solve a lot of problems, but, it can be done. Basically each row retrieved should include a field that identify each row in the table as unique, so DELETE and UPDATE should work well to implement its xBase counterparts.

JSON, could be used too. But we should evaluate the size of the transferred recordset and processing time to decode/eval it on the client compared with delimited text.

Saludos,

Roberto.
Regards/Saludos,

Roberto


(Veritas Filia Temporis)

Post Reply