set caseSensitive to true

Creating desktop or client-server database solutions?

Moderators: FourthWorld, heatherlaine, Klaus, kevinmiller, robinmiller

Post Reply
mcbroh
Posts: 15
Joined: Wed Nov 19, 2014 5:05 pm

set caseSensitive to true

Post by mcbroh » Sat Jan 17, 2015 2:51 pm

on getPoint
global gConnectionID, gPoint, gUser

set the caseSensitive to true

if field id 1098 is empty then
answer "Please enter code first."
exit getPoint
else
put field id 1098 into tCodes
end if

put "codes" into tTableCodes
put "share" into tTableName

put "SELECT Points FROM "&tTableCodes&" WHERE Codes= '" & tCodes & "'" into tSQL
 put revDataFromQuery(tab, cr, gConnectionID, tSQL) into tData
if item 1 of tData = "revdberr" then
answer error "check internet connection"
exit to top
    else
if tData = "0" then
answer "Used Code"
exit getPoint
else
if item 1 of tData is field id 1098 then
Add tData to gPoint
else
answer "Check Code"
exit getPoint
end if
end if
end if

Hello All,

I have an issue with setting case sensitive of alphanumeric sequence from database. I would appreciate your kind help as i have included the script, so as to show if its my misstake or just not possible with alphanumeric sequence.

Regards
mcbroh

Klaus
Posts: 14177
Joined: Sat Apr 08, 2006 8:41 am
Contact:

Re: set caseSensitive to true

Post by Klaus » Sat Jan 17, 2015 3:07 pm

Hej, mcvroh,

sorry, don't understand this:
I have an issue with setting case sensitive of alphanumeric sequence from database.
?


Best

Klaus

mcbroh
Posts: 15
Joined: Wed Nov 19, 2014 5:05 pm

Re: set caseSensitive to true

Post by mcbroh » Sat Jan 17, 2015 3:50 pm

Hi Klause,

An example... on database (xaYj1E2)
when i type (xayj1e2) am expecting it to answer wrong code. but it just accepts it :(

Regards
mcbroh

Klaus
Posts: 14177
Joined: Sat Apr 08, 2006 8:41 am
Contact:

Re: set caseSensitive to true

Post by Klaus » Sat Jan 17, 2015 4:33 pm

Hm, still not sure I quite understand, but I guess this is more a SQL than a Livecode problem.

Sorry, I do not know how to solve this problem.

mcbroh
Posts: 15
Joined: Wed Nov 19, 2014 5:05 pm

Re: set caseSensitive to true

Post by mcbroh » Sat Jan 17, 2015 4:54 pm

Thanks Klaus,

would keep cracking my head out :(

AxWald
Posts: 578
Joined: Thu Mar 06, 2014 2:57 pm

Re: set caseSensitive to true

Post by AxWald » Mon Jan 19, 2015 6:48 pm

Hi,

regarding the script in the OP - assuming that only the "end getPoint" is lacking:

The script starts with an already open DB (gConnectionID).
Then you grab a Code from a field & put it into tCodes. Be it "123" for now.
Then you fill the variables tTableCodes & tTableName - where tTableName istn't used anymore later ...
And construct an SQL-String: "SELECT Points from codes WHERE Codes= '123'"

Remark: Seems you have a table that contains a field with the same name? This is crying for problems, IMHO. A way to escape it is to construct something like this:
"SELECT codes.Points from codes WHERE codes.Codes= '123';"
And it never hurts to close with a semicolon, too ;-)

Now we should receive (in tData) the Points-value of the row where codes is 123. If Points is zero, it's a used code.
Then:
... if item 1 of tData is field id 1098 then
Item 1 of tData is the points (you only asked for them!)! And you compare it to the Code?

Remark 2: OK, maybe you didn't post all of the code, maybe this is beyond my scope - as I see it, only if Points = 123 in the row where Codes = 123 it will execute at all...

Regarding "caseSensitive":

Dictionary: "Specifies whether comparisons treat uppercase and lowercase letters as different."
This is for LiveCode only, as I understand it!
There's only one comparison in the code, and this tests tData, the Points (a number?).

Regarding the database name in the second post:

Try this in the message box (multi-lines):

Code: Select all

set the casesensitive to true
put "xaYj1E2" = "xayj1e2"
Returns false, as it should. (LC-C 6.7.1)

Further:

When you call a database or a table by name, it's dependent on what system it runs:
- Win is case-insensitive
- Linux is case-sensitive
- Mac is whatever
(- and I may be wrong, but at least this way it always worked for me ...)

When you call a field by name (in SQL), even in MySQL on Linux it isn't case-sensitive. Was there, tried it, reporting here.

Hope I was able to add to the general confusion ;-)

Have a good time!
All code published by me here was created with Community Editions of LC (thus is GPLv3).
If you use it in closed source projects, or for the Apple AppStore, or with XCode
you'll violate some license terms - read your relevant EULAs & Licenses!

mcbroh
Posts: 15
Joined: Wed Nov 19, 2014 5:05 pm

Re: set caseSensitive to true

Post by mcbroh » Mon Jan 19, 2015 8:14 pm

hello Axwald,

thanks for your input.
i figured it out now. i can not check case sensitiv directly from within the Database. i have to put the info first into a variable on app and then case sensitive can work.

Thanks

Post Reply