Connecting to mariadb lazarus / 16-Databases ---------------------------------------------------------------------- jshand2010 · 2017-02-24 01:39 I am having trouble trying to get this code to work...  can someone let me know where i'm going wrong?  i get the error about a transaction not being set. ---------------------------------------------------------------------- mangakissa · 2017-02-24 07:41 What error? Piece of code instead of whole project? ---------------------------------------------------------------------- jshand2010 · 2017-02-24 10:21 just look into the provars.pas file.  this is where the error is.  it happens as i load loadlogintb procedure.  i presume the loaddb; code is correct to get things started ---------------------------------------------------------------------- Thaddy · 2017-02-24 11:30 Try mysql57conn -->> mysql56conn That one is still MariaDb compatible. Note we would probably need to start a new component for MariaDb. It is diverging. I did not test this yet, but just try first. ---------------------------------------------------------------------- jshand2010 · 2017-02-24 21:49 thanks thaddy, i forgot about that technicality.  i will test it and let you know ---------------------------------------------------------------------- jshand2010 · 2017-02-24 22:43 here is the code snippet:  it still doesn't work with mysql56conn: a:=0;   clearul(a);   cleartl;   loaddb;   try     if (conn.Connected=true) then begin       query.Close;       query.SQL.Clear;       query.SQL.Add('select uname, pword from userlogintb;');       query.ExecSQL;       query.Last;     end;   except     on err: ESQLDatabaseError do begin       ShowMessage(err.Message);       ShowMessage(err.UnitName);     end;   end; ---------------------------------------------------------------------- rvk · 2017-02-24 23:31 You set the database in the transaction. But you should also set the transaction in the connection and the sqlquery. You forgot to do that. ---------------------------------------------------------------------- mangakissa · 2017-02-27 08:43 Query.ExecSQL doesn't get a dataset for you. So there are no records to check. ---------------------------------------------------------------------- Thaddy · 2017-02-27 10:45 Quote from: mangakissa on February 27, 2017, 09:43:46 amQuery.ExecSQL doesn't get a dataset for you. So there are no records to check. Why does it is name says QueryXXX then? A query is supposed to return a dataset.... Is this true? Then it's a bug. If only poor language choice. Query means: I am asking and would like to have (an) answer(s). Usually you get one at least.... ---------------------------------------------------------------------- rvk · 2017-02-27 11:02 Quote from: Thaddy on February 27, 2017, 11:45:49 amQuote from: mangakissa on February 27, 2017, 09:43:46 amQuery.ExecSQL doesn't get a dataset for you. So there are no records to check. Why does it is name says QueryXXX then? A query is supposed to return a dataset.... Is this true? Then it's a bug. If only poor language choice.  I am asking and would like to have (an) answer(s). Usually you get one at least.... Although this is a TSQLQuery component, the ExecSQL does NOT return a dataset. It just executes a statement. So consider the ExecSQL a "helper" function which you use to execute a statement when you don't need to have a result-set. You could also use a separate TSQLScript or even use the .ExecuteDirect() from the connection-component instead. From the manual: http://www.freepascal.org/docs- html/fcl/sqldb/tcustomsqlquery.execsql.html QuoteExecSQL will execute the statement in TSQLQuery.SQL, preparing the statement if necessary. It cannot be used to get results from the database (such as returned by a SELECT statement): for this, the Open method must be used. This is a well known fact of the .ExecSQL() function. ---------------------------------------------------------------------- mangakissa · 2017-02-27 11:18 Create an example for check login. It's not the best solution, but it works. ---------------------------------------------------------------------- Thaddy · 2017-02-27 11:30 Quote from: rvk on February 27, 2017, 12:02:31 pm[Although this is a TSQLQuery component, the ExecSQL does NOT return a dataset. It just executes a statement. So consider the ExecSQL a "helper" function which you use to execute a statement when you don't need to have a result-set. You could also use a separate TSQLScript or even use the .ExecuteDirect() from the connection-component instead. From the manual: http://www.freepascal.org/docs- html/fcl/sqldb/tcustomsqlquery.execsql.html QuoteExecSQL will execute the statement in TSQLQuery.SQL, preparing the statement if necessary. It cannot be used to get results from the database (such as returned by a SELECT statement): for this, the Open method must be used. This is a well known fact of the .ExecSQL() function. So I was right (again). Semantics. Design error. Problem is that most people have no clue about software design.Introducing this functionality in the wrong place is moronic. It is wrong.  Go shopping for apples and bring back pears. ---------------------------------------------------------------------- mangakissa · 2017-02-27 11:39 If this is a design error, all database frameworks are wrong designed. I can not tell you which framework gives a dataset back when using execSQL. ---------------------------------------------------------------------- mangakissa · 2017-03-01 06:41 Quote from: mangakissa on February 27, 2017, 12:18:53 pmCreate an example for check login. It's not the best solution, but it works. Does it work? ---------------------------------------------------------------------- balazsszekely · 2017-03-01 07:23 Most definitely not a design error, though I agree the query word can be misleading.