sanchezzzhak / kak-clickhouse

Yii2 ext. ClickHouse
69 stars 43 forks source link

The code polishing #11

Closed sleptor closed 7 years ago

sleptor commented 7 years ago

Let's make the code more beautiful and compact :)

  1. You extended \yii\db\Command. It is ok. But you copy-pasted a lot of unnecessary code from a parent class to your child class. You should clean it up.

for example, properties public $db; public $params = []; ... and so on must be removed from your class some unnecessary methods should be removed as well

I checked only Command class, but I guess other classes may be affected as well. Please fix it.

  1. https://github.com/sanchezzzhak/kak-clickhouse/blob/master/Command.php#L332 I guess preg_match may be replaced with stripos here

  2. to be continued :)

sanchezzzhak commented 7 years ago

Thanks

sleptor commented 7 years ago

I guess a lot of methods of Command class can be removed as well cache noCache getSql setSql (why did you change it?) queryAll queryOne bindValues (why schema checking was commented out? you set $typeMap in Scheme class, all has to work good)

maybe some other methods may be removed also..

the main idea is the MOST methods MUST be inherited from a parent class

$_sql & $_pendingParams must be removed as well

sanchezzzhak commented 7 years ago

setSql (why did you change it?)

I do not remember (((

getSql, setSql, queryAll, queryOne - removed