mrluigi2017

Forum Replies Created

Viewing 50 posts - 1 through 50 (of 50 total)
  • Author
    Posts
  • in reply to: TkbmMWI18NLanguage language name property #57209
    mrluigi2017
    Participant

    Hi Kim,

    It looks like this one is reintroduced in version 5.21 (and still there in 5.22)

     

    Kind regards,

     

    Luigi

    in reply to: ORM Update – Tablename gets quoted 3 times instead of 1 #56935
    mrluigi2017
    Participant

    I have written al little test application and I noticed that the tripple quotes only appear when quotes are used when creating tables. Since this is a new project I have decided to use uppercase and no quotes for tables names (and other identifiers).

    in reply to: ORM Update – Tablename gets quoted 3 times instead of 1 #56933
    mrluigi2017
    Participant

    Message removed.

    • This reply was modified 3 years, 10 months ago by mrluigi2017.
    in reply to: ORM Update – Tablename gets quoted 3 times instead of 1 #56932
    mrluigi2017
    Participant

    The connection pool is a TkbmMWUNIDACConnectionPool with a kbmMWInterbaseMetaData and a kbmMWInterbaseSQLRewriter.

    in reply to: TkbmMWDatastoreSequencer.GetValue UpperCase issue #56843
    mrluigi2017
    Participant

    We use Pascal case for our database including the sequences. I have change the sequences to upper case now 😀

    in reply to: REST HTTP StatusCode without raising an error #56786
    mrluigi2017
    Participant

    Sorry that 🙁 I am using kbmMWHTTPSysServerTransport. I have tested it with kbmMWTCPServerTransport and kbmMWTCPIPIndyServerTransport and that seems to works fine.

    in reply to: REST HTTP StatusCode without raising an error #56784
    mrluigi2017
    Participant

    It looks like that in unit kbmMWHTTPSysServerTransport (didn’t check other transports yet) on line 579 the status code that is set is overwritten by this line of code:

    reshlp.HTTPStatusCode:=reshlp.HTTPStatusCodeFromServerStatusCode(res.StatusCode);

     

    in reply to: REST HTTP StatusCode without raising an error #56783
    mrluigi2017
    Participant

    In Fiddler and Postman I still get a 200 status code instead of 201. Are you sure that this should work?

    in reply to: MySQL ORM problems #55662
    mrluigi2017
    Participant

    Hi Charles,

    Some things you might want to check:

    1) Do you have a MetaData component attached to the kbmMWMySQLRewriter?
    2) Do you have a kbmMWMySQLRewriter attached to the kbmMWFiredacConnectionPool?
    3) Does the table name in your entity match the table name in MySQL [kbmMW_Table(‘name:person’)]
    4) Make sure that the meta data component properties like “quote table name” etc. match your situation.

    Kind regards,

    Luigi

    in reply to: Default URL in rest service #55479
    mrluigi2017
    Participant

    Du er fantastisk 🙂

    • This reply was modified 5 years, 8 months ago by mrluigi2017.
    mrluigi2017
    Participant

    Hi,

    If I remember it well there where some serious issues in XE5 with generics which are heavily used in the ORM framework. I think you need XE7 or up.

    • This reply was modified 5 years, 9 months ago by mrluigi2017.
    in reply to: REST SmartService method #55429
    mrluigi2017
    Participant

    Never mind I found the solution.

    var

    qv: TkbmMWHTTPQueryValues; // kbmMWHTTPUtils

    hlp: TkbmMWHTTPTransportStreamHelper;

    s: string;

    begin

    qv := TkbmMWHTTPQueryValues.Create;

    try

    hlp := TkbmMWHTTPTransportStreamHelper(RequestTransportStream.Helper);
    qv.AsString := hlp.Query; // Contains the part after the ?
    s := qv.ValueByName[‘test’];

    …

     

     

     

    in reply to: $ char in REST method path #55427
    mrluigi2017
    Participant

    Are you sure this should work? I can’t get it working here.

    • This reply was modified 5 years, 9 months ago by mrluigi2017.
    in reply to: Log to database ORM DBISAM 4 error #55109
    mrluigi2017
    Participant

    Could you log the SQL statement? I use Devart and they have a monitor tools which shows you all the SQL which is sent to the user. If not you could maybe use the kbmmw log function:

    kbmMWDebugLevel := mwdlAll;
    kbmMWDebugWhere := mwddDebug;
    kbmMWDebugTypes := [mwdtDBQuery];

    It logs to the IDE messages window.

    in reply to: ToDataSet in trial method #55071
    mrluigi2017
    Participant

    Just forgot to add kbmmwOrm to the uses 🙂 The errr I got was “Class is missing kbmMW_table or virtual table attribute”.

    in reply to: Problem compiling kbmMW Pro 5.12.12 #54999
    mrluigi2017
    Participant

    I am using enterprise 5.12.00 and both units are present. I think something went wrong with the setup.

    in reply to: File Service #54643
    mrluigi2017
    Participant

    Hi Kim,

    It works 🙂 Just tested it with a 64GB file up and down.

    It is true that I did not anticipate sending huge files (>2GB) back in the days.

    I don’t blame you. It takes more than 31 weeks on a 28.8 modem 🙂

    Thank you!!!

    • This reply was modified 6 years, 7 months ago by mrluigi2017.
    in reply to: File Service #54591
    mrluigi2017
    Participant

    What exactly do you mean? You can set the blocksize in the kbmMWFileClient. I haven’t figured out yet howto deal with the filesize issue.

    in reply to: Briefcase example #54581
    mrluigi2017
    Participant

    Hi Job,

    There is a demo that contains brief cases. Not sure if it works or not. It can be found in the demo folder:

    kbmmw\Demo\Basic\Client

     

    Kind regards,

    Luigi

    in reply to: File Service #54579
    mrluigi2017
    Participant

    The slow transfer issue is solved. I have changed the chunksize to 1048576 and the speed is good now. There is however still an issue with downloading a large file. See the code in the second post. Uploading large files (larger than max int) doesn’t seem to be a problem.

    in reply to: File Service #54578
    mrluigi2017
    Participant

    I also have an issue that the transfer is very, very slow. I think I am doing something wrong, but I have no clue what it is.

    in reply to: File Service #54577
    mrluigi2017
    Participant

    I figured out that downloading a large file doesn’t work either. I think the cause is that an int 64 is assigned to an VarArray with varIntegers.

    function TkbmMWFileService.PerformGET

    Result:=VarArrayCreate([0,2],varInteger);

    // Prepare result.
    Result[0]:=FFileToken;
    Result[1]:=ofs; //is an int64
    Result[2]:=sz; // is an int64

    Although I didn’t find anything for my upload problem I suspect it could be the same type of issue.

     

    in reply to: Rewriter questions #54576
    mrluigi2017
    Participant

    I had some issues with the ImportDBSchema as well so I wrote my own tool for Postgres databases. I am not sure if the import tool is fixed by now.

    I have used the kbmMWInterbaseSQLRewriter and it worked for me. It’s also important to connect a kbmMWInterbaseMetaData component to the Rewriter component. The metadata component takes care about things like uppercase/lowercase, the use of quotes, date layout, etc.

    I supspect that you didn’t build for 64 bit or that you forgot to set the correct paths.

    in reply to: Rewriter questions #54574
    mrluigi2017
    Participant

    Hi Alexander,

    As far as I know there is no specific documentation on the rewriter. The rewriter is needed when you use the ORM. It rewrites the SQL to match your target database requirements. It compiles on Win64 here without a problem (I am using enterprise) What version do you use? And what error do you get?

    in reply to: ORM.QueryList #54178
    mrluigi2017
    Participant

    Never mind. I am just a moron 🙁 The dataset was empty

    in reply to: ORM.QueryList #54177
    mrluigi2017
    Participant

    I think it’s not a bug. I will open a new topic.

    in reply to: ORM.QueryList #54174
    mrluigi2017
    Participant

    Any change that there is a bug in the ListFromDataset method as well?

    in reply to: Memory leaks with ORM after inserting records #54149
    mrluigi2017
    Participant

    It seem that in the destructor all the objects used in the add record method a freed, but that is not the case. For instance a1 is used as a reference for 3 different objects and only 1 of them is freed in the destructor.

     

    in reply to: kbmMemTable data persistence challenges #54133
    mrluigi2017
    Participant

    You could use the orm for this. I wrote a little very basic demo. I used firedac as a connection but you can change this. You need to setup the firedac  connection before you can use it. (Make a test database for it!) In the demo you have to take care of the primary key(message_id) yourself.

    Here is a link to the code:

    https://lycaproductions.stackstorage.com/s/5L82VjorZ4ylSNC

    is valid till 31-08-2019

    Here the code itself:

    unit f_main;

    interface

    uses
    kbmMWOrm,
    kbmMWNullable,
    kbmMWRtti,

    Data.DB,
    Generics.Collections,
    Winapi.Windows,
    Winapi.Messages,
    System.SysUtils,
    System.Variants,
    System.Classes,
    Vcl.Graphics,
    Vcl.Controls,
    Vcl.Forms,
    Vcl.Dialogs,
    kbmMWCustomConnectionPool,
    kbmMWFireDAC,
    kbmMemTable,
    Vcl.ExtCtrls,
    Vcl.DBCtrls,
    Vcl.Grids,
    Vcl.DBGrids,
    Vcl.StdCtrls,
    kbmMemCSVStreamFormat,
    FireDAC.Stan.Intf,
    FireDAC.Stan.Option,
    FireDAC.Stan.Error,
    FireDAC.UI.Intf,
    FireDAC.Phys.Intf,
    FireDAC.Stan.Def,
    FireDAC.Stan.Pool,
    FireDAC.Stan.Async,
    FireDAC.Phys,
    FireDAC.Phys.FB,
    FireDAC.Phys.FBDef,
    FireDAC.VCLUI.Wait,
    FireDAC.Comp.Client,
    kbmMWSQLRewriter,
    kbmMWCustomSQLMetaData,
    kbmMWInterbaseMetaData;

    type
    TForm1 = class(TForm)
    kbmMWFireDACConnectionPool: TkbmMWFireDACConnectionPool;
    // Notice that the kbmCSVStreamFormat is set to the AllDataFormat property
    mtMessages: TkbmMemTable;
    dsMessages: TDataSource;
    DBNavigator: TDBNavigator;
    grdMessages: TDBGrid;
    btnSaveToFile: TButton;
    btnSaveToFireBird: TButton;
    kbmCSVStreamFormat: TkbmCSVStreamFormat;
    btnOpenFromFile: TButton;
    btnOpenFromFireBird: TButton;
    FDConnection: TFDConnection;
    mtMessagesmessage_id: TIntegerField;
    mtMessagesmessage_text: TStringField;
    btnOpen: TButton;
    btnCreateTable: TButton;
    kbmMWInterbaseMetaData: TkbmMWInterbaseMetaData;
    kbmMWInterbaseSQLRewriter: TkbmMWInterbaseSQLRewriter;
    procedure btnCreateTableClick(Sender: TObject);
    procedure btnOpenClick(Sender: TObject);
    procedure btnOpenFromFileClick(Sender: TObject);
    procedure btnSaveToFileClick(Sender: TObject);
    procedure btnSaveToFireBirdClick(Sender: TObject);
    procedure FormCreate(Sender: TObject);
    private
    Orm: TkbmMWORM;
    public
    procedure SaveMessageMemoryTableToFile;
    procedure SaveMessageMemoryTableToFireBird;

    procedure LoadMessagesFromFile;
    procedure LoadMessageFromFireBird;
    end;

    [kbmMW_Table(‘name:my_messages’)]
    TMyMessage = class
    private
    FMessageID: kbmMWNullable<Integer>;
    FMessageText: kbmMWNullable<string>;
    public
    [kbmMW_Field(‘name:message_id, primary:true’, ftInteger)]
    property MessageID: kbmMWNullable<Integer> read FMessageID write FMessageID;

    [kbmMW_Field(‘name:message_text’, ftString)]
    property MessageText: kbmMWNullable<string> read FMessageText write FMessageText;
    end;

    var
    Form1: TForm1;

    implementation

    {$R *.dfm}

    procedure TForm1.btnCreateTableClick(Sender: TObject);
    begin
    if not Orm.ExistsTable(TMyMessage) then
    begin

    if Orm.CreateTable(TMyMessage) then
    ShowMessage(‘TMyMessage Table Created’)
    else
    ShowMessage(‘Error creating table’);

    end;
    end;

    procedure TForm1.btnOpenClick(Sender: TObject);
    begin
    mtMessages.Open;
    end;

    procedure TForm1.btnOpenFromFileClick(Sender: TObject);
    begin
    LoadMessagesFromFile;
    end;

    procedure TForm1.btnSaveToFileClick(Sender: TObject);
    begin
    SaveMessageMemoryTableToFile;
    end;

    procedure TForm1.btnSaveToFireBirdClick(Sender: TObject);
    begin
    SaveMessageMemoryTableToFireBird;
    end;

    procedure TForm1.FormCreate(Sender: TObject);
    begin
    // You can change the connection pool to the one you like.
    // Before you can persist to the database,
    // you have to make sure that the connection pool is setup.
    Orm := TkbmMWORM.Create(kbmMWFireDACConnectionPool);
    end;

    procedure TForm1.LoadMessageFromFireBird;
    var
    MessageList: TObjectList<TMyMessage>;
    begin
    MessageList := Orm.QueryList<TMyMessage>;
    Orm.ToDataset<TMyMessage>(MessageList, True);
    end;

    procedure TForm1.LoadMessagesFromFile;
    begin
    mtMessages.LoadFromFileViaFormat(‘.\MyMessagFile.csv’, kbmCSVStreamFormat);
    end;

    procedure TForm1.SaveMessageMemoryTableToFile;
    begin
    mtMessages.SaveToFileViaFormat(‘.\MyMessagFile.csv’, kbmCSVStreamFormat);
    end;

    procedure TForm1.SaveMessageMemoryTableToFireBird;
    var
    MessageList: TObjectList<TMyMessage>;
    begin
    MessageList := Orm.ListFromDataset<TMyMessage>(mtMessages, [usModified, usInserted, usDeleted]);
    Orm.Persist(MessageList);
    end;

    initialization

    TkbmMWRTTI.EnableRTTI([TMyMessage, TObjectList<TMyMessage>]);
    kbmMWRegisterKnownClasses([TMyMessage, TObjectList<TMyMessage>]);

    end.

     

     

    • This reply was modified 7 years, 3 months ago by mrluigi2017.
    in reply to: Debug memory enable issue #54122
    mrluigi2017
    Participant

    I guess it’s bedtime for me 🙂 Thank you!

    in reply to: Smartbinding & Deadlock #54109
    mrluigi2017
    Participant

    Min tak er stor! Only now do I realize how powerful smartbinding is. It makes life a lot easier.

    • This reply was modified 7 years, 3 months ago by mrluigi2017.
    in reply to: Request help – brought kbmMemTable and no response #54105
    mrluigi2017
    Participant

    Did you do a license request in the portal?

    in reply to: Smartservice Result object with memtable #54043
    mrluigi2017
    Participant

    The main issue was that the fields where created dynamically . I now have to separate methods one for REST clients and one for kbmmw clients. I also have two different result objects. The REST result object still marshals the memtable (no issues with this) I have replaced the memtable for a stream in the kbmmw result object and added a property with a getter that loads the stream into a memtable. This way the memtable never gets marshalled

    Maybe this solution is usefull to others.

    in reply to: ORM.ToDataSet issue #54000
    mrluigi2017
    Participant

    Never mind I did something very stupid 🙁

    I had a dbaware control connected to a DataSource->kbmMemTable with a wrong datafield value in it. So the ToDataset method works fine but when it opens it goes wrong because of the wrong datafield.  I should have known it wasn’t kbmmw 🙂 Sorry!

    • This reply was modified 7 years, 5 months ago by mrluigi2017.
    • This reply was modified 7 years, 5 months ago by mrluigi2017.
    in reply to: ORM.ToDataSet issue #53999
    mrluigi2017
    Participant

    Yes I did. Not sure if it’s important but the ToDataset method is not in the same unit as where I call the smartclient function returning the object that is used  in the ToDataset method.

    in reply to: Smartbinding and Nullable types #53987
    mrluigi2017
    Participant

    That would be nice because in combination with the orm many objects will have nullable properties I think.

    in reply to: Install issue – wrong memtable? #53981
    mrluigi2017
    Participant

    I forgive you and I still love you 😉 You’re just working to hard 🙂

     

    in reply to: Install issue – wrong memtable? #53979
    mrluigi2017
    Participant

    Are you 1000% sure? I have download 7.82 again just to be sure. But the kbmMemTable.pas shows

    const KBMMEMTABLE_VERSION = ‘7.81.00’;

    The fix comments in the same unit stop at version 7.81. as well.

     

    in reply to: Smartbinding #53974
    mrluigi2017
    Participant

    Supercool 🙂 Can’t wait to try it out.

    in reply to: Smartbinding #53971
    mrluigi2017
    Participant

    Most ORM frameworks I know use some kind of dataset between the GUI and the logic. Can the same be accomplished in kbmmw if you twoway smartbind a memtable to a TObjectList/TObject?

    • This reply was modified 7 years, 6 months ago by mrluigi2017.
    in reply to: Smartbinding #53968
    mrluigi2017
    Participant

    Im not sure exactly what you are asking.

    I was afraid for that 🙂 One more try…

    When you use datasets and data-aware controls the data-aware controls change from editable to non editable states depending on the state of the dataset dsEdit, dsBrowse etc. The dbnavigator enables only relevant buttons.This works very easy. I wonder if the same enabling/disabling of input controls can be accomplished with smartbinding and non dataset objects in an easy way.

     

     

    • This reply was modified 7 years, 6 months ago by mrluigi2017.
    in reply to: EnableRTTI & kbmMWRegisterKnownClasses #53896
    mrluigi2017
    Participant

    Hi Francisco,

    I think I used that construction before, but it gave some issues (not sure anymore what it was). I didn’t have time to dive into it, but I think something has changed between te previous release I used  an this one.

    in reply to: kbmMWNullable #53514
    mrluigi2017
    Participant

    I am not sure if I understand you correctly. Are you saying that just the visual output of a null value is zero (in case of an integer) or that the value will be zero? When reading my postgres logs I think it’s the second, but that doesn’t make sense  to me because both JSON an the database can take care of null.

    in reply to: LIMIT & OFFSET with ORM #53507
    mrluigi2017
    Participant

    Well the thing is that you make it to easy so we get a little lazy 😉

    in reply to: LIMIT & OFFSET with ORM #53504
    mrluigi2017
    Participant

    Thanks for both answers! It would be nice feature if there wouldn’t be a need to write the kbmmw syntax.

    • This reply was modified 7 years, 7 months ago by kimbomadsen.
    in reply to: Smartservice ORM issue #53461
    mrluigi2017
    Participant

    I have added the one line of code and it works 🙂

    Not sure if this is a general solution or just for kbmMWUnidac and PostgreSQL. I think it is a general solution because I believe that transactions should be only controlled from within the kbmmw framework.

    I have added this line of code in the InternalOpenConnection method.

    FDatabase.AutoCommit := False; // Is true by default in UniConnection

     

     

    in reply to: Smartservice ORM issue #53460
    mrluigi2017
    Participant

    I did some testing with kbmmwFiredac yesterday and it works fine. I think you are right that it has to do with transaction settings. I don’t want to blame kbmmw 🙂 but could it be that in the unidac adapter InternalOpenConnection method some connection properties are not set? Am I right that if a property isn’t set here the default value is used?

    Thanks in advance!

    in reply to: DataStoreSequencer and db isolation #53429
    mrluigi2017
    Participant

    How about ORM and Postgres? Will it work if I create a generator with a sequence or will the problem be the same behind the scenes?

    in reply to: create join and resolve it using ORM #53428
    mrluigi2017
    Participant

    What I try to accomplish is that I can resolve a join with ORM and that I can show the join (virtual table) as one dataset. Is there an easy way to do that?

    The only solution I see now is that in case of a TPerson with a TAddress is to add all TAddress properties as virtual fields to a TPersonWithAddress object and create a TAddress object and copy the values from the virtual addresss fields from TPersonWithAddress before persisting. (That’s an ugly sentence 🙂 )

     

    in reply to: Smartservice REST body issue #53399
    mrluigi2017
    Participant

    I looks like the mime type var never makes it to the UmarshalBody method in kbmMWSmartServiceUtils.

    My http header looks like this:

    User-Agent: Fiddler
    Mime-Type: application/json
    Host: 192.168.0.56
    Content-Length: 39

    Am I doing something wrong or is this a bug?

Viewing 50 posts - 1 through 50 (of 50 total)