Browse Source

add sqlite query driver.

Taylor Otwell 12 years ago
parent
commit
295c3b80c2
3 changed files with 28 additions and 1 deletions
  1. 3 0
      laravel/database/connection.php
  2. 24 0
      laravel/database/query/grammars/sqlite.php
  3. 1 1
      laravel/uri.php

+ 3 - 0
laravel/database/connection.php

@@ -83,6 +83,9 @@ class Connection {
 			case 'mysql':
 				return $this->grammar = new Query\Grammars\MySQL($this);
 
+			case 'sqlite':
+				return $this->grammar = new Query\Grammars\SQLite($this);
+
 			case 'sqlsrv':
 				return $this->grammar = new Query\Grammars\SQLServer($this);
 

+ 24 - 0
laravel/database/query/grammars/sqlite.php

@@ -0,0 +1,24 @@
+<?php namespace Laravel\Database\Query\Grammars;
+
+use Laravel\Database\Query;
+
+class SQLite extends Grammar
+{
+
+	/**
+	 * Compile the ORDER BY clause for a query.
+	 *
+	 * @param  Query   $query
+	 * @return string
+	 */
+	protected function orderings(Query $query)
+	{
+		foreach ($query->orderings as $ordering)
+		{
+			$sql[] = $this->wrap($ordering['column']).' COLLATE NOCASE '.strtoupper($ordering['direction']);
+		}
+
+		return 'ORDER BY '.implode(', ', $sql);
+	}
+
+}

+ 1 - 1
laravel/uri.php

@@ -37,7 +37,7 @@ class URI {
 
 		// We'll simply get the path info from the Symfony Request instance and then
 		// format to meet our needs in the router. If the URI is root, we'll give
-		// back a single slash, otherwise we'll strip the slashes.
+		// back a single slash, otherwise we'll strip all of the slashes off.
 		$uri = static::format(Request::getPathInfo());
 
 		static::segments($uri);