-
Content Count
132 -
Joined
-
Last visited
-
Days Won
1
Everything posted by weirdo12
-
https://docwiki.embarcadero.com/RADStudio/Athens/en/Preprocessing_Command_Text_(FireDAC)
-
select {IF MSSQL}dbusers.dbo.{FI}users.name, {IF MSSQL}dbusers.dbo.{FI}athentications.read, etc.
-
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.
-
Why do you need to use the mydb schema name?
-
Can you copy and paste or attach all of your .pas source code here once again.
-
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
-
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.
-
Send multiple attachments with smtp.office365/outlook.com
weirdo12 replied to weirdo12's topic in Indy
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. -
https://docwiki.embarcadero.com/RADStudio/Alexandria/en/Connect_to_Firebird_(FireDAC)
-
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
-
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)?
-
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.
-
How can I extract a row's data from a TMyQuery object ?
weirdo12 replied to dormky's topic in Databases
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 -
Store a large number of images in the filesystem or in a DB?
weirdo12 replied to RaelB's topic in Databases
Have a look at SQLite as Anders suggested: https://sqlite.org/appfileformat.html -
Trap TFDConnection error on data module create etc?
weirdo12 replied to Chris1701's topic in Databases
Was that meant as a dis of SQLite - did I read that right? -
Trap TFDConnection error on data module create etc?
weirdo12 replied to Chris1701's topic in Databases
If you are using components built specifically for Interbase/Firebird (or some other server) - absolutely. -
Trap TFDConnection error on data module create etc?
weirdo12 replied to Chris1701's topic in Databases
Okay that is a good reason to stick with what your using. -
Trap TFDConnection error on data module create etc?
weirdo12 replied to Chris1701's topic in Databases
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. -
Trap TFDConnection error on data module create etc?
weirdo12 replied to Chris1701's topic in Databases
Someone would have to write an IDE plugin. -
Trap TFDConnection error on data module create etc?
weirdo12 replied to Chris1701's topic in Databases
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. -
Trap TFDConnection error on data module create etc?
weirdo12 replied to Chris1701's topic in Databases
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. -
Trap TFDConnection error on data module create etc?
weirdo12 replied to Chris1701's topic in Databases
I'm glad you gave it a try! -
FireDAC Create table with TFDTable class at SQL Postgres 14
weirdo12 replied to shalapai's topic in Databases
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");- 18 replies
-
- create table
- tfdtable
-
(and 1 more)
Tagged with:
-
Trap TFDConnection error on data module create etc?
weirdo12 replied to Chris1701's topic in Databases
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.