-
Content Count
132 -
Joined
-
Last visited
-
Days Won
1
Everything posted by weirdo12
-
Right click on the source file and choose Edit local options.
-
What is the data type of field1? Can you share the schema of the config table?
-
Just in case you want a list of the available ODBC drivers, you can do something simple like dropping a TFDPhysODBCDriverLink component on your TDataModule and call TFDPhysODBCDriverLink.GetDrivers,
-
Distributing application that connects remote MySQL/MariaDB servers
weirdo12 replied to Dmitry Onoshko's topic in Databases
Check out their documentation or contact them directly but my understanding is they don't use the client DLL's at all. -
Distributing application that connects remote MySQL/MariaDB servers
weirdo12 replied to Dmitry Onoshko's topic in Databases
Use Devart's MyDAC: -
If you're using TClientDataSet for some serious work, I would think you should own this: http://www.jensendatasystems.com/cdsbook2/ I don't use TClientDataSet.
-
If you are building a stand alone app that relies on a database, why aren't you using SQLite? We used to use SQL Anywhere as our default database. It was great. The database could be one file that you could copy and move very easily. Like SQLite. But it did have an engine to install which could be done easily with InnoSetup without a separate exe included in the setup file (think SQL Server whatever). We did have have to pay for each install which was fine. But then it was sold to SAP and you know what, they just stopped asking us for royalties. I guess it was so small time they couldn't be bothered. So like 6-7 years ago I thought I'd see if I could use SQLite as a replacement. And it was possible. Obviously the database would work. The issue was with stuff stuff that was done in database - triggers - that we used and could they be done in SQLite. They could be.
-
Calling it with TFDBatchMove.GuesFormat is the same as calling it like this: TFDBatchMove.GuessFormat([taDelimSep, taHeader, taFields]). By default, the procedure is called will all of the analyze options. procedure GuessFormat(AAnalyze: TFDBatchMoveAnalyze = [taDelimSep, taHeader, taFields]) And after calling TFDBatchMove.GuessFormat with no arguments, the TFDBatchMove.Analyze property will has all those values - taDelimSep, taHeader, taFields. If it didn't have any default argument values it would be declared like this: procedure GuessFormat(AAnalyze: TFDBatchMoveAnalyze) https://docwiki.embarcadero.com/RADStudio/Sydney/en/Parameters_(Delphi)#Default_Parameters So if you call TFDBatchMove.GuessFormat and the don't clear TFDBatchMove.Analyze prior to calling TFDBatchMove.Execute, TFDBatchMove.GuessFormat is called again using the values from TFDBatchMove.Analyze, undoing any changes you might have made to the field types after the first call to TFDBatchMove.GuessFormat.
-
My Delphi cannot be trusted! I'm sure someone can suggest the correct code.
-
I actually missed something important: before you call TFDBatchMove.Execute call TFDBatchMove.Analyze.Clear or your changes might be overwritten. From the docs: "When the Analyze property value is not empty, then the batch move component tries to automatically recognize the data source format by calling the GuessFormat() method as part of the Execute method call." Something else I discovered last week is that WriteValue is triggered twice for any field that is part of a primary key. https://embt.atlassian.net/servicedesk/customer/portal/1/RSS-2064
-
Here's an example: void __fastcall TDMImportExport::FDBatchMoveImportWriteValue(TObject *ASender, TFDBatchMoveMappingItem *AItem, Variant &AValue) { switch (AItem->DestField->DataType) { case ftGuid: AValue = DMDatabase->GUIDFromServer(); break; case ftString: case ftWideString: break; case ftAutoInc: if (Variants::VarIsNull(AValue)) { AValue = FAutoIncVal++; } break; case ftDate: case ftDateTime: case ftTime: // NULL could be valid. Only reformat dates and times // that aren't NULL. if (!Variants::VarIsNull(AValue)) { try { AValue = Sysutils::StrToDateTime(AValue); } catch (...) { } } break; default: break; } } //--------------------------------------------------------------------------- You could look for the '--' string here.
-
What I do after GuessFormat() is fix all the types that GuessFormat() assumes to match the destination. The main issue I had was float columns being detected as integers. Do you use the TDBatchMove.OnWriteValue event? void MapTextReaderTypesToDestination(TFDTextFields* text_reader_, TFields* dest_) { for (int i = 0; i < text_reader_->Count; ++i) { auto field_ {dest_->FindField(text_reader_->Items[i]->FieldName)}; // I don't like the looks of indenting the switch statement below // inside of an if statement ;-) if (field_ == nullptr) { continue; } switch (field_->DataType) { case ftAutoInc: text_reader_->Items[i]->DataType = TFDTextDataType::atLongInt; break; case ftBCD: case ftCurrency: case TFieldType::ftExtended: case ftFloat: case ftFMTBcd: case TFieldType::ftSingle: /* // If there is a single 0 in a column that is one of // the above field types (e.g. import file contains "hello",0,1,0) // GuessFormat will think the 0, 1 and 0 values // columns are integer and there will be an error // during import if we don't specify the correct type */ text_reader_->Items[i]->DataType = TFDTextDataType::atFloat; break; case ftDate: text_reader_->Items[i]->DataType = TFDTextDataType::atDate; break; case ftDateTime: case ftTimeStamp: case ftTimeStampOffset: text_reader_->Items[i]->DataType = TFDTextDataType::atDateTime; break; case ftString: case ftWideString: text_reader_->Items[i]->DataType = TFDTextDataType::atString; break; case ftTime: text_reader_->Items[i]->DataType = TFDTextDataType::atTime; break; default: ; } } }
-
Do you use GuessFormat() prior to doing the TFDBatchMove.Execute?
-
Of course, if you'll never need to support a client/server installation it makes no sense.
-
Agreed. That said, there are developers in the space we work in (in fact most of them) that include SQL Server Express as default database for a small single-user app. That or Access. If you have not worked with PostgreSQL you should check it out.
-
It might not have been clear in the original post that SQLite is our default database (and it has been since 2021). Using FireDAC, the same install supports SQLite, PostgreSQL, SQL Server, SQL Anywhere and MySQL,
-
This guy is also pretty high on SQLite:
-
Okay, then let's go with that description if stand alone isn't clear enough.
-
Upgrading to new RAD Studio vs. project Lib names
weirdo12 replied to w0wbagger's topic in General Help
I add a new form and drop the components on that and then just delete that form from the project. -
Did you create a new project for version 12.2 or did you just open the one you used with the earlier version? Yeah, try creating a new project.
-
Can't connect to a PostgreSQL Database using a Traefik reverse proxy
weirdo12 replied to dust259's topic in Databases
I can confirm that FireDAC and the 32-bit version 10 libpq.dll works fine with the supported 64-bit versions of PostgreSQL (12-16) including those running on Linux, FreeBSD and Azure. I can't help you with the TLS and reverse proxy stuff 😉 -
v12.2, 64-Bit Modern Compiler and 3rd party Delphi components
weirdo12 replied to David P's topic in General Help
I know we are just lucky to be able to use C++ when building apps using the super powers of the VCL but it's so nice to have C++ specific stuff like Visual Assist added to the product! -
v12.2, 64-Bit Modern Compiler and 3rd party Delphi components
weirdo12 replied to David P's topic in General Help
I know DevExpress is hoping to deliver their components 'ready to go' for the new C++Builder tool chain. https://community.devexpress.com/blogs/vcl/archive/2024/07/24/vcl-year-end-roadmap-v24-2.aspx -
When you store the correct data using pgAdmin4, what do you see if you do a SELECT on the table from FireDAC?
-
What is the value of your TFDConnection CharacterSet parameter? https://docwiki.embarcadero.com/RADStudio/Athens/en/Connect_to_PostgreSQL_(FireDAC)