Code Monkey home page Code Monkey logo

easy-query's Introduction

Hi there ๐Ÿ‘‹

easy-query's People

Contributors

admad avatar arusinowski avatar itosho avatar mosaxiv avatar o0h avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar

easy-query's Issues

TableRegistory::get is deprecated from cake 3.6.x

Topic

  • When cakephp is updated for 3.6.x, we don't use TableRegistory::get('yourTableName'), but $this->getTableLocator()->get('yourTableName')
  • So, Please update the point of that ๐Ÿ‘† in README.md

Please support `INSERT ~ SELECT` query!

Can you support INSERT ~ SELECT val1, val2 FROM tmp WHERE NOT EXISTS(*) statement?

You have already support ON DUPLICATE KEY syntax, but it only helps me UNIQUE/PRIMARY keys' duplication.
I think the feature like bellow make this plugin more useful! ๐Ÿ˜„


api design

// Behavior's api
public function insertOnce(array $values, array $search = null)

usage 1

Specify search conditions.

$data = ['field1' => $val1, 'field2' => $val2];
$search = ['key' = $key];
$this->Table->insertOnce($data, $search);

generates sql statement bellow

INSERT INTO `table` (`field1`, `field2`)
SELECT "{$val1}", "{$val2}" FROM tmp WHERE NOT EXISTS(    
    SELECT * FROM table WHERE `key` = '{$key}'
)

usage 2

Auto set search conditions with inserting data.

$data = ['field1' => $val1, 'field2' => $val2];
$search = ['key' = $key];
$this->Table->insertOnce($data,);

generates sql statement bellow

INSERT INTO `table` (`field1`, `field2`)
SELECT "{$val1}", "{$val2}" FROM tmp WHERE NOT EXISTS(    
    SELECT * FROM table WHERE `field1` = '{$val1}' AND `field2` = '{$val2}'
)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.