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
administration console of the hello world component
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
php 7
sqlsrv extension 4.0 non thread safe
IIS 7
joomla 3.6
SQL Server 2014
Are you saying that script is not SQL Server compliant?
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.
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 !
I thought the abstraction layer would have covered the syntax-related differences among dbs
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!
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.
Disagree on closing this issue. The Exception needs to be handled correctly!
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.
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.
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
Ok, could you provide that in an PR? Than this issue can be closed!
Okay. It will be probably be Monday now when I should have time.
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.
Your other patch is now merged
Here you go PR #11860
Here you go PR #11860
Closing, see referenced PR for testing.
Status | New | ⇒ | Closed |
Closed_Date | 0000-00-00 00:00:00 | ⇒ | 2016-08-31 14:27:28 |
Closed_By | ⇒ | mbabker |
What might help when running on MSSQL is to provide sql scripts for it. Without the proper scripts there will be no tables!