You are not logged in.
Hi AB
i get this error:
[dcc32 Fehler] SynSQlite3Static.pas(1294): E2065 Ungenügende Forward- oder External-Deklaration: '__ieee_32_p_inf'
linking latest (self build) sqlite3.obj
Here is my build command
"c:\Program Files (x86)\Embarcadero\Studio\20.0\bin\bcc32.exe" -6 -Oi -O2 -c -d -u- -I"c:\Program Files (x86)\Windows Kits\10\Include\10.0.17134.0\shared" sqlite3.c
do you have any idea whats missing ? (With your sqlite3.obj i can link successfully)
Some of my installations use Microsoft SQL Server as Backend. But cause of some mysterious Exception with TOleDBMSSQL2012ConnectionProperties i tried the Other Implementations for MS-SQL
First i have to say i get only 2 to work first the TOleDBMSSQL2012ConnectionProperties an second the TSQLDBUniDACConnectionProperties
In the UniDAC i don't get the Exception i get with the other (see here: https://synopse.info/forum/viewtopic.php?id=4971)
as described i tried to use The ZEOS Implementation but don'get it to work. The main reason is: i can't find working examples.
I wan't to replace
TOleDBMSSQL2012ConnectionProperties.Create(ADBSettings.Host, ADBSettings.Database, ADBSettings.Username, ADBSettings.Password);
with something like:
TSQLDBZEOSConnectionProperties.Create(TSQLDBZEOSConnectionProperties.URI(dMSSQL, ADBSettings.Host + ':' + ADBSettings.Port), ADBSettings.Database, ADBSettings.Username, ADBSettings.Password);
But it raises an Exception ntwdblib.dll not found. In the Documentation a 4 Interfaces which i can use OleDB, ADO, ODBC i tried different String instead of dMSSQL OleDB[mssql], ADO[mssql] but the error is driver not found.
can anybody pls make some working examples for the ZEOS uri to connect as stated above ?
What are the prerequisites
And last but not least what will be the best (fastest) way to connect to MS-SQL
Thank you in advance
@Mpv ty for your answer, but my patch does not solve the underlying problem i found out yesterday
Im Doing a nested Query with TOleDBMSSQL2012ConnectionProperties Calling ExecuteInlined.
The Schema is
var
LRows1, LRows2 : ISQLDBRows;
begin
...
LRows1 := ConnectionProperties.ExecuteInlned(SomeSQL, true);
While LRows1.Step do begin
.. Do Something with LRows1
LRows2 := ConnectionProperties.ExecuteInlined(AnotherSQL, true);
if LRows2.Step then
.. Do Something with LRows2
end;
if ConnectionProperties is TOleDBMSSQL2012ConnectionProperties then i got Exception in the Second ExecuteInlined
if ConnectionProperties is TSQLDBZEOSConnectionProperties then it works (MySQL - Server)
Seems to be something wrong with the TOleDBMSSQL2012ConnectionProperties Implementation reusing the internal Connection.
Any Idea ?
Hi AB i got an Exception in SynOLEDB - TOleDBStatement.ExecutePrepared
mr was nil after Query
Here is my Patch (Line 1997 ff)
if not OleDBConnection.OleDBProperties.fSupportsOnlyIRowset then begin
// use IMultipleResults for 'insert into table1 values (...); select ... from table2 where ...'
res := fCommand.Execute(nil,IID_IMultipleResults,fDBParams,@fUpdateCount,@mr);
if assigned(mr) and (res=E_NOINTERFACE) then // <-- PATCH itSDS
OleDBConnection.OleDBProperties.fSupportsOnlyIRowset := true else begin
repeat
res := mr.GetResult(nil,0,IID_IRowset,@fUpdateCount,@RowSet);
until Assigned(RowSet) or (res <> S_OK);
end;
end;Today i testet the TestSQL3 with Rio 10.3.1 and got Exception (access violation at 0x00000000: read of adress 0x00000000 ....) in _AES256 Test.
The 64Bit Version works !
ty it works ![]()
Hi, i store ~ 100GB in SQLite DB and have SYNLOG with LOG_VERBOSE active.
My LOGS are growing rapidly because the BLOB Data is stored in the Log as Parameter to mOTMotSQLite3.TSQLRestServer INSERT/UPDATE Log Entries.
Is there a Option to disable the Loging of BLOB Contents. I would like to have the other SQL - Log Entry only the BLOB Parameter should not be saved (for example Replaced by BLOB(Size:616000)) Size is optional ..
BR
Stefan
ok i allready did so ![]()
I understand whats causing my query problem - TY
What i don't understand is why is not "allowed" to store '' in Textfields in MSSQL - we do this for over 20 years now. - What do you mean with allowed ?
In my understanding
if text = null then the Values is "not set" or Empty
if text = '' then the Field ist Empty String
Sometimes it is neccessary to make a difference between '' and null
Thank you - Just to add it here i was using TSQLDBZEOSConnectionProperties for MySQL and OleDBMSSQL2012ConnectionProperties for MSSQL I try now the ZEOS implementation fpr MS-SQL
Hi AB,
i found a problem with the Param generation in Executeinlined
we give the following query to Executelined
select anyvalue from thetable where textvalue is null or textvalue = :(""):
in MySQL the generated Query is correct:
select anyvalue from thetable where textvalue is null or textvalue = ''
in MSSQL the Query is wrong generated
select anyvalue from thetable where textvalue is null or textvalue = null
why is the Empty "" String in MSSQL converted to null ?
Where do i have to correct the Problem ?
ty egonhugeist
next time i'll create login for zeos bug tracker an post it there ![]()
We tested the 7.2-patches branch and the error has gone.
Thank you we already changed the zeos version but not the branch - I'll try it with the one you said.
I think so too, but the Query is generated by mORMot on Server after Update Request from REST Client.
And as Hint the Query works after the Transfer is restarted on the client.
The field binaerdaten is a mediumblob on MySQL Server
Can there be Problem with the ZEOS Lib ?
Hi ab,
everything runs fine, but since Yesterday we get a database error i can not identify / don't know what to do with
The Errormessage is this:
SynDBZeos.TSQLDBZEOSStatement(061AE280) update BinaerdatenRecord set CreationDate=0,LastEditDate=135469259944,GUID='{90944806-B92D-C7C9-1CFE-99CF08C3C3AA}',Binaerdaten=*BLOB*,Datenformat='image/jpeg',GroesseInByte=90112 where ID=80358
EZSQLException ("SQL Error: Can't send long data for non-string/non-binary data types (parameter: 3)")
SynDBZeos.TSQLDBZEOSStatement(062D0AB0) update BinaerdatenRecord set LastEditDate=135469259945,Binaerdaten=*BLOB*,GroesseInByte=122880 where ID=80359
EZSQLException ("SQL Error: Can't send long data for non-string/non-binary data types (parameter: 1)")Our Environment ist libZEOS - 7.3 V5275
mORMot latest Version
Our Database is a MySQL 5.7.19
We have a simple TSQLRecord with 1 TSQLRawBlob called "Binaerdaten"
Does you or anybody have a clue for us ?
There is a new SQLite Version pls change expected Version in Git
Hi AB there is the following compiler error generated from bcc of Tokyo (and other i suppose)
./amalgamation/sqlite3.c:50463:21: error: Wert in Ausdruck erwartet
#if SQLITE_HAS_CODEC <----
in sqlite.c you define SQLITE_HAS_CODEC
with
#define SQLITE_HAS_CODEC
to make the code compile you have to provide a value to SQLITE_HAS_CODEC
correct code:
#define SQLITE_HAS_CODEC 0
or
#define SQLITE_HAS_CODEC 1
I non't know if it should be a 1 or 0
can you pls fix this
Hi Arnaud, im thinking about reprogramming one of out MVC Services with DDD Backend from scratch (with a little copy&paste).
I saw in mormot's ddd folder some interesting classes. And the servbook ddd sample. But i see not really a red line to use it.
Is there a more complete sample e.g. servweb (as in your slideshow) to see how it can work ?
Hi Arnaud, we got a 0xc000005 in ExistsIniName, cause P was nil (Empty String assigned to PChar)
SynCommons - Line 29306ff
function ExistsIniName(P: PUTF8Char; UpperName: PAnsiChar): boolean;
var table: PNormTable;
begin
result := false;
table := @NormToUpperAnsi7;
if (P <> nil) and (P^<>'[') then // <<-- Add this pls
repeat
if P^=' ' then begin
repeat inc(P) until P^<>' '; // trim left ' '
if P^=#0 then
break;can you pls add this to repository - Many Thx
Hi AB,
the Export to SynCrossPlatform includes the Version Property from TRecordVersion as it is included in the RTTI.
What do you think will be better: Remove it from export or specify type TRecordVersion = int64 in SynCrossPlatform.pas ?
My Problem has to do with this Ticket
https://synopse.info/fossil/info/74e76e975a401
I know now Version is a sequential number. What do you think about using Version as Timestamp with high Resolution ?
Hi AB,
i have an old ORM with > 10 Tables and want to add Replication.
My idea was : Add TRecordVersion to every TSQLRecord - worked - but Version = null
I tried to Replicate all Tables on other Server with code like this:
TAutoFree.One(FMasterClient, TSQLHttpClientWinHTTP.Create(AnsiString(FMasterHostname), AnsiString(FMasterRESTPort), Model, FMasterUseHTTPS));
FMasterClient.IgnoreSSLCertificateErrors := true;
FMasterClient.Compression := [hcSynShaAes];
if FMasterClient.SetUser(cUsername, cPassword) then begin
DFLizenz.Database.RecordVersionSynchronizeSlave(TSQLRecord1, FMasterClient);
DFLizenz.Database.RecordVersionSynchronizeSlave(TSQLRecord2, FMasterClient);
DFLizenz.Database.RecordVersionSynchronizeSlave(TSQLRecord3, FMasterClient);
DFLizenz.Database.RecordVersionSynchronizeSlave(TSQLRecord4, FMasterClient);
DFLizenz.Database.RecordVersionSynchronizeSlave(TSQLRecord5, FMasterClient);
end;But nothing happend - then i thought (without reading your code)
set Version on Master to 1
But only TSQLRecord1 will be updatet then.
I think the Problem is that Verion on master is wrong initialized. I Think i have to set Version to a "unique" sequential ID or for every Table ?
or better can you enhance it to
DFLizenz.Database.RecordVersionSynchronizeSlave([TSQLRecord1, TSQLRecord2, TSQLRecord3, TSQLRecord4, TSQLRecord5], FMasterClient);
BR
Stefan
Hi AB in your Documentation is a "d" missing at the end of TSQLRecordTableDelete the Tables name is TSQLRecordTableDeleted
Can you pls integrate this in Repositorie ?
Hi AB
using my MVC Server i entered for testing reason the URL of a TMVCAction in my Browser and got Exception 0x0000000
Please change this function
function TInterfaceFactory.FindMethodIndex(const aMethodName: RawUTF8): integer;
begin
if (self=nil) or (aMethodName='') then
result := -1 else
if fMethodsCount<10 then begin
for result := 0 to fMethodsCount-1 do
if IdemPropNameU(fMethods[result].URI,aMethodName) then
exit;
result := -1;
end else
result := fMethod.FindHashed(aMethodName);
if (result<0) and (Length(aMethodName) > 0) and (aMethodName[1]<>'_') then /// <<<<---- added Length Control. aMethodName was = '' in my case and [1] caused the Exception !
result := FindMethodIndex('_'+aMethodName);
end;Thanks
Ok found a solution in setting ConnectionTimeOutMinutes to a value
Concerning to topic https://synopse.info/forum/viewtopic.php?id=4061
i made some modifications to my code and made the ConnectionProperties a Member of my ViewModel Class. so far so good (german so weit so gut
)
Now i made a few tests with TSQLDBZEOSConnectionProperties and have encountered the following problems. (Our Main Database is a MySQL Server !)
Scenario 1
Stop MySQL
Start Service
TSQLDBZEOSConnectionProperties.Create raises Exception - Could not find server. As WorkAround i programmed a function like this
property ConnectionProperties : TSQLDBConnectionProperties read GetConnectionProperties;
function TApplication.GetConnectionProperties: TSQLDBConnectionProperties;
function CreateConnectionProperties: TSQLDBConnectionProperties;
begin
try
exit(TSQLDBZEOSConnectionProperties.Create(TSQLDBZEOSConnectionProperties.URI(dMySQL, FHost + ':' + FPort), FDatabase, FUsername, FPassword));
except
end;
exit(nil);
end;
begin
if not Assigned(FConnectionProperties) then
FConnectionProperties := CreateConnectionProperties;
exit(FConnectionProperties);
end;Now the Properties are created if Server is startet - else nil is returned.
Scenario 2
Start MySQL
Start Service
Use Service's ConnectionProperties
After a while stop MySQL
Using the *ConnectionProperties.ExecuteInlined* returns "Lost Connection to MySQL Server during query" error as expected.
Now start MySQL again.
Now using *ConnectionProperties.ExecuteInlined* returns "MySQL Server has gone away"
Is there a Auto Reconnect Option ?
ty chaa and ab
you're right i have missed this part in your documentation.
I rewrote my code an allocate the Connection Properties at service Creation now.
Here is more information concerning the Exception EAccessViolation:
:7786b802 KERNELBASE.RaiseException + 0x62
mORMot.CallMethod(???)
mORMot.TServiceMethodExecute.RawExecute($463F8A4,0)
mORMot.TServiceMethodExecute.ExecuteJson((...),']',$2F3F9D0,False)
mORMot.TServiceFactoryServer.ExecuteMethod($352D460)
mORMot.ComputeResult
mORMot.TSQLRestServerURIContext.InternalExecuteSOAByInterface
mORMot.TSQLRestRoutingREST.ExecuteSOAByInterface
mORMot.TSQLRestServerURIContext.ExecuteCommand
mORMot.TSQLRestServer.URI($463FBD0)
mORMotHttpServer.TSQLHttpServer.Request($34676A8)
SynCrtSock.THttpServerGeneric.Request($34676A8)
SynCrtSock.THttpApiServer.Execute
Hi AB,
yesterday i solved a BUG in our mORMot Service and I'm not sure if it's a Berlin 10.2 BUG(Feature) or something in your mormot.pas:CallMethod Assembler Code. As it is not easy to make a demo i try to explain my observations and may be you have an idea.
We have a SOAP Interface Function like this
IDFMyService = interface(IInvokable)
...
function GetDetails(const AIDs : TIntegerDynArray) : RDetailsResult;the function GetDetails works like this in principle - We use this for a long time now
function <class>.GetDetails(const AIDs : TIntegerDynArray) : RDetailsResult;
var
LStmt : ISQLDBRows;
LConnection : TSQLDBConnectionProperties;
begin
FillChar(Result, SizeOf(Result), 0);
LConnection := CreateConnection;
if assigned(LConnection) then try
LStmt := LConnection.ExecuteInlined(<Any SQL>, True);
finally
FreeAndNil(LConnection);
end;
end;Using this function from Client sometimes throws Exception in line mormot.pas 57405:
procedure CallMethod(var Args: TCallMethodArgs);
....
call [esi].TCallMethodArgs.method
// retrieve result
mov cl, [esi].TCallMethodArgs.resKind <- ExceptionTo eliminate the Exception i had to set LStmt to nil after using it and before function end;
function <class>.GetDetails(const AIDs : TIntegerDynArray) : RDetailsResult;
var
LStmt : ISQLDBRows;
LConnection : TSQLDBConnectionProperties;
begin
FillChar(Result, SizeOf(Result), 0);
LConnection := CreateConnection;
if assigned(LConnection) then try
LStmt := LConnection.ExecuteInlined(<Any SQL>, True);
try
... Do something with LStmt
finally
LStmt := nil;
end;
finally
FreeAndNil(LConnection);
end;
end;I think there is something wrong with interface release stuff
what do you think
BR
Stefan
Hi AB Posting a TSQLRecord containing a BLOB (RawUtf8 without Index) we get the Error ORA 24816
we use TSQLDBZEOSConnectionProperties with dOracle
"ORA-24816: Expanded non LONG bind data supplied after actual LONG or LOB column"
Using the Rest Interface.
The Query mORMot generates is a standard SQL Query
insert into xxx (blobfield) values ('<500 Char String>')
If i defined
TSQLRecord
..
blobfield : RawUtf8;
..
if i modify with
blobfield : RawUtf8 index 500;
Everything works fine.
ATM this "workaround" is ok for me my field is smaller than 500 char.
Is there a better solution ?
Hi oz,
ty for your comment - but it is not the solution.
But i found and programmed one that fits for me atm.
first: The HTML Cache can be enabled and disabled with TMVCViewsMustacheParameters.FileTimestampMonitorAfterSeconds we had it set to 0 which enables the cache. Setting it to higher value than 0 lets mvc view control the file age and then reload if neccessary.
second: the partial files are loaded completely in memory on View initialization in TMVCViewsMustache.Create, there is a variable called fViewPartials which holds the partials.
here is no predefined option to disable it nor is the file age controlled.
I hard coded a reload of the partial files in DEBUG - Mode
SynMustache.pas:
TSynMustachePartials = class
protected
fList: TRawUTF8ListHashed;
fOwned: boolean;
function GetPartial(const PartialName: RawUTF8): TSynMustache;
{$if defined(DEBUG)}
public
fViewPartialFolder : RawUtf8;
{$endif}
public
....
function TSynMustachePartials.GetPartial(
const PartialName: RawUTF8): TSynMustache;
var i: integer;
begin
if self=nil then begin
result := nil;
exit;
end;
i := fList.IndexOf(PartialName);
if i<0 then
result := nil else
{$if defined(DEBUG)}
result := TSynMustache.Parse(AnyTextFileToRawUTF8(fViewPartialFolder+PartialName+'.partial', true));
{$else}
result := TSynMustache(fList.Objects[i]);
{$endif}
end;mORMotMVC:
...
// get partials
fViewPartials := TSynMustachePartials.Create;
{$if defined(DEBUG)}
fViewPartials.fViewPartialFolder := fViewTemplateFolder;
{$endif}
if FindFirst(fViewTemplateFolder+'*.partial',faAnyFile,SR)=0 then
...we are writing a bigger mvc service atm.
the develop workflow is not optimal cause of caching in mvc.
example:
1. write some delphi code
2. start debugger
3. look at pages and change some of the html/partial
4. reload in browser does show cached site
5. stop debugger
6. start debugger
7. reload browser (Sometimes have to relog)
8. look at new site
9. repeat at 3.
i think steps 3 to 9 could be faster 5,6 take a lot time if cache could be turned off. i would program it but don't know where.
br
Hi AB,
is it possible to turn the Caching of Default.html / partial FIles off. To easier test Modifications done to the files ?
I can not find any setting for this.
BR
TY i'll check it. Just to get a timestamp for the regression, it happened 28.2.2017 16:32)
Hi AB Today i found a regression in ExeVersion.ProgramName
Our EXE Name is: RestServer.Service.Exe as you can see it contains 2 DOT (.)
In one of the Former SynCommens the Following Code did the Right Thing and set ProgramName to : RestServer.Service
ProgramName := StringToUTF8(ExtractFileName(ProgramFileName));
i := length(ProgramName);
while i>0 do
if ProgramName[i]='.' then begin
SetLength(ProgramName,i-1);
break;
end else
dec(i);But actual (don't know exactly when you changed it) ProgramName is set to: RestServer missing the .Service by the following code:
ProgramName := Split(StringToUTF8(ExtractFileName(ProgramFileName)),'.');Please can you fix this ![]()
Solved - Firewall Setting on customer's side ![]()
To get more Information on that Phenomeon i installed Fiddler on my Client PC and now i found the source for the 404 Error
Normally the POST Request contain a URL e.g. Root/PortURL and the Data in the Body but in my case on that specific server the URL (and possibly the Body) is ripped away.
My Mormot Server is called with URL /
As Result it gives Answer 404 - Not Found to my POST - Request.
@AB - is there a possibility to Implement a LOG Entry in TSQLLog if such unhandled URL is requested ? I didn't found a place - i Think it is handled in http.sys. Another Idea could be to modify the not found Error Message (e.g. Adding a Servername or Hint) so i can see it is send from my Server..
Fiddler is great to debug cause it works with https (it can display the encrypted Packet by Injecting an own certificate locally
) (Man in the Middle ...)
But for no i think it is not a mormot Problem but its on my Customer's side.
No i testet again with USESYNCRT and get the same Result as with HTTP Client (I replaced InHead and InDataType with '' - hard coded
)
Result in OutHeader after POST Request.
'HTTP/1.1 404 Not Found'#$D#$A'Cache-Control: max-age=0, must-revalidate, private'#$D#$A'Connection: close'#$D#$A'Date: Sun, 29 Jan 2017 13:02:48 GMT'#$D#$A'Transfer-Encoding: chunked'#$D#$A'Content-Type: text/html; charset=us-ascii'#$D#$A'Server: Microsoft-HTTPAPI/2.0'#$D#$A'X-Cache-Control-Orig: '#$D#$A'X-Expires-Orig: None'#$D#$A#$D#$A
Does anybody have a Idea why this Server rejects my POST requests ?
Now i testet the SynCrossPlatform Http - Client with that Server.
With the HTTP Client the first 3 Steps work
1. GET ROOT/TimeStamp
2. GET ROOT/Auth=Username=...
3. GET ROOT/Auth=Username=...Password=...
But the 4. Command: PUT ROOT/..._contract_?session_signature=... gives the following Error:
'Cache-Control: max-age=0, must-revalidate, private'#$D#$A'Connection: close'#$D#$A'Date: Sun, 29 Jan 2017 12:52:59 GMT'#$D#$A'Transfer-Encoding: chunked'#$D#$A'Content-Type: text/html; charset=us-ascii'#$D#$A'Server: Microsoft-HTTPAPI/2.0'#$D#$A'X-Cache-Control-Orig: '#$D#$A'X-Expires-Orig: None'#$D#$A
May be there is a proxy between client and Server ?! Any IDEA ?
Today i testet SynCrossPlatform client with USESYNCRT Set. Using the TWinHTTP Client.
I got this Error from Server:
HTTP/1.0 400 '#$D#$A'Content-Type: text/html'#$D#$A#$D#$A
To generally test clients i wrote testpgm a time ago. And here i testet same TWinHTTP with same server url and it gives:
'HTTP/1.1 200 OK'#$D#$A'Date: Sun, 29 Jan 2017 11:57:55 GMT'#$D#$A'Content-Length: 12'#$D#$A'Content-Type: text/plain; charset=UTF-8'#$D#$A'Server: mORMot (Windows) Microsoft-HTTPAPI/2.0'#$D#$A'Set-Cookie: citrix_ns_id=y9HGJkkEtpEM9Wd5rMdbNUAj5MA0002; Domain=.XXXX; Path=/; HttpOnly'#$D#$A'X-Powered-By: mORMot 1.18 synopse.info'#$D#$A'Server-InternalState: 8'#$D#$A'Accept-Encoding: synlz,gzip'#$D#$A#$D#$A
Now i compared the Call of TWinHTTP.Request. Here is the Difference:
Not Working - as in standard SynCrossPlatform
Request(<Address>,'GET',20000,'content-type:text/plain','','text/plain',Loh,result);
Working - Using my test pgm
Request(<Address>,'GET',20000,'','','',Loh,result);
Leaving InHeader and InDataType Empty gives no Error.
I could not really explain this. if ERROR there is HTTP/1.0 on Success there is HTTP/1.1
Now i'll test Windows HTTP Client and iOS Version.
Hi Arnaud, we installed a mormot server at a customer on w2008r2 server mid last year.
The mormot server provides mvc view, rest and soa.
the server is reachable over a subdomain of our customer and uses https with valid certificate. we use port 443.
till approx. oktober everything worked fine.
Since oktober the syncrossplatform client gets error 404 connecting to the server.i tried all 3 clients, syncrt, indy and http. no success, but different error.
But if i use for example chrome or ie and enter the url the crossplatformclient uses the server gives answer as expected. for example contractid.
we want to contact the network specialist of our customer. but have no clue where can be the main difference between chrome and syncrossplatform.
He would say chrome works - so what...
The same mormot server / client works fine at many other customer. I think it may be a setting at the customers router/firewall our server is in Dmz.
do you have any idea/tip what to test ?
tyvm it works perfekt now...
ty i'll try
Hi AB the MVC Views can render .static data and views.
I have the Problem that we have to display thousands of dynamic Pictures in our View.
The Images are stored in the database.
Now i like to dynamically display images on my Client Site.
My Idea is to enhance the MVC View Renderer (InternalRunOnRestServer) with a kind of dynamic contents rendering.
For Example if URL start with .dynamic (like your .static) followed by some Text .dynamic/Pic1 then this Pic1 should be passed to a MVC function which can Return my Image Data.
The Other way would be to store the requested Images in .static/tmp subfolder but than i would have to care about garbage collection.
As other Option i have to check if the Client has the right to view the picture before sending it.
What do you think ?
I modfied the actual Version that it works. The Call to InitFast was executed if fInput = nil in former this was only if FInput neq nil
function TSQLRestServerURIContext.GetInputAsTDocVariant: variant;
var ndx: integer;
v: variant;
MultiPart: TMultiPartDynArray;
res: TDocVariantData absolute result;
begin
VarClear(result);
FillInput;
if fInput<>nil then begin
res.InitFast;
for ndx := 0 to (length(fInput) shr 1)-1 do begin
GetVariantFromJSON(pointer(fInput[ndx*2+1]),false,v,@JSON_OPTIONS[true]);
res.AddValue(fInput[ndx*2],v);
end
end else
if InputAsMultiPart(MultiPart) then begin
res.InitFast;
for ndx := 0 to high(MultiPart) do
with MultiPart[ndx] do
if ContentType=TEXT_CONTENT_TYPE then begin
// append as regular "Name":"TextValue" field
RawUTF8ToVariant(Content,v);
res.AddValue(Name,v);
end else
// append binary file as an object, with Base64-encoded data
res.AddValue(Name,_ObjFast(['data',BinToBase64(Content),
'filename',FileName,'contenttype',ContentType]));
end;
end;Calling
exec.ExecuteJson([fApplication.fFactoryEntry],pointer(fInput),WR,true)
with fInput set to 'null' Excepts with wrong Parameter
In new function the call to res.InitFast fills Result with 'null'
Hi i get error Message calling mvc view with latest version.
The error seem to be in mormot.pas:
function TSQLRestServerURIContext.GetInputAsTDocVariant: variant;
i replaced the function with former one and the mvc works as expected.
the Error is that
fInput in this call has the Value 'null' and not ''
mormotmvc - line 1484
if not exec.ExecuteJson([fApplication.fFactoryEntry],pointer(fInput),WR,true) then
the null is calculated with actual version of GetInputasTDocVariant.
here the older working funktion:
function TSQLRestServerURIContext.GetInputAsTDocVariant: variant;
var ndx: integer;
v: variant;
MultiPart: TMultiPartDynArray;
begin
VarClear(result);
FillInput;
if fInput<>nil then begin
with TDocVariantData(result) do begin
InitFast;
for ndx := 0 to (length(fInput) shr 1)-1 do begin
GetVariantFromJSON(pointer(fInput[ndx*2+1]),false,v,@JSON_OPTIONS[true]);
AddValue(fInput[ndx*2],v);
end;
end;
end else
if InputAsMultiPart(MultiPart) then
with TDocVariantData(result) do begin
InitFast;
for ndx := 0 to high(MultiPart) do
with MultiPart[ndx] do
if ContentType=TEXT_CONTENT_TYPE then begin
// append as regular "Name":"TextValue" field
RawUTF8ToVariant(Content,v);
AddValue(Name,v);
end else
// append binary file as an object, with Base64-encoded data
AddValue(Name,_ObjFast(['data',BinToBase64(Content),
'filename',FileName,'contenttype',ContentType]));
end;
end;