#1 Re: mORMot 1 » why don't create table? » 2015-04-29 01:03:17

I find the reason, in the class definition cannot include a 'user' name

#2 Re: mORMot 1 » why don't create table? » 2015-04-28 10:16:01

  
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 ?

#3 mORMot 1 » why don't create table? » 2015-04-28 06:59:05

milesyou
Replies: 4
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.

#4 mORMot 1 » Why spend so much Memory? » 2015-03-14 06:28:57

milesyou
Replies: 1

I set :memory: mode. then I Create two Fields,insert 800000 records.

I found the memory consumption of 1.4G.  Is this normal?

#5 Re: mORMot 1 » Do you Add Pagination? » 2015-03-10 13:57:45

I Study DDD, I found that you can not use it, can show a simple CRUD of Code?

#7 Re: mORMot 1 » Do you Add Pagination? » 2015-03-09 01:57:12

Hi Arnaud,
   When do you expect to use DDD? I can't wait to use it  ^.^

#8 Re: mORMot 1 » Do you Add Pagination? » 2015-03-06 10:32:08

thank your reply, Looking forward to the upcoming DDD!!!

#9 Re: mORMot 1 » Do you Add Pagination? » 2015-03-06 08:25:45

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

#10 Re: mORMot 1 » Do you Add Pagination? » 2015-03-06 05:55:12

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

#11 Re: mORMot 1 » Do you Add Pagination? » 2015-03-06 05:43:14

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 ?

#13 Re: mORMot 1 » Do you Add Pagination? » 2015-03-05 03:33:41

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;

#14 Re: mORMot 1 » Do you Add Pagination? » 2015-03-04 11:23:53

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

#15 Re: mORMot 1 » Pls Fix SynDBUniDAC ms SQL question » 2015-03-04 08:03:11

dSQLite, dFirebird, dPostgreSQL, dMySQL,dMSSQL, dDB2:   

Less of  'dMSSQL'

#16 Re: mORMot 1 » Pls Fix SynDBUniDAC ms SQL question » 2015-03-04 08:00:56

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.

#17 mORMot 1 » Do you Add Pagination? » 2015-03-04 04:10:36

milesyou
Replies: 16

no  limit in ms SQL

#18 Re: mORMot 1 » ABout 'One to many' » 2015-03-04 04:08:00

I Test Ok above code,pls check it

#19 Re: mORMot 1 » ABout 'One to many' » 2015-03-04 03:59:12

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;

#20 mORMot 1 » ABout 'One to many' » 2015-03-04 01:15:00

milesyou
Replies: 3

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

#21 mORMot 1 » Pls Fix SynDBUniDAC ms SQL question » 2015-03-04 01:06:50

milesyou
Replies: 4

In Line  415
case aProperties.DBMS of
  dSQLite, dFirebird, dPostgreSQL, dMySQL, dDB2:
    fDatabase.Database := UTF8ToString(fProperties.DatabaseName);

pls add dMSSQL ,I test OK

Board footer

Powered by FluxBB