Database query help PLEASE

Creating desktop or client-server database solutions?

Moderators: FourthWorld, heatherlaine, Klaus, kevinmiller, robinmiller

Post Reply
Jordy
Posts: 32
Joined: Sat Feb 27, 2016 3:59 am

Database query help PLEASE

Post by Jordy » Mon May 30, 2016 8:58 pm

This is the info that I am trying to extract from the database. I logged into phpmyadmin and all of this info is in the table.
Chapter50

recently thus knowingly originally wall argument summer regret watch earn imagine understood discreet torpid eminent ^

Chapter 50

Friendship, Thoroughly Challenging, Moderate Danger/Risk, Passed, 1(Honor), 4 (Honor), ^2^50^1^1^1^1^1^1^1^1
^false^0^1700^ ^2^2^2^2^2^2^2^2^false^0^0^ ^3^3^3^3^3^3^3^3^false^0^0^ ^4^4^4^4^4^4^4^4^false^0^0^ ^5^5^5^5^5^5^5^5^false^0^0^ ^6^6^6^6^6^6^6^6^false^0^0^ ^


I use this script:

local tTablename
global tSQL
global tData
on mouseUp
-- check the global connection ID to make sure we have a database connection
global gConnectionID
if gConnectionID is not a number then
answer error "Please connect to the database first."
exit to top
end if

-- construct the SQL (this selects all the data from the specified table)
put "Game4" into tTableName-- set this to the name of a table in your database
put "SELECT * FROM " & tTableName into tSQL

-- query the database
put revDataFromQuery(tab, cr, gConnectionID, tSQL) into tData

-- check the result and display the data or an error message
if item 1 of tData = "revdberr" then
answer error "There was a problem querying the database:" & cr & tData
else
put tData into field "Story" of card 2
end if
end mouseUp


And this is all the info I get in the application. It is significantly less than what is in the table

Chapter50

recently thus knowingly originally wall argument summer regret watch earn imagine understood discreet torpid eminent ^

Chapter 50

Friendship, Thoroughly Challenging, Moderate Danger/Risk, Passed, 1(Honor), 4 (Honor), ^2^50^1^1^1^1^1^1^1^1


PLEASE help I'm really close to finishing my first project. I have been trying to fix this problem for 6 hours straight now

dave.kilroy
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 858
Joined: Wed Jun 24, 2009 1:17 pm
Location: Plymouth, UK
Contact:

Re: Database query help PLEASE

Post by dave.kilroy » Mon May 30, 2016 9:46 pm

Hi Jordy - you've given us WAY too little detail to be able to offer a solution - but what I can offer are some questions that might help you to find the solution on your own.
  • 1. Do you get the same loss of data when querying data from other tables in your database?
    2. Do you have any unusually named columns in that table in your database?
    3. Do you have any unusually configured data types in your database table structure? i.e. binary...
    4. Do you have any unusual data in your database table?
    5. If you make a new test database table and populate it with sample data does this download OK?
    6. If you make a copy of the "Game4" database table, delete columns from it sequentially and try querying it each time - do you find at any stage that data from all remaining columns appear in your app?
    7. If you output returned data to the message box (i.e. with a 'put') rather than to a LiveCode field so you see any extra data?
Hopefully some or all of these questions will help you uncover what is going on - if none of them work for you try and come up with better ones for yourself!

Dave
"...this is not the code you are looking for..."

Jordy
Posts: 32
Joined: Sat Feb 27, 2016 3:59 am

Re: Database query help PLEASE

Post by Jordy » Mon May 30, 2016 11:24 pm

There is only the one table :(
No unusual column names
I tried several data-types but it is currently longtext
The only unusual data is ^ but it is showing them
I have tried several test tables all with the same problem
I will try to play with #6 suggestion
I tried putting the data returned into a global and when I checked it was exactly the same as the when I put it into a fld.

Im wondering if there is a limit to the number of characters that can be received by livecode? Otherwise maybe its something to do with the ^ sign

Jordy
Posts: 32
Joined: Sat Feb 27, 2016 3:59 am

Re: Database query help PLEASE

Post by Jordy » Tue May 31, 2016 12:44 am

I replaced the content I am actually trying to use with a gibberish paragraph, which was more characters. It works with a standard paragraph so I imagine its something to do with all the ^ signs or ^false^ because thats where it cuts out.

dave.kilroy
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 858
Joined: Wed Jun 24, 2009 1:17 pm
Location: Plymouth, UK
Contact:

Re: Database query help PLEASE

Post by dave.kilroy » Tue May 31, 2016 12:53 am

I don't think there is a limit on the amount of data that can be queried - I've certainly downloaded much much larger amounts of data from a MySQL that you show (however I always use a web service (an intermediary LiveCode Server file living on the server to which my app connects, the .lc file then connects to the db and sends responses back to the app - more faf but much more secure and convenient in the long-run)

Yeah question No. 6 seems to be the only game in town at the moment - no idea if that doesn't work for you...

Dave
"...this is not the code you are looking for..."

dave.kilroy
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 858
Joined: Wed Jun 24, 2009 1:17 pm
Location: Plymouth, UK
Contact:

Re: Database query help PLEASE

Post by dave.kilroy » Tue May 31, 2016 12:55 am

Aha I see you've found the problem! OK keep away from ^ from now on (or escape it)
"...this is not the code you are looking for..."

Post Reply

Return to “Databases”