I'm running SA, PHP 5.5.9 under Ubuntu 14.04.

The following script crashes the PHP extension and I get a "502 Bad Gateway" error.

    $conn = sasql_connect( "SERVER=demo17;DBN=demo;UID=DBA;PWD=sql" );
    if( $conn ) {
        $rows = array();
        $rs = sasql_query( $conn, "SELECT * FROM Departments FOR JSON AUTO;" );
        print "QUERY WORKED";
        sasql_disconnect( $conn );

If I leave out the 'FOR JSON AUTO' clause, it works fine.

Anyone else seen this?

asked 24 Feb '16, 13:57

Terry%20Wilkinson's gravatar image

Terry Wilkinson
accept rate: 25%

There has been a few fixes to the JSON AUTO code. What build are you using? If not the latest and I'd suggest that you try a more recent version. If the problem persists then please send me (using my first.lastname at sap.com) a repro and we can look at issue.

(24 Feb '16, 15:15) Mark Culp

I'm running SA, PHP 5.5.9 under Ubuntu 14.04.

AFAIK, it is the latest Developer Edition release.

(24 Feb '16, 15:51) Terry Wilkinson
Replies hidden

Nothing according to JSON in the freshest Windows EBF, see SQL Anywhere Readmes compared toyour version - but hey, that's only one build number later...

So the Developer Edition certainly is quite fresh:)

(24 Feb '16, 16:35) Volker Barth

Yes, it's nice to see the Developer Edition being kept fresh. Not complaining there :-)

Unless I've screwed it up, the Linux version is still

(24 Feb '16, 17:53) Terry Wilkinson

FYI: I've reproduced a problem when doing a "SELECT * from <> FOR JSON AUTO" - there appears to be an issue in the dbcapi library. I will continue to investigate...

(25 Feb '16, 11:13) Mark Culp

We're working on a fix... in the meantime a workaround is to wrap your query as an inner block and name the result column. Example:

SELECT ( SELECT * FROM Departments FOR JSON AUTO ) as jsondata
(01 Mar '16, 08:14) Mark Culp
Replies hidden

Thanks, that worked!

(01 Mar '16, 10:24) Terry Wilkinson
showing 5 of 7 show all flat view
Be the first one to answer this question!
toggle preview

Follow this question

By Email:

Once you sign in you will be able to subscribe for any updates here



Answers and Comments

Markdown Basics

  • *italic* or _italic_
  • **bold** or __bold__
  • link:[text](http://url.com/ "title")
  • image?![alt text](/path/img.jpg "title")
  • numbered list: 1. Foo 2. Bar
  • to add a line break simply add two spaces to where you would like the new line to be.
  • basic HTML tags are also supported

Question tags:


question asked: 24 Feb '16, 13:57

question was seen: 1,561 times

last updated: 01 Mar '16, 10:24