Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
sql and QM
#1
Finally got the server-side database up, running, and able to import sql formatted text docs manually. Now I need to figure out how to perform a standard "Insert Into" from info generated by QM to a remote sql server.

Assuming I can get the QM macro I've been working on to produce the static field list and a single record worth of field data (variable-driven) per macro run (essentially a web-accessible, query-able detailed log). Can this then be shot up to the db directly from QM, or do I need to call something like sql server express to do this? I saw the note on the newer database class, but couldn't find much info on it (at least not enought to get me over the novice hump on this one...)

Here's an example of a record that will generated by the macro. Works fine in manual import to the table, just don't know syntax/format to get QM to do it:

Code:
Copy      Help
<?
// connect to mysql and select database
$db = mysql_pconnect("sqlserver.host.com","username","password");
mysql_select_db("database_name",$db);

INSERT INTO murFTP_log (ref_no, upload_stamp, event_date,

event_name, event_type, upload_dir, media_file, html_file, av_tech,

proc_by) VALUES('','', '20070702', 'My Vent', 'Public', 'Righto',

'myvent.mp3', 'myvent.html', 'stevish', 'ne pas de steve');
?>


Any advice is greatly appreciated!


Steve
#2
here's what i use for Access dbs.

Code:
Copy      Help
Database db.Open(db.CsAccess("c:\test\test.mdb"))
ARRAY(str) a
int z
str b

b="SELECT username), createdate, FROM access"
db.QueryArr(b a)
for z 0 a.len
,out "%s     %s    %s" a[0 z] a[1 z] a[2 z]
An old blog on QM coding and automation.

The Macro Hook
#3
Database class is used with local databases. Don't know much about uploading data to remote web server. I would write a php script and use QM's Http.PostFormData or some other Internet function to post data from my computer to the script.
#4
Thanks for the replies...

Ultimately I would think it would be easy to get QM to send the query directly to a mySQL server. It's a lot like the ftp stuff. You just need to hit the sql server address with a user name, password, and database name (much like init ftp directory) followed by the query (in the example code below, the query is a simple INSERT INTO which just adds a record to the database by defining what fields will correspond with the enclosed data).

I can come up with a simple example table, user name, password for you if you are at all interested in persuing (i'll email the info for obvious reasons...).

----

ANYWAY, For now (since I need to get something going) could I just create a simple text-box only html form, and using QM's HTTP.PostFormData, fill in the fields and hit the submit button?

Is there any info on using HTTP.PostFormData anywhere?, e.g. syntax/examples?

Thanks again...

steve[/i]
#5
Creating a form actually is not needed. Http.PostFormData posts data directly to the script. To get help, as always, press F1.

Http ht.Connect("www.xxx.yyy")
ARRAY(POSTFIELD) a
;fill a
ht.PostFormData
#6
My apologies...I never caught on to the context-based F1. Tres stupide!

I've only ever searched the local and online help files and forum, often finding what I need, but also often puzzled with the lack of info, esp. on newer additions to your fine program. On the other hand, you have to know the specifc function/class/etc name of what you're looking for in order to use context F1, but this explains a lot and will help me even more...

Thanks!
#7
Quote:you have to know the specifc function/class/etc name of what you're looking for in order to use context F1

Or type . and browse in the list.

.internet.Http F1
#8
I've just been experimenting with ht.connect and PostFormData and IntGetFile (for confidence). Now these sections of my macro are putting the FTP section to shame because of the "fa" ability for displaying status...

Is there anyway to similarly achieve bytes uploaded or progress bar in FTP?

Or can the IGF remote/local file statement be reversed (e.g., IntGetFile localfile remotefile 16 0 1) without the local file path throwing up the "not recognizable url" format error?

Currently I just have an animated spining gif to indicate that *something* is happening (tho in fact it might not be...) that resolves to a upload completed msg.

Thanks!

S
#9
Ftp uploading with progress dialog or callback function

IGF cannot be reversed.
#10
Fantastic...you are the KING!
Thanks much,
Steve
#11
There was a bug preventing uploading multiple files on single connection. Now fixed.


Forum Jump:


Users browsing this thread: 1 Guest(s)