?
avatar BugsFinder
BugsFinder
2 Oct 2014

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?

Votes

# of Users Experiencing Issue
2/2
Average Importance Score
4.00

avatar BugsFinder BugsFinder - open - 2 Oct 2014
avatar brianteeman brianteeman - change - 2 Oct 2014
Category MS SQL
avatar vdespa
vdespa - comment - 2 Oct 2014

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.

avatar vdespa vdespa - change - 2 Oct 2014
Title
Joomla 3.3.6 compatibility with MS SQL Server 2012/2014
SQL error after installing Joomla 3.3.6 - Compatibility with MS SQL Server 2012/2014
Build staging 3.3.6
avatar sovainfo
sovainfo - comment - 2 Oct 2014

Try #3602

avatar BugsFinder
BugsFinder - comment - 2 Oct 2014

Thanks, I try, but not work.

avatar sovainfo
sovainfo - comment - 2 Oct 2014

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);

avatar BugsFinder
BugsFinder - comment - 2 Oct 2014

I'm sorry, your fix work perfect. I clear the cache, and site work.

avatar sovainfo
sovainfo - comment - 2 Oct 2014

Could you add that to my PR?

avatar BugsFinder
BugsFinder - comment - 2 Oct 2014

I'm sorry for question, but what do you mean "add that to my PR"?

avatar sovainfo
sovainfo - comment - 2 Oct 2014

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".

avatar BugsFinder
BugsFinder - comment - 3 Oct 2014

like this
#3602

avatar sovainfo
sovainfo - comment - 3 Oct 2014

Thank you, one more needed and we'll be waiting for it to be committed.

avatar nicksavov nicksavov - change - 16 Oct 2014
The description was changed
Labels Added: ?
avatar joomlacorner
joomlacorner - comment - 17 Oct 2014

@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.

avatar sovainfo
sovainfo - comment - 17 Oct 2014

Try #3602

avatar joomlacorner
joomlacorner - comment - 17 Oct 2014

@sovainfo I have been try #3602 but do you checked on other part.

  • Publish Date in content. by default it store as 1970-01-01 00:00:00
  • Schema not up-to-date - Error in MSSQL syntax screen shot 2557-10-17 at 4 27 19 pm screen shot 2557-10-17 at 4 28 34 pm

#4652

avatar sovainfo
sovainfo - comment - 17 Oct 2014

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.

avatar joomlacorner
joomlacorner - comment - 17 Oct 2014

@sovainfo sorry just saw it. coz #2517 is close. but it's not merge to master.

avatar sovainfo
sovainfo - comment - 17 Oct 2014

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.

avatar joomlacorner
joomlacorner - comment - 17 Oct 2014

@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.

avatar sovainfo
sovainfo - comment - 17 Oct 2014

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!

avatar brianteeman
brianteeman - comment - 17 Oct 2014

Its not closed I reopened it as requested

avatar sovainfo
sovainfo - comment - 17 Oct 2014

@joomlacorner :

For missing alias replace line 178 of administrator/components/com_menus/helpers/menu.php with:->group('a.id, a.title, a.alias, a.level, a.menutype, a.type, a.template_style_id, a.checked_out, a.lft')

See #4796

avatar zero-24 zero-24 - close - 18 Oct 2014
avatar zero-24 zero-24 - close - 18 Oct 2014
avatar infograf768
infograf768 - comment - 18 Oct 2014

#4796 merged. Closing

avatar infograf768 infograf768 - close - 18 Oct 2014
avatar infograf768 infograf768 - change - 18 Oct 2014
Status New Closed
Closed_Date 0000-00-00 00:00:00 2014-10-18 09:38:24
avatar sovainfo
sovainfo - comment - 18 Oct 2014

Agree with closing. All other issues have been covered by other PR's.

avatar brianteeman
brianteeman - comment - 18 Oct 2014

@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.

avatar sovainfo
sovainfo - comment - 18 Oct 2014

@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.

avatar jbultena
jbultena - comment - 20 Oct 2014

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
/**

  • @package Joomla.Platform
  • @subpackage Database *
  • @copyright Copyright (C) 2005 - 2014 Open Source Matters, Inc. All rights reserved.
  • @license GNU General Public License version 2 or later; see LICENSE */

defined('JPATH_PLATFORM') or die;

