Results 1 to 4 of 4

Thread: Affected rows for database commands

  1. #1

    Default Affected rows for database commands

    How do you tell how many rows your database command affected? For example, how do I check that my update command affected exactly the number of rows expected, so I can roll back if it doesn't?

    If there isn't currently a way, there should probably be one

  2. #2
    ClanLib Developer
    Join Date
    Sep 2006
    Location
    Denmark
    Posts
    554

    Default

    For SQLite, you can follow-up your command with:

    Code:
    CL_DBCommand cmd_changes = connection.create_command("changes()");
    int rows_affected = connection.execute_scalar_int(cmd_changes);
    The only alternative is to patch ClanLib. This would mean that CL_DBCommand needs an extra function called get_output_changes() that then would call sqlite3_changes() to retrieve this information.

  3. #3

    Default

    Thanks!

  4. #4

    Default

    Minor correction:

    You need "SELECT changes()", not just "changes()"

Similar Threads

  1. New overview: Database
    By sphair in forum Official ClanLib SDK Forums
    Replies: 0
    Last Post: 10-11-2009, 09:45 PM

Bookmarks

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •