QuickBooks/Driver/Sql/Pgsql.php
protected function _query($sql, &$errnum, &$errmsg, $offset = 0, $limit = null)
	{
		if (strtoupper(substr(trim($sql), 0, 6)) != 'UPDATE')
		{
			// PostgreSQL does not support LIMIT for UPDATE queries
			
			if ($limit)
			{
				if ($offset)
				{
					$sql .= " LIMIT " . (int) $offset . ", " . (int) $limit;
				}
				else
				{
					$sql .= " LIMIT " . (int) $limit;
				}
			}
			else if ($offset)
			{
				// @todo Should this be implemented...?
			}		
		}
		
		// 
		$boolean_fixes = array(
			'qbsql_to_skip != 1' => 		' qbsql_to_skip <> TRUE ', 
			'qbsql_to_delete != 1' => 		' qbsql_to_delete <> TRUE ', 
			'qbsql_to_delete = 1' => 		' qbsql_to_delete = TRUE ', 
			'qbsql_flag_deleted != 1' => 	' qbsql_flag_deleted <> TRUE ', 
			'qbsql_to_void != 1' => 		' qbsql_to_void <> TRUE ', 
			'qbsql_to_void = 1' => 			' qbsql_to_void = TRUE ', 
			'qbsql_flag_voided != 1' => 	' qbsql_flag_voided <> TRUE ', 
			);
		
		$sql = str_replace(array_keys($boolean_fixes), array_values($boolean_fixes), $sql);
		
		// Run the query
		$res = pg_query($this->_conn, $sql);
		
		$this->_last_result = $res;
		
		if (!$res)
		{
			$errnum = -1;
			$errmsg = pg_last_error($this->_conn);
			
			trigger_error('PostgreSQL Error: ' . $errmsg . ', SQL: ' . $sql, E_USER_ERROR);
			return false;
		}
		
		return $res;
	}
protected function _query($sql, &$errnum, &$errmsg, $offset = 0, $limit = null)
	{
		if (strtoupper(substr(trim($sql), 0, 6)) != 'UPDATE')
		{
			// PostgreSQL does not support LIMIT for UPDATE queries
			
			if ($limit)
			{
				if ($offset)
				{
					$sql .= " LIMIT " . (int) $offset . ", " . (int) $limit;
				}
				else
				{
					$sql .= " LIMIT " . (int) $limit;
				}
			}
			else if ($offset)
			{
				// @todo Should this be implemented...?
			}		
		}
		
		// 
		$boolean_fixes = array(
			'qbsql_to_skip != 1' => 		' qbsql_to_skip <> TRUE ', 
			'qbsql_to_delete != 1' => 		' qbsql_to_delete <> TRUE ', 
			'qbsql_to_delete = 1' => 		' qbsql_to_delete = TRUE ', 
			'qbsql_flag_deleted != 1' => 	' qbsql_flag_deleted <> TRUE ', 
			'qbsql_to_void != 1' => 		' qbsql_to_void <> TRUE ', 
			'qbsql_to_void = 1' => 			' qbsql_to_void = TRUE ', 
			'qbsql_flag_voided != 1' => 	' qbsql_flag_voided <> TRUE ', 
			);
		
		$sql = str_replace(array_keys($boolean_fixes), array_values($boolean_fixes), $sql);
		
		// Run the query
		$res = pg_query($this->_conn, $sql);
		
		$this->_last_result = $res;
		
		if (!$res)
		{
			$errnum = -1;
			$errmsg = pg_last_error($this->_conn);
			
			trigger_error('PostgreSQL Error: ' . $errmsg . ', SQL: ' . $sql, E_USER_ERROR);
			return false;
		}
		
		return $res;
	}
Query the database

@param string $sql
@return resource