mirror of
https://github.com/yiisoft/yii2.git
synced 2025-11-14 21:30:17 +08:00
add sqllite dummy
This commit is contained in:
@@ -110,7 +110,7 @@ class ColumnSchemaBuilder extends Object
|
||||
|
||||
/**
|
||||
* Specify the comment for the column.
|
||||
* @param $comment the comment
|
||||
* @param string $comment the comment
|
||||
* @return $this
|
||||
*/
|
||||
public function comment($comment)
|
||||
|
||||
40
framework/db/sqlite/ColumnSchemaBuilder.php
Normal file
40
framework/db/sqlite/ColumnSchemaBuilder.php
Normal file
@@ -0,0 +1,40 @@
|
||||
<?php
|
||||
/**
|
||||
* @link http://www.yiiframework.com/
|
||||
* @copyright Copyright (c) 2008 Yii Software LLC
|
||||
* @license http://www.yiiframework.com/license/
|
||||
*/
|
||||
|
||||
namespace yii\db\sqlite;
|
||||
|
||||
use yii\base\NotSupportedException;
|
||||
use yii\db\ColumnSchemaBuilder as AbstractColumnSchemaBuilder;
|
||||
|
||||
/**
|
||||
* ColumnSchemaBuilder is the schema builder for Postgres databases.
|
||||
*
|
||||
* @author Vasenin Matvey <vaseninm@gmail.com>
|
||||
* @since 2.0.6
|
||||
*/
|
||||
class ColumnSchemaBuilder extends AbstractColumnSchemaBuilder
|
||||
{
|
||||
/**
|
||||
* Specify the comment for the column.
|
||||
* @param string $comment the comment
|
||||
* @return $this
|
||||
* @throws NotSupportedException this is not supported by SQLite
|
||||
*/
|
||||
public function comment($comment)
|
||||
{
|
||||
throw new NotSupportedException(__METHOD__ . ' is not supported by SQLite.');
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @inheritdoc
|
||||
*/
|
||||
protected function buildCommentString()
|
||||
{
|
||||
return '';
|
||||
}
|
||||
}
|
||||
@@ -275,6 +275,58 @@ class QueryBuilder extends \yii\db\QueryBuilder
|
||||
throw new NotSupportedException(__METHOD__ . ' is not supported by SQLite.');
|
||||
}
|
||||
|
||||
/**
|
||||
* Builds a SQL command for adding comment to column
|
||||
*
|
||||
* @param string $table the table whose column is to be commented. The table name will be properly quoted by the method.
|
||||
* @param string $column the name of the column to be commented. The column name will be properly quoted by the method.
|
||||
* @param string $comment the text of the comment to be added. The comment will be properly quoted by the method.
|
||||
* @return $this the command object itself
|
||||
* @throws NotSupportedException this is not supported by SQLite
|
||||
*/
|
||||
public function addCommentOnColumn($table, $column, $comment)
|
||||
{
|
||||
throw new NotSupportedException(__METHOD__ . ' is not supported by SQLite.');
|
||||
}
|
||||
|
||||
/**
|
||||
* Builds a SQL command for adding comment to table
|
||||
*
|
||||
* @param string $table the table whose column is to be commented. The table name will be properly quoted by the method.
|
||||
* @param string $comment the text of the comment to be added. The comment will be properly quoted by the method.
|
||||
* @return $this the command object itself
|
||||
* @throws NotSupportedException this is not supported by SQLite
|
||||
*/
|
||||
public function addCommentOnTable($table, $comment)
|
||||
{
|
||||
throw new NotSupportedException(__METHOD__ . ' is not supported by SQLite.');
|
||||
}
|
||||
|
||||
/**
|
||||
* Builds a SQL command for adding comment to column
|
||||
*
|
||||
* @param string $table the table whose column is to be commented. The table name will be properly quoted by the method.
|
||||
* @param string $column the name of the column to be commented. The column name will be properly quoted by the method.
|
||||
* @return $this the command object itself
|
||||
* @throws NotSupportedException this is not supported by SQLite
|
||||
*/
|
||||
public function dropCommentFromColumn($table, $column)
|
||||
{
|
||||
throw new NotSupportedException(__METHOD__ . ' is not supported by SQLite.');
|
||||
}
|
||||
|
||||
/**
|
||||
* Builds a SQL command for adding comment to table
|
||||
*
|
||||
* @param string $table the table whose column is to be commented. The table name will be properly quoted by the method.
|
||||
* @return $this the command object itself
|
||||
* @throws NotSupportedException this is not supported by SQLite
|
||||
*/
|
||||
public function dropCommentFromTable($table)
|
||||
{
|
||||
throw new NotSupportedException(__METHOD__ . ' is not supported by SQLite.');
|
||||
}
|
||||
|
||||
/**
|
||||
* @inheritdoc
|
||||
*/
|
||||
|
||||
@@ -91,6 +91,14 @@ class Schema extends \yii\db\Schema
|
||||
return new QueryBuilder($this->db);
|
||||
}
|
||||
|
||||
/**
|
||||
* @inheritdoc
|
||||
*/
|
||||
public function createColumnSchemaBuilder($type, $length = null)
|
||||
{
|
||||
return new ColumnSchemaBuilder($type, $length);
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns all table names in the database.
|
||||
* @param string $schema the schema of the tables. Defaults to empty string, meaning the current or default schema.
|
||||
|
||||
@@ -87,6 +87,30 @@ class SqliteQueryBuilderTest extends QueryBuilderTest
|
||||
parent::testAddDropPrimaryKey();
|
||||
}
|
||||
|
||||
public function testCommentOnColumnSchemaBuilder()
|
||||
{
|
||||
$this->setExpectedException('yii\base\NotSupportedException');
|
||||
$this->string()->comment('comment');
|
||||
}
|
||||
|
||||
public function testCommentColumn()
|
||||
{
|
||||
$qb = $this->getQueryBuilder();
|
||||
|
||||
$this->setExpectedException('yii\base\NotSupportedException');
|
||||
$qb->addCommentOnColumn('comment', 'text', 'This is my column.');
|
||||
$qb->dropCommentFromColumn('comment', 'text');
|
||||
}
|
||||
|
||||
public function testCommentTable()
|
||||
{
|
||||
$qb = $this->getQueryBuilder();
|
||||
|
||||
$this->setExpectedException('yii\base\NotSupportedException');
|
||||
$qb->addCommentOnTable('comment', 'This is my table.');
|
||||
$qb->dropCommentFromTable('comment');
|
||||
}
|
||||
|
||||
public function testBatchInsert()
|
||||
{
|
||||
$db = $this->getConnection();
|
||||
|
||||
Reference in New Issue
Block a user