On 02/01/2017 01:54 PM, Suliman wrote:
Also I can't understand what is SQL Command and what exec is doing if
it's returning ulong?



"struct Command" should not be used. It is old, and a bad design. This new release attempts to replace it with a better design. Hopefully, "struct Command" will be deleted in a later release.

The "exec" functions are for commands like INSERT, UPDATE, DELETE, CREATE, etc (it is *not* for SELECT). It is for things that do NOT return actual rows of data. The "exec" functions return "rows affected" - the number of rows that were affected by your INSERT, or UPDATE, etc. Usually people ignore that number, but it's information the server sends back, and is sometimes useful to some people. For example, SQL administration tools usually tell you "# rows affected" after you run an INSERT/UPDATE/etc.

If you are doing a SELECT, then you do NOT use "exec", you use "query" for SELECT. "query" returns a set of rows.

Summary:
---------

SELECT: Use query() or querySet() or queryRow(), etc.

INSERT/UPDATE/DELETE/CREATE/DROP: Use exec(). Return value tells you how many rows were added/changed/deleted/etc.

Reply via email to