?
Referenced as Pull Request for: # 11860
avatar rudisten1
rudisten1
23 Jul 2016

Steps to reproduce the issue

set php ini error_reporting = E_ALL
install joomla using a SQL Server db as the main database
install the HelloWorld extension from the "Developing an MVC Component" official tutorial
link: https://docs.joomla.org/J3.x:Developing_an_MVC_Component/Adding_ACL
direct link to extension: https://github.com/scionescire/Joomla-3.2-Hello-World-Component/archive/step-14-adding-ACL.zip
go to "components - helloworld" in the administration site

Expected result

administration console of the hello world component

Actual result

php blocking error as follow:

Error
[Microsoft][ODBC Driver 11 for SQL Server][SQL Server]Invalid object name '#__helloworld'. SQL=SELECT * FROM ( SELECT * , ROW_NUMBER() OVER (ORDER BY greeting asc) AS RowNumber FROM [#__helloworld] ) A WHERE A.RowNumber BETWEEN 1 AND 20
[Microsoft][ODBC Driver 11 for SQL Server][SQL Server]Invalid object name '#__helloworld'. SQL=SELECT COUNT(*) FROM [#__helloworld]

Notice: A non well formed numeric value encountered in C:\inetpub\wwwroot\joomla7sqlsrv\libraries\joomla\database\exception\executing.php on line 39

System information (as much as possible)

php 7
sqlsrv extension 4.0 non thread safe
IIS 7
joomla 3.6
SQL Server 2014

Additional comments

avatar rudisten1 rudisten1 - open - 23 Jul 2016
avatar sovainfo
sovainfo - comment - 24 Jul 2016

What might help when running on MSSQL is to provide sql scripts for it. Without the proper scripts there will be no tables!

avatar rudisten1
rudisten1 - comment - 25 Jul 2016

Are you saying that script is not SQL Server compliant?


This comment was created with the J!Tracker Application at issues.joomla.org/joomla-cms/11280.

avatar mbabker
mbabker - comment - 25 Jul 2016

Honestly, I'm surprised anyone is able to install Joomla on SQL Server considering how poorly maintained its support has been since the team that went through the work to make it happen got their work merged then left the project. And considering there are less than 50 sites reporting statistics and saying they use SQL Server, it doesn't surprise me that there are so many bugs because when so few people use a feature so many less are going to report bugs.

avatar sovainfo
sovainfo - comment - 25 Jul 2016

The extension you linked to only contains the scripts for mysql, so when using mssql or pgsql you need to provide the scripts for those. You can't use the one for mysql when not using mysql !

avatar rudisten1
rudisten1 - comment - 26 Jul 2016

I thought the abstraction layer would have covered the syntax-related differences among dbs

avatar mbabker
mbabker - comment - 26 Jul 2016

The fact it's coming from this line suggests that the drivers aren't converting the $code parameter to an integer which could mean the code building those values is mishandling something.

avatar sovainfo
sovainfo - comment - 26 Jul 2016

The installation package needs to provide the code for each dbs. Joomla doesn't provide an abstraction layer for those statements. They have to be provided by the developer!

avatar williamsandy
williamsandy - comment - 29 Jul 2016

The reason why you are getting this notice message is because the HelloWorld component is throwing an Exception and as mbaker commented it is not being handled correctly. However, this is just a notice and not the Error.

The error for the exception is that the install package out of the box will not install any database tables on a MSSQL server. This is why you are getting the 'SQL Server][SQL Server]Invalid object name '#__helloworld' error message.

You need to modify the HelloWord component install package by copying the SQL/install.mysql.uft8.sql and uninstall.mysql.uft8.sql to SQL/install.sqlsrv.uft8.sql and uninstall.srlsrv.uft8.sql and then convert the SQL in those two added scripts to work with MSSQL. After that, you then will need to update the helloword.xml file so that it will tell Joomla the location of those two new added files on install.

IMHO this issue can be closed. The only thing to note is the notice message that is being thrown in this issue.


This comment was created with the J!Tracker Application at issues.joomla.org/joomla-cms/11280.

avatar sovainfo
sovainfo - comment - 29 Jul 2016

Disagree on closing this issue. The Exception needs to be handled correctly!

avatar williamsandy
williamsandy - comment - 29 Jul 2016

Okay if you want to keep this open to track this notice issue. However, this is low priority as it is a notice not an error. The exception is still being thrown so it is hardly a show stopper.

avatar sovainfo
sovainfo - comment - 29 Jul 2016

A bug is a bug and needs to be resolved! The fact this bug appears because the user is doing something wrong is irrelevant. It reveals there is something completely wrong with the error handling in the databases drivers. The issue should stay open, there might be people interested in providing fixes.

avatar williamsandy
williamsandy - comment - 29 Jul 2016

My point was this would have been easier to manage if the notice issue was handled in a separate ticket. Anyway the notice is caused by line 644 in libraries\joomla\database\driver \sqlsrv trying to use 'SQLSTATE' as the SQL error number. This is incorrect an hence the notice.

Need to change on line 644
$this->errorNum = $errors[0]['SQLSTATE'];

To

$this->errorNum = $errors[0]['code'];

Also need to update line 660

avatar sovainfo
sovainfo - comment - 29 Jul 2016

Ok, could you provide that in an PR? Than this issue can be closed!

avatar williamsandy
williamsandy - comment - 29 Jul 2016

Okay. It will be probably be Monday now when I should have time.

avatar williamsandy
williamsandy - comment - 1 Aug 2016

I want be able to make a PR for this file yet as I am still waiting for PR 11056 to be reviewed and to go through first which I made before Joomla 3.6 went live.

avatar andrepereiradasilva
andrepereiradasilva - comment - 24 Aug 2016

Your other patch is now merged

avatar williamsandy
williamsandy - comment - 31 Aug 2016

Here you go PR #11860


This comment was created with the J!Tracker Application at issues.joomla.org/joomla-cms/11280.

avatar williamsandy
williamsandy - comment - 31 Aug 2016

Here you go PR #11860


This comment was created with the J!Tracker Application at issues.joomla.org/joomla-cms/11280.

avatar mbabker
mbabker - comment - 31 Aug 2016

Closing, see referenced PR for testing.

avatar mbabker mbabker - change - 31 Aug 2016
Status New Closed
Closed_Date 0000-00-00 00:00:00 2016-08-31 14:27:28
Closed_By mbabker
avatar mbabker mbabker - close - 31 Aug 2016

Add a Comment

Login with GitHub to post a comment