File tree Expand file tree Collapse file tree 3 files changed +17
-5
lines changed Expand file tree Collapse file tree 3 files changed +17
-5
lines changed Original file line number Diff line number Diff line change @@ -461,15 +461,15 @@ public function getCountPendingQueue()
461
461
}
462
462
463
463
/**
464
- * Insert Array
465
- *
466
464
* @param mixed[][] $values
467
465
* @param string[] $columns
468
- * @return Statement
469
- * @throws Exception\TransportException
470
466
*/
471
- public function insert (string $ table , $ values , $ columns = [])
467
+ public function insert (string $ table , array $ values , array $ columns = []) : Statement
472
468
{
469
+ if (empty ($ values )) {
470
+ throw QueryException::cannotInsertEmptyValues ();
471
+ }
472
+
473
473
if (stripos ($ table , '` ' ) === false && stripos ($ table , '. ' ) === false ) {
474
474
$ table = '` ' . $ table . '` ' ; //quote table name for dot names
475
475
}
Original file line number Diff line number Diff line change 8
8
9
9
class QueryException extends LogicException implements ClickHouseException
10
10
{
11
+ public static function cannotInsertEmptyValues () : self
12
+ {
13
+ return new self ('Inserting empty values array is not supported in ClickHouse ' );
14
+ }
11
15
}
Original file line number Diff line number Diff line change @@ -788,6 +788,14 @@ public function testExceptionInsert()
788
788
], ['s_key ' , 's_arr ' ]);
789
789
}
790
790
791
+ public function testExceptionInsertNoData () : void
792
+ {
793
+ $ this ->expectException (QueryException::class);
794
+ $ this ->expectExceptionMessage ('Inserting empty values array is not supported in ClickHouse ' );
795
+
796
+ $ this ->client ->insert ('bla_bla ' , []);
797
+ }
798
+
791
799
public function testExceptionSelect ()
792
800
{
793
801
$ this ->expectException (DatabaseException::class);
You can’t perform that action at this time.
0 commit comments