#1 2013-02-19 12:31:47

ManUn
Member
Registered: 2013-02-04
Posts: 22

Too many : ( ) : params

I'm trying to insert a object into a table and I get this error from the server:
"Too many : ( ) : params".

The table(class) that I'm trying to insert has 65 fields (published properties).

What could be the cause of this error?

Last edited by ManUn (2013-02-19 12:45:54)

Offline

#2 2013-02-19 12:53:11

Leander007
Member
From: Slovenia
Registered: 2011-04-29
Posts: 113

Re: Too many : ( ) : params

At SynCommons.pas you have

MAX_SQLFIELDS = 64;

Change this value according to this text:

MAX_SQLFIELDS default is still 64, but can now be set to any value (64,
128, 192 and 256 have optimized fast code) so that you can have any number
of fields in a Table

"Uncertainty in science: There no doubt exist natural laws, but once this fine reason of ours was corrupted, it corrupted everything.", Blaise Pascal

Offline

#3 2013-02-19 13:15:49

ManUn
Member
Registered: 2013-02-04
Posts: 22

Re: Too many : ( ) : params

Thank you for the answer, but, this is already in 128. Even If I change to 256 the error continues.

function ExtractInlineParameters(const SQL: RawUTF8;
  var Types: TSQLParamTypeDynArray; var Values: TRawUTF8DynArray;
  var maxParam: integer; var Nulls: TSQLFieldBits): RawUTF8;
var ppBeg: integer;
    P, Gen: PUTF8Char;
    wasNull: boolean;
begin
  (...)
    if maxParam>high(Types) then
      raise ESynException.Create('Too many :(): params');  //<--- error occurs here
  (...)
end;

Last edited by ManUn (2013-02-19 13:18:48)

Offline

#4 2013-02-19 14:13:12

ab
Administrator
From: France
Registered: 2010-06-21
Posts: 15,495
Website

Re: Too many : ( ) : params

This limitation should be removed now.
You can delete the whole check, since the Types[] array is now a dynamic array, resized within the internal loop.

See http://synopse.info/fossil/info/a0d92dfc7d

Online

#5 2013-02-19 14:27:31

ManUn
Member
Registered: 2013-02-04
Posts: 22

Re: Too many : ( ) : params

Beautiful, thanks!! smile

Offline

#6 Today 12:10:12

zed
Member
Registered: 2015-02-26
Posts: 120

Re: Too many : ( ) : params

Sorry for reviving such an old thread, but I ran into this issue while migrating to mORMot v2.

In my case, I'm trying to delete 89 records using a DELETE FROM ... WHERE RowID IN (...) statement and I get a "Too many parameters..." error.

In the old codebase, I had an internal limit of 900 parameters for such operations (SQLite allows anywhere from 999 to 32,766, depending on the version).

In mORMot there is a MAX_SQLPARAMS = 500 constant, but it doesn't seem to be taken into account during parameter parsing. Instead, MAX_SQLFIELDS (which defaults to 64) is used: https://github.com/synopse/mORMot2/blob … e.pas#L842

Is this a bug, or is it the intended behavior?

Last edited by zed (Today 12:11:27)

Offline

#7 Today 13:37:36

zed
Member
Registered: 2015-02-26
Posts: 120

Re: Too many : ( ) : params

In my case, I’ll pass the RowIDs as literals instead of parameters, as it doesn’t make any practical difference here (as I suppose).

Offline

Board footer

Powered by FluxBB