You are not logged in.
Pages: 1
I find the reason, in the class definition cannot include a 'user' name
TSQLcrm_customer = class(TSQLRecord)
private
fname: RawUTF8;
factive: boolean;
fphone1: RawUTF8;
fphone2: RawUTF8;
fmobile: RawUTF8;
faddress: RawUTF8;
fcreate_uid: integer;
fcreate_date: TCreateTime;
fwrite_uid: integer;
fwrite_date: TModTime;
published
property name: RawUTF8 index 32 read fname write fname;
property active: boolean index 32 read factive write factive;
property phone1: RawUTF8 index 32 read fphone1 write fphone1;
property phone2: RawUTF8 index 32 read fphone2 write fphone2;
property mobile: RawUTF8 index 32 read fmobile write fmobile;
property address: RawUTF8 index 1024 read faddress write faddress;
property create_uid: integer read fcreate_uid write fcreate_uid;
property create_date: TCreateTime read fcreate_date write fcreate_date;
property write_uid: integer read fwrite_uid write fwrite_uid;
property write_date: TModTime read fwrite_date write fwrite_date;
end;
why this success ? this in 'name';
I change 'name' to 'name2' same error
I Test it,
I change TSQLres_shop to TSQLres_shop2 success ,pls check table name
why res_shop as table name in mysql or ms sql error ?
TSQLres_shop = class(TSQLRecord)
private
fname: RawUTF8;
factive: boolean;
fcode: RawUTF8;
fuser: RawUTF8;
fpassword: RawUTF8;
fphone: RawUTF8;
ffax: RawUTF8;
faddress: RawUTF8;
fzip: RawUTF8;
fplatform_id: integer;
fcreate_uid: integer;
fcreate_date: TCreateTime;
fwrite_uid: integer;
fwrite_date: TModTime;
published
property name: RawUTF8 index 32 read fname write fname;
property active: boolean read factive write factive;
property code: RawUTF8 index 16 read fcode write fcode;
property user: RawUTF8 index 32 read fuser write fuser;
property password: RawUTF8 index 32 read fpassword write fpassword;
property phone: RawUTF8 index 32 read fphone write fphone;
property fax: RawUTF8 index 32 read ffax write ffax;
property address: RawUTF8 index 1024 read faddress write faddress;
property zip: RawUTF8 index 20 read fzip write fzip;
property platform_id: integer read fplatform_id write fplatform_id;
property create_uid: integer read fcreate_uid write fcreate_uid;
property create_date: TCreateTime read fcreate_date write fcreate_date;
property write_uid: integer read fwrite_uid write fwrite_uid;
property write_date: TModTime read fwrite_date write fwrite_date;
end;
this in ms SQL error,
Error SQLITE ERROR(1) using 3.8.9-'TSQLRestStorageExternal.Crete:unable to create external missing
field dbo.res.shop.name-SQL="ALTER TABLE dbo.res_shop ADD name nvarchar(32)"' extended_errcode=1.
I set :memory: mode. then I Create two Fields,insert 800000 records.
I found the memory consumption of 1.4G. Is this normal?
I Study DDD, I found that you can not use it, can show a simple CRUD of Code?
thank your reply
Hi Arnaud,
When do you expect to use DDD? I can't wait to use it ^.^
thank your reply, Looking forward to the upcoming DDD!!!
TSQLRecord.CreateAndFillPrepareJoined() method
this olny get ListOfMain[].Company_ID.name but no get ListOfMain[].Company_ID.Create_uID.Login
Can you give Simaple? thank you
I'm confused, multi table Association, I would like to have these table correlation data statistics, found a lot of trouble, I do not know the author have what good way, can fill them
For example:
TSQLRes_Users = class;
TSQLRecordTimeStamped = class(TSQLRecord)
private
fCreate_Date: TCreateTime;
fWrite_Date: TModTime;
fWrite_uID: TSQLRes_Users;
fCreate_uID: TSQLRes_Users;
published
property Create_Date: TCreateTime read fCreate_Date write fCreate_Date;
property Write_Date: TModTime read fWrite_Date write fWrite_Date;
property Write_uID: TSQLRes_Users read fWrite_uID write fWrite_uID;
property Create_uID: TSQLRes_Users read fCreate_uID write fCreate_uID;
end;
TSQLRes_Company = class(TSQLRecordTimeStamped)
private
fName: RawUTF8;
fFax: RawUTF8;
fZip: RawUTF8;
fStreet2: RawUTF8;
fbic: RawUTF8;
fPhone: RawUTF8;
fState: RawUTF8;
fStreet: RawUTF8;
fActive: boolean;
fEmail: RawUTF8;
published
property Name: RawUTF8 read fName write fName;
property Fax: RawUTF8 read fFax write fFax;
property Zip: RawUTF8 read fZip write fZip;
property Street2: RawUTF8 read fStreet2 write fStreet2;
property bic: RawUTF8 read fbic write fbic;
property Phone: RawUTF8 read fPhone write fPhone;
property State: RawUTF8 read fState write fState;
property Street: RawUTF8 read fStreet write fStreet;
property Active: boolean read fActive write fActive;
property Email: RawUTF8 read fEmail write fEmail;
end;
TSQLRes_Users = class(TSQLRecordTimeStamped)
private
fActive: boolean;
fLogin: RawUTF8;
fPassword: RawUTF8;
fCompany_ID: TSQLRes_Company;
fLogin_Date: TDateTime;
fSignature: RawUTF8;
fPassword_Crypt: RawUTF8;
fShare: boolean;
fEan13: RawUTF8;
public
procedure SetPlainPassword(const PlainPassword: RawUTF8);
function CheckPlainPassword(const PlainPassword: RawUTF8): boolean;
published
property Active: boolean read fActive write fActive;
property Login: RawUTF8 index 32 read fLogin write fLogin;
property Password: RawUTF8 index 64 read fPassword write fPassword;
property Company_ID: TSQLRes_Company read fCompany_ID write fCompany_ID;
property Login_Date: TDateTime read fLogin_Date write fLogin_Date;
property Signature: RawUTF8 read fSignature write fSignature;
property Password_Crypt: RawUTF8 index 32 read fPassword_Crypt
write fPassword_Crypt;
property Share: boolean read fShare write fShare;
property Ean13: RawUTF8 read fEan13 write fEan13;
end;
I Create
ListOfMain: TObjectList<TSQLRes_Users>;
I want To Show ListOfMain[].Company_ID.Create_uID.Login,
What should I do?
Do you any solution to correct transaction handling with that much data?
thank
First of all, thank the authors, I learn in your program, I would like to ask a question
Does TSQLRestServerURIPagingParameters support across the table? Like CreateAndFillPrepareJoined ?
thanks you
Do you add funtion?
The following is paging query SQL,I want to Exe SQL by ExecuteList,Can Do?
function GetPageSQL(Tablename,KeyField:string;PageSize,PageIndex:Integer;GetFields:string='*';WhereStr:string='';OrderType:Integer=0):string;
function GetPageSQL(Tablename, KeyField:string;PageSize,PageIndex:Integer;
GetFields: string;WhereStr:string; OrderType: Integer): string;
var
OrderStr,str:string;
begin
Result:='';
if OrderType=0 then
begin
str:='>(select max';
OrderStr:=' order by '+KeyField;
end
else
begin
OrderStr:=' order by '+KeyField+' DESC';
str:=' <(select min';
end;
if PageIndex=1 then
Result:='SELECT TOP '+IntToStr(PageSize)+' '+GetFields+' FROM '+TableName+' '+WhereStr+' '+OrderStr
else
begin
Result:='SELECT TOP '+IntTostr(PageSize)+' '+GetFields+' FROM '+TableName;
if WhereStr<>'' then Result:=Result+' '+WhereStr+' and '
else Result:=Result+' where ';
Result:=Result+KeyField+' '+str+'('+KeyField+') FROM (SELECT TOP '+IntTostr((PageIndex-1)*PageSize)+' '
+KeyField+' FROM '+tableName;
if WhereStr<>'' then Result:=Result+' '+WhereStr+' '+OrderStr+') as tblTmp)'+OrderStr
else Result:=Result+' '+OrderStr+') as tblTmp)'+OrderStr;
end;
end;
As I need the row count for the UI I'll go with a separate SQL query.
I just learn the framework, do not know how to achieve
with the URL parameters:
- select=someselect
- where=wherestatement
- sort=sortstatement
- startindex=startindexstament
- results=resultstatement
- dir=DESC will add the DESC statement
This seems to Web UI
dSQLite, dFirebird, dPostgreSQL, dMySQL,dMSSQL, dDB2:
Less of 'dMSSQL'
fConnectionProps := TSQLDBUniDACConnectionProperties.Create
(TSQLDBUniDACConnectionProperties.URI(dMSSQL, HostPort), m_dbinfo.dbname,
m_dbinfo.dbUser, m_dbinfo.DBPassword);
I had add ,but cashed.
so , I add
case aProperties.DBMS of
dSQLite, dFirebird, dPostgreSQL, dMySQL,dMSSQL, dDB2:
fDatabase.Database := UTF8ToString(fProperties.DatabaseName);
It is working now.
no limit in ms SQL
I Test Ok above code,pls check it
This is my modified
in RegisterTableForRecordReference funtion:
if Props.Props.JoinedFieldsTable<>nil then begin
W := TTextWriter.CreateOwnedStream;
try
W.AddShort('SELECT ');
for j := 0 to high(Props.Props.JoinedFieldsTable) do
with Props.Props.JoinedFieldsTable[j].RecordProps do begin
if j>0 then
W.Add('%.RowID as `%.RowID`,',[Props.Props.JoinedFields[J-1].Name,Props.Props.JoinedFields[J-1].Name])
else
W.Add('%.RowID as `%.RowID`,',[SQLTableName,SQLTableName]);
for f := 0 to High(SimpleFields) do
if SimpleFields[f].SQLFieldType<>sftID then
begin
if j>0 then
W.Add('%.% as `%.%`,',[Props.Props.JoinedFields[J-1].Name,SimpleFields[f].Name,
Props.Props.JoinedFields[J-1].Name,SimpleFields[f].Name])
else
W.Add('%.% as `%.%`,',[SQLTableName,SimpleFields[f].Name,
SQLTableName,SimpleFields[f].Name]);
end;
end;
W.CancelLastComma;
W.AddStrings([' FROM ',aTableName]);
for f := 1 to high(Props.Props.JoinedFieldsTable) do
with Props.Props.JoinedFieldsTable[f].RecordProps do
W.Add(' LEFT JOIN % as % ON %.%=%.RowID',[
SQLTableName,Props.Props.JoinedFields[f-1].Name,aTableName,Props.Props.JoinedFields[f-1].Name,Props.Props.JoinedFields[f-1].Name]);
W.SetText(Props.SQL.SelectAllJoined);
finally
W.Free;
end;
end;
TSQLMyFileInfo = class(TSQLRecord)
private
FMyFileDate: TDateTime;
FMyFileSize: Int64;
published
property MyFileDate: TDateTime read FMyFileDate write FMyFileDate;
property MyFileSize: Int64 read FMyFileSize write FMyFileSize;
end;
TSQLMyFile = class(TSQLRecord)
private
FSecondOne: TSQLMyFileInfo;
FFirstOne: TSQLMyFileInfo;
FMyFileName: RawUTF8;
published
property MyFileName: RawUTF8 read FMyFileName write FMyFileName;
property FirstOne: TSQLMyFileInfo read FFirstOne write FFirstOne;
property SecondOne: TSQLMyFileInfo read FSecondOne write FSecondOne;
end;
I use your code of document, I Find query error, no show results
RJoin := TSQLMyFile .CreateAndFillPrepareJoined(Database, '', [], []);
try
while RJoin.FillOne do
begin
end;
RJoin.FillClose;
finally
RJoin.Free;
end;
I discovered after analysis:
in left Join
At the same time, the emergence of a table 'MyFileInfo'
I Hope you Fix it
In Line 415
case aProperties.DBMS of
dSQLite, dFirebird, dPostgreSQL, dMySQL, dDB2:
fDatabase.Database := UTF8ToString(fProperties.DatabaseName);
pls add dMSSQL ,I test OK
Pages: 1