You are not logged in.
I tryed to serialize the DynArry as JSON but I get a Base64 string, I read the documentation but I don't understand how to do the conversion.
var json : RawUtf8;
inv : TSQLInvoice;
invDets : TInvoiceRecs;
begin
...
try
inv := := TSQLInvoice.CreateJoined(globalClient, fRec.ID);
invDets := inv.Details; <----------------- No Base64
TTextWriter.RegisterCustomJSONSerializer(TypeInfo(TInvoiceRecs), nil, nil);
json := DynArraySaveJSON(invDets, TypeInfo(TInvoiceRecs)); <--------------- Base64
finally
inv.free;
end;
...Another question :
I added a TSQLArticle property into TInvoiceRec and some others, that works fine when adding records but when I try to load/retrieve the article information I got AV, should I retrieve true instances like with FillPrepareMany for TSQLRecordMany?
type
TInvoiceRec = record
Ident: RawUTF8;
Article: TSQLArticle;
Qty : Double;
Amount: currency;
end;
TInvoiceRecs = array of TInvoiceRec;I'm on Delphi7.
Hi all,
I have the same Invoice class as in the documentation and I want to display the "Details: TInvoiceRecs" on a drawGrid, how can I do this ?
type
TInvoiceRec = record
Ident: RawUTF8;
Amount: currency;
end;
TInvoiceRecs = array of TInvoiceRec;
TSQLInvoice = class(TSQLRecord)
protected
fDetails: TInvoiceRecs;
fTotal: Currency;
procedure SetDetails(const Value: TInvoiceRecs);
published
property Details: TInvoiceRecs read fDetails write SetDetails;
property Total: Currency read fTotal;
end; I think that you've missed
SaveAsRawByteString(imgDocument.Picture,doc,gptJPG,80,1500);
ContattoRecord := TSQLContacts.Create;
try
ContattoRecord.Name = "something";
ContattoRecord.Lastname= "something";
ContattoRecord.Document := doc; <--------------------------------------
id := Database.Add(ContattoRecord, true);
if id > 0 then
begin
Database.UpdateBlob(TSQLContacts, id, 'Document', doc)
end;
finally
ContattoRecord.Free;
end;Ok AB it works now with TRawByteStringStream thnx,
BTW, the compilation error persists although I restarted the IDE and tryed to compile "01 - In Memory ORM" sample.
I forgot the MaxAllowedSize parameter then I put :
Report.SaveToStream(msStream);
msStream.seek(0,soBeginning);
msStream.Read(L,4);
ShowMessage(ReadStringFromStream(msStream, L));and I got an Out of memory here
function ReadStringFromStream(S: TStream; MaxAllowedSize: integer): RawUTF8;
var L: integer;
begin
result := '';
L := 0;
if (S.Read(L,4)<>4) or (L<=0) or (L>MaxAllowedSize) then
exit;
SetLength(Result,L); <--------------------- out of memory L = 1702240364
if S.Read(pointer(result)^,L)<>L then
result := '';
end;Hi AB,
It doesn't work for me
When I've updated the source with the latest one, I got this compilation error in syncommons.pas at line 25231
[Erreur fatale] SynCommons.pas(25231): Erreur interne : C3950I'm on D7 and win8
Sorry but it doesn't work for me, I've already an empty string !!
Hi,
I've a TMemorystream containing a fastreport file (xml) that I want to save onto a blob field but this code doesn't work
try
Stream := TMemoryStream.Create;
Stream.Position := 0;
Report.SaveToStream(Stream);
ShowMessage(ReadStringFromStream(Stream)); <--- Empty string although Stream.Size = 1828
finally
Stream.Free;
end;Hi AB,
I added two properties to TSQLRibbonTabParameters SQLWhere and FieldAlign
unit mORMot;
....
/// defines the settings for a Tab for User Interface generation
// - used in mORMotToolBar.pas unit and TSQLModel.Create() overloaded method
TSQLRibbonTabParameters = object
public
/// the Table associated to this Tab
Table: TSQLRecordClass;
/// the caption of the Tab, to be translated on the screen
// - by default, Tab name is taken from TSQLRecord.Caption(nil) method
// - but you can override this value by setting a pointer to a resourcestring
CustomCaption: PResStringRec;
/// the hint type of the Tab, to be translated on the screen
// - by default, hint will replace all %s instance by the Tab name, as taken
// from TSQLRecord.Caption(nil) method
// - but you can override this value by setting a pointer to a resourcestring
CustomHint: PResStringRec;
/// SQL fields to be displayed on the data lists
// 'ID,' is always added at the beginning
Select: RawUTF8;
/// SQL where to apply
SQLWhere : RawUTF8; <------------------------------
/// Tab Group number (index starting at 0)
Group: integer;
/// displayed field length mean, one char per field (A=1,Z=26)
// - put lowercase character in order to center the field data
FieldWidth: RawUTF8;
/// displayed field align, one char par field (r=Right, l=Left, c=Center)
FieldAlign: RawUTF8; <------------------------------
....unit mORMotToolBar;
......
constructor Create(aOwner: TComponent; aClient: TSQLRestClientURI;
aClass: TSQLRecordClass; aGrid: TDrawGrid; aIDColumnHide: boolean;
aPager: TSynPager; aImageList32,aImageList16: TImageList;
aOnButtonClick: TSQLListerEvent; aOnValueText: TValueTextEvent;
const aGridSelect: RawUTF8= '*'; const aGridSQLWhere: RawUTF8= ''; <---------------------------------------------
aHideDisabledButtons: boolean=false;
aHeaderCheckboxSelectsInsteadOfSort: Boolean=false); reintroduce; overload;
....
Constructor TSQLLister.Create(aOwner: TComponent; aClient: TSQLRestClientURI;
aClass: TSQLRecordClass; aGrid: TDrawGrid; aIDColumnHide: boolean;
aPager: TSynPager; aImageList32,aImageList16: TImageList;
aOnButtonClick: TSQLListerEvent; aOnValueText: TValueTextEvent;
const aGridSelect: RawUTF8= '*'; const aGridSQLWhere: RawUTF8= ''; <---------------------------------------------
aHideDisabledButtons: boolean=false;
aHeaderCheckboxSelectsInsteadOfSort: Boolean=false);
var T: TSQLTable;
begin
if (aClient=nil) or (aGridSelect='') then
T := nil else
T := aClient.List([aClass],aGridSelect, aGridSQLWhere); <---------------------------------------------
Create(aOwner,aClient,aClass,aGrid,aIDColumnHide,aPager,
aImageList32,aImageList16,aOnButtonClick,aOnValueText,T,aHideDisabledButtons,
aHeaderCheckboxSelectsInsteadOfSort);
end;
.................
constructor TSQLRibbonTab.Create(ToolBar: TSynPager; Body: TSynBodyPager;
aImageList32,aImageList16: TImageList; var aPagesShortCuts: TFreeShortCut;
const aTabParameters: TSQLRibbonTabParameters;
Client: TSQLRestClientURI; aUserRights: TSQLFieldBits;
aOnValueText: TValueTextEvent; SetAction: TSQLRibbonSetActionEvent;
const ActionsTBCaptionCSV, ActionsHintCaption: string; ActionIsNotButton: pointer;
aOnActionClick: TSQLListerEvent; ViewToolbarIndex: integer;
aHideDisabledButtons, aHeaderCheckboxSelectsInsteadOfSort: boolean);
......
begin
......
Lister := TSQLLister.Create(Page,Client,Table,List,not aTabParameters.ShowID,
Toolbar,aImageList32,aImageList16,aOnActionClick,aOnValueText,
'ID,'+aTabParameters.Select,aTabParameters.SQLWhere, <---------------------------------------------
aHideDisabledButtons,aHeaderCheckboxSelectsInsteadOfSort);
......
if TableToGrid<>nil then begin
TableToGrid.SetFieldLengthMean(U,actMark in Act, aTabParameters.FieldAlign); <---------------------------------------------
......
end;unit mORMotUI;
......
procedure SetFieldLengthMean(const Lengths: RawUTF8; aMarkAllowed: boolean; const Aligns: RawUTF8='');<---------------------------------------------
......
procedure TSQLTableToGrid.SetFieldLengthMean(const Lengths: RawUTF8; aMarkAllowed: boolean; const Aligns: RawUTF8='');
var L, i: integer;
c: AnsiChar;
Means: array of cardinal;
a: AnsiChar;<---------------------------------------------
begin
if self=nil then Exit;
fMarkAllowed := aMarkAllowed;
L := length(Lengths);
if L=0 then begin
SetLength(Means,Table.FieldCount);
for i := 0 to Table.FieldCount-1 do
Means[i] := 10; // some fixed width
end else
if Table.FieldCount=L then begin
SetLength(Means,L);
for i := 0 to L-1 do begin
c := Lengths[i+1];
if Aligns <> '' then <---------------------------------------------
begin <---------------------------------------------
a := Aligns[i+1]; <---------------------------------------------
case a of <---------------------------------------------
'l' : Aligned[i] := alLeft; <---------------------------------------------
'r' : Aligned[i] := alRight; <---------------------------------------------
'c' : Aligned[i] := alCenter; <---------------------------------------------
end; <---------------------------------------------
end <---------------------------------------------
else <---------------------------------------------
if c in ['a'..'z'] then begin
Aligned[i] := alCenter;
dec(c,32);
end;
Means[i] := ord(c)+(-ord('A')+1);
end;
Table.SetFieldLengthMean(Means);
end;
if aMarkAllowed then
Table.FieldLengthMeanIncrease(0,2); // space for Marked[] checkbox e.g.
end;But for the joined table fields I'm blocked here:
unit mORMot;
......
function TSQLRestClientURI.List(const Tables: array of TSQLRecordClass;
const SQLSelect, SQLWhere: RawUTF8): TSQLTableJSON;
var Resp, SQL: RawUTF8;
U: RawUTF8;
InternalState: cardinal;
props: TSQLModelRecordProperties; <---------------------------------------------
begin
result := nil;
if high(Tables)<0 then exit;
// GET Collection
props := Model.Props[Tables[0]]; <---------------------------------------------
SQL := props.SQL.SelectAllJoined; <---------------------------------------------
if SQL = '' then <---------------------------------------------
SQL := Model.SQLFromSelectWhere(Tables,SQLSelect,SQLWhere); <-------- SQLSelect='Name,Created,Modified,KeyWords,SignatureTime,joinedTable.Field1'
if high(Tables)=0 then begin
// one Table -> use REST protocol (SQL as parameters)
if not IsRowID(pointer(SQLSelect)) then
// ID selected by default
U := '?select='+UrlEncode(SQLSelect) else
U := '';
if SQLWhere<>'' then begin
if U<>'' then
U := U+'&where=' else
U := U+'?where=';
U := U+UrlEncode(SQLWhere);
end;
with URI(Model.URI[TSQLRecordClass(Tables[0])]+U,'GET',@Resp) do <--- I got 'no such column : JoinedTable.Field1' because the URI accept only one table
if Lo<>HTML_SUCCESS then
exit else
InternalState := Hi;
result := TSQLTableJSON.CreateFromTables([Tables[0]],SQL,Resp); // get data
end else begin
// multiple tables -> send SQL statement as HTTP body
with URI(Model.Root,'GET',@Resp,nil,@SQL) do
if Lo<>HTML_SUCCESS then
exit else
InternalState := Hi;
result := TSQLTableJSON.CreateFromTables(Tables,SQL,Resp); // get data
end;
result.fInternalState := InternalState;
end;thnx,
Is there a way to detect the existance of a joined field in the TSQLRibbonTabParameters.Select property and then embed automaticaly the whole content ?
Why there's not a TSQLRibbonTabParameters.SQLWhere property to add a filter if needed ?
Thx,
Hi,
I use TSQLRibbonTabParameters like in the MainDemo and I want to show some fields of the joined table instead of the ID.
I suppose that TSQLMemo has a property pointing joinedTable, is it possibile to do that :
(Table: TSQLMemo;
Select: 'Name,Created,Modified,KeyWords,SignatureTime,joinedTable.Field1,joinedTable.Field2'; Group: GROUP_CLEAR; FieldWidth: 'IddIdII'; Actions: DEF_ACTIONS)Thx,
The "globalClient" is an instance of a class derived from TSQLHttpClient and I run the code on the client like on the MainDemo.
I updated the source code and the these are the differences that I found :
http://synopse.info/fossil/info/4a0c549975
http://synopse.info/fossil/vinfo?name=9 … 57dbb37b0f
But the error is still here.
I switched to ODBC as you said, but I get the following error when I check the existence of a record and I try to create it if it does not exist:
'[HY000] [Microsoft][SQL Server Native Client 10.0]La connexion est occupée avec les résultats d'une autre commande (0)'This is my code
var jmouv : TSQLmsJMOUV;
begin
Result := True;
try
jmouv := TSQLmsJMOUV.CreateAndFillPrepare(globalClient, 'JO_NUM= ? AND JM_date = ?', [JO_NUM, DateToSQL(JM_date)]);
jmouv.FillOne;
if jmouv.JO_Num = '' then
begin
jmouv.fJO_Num := JO_NUM;
jmouv.fJM_Date := JM_date;
jmouv.fJM_Cloture := 0;
jmouv.fJM_Impression := 0;
globalClient.Add(jmouv, True); <==================== The error
end;
finally
jmouv.Free;
end;
end;Hi,
I've debug remotly the app on the client machine and the exception occurs here :
procedure TOleDBConnection.Connect;
var DataInitialize : IDataInitialize;
unknown: IUnknown;
Log: ISynLog;
begin
....
OleCheck(DataInitialize.GetDataSource(nil,CLSCTX_INPROC_SERVER,
pointer(OleDBProperties.ConnectionString),
IID_IDBInitialize,IUnknown(fDBInitialize))); <======================= 1st Exception
DataInitialize := nil;
// open the connection to the DB
OleDBCheck(fDBInitialize.Initialize); <======================= 2st Exception
....
end;After that I discovered that the sql native client for mssql 2008 was not installed on the client machine. I've installed the SNCLI10 and I got an other exception, this is the log file :
C:\Projets\bala\Comm2 1.0.0.0 (2014-03-22 11:14:12)
Host=OMNICLIENT User=bala CPU=1*0-15-1025 OS=4.2=5.2.3790 Wow64=0 Freq=3579545
Environment variables=ALLUSERSPROFILE=C:\Documents and Settings\All Users APPDATA=C:\Documents and Settings\bala\Application Data CLIENTNAME=ADELON ClusterLog=C:\WINDOWS\Cluster\cluster.log CommonProgramFiles=C:\Program Files\Fichiers communs COMPUTERNAME=OMNICLIENT ComSpec=C:\WINDOWS\system32\cmd.exe FP_NO_HOST_CHECK=NO HOMEDRIVE=C: HOMEPATH=\Documents and Settings\bala LOGONSERVER=\\OMNICLIENT MOZ_PLUGIN_PATH=C:\Program Files\Foxit Software\Foxit Reader\plugins\ NUMBER_OF_PROCESSORS=1 OS=Windows_NT Path=C:\PROGRA~1\Borland\REMOTE~1\7.0\Bin;C:\WINDOWS\system32;C:\WINDOWS;C:\WINDOWS\System32\Wbem;C:\Program Files\Microsoft SQL Server\80\Tools\Binn\ PATHEXT=.COM;.EXE;.BAT;.CMD;.VBS;.VBE;.JS;.JSE;.WSF;.WSH PROCESSOR_ARCHITECTURE=x86 PROCESSOR_IDENTIFIER=x86 Family 15 Model 4 Stepping 1, GenuineIntel PROCESSOR_LEVEL=15 PROCESSOR_REVISION=0401 ProgramFiles=C:\Program Files SESSIONNAME=RDP-Tcp#3 SystemDrive=C: SystemRoot=C:\WINDOWS TEMP=C:\DOCUME~1\bala\LOCALS~1\Temp\1 TMP=C:\DOCUME~1\bala\LOCALS~1\Temp\1 USERDOMAIN=OMNICLIENT USERNAME=bala USERPROFILE=C:\Documents and Settings\bala windir=C:\WINDOWS
TSQLLog 1.18 2014-03-22T11:22:52
20140322 11225240 + 000DEE6C SynSQLite3.TSQLDatabase.DBOpen (3438)
20140322 11225240 + TSQLDatabase(01007360).000DE67E SynSQLite3.TSQLDatabase.Execute (3077)
20140322 11225240 SQL PRAGMA cache_size=10000
20140322 11225240 - 00.001.948
20140322 11225240 - 00.003.580
20140322 11225240 + TSQLDatabase(01007360).000DE778 SynSQLite3.TSQLDatabase.Execute (3210)
20140322 11225240 SQL SELECT name FROM sqlite_master WHERE type='table' AND name NOT LIKE 'sqlite_%';
20140322 11225240 - 00.000.167
20140322 11225240 debug TSQLDatabase(01007360) TableNames=["Params"]
20140322 11225240 cache TSQLDatabase(01007360) not in cache
20140322 11225240 SQL TSQLRestServerDB(00F0B5A0) SELECT ID,Societe,CG_RegD,CG_RegC,myServer,myBDD,myUser,myPwd,myLibmySQL,msServer,msBDD,msUser,msPwd FROM Params; is no prepared statement
20140322 11225240 res TSQLDatabase(01007360) {"fieldCount":13,"values":["ID","Societe","CG_RegD","CG_RegC","myServer","myBDD","myUser","myPwd","myLibmySQL","msServer","msBDD","msUser","msPwd"],"rowCount":0}
20140322 11230615 + TOleDBConnection(00FE4108).00249576 SynOleDB.TOleDBConnection.Create (1975)
20140322 11230615 - 00.000.006
20140322 11230615 + TOleDBConnection(00FE4108).002492E4 SynOleDB.TOleDBConnection.Connect (1938)
20140322 11233024 ERROR "EOleDBException(01015C70)":"Erreur non spécifiée - (line 0): Fournisseur de canaux nommés : Impossible d'ouvrir une connexion à SQL Server [1326]. \r\n" stack trace API 00249BC7 SynOleDB.TOleDBConnection.OleDBCheck (2079) 002493C5 SynOleDB.TOleDBConnection.Connect (1954) 002959F8 Options.TOptionForm.btnmsSQLClick (170) 0006B656 Controls.TControl.Click 0006E408 Controls.TWinControl.WndProc 0006E540 Controls.DoControlMsg 0006E408 Controls.TWinControl.WndProc 0002837A Classes.StdWndProc
20140322 11233024 EXC EOleDBException ("Erreur non spécifiée - (line 0): Fournisseur de canaux nommés : Impossible d'ouvrir une connexion à SQL Server [1326]. \r\n") at 00249AAF SynOleDB.EnhancedTest (2073) stack trace API 000A6DC8 SynCommons.SynRtlUnwind (32354) 000039F0 System.@HandleOnException
20140322 11233024 ERROR "EOleDBException(01015C70)":"Erreur non spécifiée - (line 0): Fournisseur de canaux nommés : Impossible d'ouvrir une connexion à SQL Server [1326]. \r\n" stack trace API 002959F8 Options.TOptionForm.btnmsSQLClick (170) 0006B656 Controls.TControl.Click 0006E408 Controls.TWinControl.WndProc 0006E540 Controls.DoControlMsg 0006E408 Controls.TWinControl.WndProc 0002837A Classes.StdWndProc 0006E4EC Controls.TWinControl.DefaultHandler
20140322 11233024 EXC EOleDBException ("Erreur non spécifiée - (line 0): Fournisseur de canaux nommés : Impossible d'ouvrir une connexion à SQL Server [1326]. \r\n") at 00249AAF SynOleDB.EnhancedTest (2073) stack trace API 000A6DC8 SynCommons.SynRtlUnwind (32354) 000039F0 System.@HandleOnException I forgot that mssql server used named pipe, TCP/IP and shared memory
This is the log file after adding .map file to the exe :
C:\Projets\bala\Comm2.exe 1.0.0.0 (2014-03-21 09:42:14)
Host=OMNICLIENT User=bala CPU=1*0-15-1025 OS=4.2=5.2.3790 Wow64=0 Freq=3579545
Environment variables=ALLUSERSPROFILE=C:\Documents and Settings\All Users APPDATA=C:\Documents and Settings\bala\Application Data CLIENTNAME=ADELON ClusterLog=C:\WINDOWS\Cluster\cluster.log CommonProgramFiles=C:\Program Files\Fichiers communs COMPUTERNAME=OMNICLIENT ComSpec=C:\WINDOWS\system32\cmd.exe FP_NO_HOST_CHECK=NO HOMEDRIVE=C: HOMEPATH=\Documents and Settings\bala LOGONSERVER=\\OMNICLIENT MOZ_PLUGIN_PATH=C:\Program Files\Foxit Software\Foxit Reader\plugins\ NUMBER_OF_PROCESSORS=1 OS=Windows_NT Path=C:\WINDOWS\system32;C:\WINDOWS;C:\WINDOWS\System32\Wbem PATHEXT=.COM;.EXE;.BAT;.CMD;.VBS;.VBE;.JS;.JSE;.WSF;.WSH PROCESSOR_ARCHITECTURE=x86 PROCESSOR_IDENTIFIER=x86 Family 15 Model 4 Stepping 1, GenuineIntel PROCESSOR_LEVEL=15 PROCESSOR_REVISION=0401 ProgramFiles=C:\Program Files SESSIONNAME=RDP-Tcp#3 SystemDrive=C: SystemRoot=C:\WINDOWS TEMP=C:\DOCUME~1\bala\LOCALS~1\Temp\1 TMP=C:\DOCUME~1\bala\LOCALS~1\Temp\1 USERDOMAIN=OMNICLIENT USERNAME=bala USERPROFILE=C:\Documents and Settings\bala windir=C:\WINDOWS
TSQLLog 1.18 2014-03-21T09:51:36
20140321 09513636 + 000DEE6C SynSQLite3.TSQLDatabase.DBOpen (3438)
20140321 09513636 + TSQLDatabase(01007360).000DE67E SynSQLite3.TSQLDatabase.Execute (3077)
20140321 09513636 SQL PRAGMA cache_size=10000
20140321 09513636 - 00.000.512
20140321 09513636 - 00.000.908
20140321 09513636 + TSQLDatabase(01007360).000DE778 SynSQLite3.TSQLDatabase.Execute (3210)
20140321 09513636 SQL SELECT name FROM sqlite_master WHERE type='table' AND name NOT LIKE 'sqlite_%';
20140321 09513636 - 00.000.164
20140321 09513636 debug TSQLDatabase(01007360) TableNames=["Params"]
20140321 09513636 cache TSQLDatabase(01007360) not in cache
20140321 09513636 SQL TSQLRestServerDB(00F0B5A0) SELECT ID,Societe,CG_RegD,CG_RegC,myServer,myBDD,myUser,myPwd,myLibmySQL,msServer,msBDD,msUser,msPwd FROM Params; is no prepared statement
20140321 09513636 res TSQLDatabase(01007360) {"fieldCount":13,"values":["ID","Societe","CG_RegD","CG_RegC","myServer","myBDD","myUser","myPwd","myLibmySQL","msServer","msBDD","msUser","msPwd"],"rowCount":0}
20140321 09515145 + TOleDBConnection(00FE4108).00249576 SynOleDB.TOleDBConnection.Create (1975)
20140321 09515145 - 00.000.006
20140321 09515145 + TOleDBConnection(00FE4108).002492E4 SynOleDB.TOleDBConnection.Connect (1938)
20140321 09515158 EXC EOleSysError 80040154 ("Classe non enregistrée") at 001649E9 ComObj.OleError stack trace API 000AE330 SynCommons.SynRtlUnwind (32354) 000039F0 System.@HandleOnException
20140321 09515158 ERROR "EOleSysError(01C1C780)":"Classe non enregistrée" stack trace API 002959F8 Options.TOptionForm.btnmsSQLClick (170) 0006B656 Controls.TControl.Click 0006E408 Controls.TWinControl.WndProc 0006E540 Controls.DoControlMsg 0006E408 Controls.TWinControl.WndProc 0002837A Classes.StdWndProc 0006E4EC Controls.TWinControl.DefaultHandler
20140321 09515158 EXC EOleSysError 80040154 ("Classe non enregistrée") at 001649E9 ComObj.OleError stack trace API 000AE330 SynCommons.SynRtlUnwind (32354) 000039F0 System.@HandleOnException Yes I've updated to the latest unstable version but the problem persists.
Here's the log file :
C:\Projets\bala\Comm2.exe 1.0.0.0 (2014-03-20 17:26:14)
Host=OMNICLIENT User=bala CPU=1*0-15-1025 OS=4.2=5.2.3790 Wow64=0 Freq=3579545
Environment variables=ALLUSERSPROFILE=C:\Documents and Settings\All Users APPDATA=C:\Documents and Settings\bala\Application Data CLIENTNAME=ADELON ClusterLog=C:\WINDOWS\Cluster\cluster.log CommonProgramFiles=C:\Program Files\Fichiers communs COMPUTERNAME=OMNICLIENT ComSpec=C:\WINDOWS\system32\cmd.exe FP_NO_HOST_CHECK=NO HOMEDRIVE=C: HOMEPATH=\Documents and Settings\bala LOGONSERVER=\\OMNICLIENT MOZ_PLUGIN_PATH=C:\Program Files\Foxit Software\Foxit Reader\plugins\ NUMBER_OF_PROCESSORS=1 OS=Windows_NT Path=C:\WINDOWS\system32;C:\WINDOWS;C:\WINDOWS\System32\Wbem PATHEXT=.COM;.EXE;.BAT;.CMD;.VBS;.VBE;.JS;.JSE;.WSF;.WSH PROCESSOR_ARCHITECTURE=x86 PROCESSOR_IDENTIFIER=x86 Family 15 Model 4 Stepping 1, GenuineIntel PROCESSOR_LEVEL=15 PROCESSOR_REVISION=0401 ProgramFiles=C:\Program Files SESSIONNAME=RDP-Tcp#1 SystemDrive=C: SystemRoot=C:\WINDOWS TEMP=C:\DOCUME~1\bala\LOCALS~1\Temp\1 TMP=C:\DOCUME~1\bala\LOCALS~1\Temp\1 USERDOMAIN=OMNICLIENT USERNAME=bala USERPROFILE=C:\Documents and Settings\bala windir=C:\WINDOWS
TSQLLog 1.18 2014-03-20T17:29:17
20140320 17291716 + 004DFE6C
20140320 17291716 + TSQLDatabase(01007360).004DF67E
20140320 17291716 SQL PRAGMA cache_size=10000
20140320 17291716 - 00.006.187
20140320 17291716 - 00.007.715
20140320 17291716 + TSQLDatabase(01007360).004DF778
20140320 17291716 SQL SELECT name FROM sqlite_master WHERE type='table' AND name NOT LIKE 'sqlite_%';
20140320 17291716 - 00.000.164
20140320 17291716 debug TSQLDatabase(01007360) TableNames=["Params"]
20140320 17291716 cache TSQLDatabase(01007360) not in cache
20140320 17291716 SQL TSQLRestServerDB(00F0B5A0) SELECT ID,Societe,CG_RegD,CG_RegC,myServer,myBDD,myUser,myPwd,myLibmySQL,msServer,msBDD,msUser,msPwd FROM Params; is no prepared statement
20140320 17291716 res TSQLDatabase(01007360) {"fieldCount":13,"values":["ID","Societe","CG_RegD","CG_RegC","myServer","myBDD","myUser","myPwd","myLibmySQL","msServer","msBDD","msUser","msPwd"],"rowCount":0}
20140320 17300157 + TOleDBConnection(00FE4038).0064A576
20140320 17300157 - 00.000.006
20140320 17300157 + TOleDBConnection(00FE4038).0064A2E4
20140320 17300207 EXC EOleSysError 80040154 ("Classe non enregistrée") at 005659E9 stack trace API 004AF330 004049F0
20140320 17300207 ERROR "EOleSysError(01C49B30)":"Classe non enregistrée" stack trace API 004B0E7E 004B0266 006969F8 0046C656 0046F408 0046F540 0046F408 0042937A 77F4B6E3 77F4B874 77F4C2D3 77F4C337 77E489F7 77E48AD9 77E4ADDE 77F4B6E3 77F4B874 77F4BFCE 77F60463 0046F4EC
20140320 17300207 EXC EOleSysError 80040154 ("Classe non enregistrée") at 005659E9 stack trace API 004AF330 004049F0 The server is windows 2008 and the client is windows7.
The version of oleDb dll is 6.1.96.
The class name that I got is EOleSysError.
For the n-Tier architecture I will switch to it later, it is juste because my app is not yet OK and I must install it for testing.
Here's my code for testing connection :
procedure TOptionForm.btnmsSQLClick(Sender: TObject);
var PropsMS : TOleDBMSSQL2008ConnectionProperties;
Conn: TSQLDBConnection;
begin
try
try
PropsMS := TOleDBMSSQL2008ConnectionProperties.Create(edtmsServer.Text, edtmsBdd.Text, edtmsUser.Text, edtmsPwd.Text);
Conn := PropsMS.NewConnection;
Conn.Connect;
ShowMessage('Connexion OK');
Except
on E : Exception do
ShowMessage('Connexion impossible au '+ edtmsServer.Text +'\'+ edtmsBdd.Text + #10#13+
'Exception class = '+E.ClassName + #10#13+
'Exception message = '+E.Message);
end;
finally
Conn.free;
PropsMS.Free;
end;
end;How can I know ?
I've tested this http://blogs.msdn.com/b/support_sql_fra … -bits.aspx
and all is OK.
Hi,
If I launch my app on the server it makes connection fine, but if I launch it on a client machine it doesn't.
What I don't understand is that I've another app making connection fine via ADO component and OLEDB !!
What I'm missing here ?
N.B: The client and the server are on the same domaine.
I got an Unregistred Class exception.
This is great.
Thnx,
I use the MapField() right.On the external mysql table I've ID field and I've mapped it into myID field of the internal table.
That is what I do :
aProps := TSQLDBZeosConnectionProperties.Create(TSQLDBZeosConnectionProperties.URI(dMySQL, myServer, 'libmysql.dll', False),
myDB, myUser, myPwd);
VirtualTableExternalRegister(globalModel, TSQLmyTable, aProps, 'TableExternal');
globalModel.Props[TSQLmyTable].ExternalDB.MapField('myID', 'ID');All this works fine and I retreive the varchar250 key, but I got error when I try to update one record on the external table via varchar250 key.
globalClient.EngineExecute('UPDATE myTABLE SET FIELD1 = VAL1 WHERE ID='+ Varchar250key);Hi,
Is it possible to reset the ID after this ?
globalClient.EngineExecute('delete from table');The table is temporary and I want to start new IDs after a delete.
I've tested the mapping feature and it works fine like that
globalModel.Props[TSQLmyTable].ExternalDB.MapField('mySQLID', 'ID');But I get the 'no such column:ID' error when I try this update
:
globalClient.EngineExecute('UPDATE myTABLE SET FIELD1 = VAL1 WHERE ID='+ Varchar250key);Well, I begin to understand the philosophy of fieldWidth.
We must have the same number of letters that fields if we want it to work.
The width of the field is calculated according to the ord value of the letter, and the alignment is Left if uppercase and center if lowercase, but nothing for the right one.
I think it is better to have another parameter FieldAlign: 'lrc' with l: Left, r: Rigth and c: Center.
In the meantime I replaced the alCenter by alRight in SetFieldLengthMean because I do not need it.
What do you think AB ?
I solved the precision display by adding another RawUTF8 field that contains the correct string to display.
Thnx,
Hi,
I want to set the column widths and I can not understand how does this syntax:
fieldWidth : 'IddId'I also want to align double and currency fields to the right with an accuracy of 2.
Thnx,
After i18n i got a stackoverflow when :
StrToFloat(table.GetS(X, 1))The field 1 on the table is a double.
Which conversion function we must use without i18n ?
Great I've convert the file into ANSI and it works fine now.
There's somethings that doesn't work. The resourcestrings was not extracted into .messages !
Hi AB,
I used the USEFORMCREATEHOOK and it works but there is one issue with french è, é, à ....
e.i: Société is written like that: http://105.157.31.10:8888/mormot.png
Hi,
First I've extracted all ressources and the .messages file was created then I've created a new file myapp.FR with some strings translation and set the language to FR
procedure TMainForm.FormShow(Sender: TObject);
begin
{$ifdef EXTRACTALLRESOURCES}
ExtractAllResources(
// first, all enumerations to be translated
[TypeInfo(TFileEvent),TypeInfo(TFileAction){,TypeInfo(TPreviewAction)}],
// then some class instances (including the TSQLModel will handle all TSQLRecord)
[globalClient.Model],
// some custom classes or captions
[],[]);
Close;
{$else}
i18nLanguageToRegistry(lngFrench);
{$endif}
Ribbon.ToolBar.ActivePageIndex := 0;
i18nDateText := Iso2S;
end;When I launch the project, the UI still not localized neither translated into french !
Hi,
this is an example for connecting to MSSQL via OLE and virtual table :
uses SynOleDB, ....;
...
var aPropsMS : TOleDBMSSQL2008ConnectionProperties;
Model : TSQLModel;
...
aPropsMS := TOleDBMSSQL2008ConnectionProperties.Create(server, database, user, pwd);
Model := TSQLModel.Create([TSQLCLASS]);
VirtualTableExternalRegister(Model, TSQLCLASS, aPropsMS, 'MS_TABLE_NAME');
CreateMissingTables(0);You can explore the code of 15 - External DB performance.
Ooops I did not saw the post of AB.
I can send you the whole project but by private email if you wish.
I've marked the incoherent records then modify the NewDrawCellBackground to color marked when MARKEDROWSCOLORED is defined
{$define MARKEDROWSCOLORED}
// if defined, all Marked[] rows are highligted with a different background color
procedure NewDrawCellBackground(Sender: TObject; ACol, ARow: Integer;
Rect: TRect; State: TGridDrawState;
{$ifdef USETMSPACK} TabAppearance: TTabAppearance;{$endif} Marked: boolean);
var Grid: TDrawGrid absolute Sender;
begin
if not Sender.InheritsFrom(TDrawGrid) then
exit;
{$ifdef USETMSPACK}
if TabAppearance<>nil then
with TabAppearance, Grid.Canvas do begin
Font := Grid.Font;
if (gdFixed in State) then begin
Brush.Color := BackGround.Color;
Font.Color := TextColor;
Pen.Color := ShadowColor;
inc(Rect.Bottom,1);
MoveTo(Rect.Right,Rect.Top);
LineTo(Rect.Right,Rect.Bottom);
end else
if Marked then
if (gdSelected in State) then begin
Brush.Color := HighLightColorSelected;
Font.Color := TextColorHot;
end else
Brush.Color := HighLightColor else
if (gdSelected in State) then begin
Brush.Color := ColorHot;
Font.Color := TextColorHot;
end else
Brush.Color := ColorTo;
{$else}
with Grid.Canvas do begin
Font := Grid.Font;
if gdFixed in State then begin
Font.Color := clCaptionText;
Brush.Color := clGradientInactiveCaption;
Pen.Color := clGrayText;
inc(Rect.Bottom,1);
MoveTo(Rect.Right,Rect.Top);
LineTo(Rect.Right,Rect.Bottom);
end else
{$IFDEF MARKEDROWSCOLORED}
if Marked then
begin
Brush.Color := clLime;
Font.Color := clWindowText;
end
else
if (gdSelected in State) then begin
Font.Color := clHighlightText;
Brush.Color := clHighlight;
end else begin
Font.Color := clWindowText;
Brush.Color := clWindow;
end;
{$else}
if (gdSelected in State) then begin
Font.Color := clHighlightText;
Brush.Color := clHighlight;
end else begin
Font.Color := clWindowText;
Brush.Color := clWindow;
end;
{$ENDIF}
{$endif}
FillRect(Rect);
end;
end;Is it possible to have a global clMarked variable to be able to change it ?
Hi ab,
I just use FastMM4 in full debugg mode and EA has vanished without any memory leak !?
There are somethings wrong
Hi all,
I got this AV when freeing my server.
---------------------------
Application Error
---------------------------
Exception EAccessViolation in module ntdll.dll at 0001E12C.
Access violation at address 76F5E12C in module 'ntdll.dll'. Write of address 00000014.
---------------------------
OK
---------------------------The AV occurs exactly here :
destructor THttpApiServer.Destroy;
var i: integer;
begin
if (fClones<>nil) and (Http.Module<>0) then begin // fClones=nil for clone threads
if fReqQueue<>0 then begin
if Http.Version.MajorVersion>1 then begin
if fUrlGroupID<>0 then begin
Http.RemoveUrlFromUrlGroup(fUrlGroupID,nil,HTTP_URL_FLAG_REMOVE_ALL);
Http.CloseUrlGroup(fUrlGroupID);
end;
CloseHandle(FReqQueue);
if fServerSessionID<>0 then
Http.CloseServerSession(fServerSessionID);
end else begin
for i := 0 to high(fRegisteredUnicodeUrl) do
Http.RemoveUrl(fReqQueue,pointer(fRegisteredUnicodeUrl[i]));
CloseHandle(fReqQueue); // will break all THttpApiServer.Execute
end;
fReqQueue := 0;
Http.Terminate(HTTP_INITIALIZE_SERVER);
end;
FreeAndNil(fClones);
end;
inherited Destroy; <=================================== AV here
end;The server is created here :
Server := TSQLHttpServer.Create(SERVER_HTTP_PORT,self,'+',useHttpApiRegisteringURI);and freed on the destroy :
FreeAndNil(Server);All that like the maindemo of synFile.
I don't know what I'm doing wrong here.
In this case I'll use
globalClient.EngineExecute('UPDATE TABLE SET FIELD1 = VAL1 WHERE ID='+ Varchar250key)thnx,
Great work Arnaud,
I'll test the mapping functionnality later.
I think that the easy way is to map the Varchar250 key into a RawUTF8 field (<> SQLite ID) and then specify it for the update/delete operations.
Merci beaucoup
I know but I can't modify the table structure. How can I get around this problem ?
My idea is to have a computed class property on delphi that copy the content of the mySQL ID for using it later.
Is there a way to have this?
Thnx,
Hi Arnaud,
I have the same problem with a mySql table that have 'ID' like this `id` varchar(250) NOT NULL.
when I get the records, the ID only takes integers from the start until it finds an alpha char of the mySQL ID field.
Example :
mySQL_ID = 1213E30377
SQLite_ID = 1213How I can retrieve the entire primary key in order to change the record?
Thnx,
Ok, good news.
Thank you ab.
I found TSQLRibbonTab.TableToGrid.DrawGrid and I'll use the mark option to draw incoherent records with red color.
Thanks,
I've emplemented the Server.HttpServer.OnHttpThreadTerminate notification to call this as indicated :
aPropsMS.EndCurrentThread;but I got a serious AV
---------------------------
Application Error
---------------------------
Exception EAccessViolation in module project1.exe at 000043B8.
Access violation at address 004043B8 in module 'project1.exe'. Read of address 49776F2E.
---------------------------
OK
---------------------------
I confess that I have trouble understanding how mORMot works.
Thnx,
Hi,
I'm creating the UI at run-time with the same code on the main demo with TSQLRibbon and I want to retrieve the draw grid associated to a TSQLRecord sub-class to have the possibility to draw some incoherent records with red color.
What I need is exactly the opposite of this function :
class function From(Grid: TDrawGrid): TSQLTableToGrid;How can'I do that ?
Thanks,
The server is created/freed on the main form and the TOleDBMSSQL is created/freed on the server.
I think they are on the same thread.
aPropsMS := TOleDBMSSQL2008ConnectionProperties.Create('127.0.0.1', 'MSDB', 'sa', '');and
FreeAndNil(aPropsMS);All on the same unit.
the create is on the server.create and the freeAndNil on the Server.Destroy.
I don't use the interface-based services.
Hi,
I got this exception when I try to freeing a TOleDBMSSQL2008ConnectionProperties :
'You should call TOleDBConnection.Free from the same thread which called its Create: i.e. call MyProps.EndCurrentThread from an THttpServerGeneric.OnHttpThreadTerminate event - see ticket 213544b2f5 I saw the ticket but I don't understand what's wrong.
Thnx.
Good news
Ok, I'll add the ID to the virtual table and waiting for the ID field mapping feature.
thnx
Hi,
I've mapped an existing mssql table that have primary key field 'NUM'. I want to force mORMot to use this field as its internal 'ID' because I can't create 'ID' field and want to continue incremental of 'NUM'.
Is this possible or not?
Thx.