Jump to content

weirdo12

Members
  • Content Count

    132
  • Joined

  • Last visited

  • Days Won

    1

Everything posted by weirdo12

  1. weirdo12

    FireDAC SQLite MetaDefCatalog

    Excellent!
  2. weirdo12

    FireDAC SQLite MetaDefCatalog

    https://docwiki.embarcadero.com/RADStudio/Athens/en/Preprocessing_Command_Text_(FireDAC)
  3. weirdo12

    FireDAC SQLite MetaDefCatalog

    select {IF MSSQL}dbusers.dbo.{FI}users.name, {IF MSSQL}dbusers.dbo.{FI}athentications.read, etc.
  4. weirdo12

    FireDAC SQLite MetaDefCatalog

    unit Unit1; interface uses Winapi.Windows, Winapi.Messages, System.SysUtils, System.Variants, System.Classes, Vcl.Graphics, Vcl.Controls, Vcl.Forms, Vcl.Dialogs, 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.SQLite, FireDAC.Phys.SQLiteDef, FireDAC.Stan.ExprFuncs, FireDAC.VCLUI.Wait, FireDAC.Phys.SQLiteWrapper.Stat, Data.DB, FireDAC.Comp.Client; type TForm1 = class(TForm) FDConnection1: TFDConnection; FDPhysSQLiteDriverLink1: TFDPhysSQLiteDriverLink; procedure FDConnection1AfterConnect(Sender: TObject); procedure FormCreate(Sender: TObject); private { Private declarations } public { Public declarations } end; var Form1: TForm1; implementation {$R *.dfm} procedure TForm1.FDConnection1AfterConnect(Sender: TObject); begin var count : Integer; // this will create mydb.sqlite if it does not exist FDConnection1.ExecSQL('ATTACH DATABASE ''C:\Users\Public\Documents\mydb.sqlite'' AS mydb'); FDConnection1.ExecSQL('CREATE TABLE IF NOT EXISTs mydb.t1 (c1 TEXT)'); FDConnection1.ExecSQL('INSERT INTO mydb.t1 (c1) VALUES (lower(hex(randomblob(16))))'); count := FDConnection1.ExecSQLScalar('SELECT COUNT(*) FROM mydb.t1'); end; procedure TForm1.FormCreate(Sender: TObject); begin FDConnection1.Params.Database := ':memory:'; FDConnection1.Connected := true; end; end.
  5. weirdo12

    FireDAC SQLite MetaDefCatalog

    Why do you need to use the mydb schema name?
  6. weirdo12

    Help to find database error

    Can you copy and paste or attach all of your .pas source code here once again.
  7. weirdo12

    FireDAC SQLite MetaDefCatalog

    schema-name == The database in which the new table is created. Tables may be created in the main database, the temp database, or in any attached database. https://sqlite.org/lang_attach.html
  8. It's weird. If I send multiple PDF attachments using smtp.outlook.com or smtp.office356.com, all attachments appear identical to the last file attached. For example, if I send 3 attachments, the first 2 will appear to contain the contents of the last file that was attached to the email. The file names are not altered. I've tried sending .ini and xls files too. Same thing happens. I can send a message as expected using smtp.gmail.com, Mailjet, SendGrid and our ISPs smtp server. Nothing in my code detects what server is used to send a message.
  9. weirdo12

    Send multiple attachments with smtp.office365/outlook.com

    Thanks, Remy. That's the answer I expected and what I had already told the customer. I really hesitated asking the question but thought I better before telling the customer they'd need to contact Microsoft.
  10. weirdo12

    New Firebird 4 datatype "TIMESTAMP WITH TIMEZONE"

    https://docwiki.embarcadero.com/RADStudio/Alexandria/en/Connect_to_Firebird_(FireDAC)
  11. If you use a suitable column type alias in your SQLite table definition, FireDAC will figure out the correct field data type to use. DATE | SMALLDATE dtDate DATETIME | SMALLDATETIME dtDateTime TIMESTAMP dtDateTimeStamp TIME dtTime https://docwiki.embarcadero.com/RADStudio/Alexandria/en/SQLite_support_in_RAD_Studio
  12. Do you need to store exit_time value as INTEGER or would you prefer it stored in a format that you can read (like yyyy-mm-dd)?
  13. weirdo12

    SQLite Delphi 11 Community Edition

    If you do want to use the latest version of SQLite, make sure to change the EngineLink property of your TFDPhysSQLiteDriverLink component to slDynamic and put the SQLite DLL in the same directory as the application exe.
  14. To use the example as shown, DataObject would be a type that has an overloaded assignment (Assign) operator that accepted a TDataSet (or TFDQuery or whatever). In Assign you would copy the data you want to the members of DataObject. https://docwiki.embarcadero.com/RADStudio/Alexandria/en/Operator_Overloading_(Delphi)#Declaring_Operator_Overloads
  15. Have a look at SQLite as Anders suggested: https://sqlite.org/appfileformat.html
  16. weirdo12

    Trap TFDConnection error on data module create etc?

    Was that meant as a dis of SQLite - did I read that right?
  17. weirdo12

    Trap TFDConnection error on data module create etc?

    If you are using components built specifically for Interbase/Firebird (or some other server) - absolutely.
  18. weirdo12

    Trap TFDConnection error on data module create etc?

    Okay that is a good reason to stick with what your using.
  19. weirdo12

    Trap TFDConnection error on data module create etc?

    Would you consider changing to SQLite? I know it might be a huge deal if you have a lot of database specific dependencies in your code so it might not be practical.
  20. weirdo12

    Trap TFDConnection error on data module create etc?

    Someone would have to write an IDE plugin.
  21. weirdo12

    Trap TFDConnection error on data module create etc?

    No, I would say the file is already in use. Maybe you have no choice but to make sure the IDE closes the connection before you run your app. The IDE and your app can't both use the file. That's a different problem and it won't be solved by ConnectedStoredUsage. But if your want you app to always start with the Connected = False outside of the IDE it will make sure that happens.
  22. weirdo12

    Trap TFDConnection error on data module create etc?

    Please try using the ConnectedStorageUsage property and save yourself all that hassle. You can have you cake and eat it too. Just uncheck uaRunTime and the TFDConnection.Connected property will never be True at runtime even when you save your unit with it set to True.
  23. weirdo12

    Trap TFDConnection error on data module create etc?

    I'm glad you gave it a try!
  24. This works in RAD Studio 11.3 with PostgreSQL 14.8 running on Ubuntu. Without the SET search_path code, the table is always being added to public even if SchemaName was set to dba or if the TableName was qualified like dba.test_table. std::unique_ptr<TFDTable> vTable(new TFDTable(0)); vTable->Connection = db_connection; vTable->TableName = "test_table"; vTable->FieldDefs->Add("login", ftLargeint, 0, true); vTable->FieldDefs->Add("ticket", ftLargeint, 0, true); vTable->FieldDefs->Add("exec_time", ftDateTime, 0, true); vTable->FieldDefs->Add("req_price", ftFloat, 0, true); TFDIndex* idx = vTable->Indexes->Add(); idx->Name = System::Sysutils::Format("%s_pkey", String("test_table")); idx->Fields = "login;ticket"; idx->Active = true; db_connection->ExecSQL("SET search_path TO dba, public"); if (!vTable->Exists) { vTable->CreateTable(False); } db_connection->ExecSQL("SET search_path TO public, dba");
  25. weirdo12

    Trap TFDConnection error on data module create etc?

    If both of those are False the state of Connected will be ignored. You can test this by setting Connected to True, saving the file, closing it and reopening it. Connected will be False. Or create a new app. Drop a TFDConnection component on the main form. Set DriverName to SQLite. Add a BeforeConnect event handler. Put some dummy code in it so it does get deleted because it's empty. Set a break point on it. Set Connected to True. You should get prompted for a password. Click OK. Now run the app. The breakpoint won't occur. Now check auRunTime. Run the app again. It will break at the BeforeConnect event handler.
×