/**

  • Query Building Class. *
  • @package Joomla.Platform
  • @subpackage Database
  • @since 11.1
    /
    class JDatabaseQuerySqlsrv extends JDatabaseQuery implements JDatabaseQueryLimitable
    {
    /*

    • The character(s) used to quote SQL statement names such as table names or field names,
    • etc. The child classes should define this as necessary. If a single character string the
    • same character is used for both sides of the quoted name, else the first character will be
    • used for the opening quote and the second for the closing quote. *
    • @var string
    • @since 11.1 */ protected $name_quotes = '`';

    /**

    • The null or zero representation of a timestamp for the database driver. This should be
    • defined in child classes to hold the appropriate value for the engine. *
    • @var string
    • @since 11.1 */ protected $null_date = '1900-01-01 00:00:00';

    /**

    • @var integer The affected row limit for the current SQL statement.
    • @since 3.2 CMS */ protected $limit = 0;

    /**

    • @var integer The affected row offset to apply for the current SQL statement.
    • @since 3.2 CMS */ protected $offset = 0;

    /**

    • Magic function to convert the query to a string. *
    • @return string The completed query. *
    • @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;
      }

    /**

    • Casts a value to a char. *
    • Ensure that the value is properly quoted before passing to the method. *
    • @param string $value The value to cast as a char. *
    • @return string Returns the cast value. *
    • @since 11.1 */ public function castAsChar($value) { return 'CAST(' . $value . ' as NVARCHAR(10))'; }

    /**

    • Gets the function to determine the length of a character string. *
    • @param string $field A value.
    • @param string $operator Comparison operator between charLength integer value and $condition
    • @param string $condition Integer value to compare charLength with. *
    • @return string The required char length call. *
    • @since 11.1 */ public function charLength($field, $operator = null, $condition = null) { return 'DATALENGTH(' . $field . ')' . (isset($operator) && isset($condition) ? ' ' . $operator . ' ' . $condition : ''); }

    /**

    • Concatenates an array of column names or values. *
    • @param array $values An array of values to concatenate.
    • @param string $separator As separator to place between each value. *
    • @return string The concatenated values. *
    • @since 11.1 */ public function concatenate($values, $separator = null) { if ($separator) { return '(' . implode('+' . $this->quote($separator) . '+', $values) . ')'; } else { return '(' . implode('+', $values) . ')'; } }

    /**

    • Gets the current date and time. *
    • @return string *
    • @since 11.1 */ public function currentTimestamp() { return 'GETDATE()'; }

    /**

    • Get the length of a string in bytes. *
    • @param string $value The string to measure. *
    • @return integer *
    • @since 11.1 */ public function length($value) { return 'LEN(' . $value . ')'; }

    /**

    • Add to the current date and time.
    • Usage:
    • $query->select($query->dateAdd());
    • Prefixing the interval with a - (negative sign) will cause subtraction to be used. *
    • @param datetime $date The date to add to; type may be time or datetime.
    • @param string $interval The string representation of the appropriate number of units
    • @param string $datePart The part of the date to perform the addition on *
    • @return string The string with the appropriate sql for addition of dates *
    • @since 13.1
    • @note Not all drivers support all units.
    • @link http://msdn.microsoft.com/en-us/library/ms186819.aspx for more information */ public function dateAdd($date, $interval, $datePart) { return "DATEADD('" . $datePart . "', '" . $interval . "', '" . $date . "'" . ')'; }

    /**

    • Method to modify a query already in string format with the needed
    • additions to make the query limited to a particular number of
    • results, or start at a particular offset. *
    • @param string $query The query in string format
    • @param integer $limit The limit for the result set
    • @param integer $offset The offset for the result set *
    • @return string *
    • @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;
      }

    /**

    • Sets the offset and limit for the result set, if the database driver supports it. *
    • Usage:
    • $query->setLimit(100, 0); (retrieve 100 rows, starting at first record)
    • $query->setLimit(50, 50); (retrieve 50 rows, starting at 50th record) *
    • @param integer $limit The limit for the result set
    • @param integer $offset The offset for the result set *
    • @return JDatabaseQuery Returns this object to allow chaining. *
    • @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.

avatar zero-24
zero-24 - comment - 20 Oct 2014

@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.

avatar jbultena
jbultena - comment - 20 Oct 2014

Thx zero-24, submitted a PR

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

avatar sovainfo
sovainfo - comment - 20 Oct 2014

@jbultena Could you have a look at #2517 ?

avatar zero-24 zero-24 - change - 7 Jul 2015
Labels Added: ?

Add a Comment

Login with GitHub to post a comment