Digital Workshop

Welcome to the Digital Workshop Message Boards
It is currently October 10th, 2024, 12:18 pm

All times are UTC [ DST ]




Post new topic Reply to topic  [ 8 posts ] 
Author Message
 Post subject: Recent DB Problem
PostPosted: March 21st, 2006, 1:17 pm 
Offline

Joined: November 3rd, 2004, 6:37 pm
Posts: 42
Location: Ireland
hi lads,

i have some sql script to access a database. i've added some pages to the publication and with the very same script i'm getting the following errors.

i'm not sure why this is happening, all the rest work fine but the new pages with the very same script and actions keeps throwing out this error. but it is pulling the data from the DB, i'm just confused about this error.

RegionExamF[186] (138, 0) : Function Not Found : Check spelling and capitalisation
RegionExamF[186] (138, 0) : Function Not Found : Check spelling and capitalisation


here's a sample of the script which shows this error:
var featureList = KYI_db.ExecuteSQL("SELECT Name FROM Features WHERE TypeID = ('" + currentFeature + "') AND LanguageID = ('" + LanguageID + "') ORDER BY FeatureID;");
var numRecords = featureList.GetNumberOfRecords()


For this message lukemcurley has been thanked by : mackavi


Top
 Profile  
 
 Post subject:
PostPosted: March 21st, 2006, 1:59 pm 
Offline

Joined: October 26th, 2004, 10:23 am
Posts: 666
Location: Digital Workshop
As a first guess from that code; "KYI_db" is not a valid database object on that page.

_________________
ddww Opus Developer


For this message Duncan Lilly has been thanked by : mackavi


Top
 Profile Visit website  
 
 Post subject:
PostPosted: March 21st, 2006, 2:03 pm 
Offline

Joined: November 3rd, 2004, 6:37 pm
Posts: 42
Location: Ireland
hi duncan,

i have it set up on the page with the following script:
var KYI_db = new Database(DB_FileDNS);

where the var DB_FileDNS is set up asa pub variable:
FILEDSN=KYUSA_StdRec_Db.dsn


also here's a quick question if someone enters their name as john o'shea will the ' cause the db to do strange things with a ms mdb? i'm sure i was able to use them before but i'm getting errors now. can't remember though.

i'm currently going through the whole script again ensuring that it's correct. i'll let you know my progress.


For this message lukemcurley has been thanked by : mackavi


Top
 Profile  
 
 Post subject:
PostPosted: March 21st, 2006, 2:36 pm 
Offline

Joined: November 3rd, 2004, 6:37 pm
Posts: 42
Location: Ireland
ok it appears to be the ' problem in the name. so how is it possible to store a name with a ' like conor o'shea or something to that affect. irish names!

i'm almost sure i was able to store this type of data before in a ms database. any ideas?

i tried the following but i don't think that OpusScript supports the String Replace function?

Quote:
var atmosphere = "''"
//REPLACES ANY ' WITH '' FOR DB INPUT
StudentNameNew = StudentNameNew.replace("'",atmosphere)
Debug.trace("NAME IS : " + StudentNameNew + "\n")



thanks, luke


For this message lukemcurley has been thanked by : mackavi


Top
 Profile  
 
 Post subject:
PostPosted: March 22nd, 2006, 7:25 pm 
Offline

Joined: December 14th, 2004, 5:08 pm
Posts: 55
Location: Holland
Opus: version 8.0
OS: XP, Vista, Windows7, Windows8
System: Intel Corei7-2600 CPU 3.400GHz
A late reply but anyway I saw something in the script maybe this would work also...
var featureList = KYI_db.ExecuteSQL("SELECT Name FROM Features WHERE (TypeID LIKE '"+ currentFeature +
"' AND LanguageID LIKE '" + LanguageID + "') ORDER BY FeatureID;");

for the replacing I have a following script I used a long time ago

var blancContainer =""; // creates a blanc container
var answer = StudentNameNew.toString(); // convert name to string

myarray = answer.split("'"); //split at '

blancContainer += myarray[0]+""

for (num=1; num <(myarray.length-1); num++)
{
blancContainer += myarray[num] + ""
}


blancContainer += myarray[myarray.length-1];

StudentNameNew = blancContainer;



Hopes this helpes,

Jim


For this message ivisionar has been thanked by : mackavi


Top
 Profile  
 
 Post subject:
PostPosted: March 23rd, 2006, 5:40 pm 
Offline

Joined: November 3rd, 2004, 6:37 pm
Posts: 42
Location: Ireland
perfect jim that's the road i was going to go down over the weekend. i'll try it out but it should work. thanks a million.

i was trying the javascript replace() function but that is a JavaScript 1.3 function which isn't supported in opus script yet! duncan any plans?


luke


For this message lukemcurley has been thanked by : mackavi


Top
 Profile  
 
 Post subject:
PostPosted: March 23rd, 2006, 6:39 pm 
Offline

Joined: October 26th, 2004, 10:23 am
Posts: 666
Location: Digital Workshop
OpusScript and JavaScript are based on a common root - ecmascript (to be precise ECMA-262). Changes to JavaScript versions have no effect on that base language; so will not become part of OpusScript.

If or when there is a revised version of ecmascript (there are plans for a newer spec but nothing fixed) then we might change to that but it's best to think of OpusScript as it's own language.

Which is not to say we can't extend on ecmascript (after all that's what Javascript has done and we have done with all the Opus specific stuff in OpusScript) and add a replace() that works in a similar way - I'll add it to the requested features list.

_________________
ddww Opus Developer


For this message Duncan Lilly has been thanked by : mackavi


Top
 Profile Visit website  
 
 Post subject:
PostPosted: March 23rd, 2006, 10:25 pm 
Offline

Joined: November 3rd, 2004, 6:37 pm
Posts: 42
Location: Ireland
cheers duncan,

jim i've used the following code for the time being to check if the user enters an ' and if so i just display a warning. i'll work on the code to insert the ' into the database with SQL later when i've more time.

Quote:
TokenPos = StudentNameNew.indexOf("'")

//IF AN ' EXISTS IT WILL NOT PROCESS AND DISPLAY A WARNING INSTEAD
if (TokenPos != -1 )
{
ApostropheWarn.Show()
//Debug.trace("NAME CONTAINS A '" + "\n")
//Debug.trace("POS IS : " + TokenPos + "\n")
}

else
{
//INSERT NAME INTO DATABASE
}


For this message lukemcurley has been thanked by : mackavi


Top
 Profile  
 
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 8 posts ] 

All times are UTC [ DST ]


Who is online

Users browsing this forum: No registered users and 2 guests


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Jump to:  
cron
Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group