Database access and Cscript

For discussing Thinking Worlds topics not covered in the other forums

Database access and Cscript

Postby joel » Wed Dec 07, 2011 7:44 am

Hi, I am new to TW and slowly realising it's awesome potential! I am now considering using it for a fairly major educational project. However, I am not very knowledgeable of Windows dev and geekery (Java background), and I have never heard of Cscript!

My question is - can I use Cscript in TW to read/write from a database? And to dynamically load images (from the filesystem?) at runtime.

I found this page http://msdn.microsoft.com/en-us/library ... 85%29.aspx, but don't know how it relates to TW.

On a more general note, can you recommend a good Cscript tutorial?

Many thanks
Joe
joel
 
Posts: 2
Joined: Wed Dec 07, 2011 7:29 am

Re: Database access and Cscript

Postby Gary » Wed Dec 07, 2011 2:28 pm

Hello,

I've just posted a tutorial on saving and loading to a database, however its not for the faint hearted.


http://www.thinkingworlds.com/forums/viewtopic.php?f=12&t=506


You may find it useful.

Thanks Gary
Gary Alan Morris
Support Analyst
Caspian Learning
gary.morris@caspianlearning.co.uk
Gary
 
Posts: 99
Joined: Wed Jan 12, 2011 5:31 pm

Re: Database access and Cscript

Postby joel » Thu Dec 08, 2011 4:44 am

Thanks for your that, I think I get the broad strokes. Let me run it back, just to check:

TW can read params from html using ExternalParams, and generate an HTTP GET using JavascriptInvoke. PHP is then used for database connectivity.

So either:
PHP queries the database (how is this/the TW_Applet invoked?) and writes the key/value pairs returned into an html page; these k/v pairs are read in to TW as ExternalParams

or

TW issues a GET using JavascriptInvoke, with the k/v pairs written into it. PHP intercepts the GET, extracts the k/v pairs, writes them into an SQL query, and inserts them into the db.

I can see how this works for a serverside db, but how about for a local eg SQLite/iOS database? I need to store a number of wordlists + associated data for each word locally on the device (or I think I do, anyway!).

Many thanks, fantastic support from Caspian!

Joe.
joel
 
Posts: 2
Joined: Wed Dec 07, 2011 7:29 am

Re: Database access and Cscript

Postby Gary » Tue Dec 13, 2011 12:00 pm

Hello,


The PHP queries the database and returns the external params formatted as html. So if you view the page source of the page when its running, it will contain the external params.


You then use the External ExternalParamValue( String parameterName ) cscript function to load these. When you wish to save these values, you simple call the JavaScript invoke to save these values out, or write them on the screen, it depends entirely on your javascript code.

I hope this helps.

Thanks Gary
Gary Alan Morris
Support Analyst
Caspian Learning
gary.morris@caspianlearning.co.uk
Gary
 
Posts: 99
Joined: Wed Jan 12, 2011 5:31 pm


Return to General Thinking Worlds Discussion

Who is online

Users browsing this forum: No registered users and 0 guests

cron