Giter Club home page Giter Club logo

eloquent-param-limit-fix's People

Contributors

staudenmeir 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  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar

eloquent-param-limit-fix's Issues

exceeding parameter in MS SQL

ok so here is the error message :

"message": "SQLSTATE[IMSSP]: Tried to bind parameter number 2101. SQL Server supports a maximum of 2100 parameters. (SQL: select * from [P21].[dbo].[oe_line_promise_date] where [P21].[dbo].[oe_line_promise_date].[oe_line_uid] in (795249, 795250, 795251, 795252, 795253, 795254, 795255, 795256, 795257, 795258, 795259, 795260, 795261, 795262, 795263, 795264, 795265, 795266, 795267, 795268, 795269, 795270, 795271, 795272, 795273, 795274, 795275, 795276, 795277, 795278, 795279, 795280, 795281, 795282, 795283, 795284, 795285, 795286, 795287, 795288, 795289, 795290,...

the original call starts here in App\MarsDW\AccountGroup:

    public function openOrders(){
        return $this->hasManyDeep('App\P21\Order',
                         ['App\MarsDW\Account','App\P21\customer'],
                         ['AccountGroupID','customer_id','customer_id'],
                         ['AccountGroupID','customer_id','customer_id']
        )->open()->noLock();
    }

here is the scope that includes the oe_line_promise_date relation in App\P21\Order:

public function scopeOpen($query){
        return $query->where('P21.dbo.oe_hdr.delete_flag','=','N')
                     ->where('P21.dbo.oe_hdr.completed'  ,'=','N')
                     ->where('P21.dbo.oe_hdr.cancel_flag','=','N')
                     ->with('oe_hdr_notepad',
                            'oe_line.oe_line_notepad',
                            'oe_line.oe_line_po',
                            'oe_line.oe_line_promise_date',
                            'oe_pick_ticket',
                            'oe_schedule'
                    );
    }

next the oe_line_promise_date class in App\P21\Order\oe_line_promise_date:

class oe_line_promise_date extends \App\P21\Order
{
    protected $connection = 'p21';
    protected $table = 'P21.dbo.oe_line_promise_date';
    protected $primaryKey = 'oe_line_promise_date_uid';

	use \Staudenmeir\EloquentParamLimitFix\ParamLimitFix;

    public function oe_line(){
        return $this->belongsTo('App\P21\Order\oe_line','oe_line_uid','oe_line_uid');
    }
}

Further I have included your trait on each Model in the chain I have mentioned. I am really unsure of what is or isn't going on here to cause this. Looking at your code it seems pretty straight forward; adding the limits to the builder and passing the modified builder back through your trait. Also if there is any further info I can provide to help figure this out just let me know.

Error "Tried to bind parameter number 2101" when I implement Scout features

Hello! Thank you for greate package. It works prefect when I use eager loading.
But when I add Laravel Scout features in my model like this:

<?php
namespace App;
use ScoutElastic\Searchable;
use Illuminate\Database\Eloquent\Model

class Test extends Model
{
    use \Staudenmeir\EloquentParamLimitFix\ParamLimitFix;
    use Searchable;
    public $timestamps = false;
    public $table = 'Tests';
/*
some Elastic configuration -  I work with  babenkoivan/scout-elasticsearch-driver as Scout driver
*/

Error occures

SQLSTATE[IMSSP]: Tried to bind parameter number 2101. SQL Server supports a maximum of 2100 parameters

Can you help, please? ( Laravel 5.8, MS SQL v. 2012)

Use with Maatwebsite Excel ?

Used within import model of Maatwebsite Excel but still getting error : SQL Server supports a maximum of 2100 parameters.. Can you guide the correct way?

Laravel 5.7

Having trouble getting the trait to work

Hi! This looks like exactly what I need, but I keep hitting the SQLSTATE[IMSSP]: Tried to bind parameter number 2101. error. Here's my implementation:

Base model, all models that use the MSSQL connection in my project extend this:

use Illuminate\Database\Eloquent\Model;
use Staudenmeir\EloquentParamLimitFix\ParamLimitFix;

class BaseModel extends Model
{
    use ParamLimitFix;

    protected $connection = 'sqlsrv';
}

Specific model that is triggering the issue:

class Part extends BaseModel
{
    protected $table = 'dbo.Part';

    protected $primaryKey = 'PartNum';

    protected $keyType = 'string';

    public $incrementing = false;

    protected $casts = [
        'UnitPrice' => 'float',
        'SparePart_c' => 'boolean',
        'InActive' => 'boolean',
        'WebPart' => 'boolean',
        'OnHold' => 'boolean',
    ];

    protected static function booted(): void
    {
        static::addGlobalScope(new PartClassScope());
        static::addGlobalScope(
            new SelectScope([
                'PartNum',
                'PartDescription',
                'TypeCode',
                'ClassID',
                'UnitPrice',
                'SparePart_c',
                'SubPart',
                'OnHold',
                'OnHoldReasonCode',
                'InActive',
                'WebPart',
            ])
        );
    }
// ...

Relationship on queried model (Node.php, references above model):

class Node extends Model
{
    use HasFactory;
    use HasRecursiveRelationships;
// ...
    public function part(): BelongsTo
    {
        return $this->belongsTo(Part::class);
    }
// ...

Eager loading:

public function show(Bom $bom)
{
    $nodes = Node::query()
        ->bom($bom->id)
        ->visible()
        ->with([
            'part',
            'section',
            'type',
            'ancestors',
            'descendants',
        ])
        ->get();
// ...

Now, the Node model is not on the same connection as the Part model--the nodes are stored in a PostgreSQL database-- however this relationship works with all Nodes with < 2100 Part relationships.

Another thing is that the Builder provided by the trait does not appear to be getting invoked at all, is this because I am trying to load the relationship from a parent model (Node) that does not use it? I did try adding it to the Node model but wasn't able to get that to work either.

Thanks for your time.

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.