SQLite3 database connection functions and commands


Q.77 SQLite3 database connection functions and commands.Ans:-

  • 1)sqlite3_open() – will result in a database  with the default UTF-8 encoding.
    2)sqlite3_open_v2() – will result in a database  with the default UTF-8 encoding.
    3)sqlite3_open_16() – is used to create a database, the default string encoding will be UTF-16 in the native byte order of the machine.
    4)sqlite3_close() – To close and release a database connection.
    5)sqlite3_errmsg() – This allows the caller to retrive an error message.
    6)sqlite3_stmt – Once a database connection is established, we can start to execute SQL commands. This is normally  done by preparing and stepping through statements.
    7)sqlite3_prepare_v2() – The prepare process converts an SQL command string into a prepared statement.
  • *note : Preparing an SQL statement causes the command string to be parsed and converted into a set of byte-code commands. This byte-code is fed into SQLite’s Virtual Database Engine (VDBE) for execution.
    8)sqlite3_step() –  To execute the VDBE code.
    9)sqlite3_column_count() – Returns the number of columns in the statement result.
    10)sqlite3_column_name()/sqlite3_column_name16() – returns the name of the  specified column as a UTF8 or UTF16 encoded string.
    11)sqlite3_finalize()
    12)sqlite3_reset()
    13)sqlite3_free()
    14)sqlite3_column_type() – return the native type (strong class) of the value found in the specified column.
    15)sqlite3_column_blob() – returns a pointer to the BLOB value from the given column.
    16)sqlite3_column_double() – returns a 64-bit floating-point value from the given column.
    17)sqlite3_column_int() – returns a 32-bit signed integer from the given column.
    18)sqlite3_column_int64() – return a 64-bit signed integer from the given column.
    19)sqlite3_column_text()/sqlite3_column_text16() – returns a pointer to a UTF-8 or UTF-16 encoded string from the given column.
    20)sqlite3_column_value() – returns a pointer to an unprotected sqlite3_value.
    21)sqlite3_column_type – to return undefined results.
    22)sqlite3_column_bytes() – returns the number of byte in a BLOB or in a UTF-8 text value.
    23)sqlite3_column_bytes16() – returns the number of bytes in UTF-16 encoded text value,including the terminator.
    24)sqlite3_reset() – reset a prepared statements so that it is ready for another execution.

Kalavati Technologies Pvt Ltd