Re: [fpc-devel] odbcconn.pas
Nope. Is that required? How does that factor in to accessing the data through bound controls? Thanks. Nathan T. Wild On Mar 13, 2014 9:57 AM, LacaK la...@zoznam.sk wrote: Nathan Wild wrote / napísal(a): I have been transitioning my work over from Delphi to Lazarus. For the most part it has been smooth and satisfying experience. I'm loving Lazarus and FPC and being unburdened by closed source proprietary stuff in general. The majority of the work I do requires connections to a Pervasive database (from Btrieve v6 all the way up to the most current). I should be able to do this via ODBC. I have no problem reading data, executing queries, etc. but as soon I try and act on a TSQLQuery using methods like .Delete(), .Append(), etc. everything appears to work fine, but as soon as the dataset refreshes my changes disappear. I can write to the same tables using INSERT, DELETE and UPDATE queries without issue. Do you use TSQLQuery.ApplyUpdates followed by TSQLTransaction.Commit or CommitRetaining ? -lacak. ___ fpc-devel maillist - fpc-devel@lists.freepascal.org http://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-devel ___ fpc-devel maillist - fpc-devel@lists.freepascal.org http://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-devel
Re: [fpc-devel] odbcconn.pas
Thanks so much for responding! I am extremely excited about the prospect of getting this working. Nothing I do in databound controls seems to commit anything to the underlying dataset. If I open a connection, activate a TSQLQuery with 'SELECT * FROM AnyTable', connect it toa dbgrid, etc. I can delete rows, edit data etc. and it appears to work normally. Changes take effect inside the controls, values change in the dataset, etc. but as soon as I disconnect and reconnect the dataset all my changes are reverted. ODBCConnection1.Connected := TRUE; SQLQuery1.SQL.Clear(); SQLQuery1.SQL.Append('SELECT * FROM AnyTable'); SQLQuery1.Active := TRUE; SQLQuery1.Delete(); SQLQuery1.Edit(); SQLQuery1['AnyField'] := 'CHANGED'; SQLQuery1.Post(); All of these changes take place in the UI. i.e. the first row is deleted and the field is modified in the second. As soon as I close and re-open the table, both changes are undone. UPDATE and DELETE queries work as expected. Some notes: - Calling combinations of StartTransaction / Commit / CommitRetaining don't appear to do anything? - Nothing I do changes the Active property of the associated SQLTransansaction (I'm not actually sure if anything should? Just mentioning it as this feels to me like a commit problem) - I have nothing set in the UpdateSQL / DeleteSQL / InsertSQL properties of the TSQLQuery. Are these required when accessing data in this manner? Thanks again to all who take the time to read this and I hope I'm not just missing something stupid!! On 13 March 2014 05:25, Reinier Olislagers reinierolislag...@gmail.comwrote: On 13/03/2014 00:06, Nathan Wild wrote: I have been transitioning my work over from Delphi to Lazarus. For the most part it has been smooth and satisfying experience. I'm loving Lazarus and FPC and being unburdened by closed source proprietary stuff in general. Good to hear that ;) The majority of the work I do requires connections to a Pervasive database (from Btrieve v6 all the way up to the most current). I should be able to do this via ODBC. I have no problem reading data, executing queries, etc. but as soon I try and act on a TSQLQuery using methods like .Delete(), .Append(), etc. everything appears to work fine, but as soon as the dataset refreshes my changes disappear. I can write to the same tables using INSERT, DELETE and UPDATE queries without issue. Am I missing something stupid? We don't know your code, so no idea... open door Are you .Posting the data? To give you an idea, the GUI/RAD tutorials http://wiki.lazarus.freepascal.org/SQLdb_Tutorial0 http://wiki.lazarus.freepascal.org/SQLdb_Tutorial1 and http://wiki.lazarus.freepascal.org/SQLdb_Tutorial2 should work with odbc as well as with other dbs; just use odbcconn.. Also, you could have a look at the database test suite: http://wiki.lazarus.freepascal.org/Databases#Running_FPC_database_tests fpc\packages\fcl-db\tests\dbtestframework.pas The info on http://wiki.lazarus.freepascal.org/ODBCConn you probably already know about as you can connect etc. Please feel free to document any hints/tips/needed additions for Pervasive there... You could create a minimal test program based on http://wiki.lazarus.freepascal.org/Database_bug_reporting#FreePascal and post on the forum http://forum.lazarus.freepascal.org/index.php/board,63.0.html with an attachment. ___ fpc-devel maillist - fpc-devel@lists.freepascal.org http://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-devel -- *Nathan T. Wild* ___ fpc-devel maillist - fpc-devel@lists.freepascal.org http://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-devel
Re: [fpc-devel] odbcconn.pas
On Thu, 13 Mar 2014, Nathan Wild wrote: Thanks so much for responding! I am extremely excited about the prospect of getting this working. Nothing I do in databound controls seems to commit anything to the underlying dataset. If I open a connection, activate a TSQLQuery with 'SELECT * FROM AnyTable', connect it toa dbgrid, etc. I can delete rows, edit data etc. and it appears to work normally. Changes take effect inside the controls, values change in the dataset, etc. but as soon as I disconnect and reconnect the dataset all my changes are reverted. ODBCConnection1.Connected := TRUE; SQLQuery1.SQL.Clear(); SQLQuery1.SQL.Append('SELECT * FROM AnyTable'); SQLQuery1.Active := TRUE; SQLQuery1.Delete(); SQLQuery1.Edit(); SQLQuery1['AnyField'] := 'CHANGED'; SQLQuery1.Post(); All of these changes take place in the UI. i.e. the first row is deleted and the field is modified in the second. As soon as I close and re-open the table, both changes are undone. You must call applyupdates. Post only modifies the in-memory copy of the data, but doesn't actually execute any queries on the database. Only when you call ApplyUpdates(), the SQL will be executed to update the database. Michael.___ fpc-devel maillist - fpc-devel@lists.freepascal.org http://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-devel
[fpc-devel] Request for help
Hi, I'm helping the editor of Blaise Pascal magazine to develop some components for Lazarus Delphi (for the Leap Motion). We need someone with experience in 3D-rendering to help out in writing some code. If you think you can do this, please visit http://www.blaisepascal.eu/index.php?actie=HelpOpenGL There is a description of the assignment, and a contact address. Michael. ___ fpc-devel maillist - fpc-devel@lists.freepascal.org http://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-devel
Re: [fpc-devel] odbcconn.pas
On 13/03/2014 14:20, Nathan Wild wrote: Nothing I do in databound controls seems to commit anything to the underlying dataset. It seems you're mixing GUI databound controls (dbgrid) with programmatic editing of the query... The GUI controls are provided by Lazarus, not FPC. As this list only covers FPC development, could you please post questions about Lazarus on the Lazarus list, or, perhaps even better, on the Lazarus forum as you can include a sample project that demonstrates your problems? Thanks ___ fpc-devel maillist - fpc-devel@lists.freepascal.org http://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-devel
Re: [fpc-devel] odbcconn.pas
On 13/03/2014 14:20, Nathan Wild wrote: Thanks so much for responding! I am extremely excited about the prospect of getting this working. Nothing I do in databound controls seems to commit anything to the underlying dataset. Responding privately - I read the Lazarus forum mailing list, so I'll see responsed there as well... I'm not a GUI guru at all but have you tried the sqldb tutorials 0 through 2? Do they work for you? ___ fpc-devel maillist - fpc-devel@lists.freepascal.org http://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-devel
Re: [fpc-devel] odbcconn.pas
Nope. Is that required? Yes is. TSQLQuery is descendant of buffered dataset so all changes what you do are cached localy until they are applied to remote database. ApplyUpdates does it ... How does that factor in to accessing the data through bound controls? Bound controls have nothing with it ;-) L. Thanks. Nathan T. Wild On Mar 13, 2014 9:57 AM, LacaK la...@zoznam.sk mailto:la...@zoznam.sk wrote: Nathan Wild wrote / napísal(a): I have been transitioning my work over from Delphi to Lazarus. For the most part it has been smooth and satisfying experience. I'm loving Lazarus and FPC and being unburdened by closed source proprietary stuff in general. The majority of the work I do requires connections to a Pervasive database (from Btrieve v6 all the way up to the most current). I should be able to do this via ODBC. I have no problem reading data, executing queries, etc. but as soon I try and act on a TSQLQuery using methods like .Delete(), .Append(), etc. everything appears to work fine, but as soon as the dataset refreshes my changes disappear. I can write to the same tables using INSERT, DELETE and UPDATE queries without issue. Do you use TSQLQuery.ApplyUpdates followed by TSQLTransaction.Commit or CommitRetaining ? -lacak. ___ fpc-devel maillist - fpc-devel@lists.freepascal.org mailto:fpc-devel@lists.freepascal.org http://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-devel ___ fpc-devel maillist - fpc-devel@lists.freepascal.org http://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-devel ___ fpc-devel maillist - fpc-devel@lists.freepascal.org http://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-devel