requtize / query-builder Goto Github PK
View Code? Open in Web Editor NEWFast, simple and dependency-free query builder for PHP.
License: MIT License
Fast, simple and dependency-free query builder for PHP.
License: MIT License
Hey,
I realised that there is no way to alias a column in a select, except using the raw()
object. Perhaps this might be a good feature.
Thanks
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;
}
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
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
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.
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.
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.