After Installing Joomla 3.3.6 Full package, receive next message:
::::::::::::::::::::::::::::::::::::
Error displaying the error page: Application Instantiation Error: [Microsoft][SQL Server Native Client 11.0][SQL Server]Invalid object name 'hox1t_session'.SQL=SELECT * FROM ( SELECT [session_id] , ROW_NUMBER() OVER (ORDER BY (select 0)) AS RowNumber FROM [hox1t_session] WHERE [session_id] = 'f5i6jovj1kq5tlonjnhp8pvfl0') _myResults WHERE RowNumber BETWEEN 1 AND 1
::::::::::::::::::::::::::::::::::::
How can I fix this?
Category | ⇒ | MS SQL |
Title |
|
||||||
Build | staging | ⇒ | 3.3.6 |
Thanks, I try, but not work.
That is what I expected, it complains about the table #__session not being available. Could you verify whether the table exists and create it if not. /****** Object: Table [#__session] ******/
SET QUOTED_IDENTIFIER ON;
CREATE TABLE #__session NULL DEFAULT '',
[data] nvarchar NULL,
[userid] [int] NULL DEFAULT 0,
[username] nvarchar NULL DEFAULT '',
CONSTRAINT [PK_#__session_session_id] PRIMARY KEY CLUSTERED
(
[session_id] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON) ON [PRIMARY]
) ON [PRIMARY];
CREATE NONCLUSTERED INDEX [time] ON #__sessionWITH (STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, DROP_EXISTING = OFF, ONLINE = OFF);
CREATE NONCLUSTERED INDEX [userid] ON #__sessionWITH (STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, DROP_EXISTING = OFF, ONLINE = OFF);
I'm sorry, your fix work perfect. I clear the cache, and site work.
Could you add that to my PR?
I'm sorry for question, but what do you mean "add that to my PR"?
As you may have read in the topic referred to by @vdespa this community has no real interest MS SQL or PostgreSQL for that matter. Although my PR is database independent, environments running MySQL don't consider it a real problem. It is however for environments on MS SQL.
Considering the lack of interest it is very difficult to get real fixes implemented. For sure without feadback they'll just go lost.
My request is to add a remark like "@test ok, PR resolves my issue".
Thank you, one more needed and we'll be waiting for it to be committed.
Labels |
Added:
?
|
@soviafo where the patch that's need to test for this. I have environment for test this.
This comment was created with the J!Tracker Application at issues.joomla.org/joomla-cms/4423.
For Extension manager->Database see #2517.
Don't understand what you are trying to say with the rest.
As mentioned #3602 fixes several reports on all databases on strange SQL syntax. Even with DELETE and UPDATE statements where the LIMIT should not be applied. Indeed MySQL only warns or ignore invalid syntax, PostgreSQL and MS SQL are more strict, depending on configuration.
Only the MS SQL implementation causes severe problems due to the complex construct of applying a LIMIT.
I know, still solves the issue! But if this community doesn't want it, fine with me! Also applies to the other fixes to Database->Fix.
@sovainfo if you still solves the issue!. I can help on test it too. :)
This comment was created with the J!Tracker Application at issues.joomla.org/joomla-cms/4423.
Welcome that, but it is currently closed, mistakenly in my opinion. You connected it to something unrelated I think.
You can apply the changes and test it. Then report that it fixes Extension manager->Database. Hopefully they'll recognize their mistake and finally commit it!
Its not closed I reopened it as requested
Status | New | ⇒ | Closed |
Closed_Date | 0000-00-00 00:00:00 | ⇒ | 2014-10-18 09:38:24 |
Agree with closing. All other issues have been covered by other PR's.
@sovainfo it has been merged not closed. Are you saying tht @inforgraf768 should not have merged it. I am confused
This comment was created with the J!Tracker Application at issues.joomla.org/joomla-cms/4423.
@brianteeman This topic is closed. It doesn't contain any code so can't be merged. It references several issues. As far as I know all issues have PR's, not all are merged. The PR for the original issue is. That is why I agree with closing this issue.
I have fixed this issue. I have modified the file sqlsrv.php in \libraries\joomla\database\query\
There are changes at two points: the function __toString() and function processLimit
I don't know how to report this code in github but i believe when I post it here it can be done by someone else.
new sqlsrv.php file:
<?php
/**
defined('JPATH_PLATFORM') or die;
/**
@since 11.1
/
class JDatabaseQuerySqlsrv extends JDatabaseQuery implements JDatabaseQueryLimitable
{
/*
/**
/**
/**
/**
@since 11.1
*/
public function __toString()
{
$query = '';
switch ($this->type)
{
case 'select':
$query .= (string) $this->select;
$query .= (string) $this->from;
if ($this->join)
{
// Special case for joins
foreach ($this->join as $join)
{
$query .= (string) $join;
}
}
if ($this->where)
{
$query .= (string) $this->where;
}
if ($this->group)
{
$query .= (string) $this->group;
}
if ($this->having)
{
$query .= (string) $this->having;
}
if ($this->order)
{
$query .= (string) $this->order;
}
break;
case 'insert':
$query .= (string) $this->insert;
// Set method
if ($this->set)
{
$query .= (string) $this->set;
}
// Columns-Values method
elseif ($this->values)
{
if ($this->columns)
{
$query .= (string) $this->columns;
}
$elements = $this->insert->getElements();
$tableName = array_shift($elements);
$query .= 'VALUES ';
$query .= (string) $this->values;
if ($this->autoIncrementField)
{
$query = 'SET IDENTITY_INSERT ' . $tableName . ' ON;' . $query . 'SET IDENTITY_INSERT ' . $tableName . ' OFF;';
}
if ($this->where)
{
$query .= (string) $this->where;
}
}
break;
default:
$query = parent::__toString();
break;
}
if ($this instanceof JDatabaseQueryLimitable && ($this->limit > 0 || $this->offset > 0))
{
$query = $this->processLimit($query, $this->limit, $this->offset);
}
return $query;
}
/**
/**
/**
/**
/**
/**
/**
@since 12.1
*/
public function processLimit($query, $limit, $offset = 0)
{
$start = $offset + 1;
$end = $offset + $limit;
$orderBy = stristr($query, 'ORDER BY');
if (strpos($query,'SELECT') !== false)
{
if (is_null($orderBy) || empty($orderBy))
{
$orderBy = 'ORDER BY (select 0)';
}
$query = str_ireplace($orderBy, '', $query);
$rowNumberText = ', ROW_NUMBER() OVER (' . $orderBy . ') AS RowNumber FROM ';
$query = preg_replace('/\sFROM\s/i', $rowNumberText, $query, 1);
$query = 'SELECT * FROM (' . $query . ') _myResults WHERE RowNumber BETWEEN ' . $start . ' AND ' . $end;
}
return $query;
}
/**
@since 12.1
*/
public function setLimit($limit = 0, $offset = 0)
{
$this->limit = (int) $limit;
$this->offset = (int) $offset;
return $this;
}
}
This comment was created with the J!Tracker Application at issues.joomla.org/joomla-cms/4423.
@jbultena please send a PR against staging see here:
Review: https://github.com/joomla/joomla-cms/blob/staging/CONTRIBUTING.md
and see here for how you can submit a PR: http://docs.joomla.org/Using_the_Github_UI_to_Make_Pull_Requests
This comment was created with the J!Tracker Application at issues.joomla.org/joomla-cms/4423.
Thx zero-24, submitted a PR
This comment was created with the J!Tracker Application at issues.joomla.org/joomla-cms/4423.
Labels |
Added:
?
|
A starting point you be to have a look at the discussion taking place on https://groups.google.com/forum/#!topic/joomla-dev-cms/VZNVSf4IfZc.