GithubHelp home page GithubHelp logo

requtize / query-builder Goto Github PK

View Code? Open in Web Editor NEW
18.0 2.0 3.0 46 KB

Fast, simple and dependency-free query builder for PHP.

License: MIT License

PHP 100.00%
query-builder database-adapter database database-management query-building

query-builder's People

Contributors

requtize avatar

Stargazers

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

Watchers

 avatar  avatar

query-builder's Issues

orderBy is not working

Warning: Array to string conversion in D:\development\scraper\gptools\vendor\requtize\query-builder\src\QueryBuilder\QueryBuilder\Compiler.php on line 68

And I solved this problem

if(isset($querySegments['orderBy']) && is_array($querySegments['orderBy']))
        {
            foreach($querySegments['orderBy'] as $order)
                $orderBy = $this->quoteTable($order['field']).' '.$order['type'].', ';

            if($orderBy = trim($orderBy, ', '))
                $orderBy = 'ORDER BY '.$orderBy;
        }

image

methods related to updates aren't working

as far as I noticed when you want to update using update or updateOrInsert the builder throws an error
source()->from('countries')->update([
'name' => 'Serbiasss',
'code' => 'RS',
'is_active' => 1
]);
source()->from('countries')->where('name', 'Serbias')->update([
'name' => 'Serbiasss12',
'code' => 'RS',
'is_active' => 1
]);

The problem is caused by mismatching between names of a placeholders and bonded parameters

Bug $Db->update() method

I encounter an error while using the update() function.

When you execute

$DB->table('table')->where('id', 1)->getQuery('update', [ 'name' => 'table_name' ]);

The function will return

UPDATE `table` SET `name` = name WHERE `id` = 'table_name'

That will throw an error;

Fatal error: Uncaught Error: Wrong parameters for Requtize\QueryBuilder\Exception\QueryExecutionFailException([string $message [, long $code [, Throwable $previous = NULL]]]) in /media/sf_htdocs/candyfactory/vendor/requtize/query-builder/src/QueryBuilder/QueryBuilder/QueryBuilder.php:815 Stack trace: #0 /media/sf_htdocs/candyfactory/vendor/requtize/query-builder/src/QueryBuilder/QueryBuilder/QueryBuilder.php(815): Exception->__construct() #1 /media/sf_htdocs/candyfactory/vendor/requtize/query-builder/src/QueryBuilder/QueryBuilder/QueryBuilder.php(462): Requtize\QueryBuilder\QueryBuilder\QueryBuilder->prepareAndExecute() #2 /media/sf_htdocs/candyfactory/src/register/index.php(27): Requtize\QueryBuilder\QueryBuilder\QueryBuilder->update() #3 {main} thrown in /media/sf_htdocs/candyfactory/vendor/requtize/query-builder/src/QueryBuilder/QueryBuilder/QueryBuilder.php on line 815

Allow for overwriting of query segements

Hey,

Came across a use case that, while maybe possible, is probably not great. I am busy building large query objects, and in an inheritance case, I want to overwrite the selects. I do understand that this is a little bit of an edge case. It would good however to have select and addSelect which will allow for this. select would overwrite the selects and addSelect would append.

Later.

Transaction commit always throws TransactionHaltException

Hey,

I noticed that on committing a transaction, it always throws a TransactionHaltException, which seems a little weird. Is there a particular reason for this?

That aside, I have been looking for a standalone QueryBuilder for some time, and this looks awesome.

Thanks.

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.