Changeset 973 for trunk


Ignore:
Timestamp:
Apr 19, 2019, 4:59:02 PM (5 months ago)
Author:
cito
Message:

Add note about executing multiple SQL commands

Also mention performance penalty of query_formatted().

Location:
trunk/docs/contents/pg
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/docs/contents/pg/connection.rst

    r963 r973  
    6363SQL injection or syntax errors.
    6464
     65If you don't pass any parameters, the command string can also include
     66multiple SQL commands (separated by semicolons). You will only get the
     67return value for the last command in this case.
     68
    6569When the database could not process the query, a :exc:`pg.ProgrammingError` or
    6670a :exc:`pg.InternalError` is raised. You can check the ``SQLSTATE`` error code
  • trunk/docs/contents/pg/db_wrapper.rst

    r968 r973  
    491491If you set *inline* to True, the parameters will be sent to the database
    492492embedded in the SQL command, otherwise they will be sent separately.
     493
     494If you set *inline* to True or don't pass any parameters, the command string
     495can also include multiple SQL commands (separated by semicolons). You will
     496only get the return value for the last command in this case.
     497
     498Note that the adaption and conversion of the parameters causes a certain
     499performance overhead. Depending on the type of values, the overhead can be
     500smaller for *inline* queries or if you pass the types of the parameters,
     501so that they don't need to be guessed from the values. For best performance,
     502we recommend using a raw :meth:`DB.query` or :meth:`DB.query_prepared` if you
     503are executing many of the same operations with different parameters.
     504
    493505
    494506Example::
Note: See TracChangeset for help on using the changeset viewer.