DMXzone Database Connector PHP Support Product Page
Answered
Testing queries with new Server Connect Query Builder
Asked 06 Apr 2016 11:20:51
2
have this question
06 Apr 2016 11:20:51 David Woolley posted:
What happened to the Test Source in the Query Builder using Server Connect?This functionality was so useful for troubleshooting.
I'm having trouble with complex joins that were working fine using the old data source method. I use the exact same query with the new SC method, but can't get any records to show. 'Test Source' would have been so helpful to troubleshoot in this situation.
Replies
Replied 06 Apr 2016 12:44:51
06 Apr 2016 12:44:51 Teodor Kuduschiev replied:
Hello David,
Please check this video: www.dmxzone.com/go/32354/debugging-problems-in-dmxzone-server-connect/
Please check this video: www.dmxzone.com/go/32354/debugging-problems-in-dmxzone-server-connect/
Replied 06 Apr 2016 15:31:30
06 Apr 2016 15:31:30 David Woolley replied:
Hi Teodor
I think the problem is with Paged Queries and joined tables.
If I just use ONE table there is no problem. Loads quickly (3000 records)
Chrome Dev Tools gives this error:
"SQLSTATE[23000]: Integrity constraint violation: 1052 Column 'topography_id' in on clause is ambiguous"
If I set up an ordinary query (without paging) in Server Connect using the joined tables as above, there is no error reported. Still a bit slow to display 3000 records! Which is why I need the Paged Query.
Dave
I think the problem is with Paged Queries and joined tables.
If I just use ONE table there is no problem. Loads quickly (3000 records)
Chrome Dev Tools gives this error:
"SQLSTATE[23000]: Integrity constraint violation: 1052 Column 'topography_id' in on clause is ambiguous"
If I set up an ordinary query (without paging) in Server Connect using the joined tables as above, there is no error reported. Still a bit slow to display 3000 records! Which is why I need the Paged Query.
Dave
Replied 06 Apr 2016 16:23:31
06 Apr 2016 16:23:31 Teodor Kuduschiev replied:
This error means both of your tables are using the same id column named 'topography_id' which causes the error. Can you send a screenshot of the two tables structures?
Replied 11 Apr 2016 15:02:00
11 Apr 2016 15:02:00 David Woolley replied:
Hi Teodor - I emailed you 2 action files and the database structure last week.
Any ideas?
Dave
Any ideas?
Dave
Replied 12 Apr 2016 09:30:52
12 Apr 2016 09:30:52 Teodor Kuduschiev replied:
Hi David,
We are checking the issue right now.
We are checking the issue right now.
Replied 12 Apr 2016 10:01:08
12 Apr 2016 10:01:08 David Woolley replied:
Thanks Teodor
I've just tested another paged query with a simple INNER JOIN
Parent table: origins with PK origin_id
Child table: cases with PK cases_id, FK origin_id
I ran the following SQL using phpmyadmin:
SELECT cases.museum_no, cases.lab_no, cases.title, origins.origin
FROM origins
INNER JOIN cases
ON origins.origin_id = cases.origin_id
This works fine.
But using a SC paged query in the action file > >
Still get the 500 Internal server error:
{code: "23000", file: "D:\Documents\Sites XAMPP\digipath2015\dmxConnectLib\lib\db\Connection.php",…}
then expanded:
1. code:"23000"
2. file:"D:\Documents\Sites XAMPP\digipath2015\dmxConnectLib\lib\db\Connection.php"
3. line:75
4. message:"SQLSTATE[23000]: Integrity constraint violation: 1052 Column 'origin_id' in on clause is ambiguous"
5. trace:"#0 D:\Documents\Sites XAMPP\digipath2015\dmxConnectLib\lib\db\Connection.php(75): PDOStatement->execute()↵#1 D:\Documents\Sites XAMPP\digipath2015\dmxConnectLib\modules\dbconnector.php(86): lib\db\Connection->execute('SELECT COUNT(*)...', Array)↵#2 D:\Documents\Sites XAMPP\digipath2015\dmxConnectLib\lib\App.php(184): modules\dbconnector->paged(Object(stdClass), 'qryCaseOriginTe...')↵#3 D:\Documents\Sites XAMPP\digipath2015\dmxConnectLib\lib\App.php(153): lib\App->execSteps(Object(stdClass))↵#4 D:\Documents\Sites XAMPP\digipath2015\dmxConnectLib\lib\App.php(123): lib\App->execSteps(Array)↵#5 D:\Documents\Sites XAMPP\digipath2015\dmxConnectLib\lib\App.php(71): lib\App->exec(Object(stdClass))↵#6 D:\Documents\Sites XAMPP\digipath2015\dmxConnect\api\Case\listCaseOriginTest.php(180): lib\App->define('{? "meta": {? ...')↵#7 {main}"
I'm using the new State Management behaviors to control the back & forward buttons.
If I change the SC action file to a simple joined query, there is no problem. Just get 3000 records on the same page!
I'm using Dreamweaver CS6 on Windows 7
Table Storage Engine: InnoDB
Dave
I've just tested another paged query with a simple INNER JOIN
Parent table: origins with PK origin_id
Child table: cases with PK cases_id, FK origin_id
I ran the following SQL using phpmyadmin:
SELECT cases.museum_no, cases.lab_no, cases.title, origins.origin
FROM origins
INNER JOIN cases
ON origins.origin_id = cases.origin_id
This works fine.
But using a SC paged query in the action file > >
Still get the 500 Internal server error:
{code: "23000", file: "D:\Documents\Sites XAMPP\digipath2015\dmxConnectLib\lib\db\Connection.php",…}
then expanded:
1. code:"23000"
2. file:"D:\Documents\Sites XAMPP\digipath2015\dmxConnectLib\lib\db\Connection.php"
3. line:75
4. message:"SQLSTATE[23000]: Integrity constraint violation: 1052 Column 'origin_id' in on clause is ambiguous"
5. trace:"#0 D:\Documents\Sites XAMPP\digipath2015\dmxConnectLib\lib\db\Connection.php(75): PDOStatement->execute()↵#1 D:\Documents\Sites XAMPP\digipath2015\dmxConnectLib\modules\dbconnector.php(86): lib\db\Connection->execute('SELECT COUNT(*)...', Array)↵#2 D:\Documents\Sites XAMPP\digipath2015\dmxConnectLib\lib\App.php(184): modules\dbconnector->paged(Object(stdClass), 'qryCaseOriginTe...')↵#3 D:\Documents\Sites XAMPP\digipath2015\dmxConnectLib\lib\App.php(153): lib\App->execSteps(Object(stdClass))↵#4 D:\Documents\Sites XAMPP\digipath2015\dmxConnectLib\lib\App.php(123): lib\App->execSteps(Array)↵#5 D:\Documents\Sites XAMPP\digipath2015\dmxConnectLib\lib\App.php(71): lib\App->exec(Object(stdClass))↵#6 D:\Documents\Sites XAMPP\digipath2015\dmxConnect\api\Case\listCaseOriginTest.php(180): lib\App->define('{? "meta": {? ...')↵#7 {main}"
I'm using the new State Management behaviors to control the back & forward buttons.
If I change the SC action file to a simple joined query, there is no problem. Just get 3000 records on the same page!
I'm using Dreamweaver CS6 on Windows 7
Table Storage Engine: InnoDB
Dave
Replied 12 Apr 2016 10:21:43
12 Apr 2016 10:21:43 Teodor Kuduschiev replied:
Hello David,
This will be fixed in tomorrows update, but until then you can fix it yourself in the following file:
/dmxConnectLib/lib/db/SqlBuilder.php line 263, change:
This will be fixed in tomorrows update, but until then you can fix it yourself in the following file:
/dmxConnectLib/lib/db/SqlBuilder.php line 263, change:
if ($this->type == 'select' && !empty($this->joins)) { to if (!empty($this->joins)) {
Replied 12 Apr 2016 12:07:47
12 Apr 2016 12:07:47 David Woolley replied:
Hi Teodor
I changed this code above in SqlBuilder.php , but not quite there yet.
There is a blank table of 5 rows without content.
However there are no errors reported in Chrome developer tools.
The record paging is working OK.
For example:
No of records: 2942
Page 3 of 148
But the first, previous, next, last page buttons are not working properly - check the URLs below:
view_case_origin_test.php?page=0
view_case_origin_test.php?page=20
view_case_origin_test.php?page=40
...
...
view_case_origin_test.php?page=2940
Code for the FIRST page button:
I definitely selected the correct page > offset> first binding
Dave
I changed this code above in SqlBuilder.php , but not quite there yet.
There is a blank table of 5 rows without content.
However there are no errors reported in Chrome developer tools.
The record paging is working OK.
For example:
No of records: 2942
Page 3 of 148
But the first, previous, next, last page buttons are not working properly - check the URLs below:
view_case_origin_test.php?page=0
view_case_origin_test.php?page=20
view_case_origin_test.php?page=40
...
...
view_case_origin_test.php?page=2940
Code for the FIRST page button:
<button type="button" class="btn btn-default btn-sm" onClick="dmxStateManagementAction('setUrlParam','page','{{sc_exec_CasePagedOrigin.data.qryCaseOriginTest.page.offset.first}}')"><i class="glyphicon glyphicon-fast-backward"></i></button>
I definitely selected the correct page > offset> first binding
Dave
Replied 12 Apr 2016 12:49:30
12 Apr 2016 12:49:30 Teodor Kuduschiev replied:
I've tested this and it is working. Can you provide a link to your page?
Replied 12 Apr 2016 14:45:51
12 Apr 2016 14:45:51 David Woolley replied:
Sorry Teodor - It's a testing site on a XAMPP server. I really wish that I could put it online for you to check it out.
Replied 12 Apr 2016 14:51:06
12 Apr 2016 14:51:06 Teodor Kuduschiev replied:
I am also testing this locally on WAMP. All works fine after the fix i sent you.
Replied 13 Apr 2016 08:02:11
13 Apr 2016 08:02:11 David Woolley replied:
Thanks Teodor - all working as it should now.
The repeat region was not bound on the <> data in the example above . I used the <>query by mistake!
Dave
The repeat region was not bound on the <> data in the example above . I used the <>query by mistake!
Dave
Replied 14 Apr 2016 08:23:47
14 Apr 2016 08:23:47 David Woolley replied:
Just another thing - there is still a general problem with how the URLs are displayed with paging.
For example in your video "Keep Pagination State with HTML5 Data Bindings State Management", each step forward displays the URLs like so :
index.php?page=0
index.php?page=10
index.php?page=20
Surely they should be displayed as :
index.php?page=0
index.php?page=1
index.php?page=2
Seems like the offset value in the name-value pair in the URL displayed should be divided by the limit
Dave
For example in your video "Keep Pagination State with HTML5 Data Bindings State Management", each step forward displays the URLs like so :
index.php?page=0
index.php?page=10
index.php?page=20
Surely they should be displayed as :
index.php?page=0
index.php?page=1
index.php?page=2
Seems like the offset value in the name-value pair in the URL displayed should be divided by the limit
Dave
Replied 14 Apr 2016 09:26:14
14 Apr 2016 09:26:14 Teodor Kuduschiev replied:
This value is an offset, it doesn't show the page and it is displayed exactly as it is supposed to be.
You can call the URL variable as you like, it may be "page" or "offset" or "anything" ...
This should not be displayed as ="1" ... ="2" etc. unless your limit is set to "1"
You can call the URL variable as you like, it may be "page" or "offset" or "anything" ...
This should not be displayed as ="1" ... ="2" etc. unless your limit is set to "1"
Replied 14 Apr 2016 10:08:09
14 Apr 2016 10:08:09 David Woolley replied:
Got it now - one could have called the URL parameter anything but page
e.g. index.php?abc=2
I'll leave this alone now!
Thanks
Dave
e.g. index.php?abc=2
I'll leave this alone now!
Thanks
Dave