QuickBooks/Driver/Sql/Mssql.php
protected function _query($sql, &$errnum, &$errmsg, $offset = 0, $limit = null)
	{
		if ($limit)
		{
			$sql = str_replace(array( "SELECT ", "SELECT\n", "SELECT\r" ), 'SELECT TOP ' . (int) $limit . ' ' . "\n", $sql);
			
			/*
select * from (
 select top 10 emp_id,lname,fname from (
    select top 30 emp_id,lname,fname
    from employee
   order by lname asc
 ) as newtbl order by lname desc
) as newtbl2 order by lname asc			
			*/
			
			if ($offset)
			{
				
			}
			else
			{
				
			}
		}
		else if ($offset)
		{
			// @todo Does this need to be implemented...?
		}
		
		$res = mssql_query($sql, $this->_conn);
		
		if (!$res)
		{
			$errnum = 1;
			$errmsg = mssql_get_last_message();
			
			//print($sql);
			
			trigger_error('Error: ' . $errmsg . "\n" . 'SQL: ' . $sql, E_USER_ERROR);
			return false;
		}
		
		return $res;
	}
protected function _query($sql, &$errnum, &$errmsg, $offset = 0, $limit = null)
	{
		if ($limit)
		{
			$sql = str_replace(array( "SELECT ", "SELECT\n", "SELECT\r" ), 'SELECT TOP ' . (int) $limit . ' ' . "\n", $sql);
			
			/*
select * from (
 select top 10 emp_id,lname,fname from (
    select top 30 emp_id,lname,fname
    from employee
   order by lname asc
 ) as newtbl order by lname desc
) as newtbl2 order by lname asc			
			*/
			
			if ($offset)
			{
				
			}
			else
			{
				
			}
		}
		else if ($offset)
		{
			// @todo Does this need to be implemented...?
		}
		
		$res = mssql_query($sql, $this->_conn);
		
		if (!$res)
		{
			$errnum = 1;
			$errmsg = mssql_get_last_message();
			
			//print($sql);
			
			trigger_error('Error: ' . $errmsg . "\n" . 'SQL: ' . $sql, E_USER_ERROR);
			return false;
		}
		
		return $res;
	}
Query the database

@param string $sql
@return resource