diff options
Diffstat (limited to 'sources/pyside6/doc/tutorials/portingguide/chapter1/chapter1.rst')
-rw-r--r-- | sources/pyside6/doc/tutorials/portingguide/chapter1/chapter1.rst | 26 |
1 files changed, 13 insertions, 13 deletions
diff --git a/sources/pyside6/doc/tutorials/portingguide/chapter1/chapter1.rst b/sources/pyside6/doc/tutorials/portingguide/chapter1/chapter1.rst index 20b11065a..87fb97660 100644 --- a/sources/pyside6/doc/tutorials/portingguide/chapter1/chapter1.rst +++ b/sources/pyside6/doc/tutorials/portingguide/chapter1/chapter1.rst @@ -17,7 +17,7 @@ the beginning of ``createdb.py``: .. literalinclude:: createdb.py :language: python :linenos: - :lines: 40-44 + :lines: 3-5 The ``initDb`` function does most of the work needed to set up the database, but it depends on the ``addAuthor``, @@ -26,40 +26,40 @@ the tables. Port these helper functions first. Here is how the C++ and Python versions of these functions look like: C++ version ------------- +----------- .. literalinclude:: initdb.h :language: c++ :linenos: - :lines: 55-81 + :lines: 9-33 Python version ---------------- +-------------- .. literalinclude:: createdb.py :language: python :linenos: - :lines: 44-65 + :lines: 7-28 Now that the helper functions are in place, port ``initDb``. Here is how the C++ and Python versions of this function looks like: -C++ version ------------- +C++ version (initDb) +-------------------- .. literalinclude:: initdb.h :language: c++ :linenos: - :lines: 81-159 + :lines: 35-112 -Python version ---------------- +Python version (init_db) +------------------------ .. literalinclude:: createdb.py :language: python :linenos: - :lines: 65- + :lines: 28- .. note:: The Python version uses the ``check`` function to execute the SQL statements instead of the ``if...else`` @@ -73,11 +73,11 @@ test it, add the following code to ``main.py`` and run it: .. literalinclude:: main.py :language: python :linenos: - :lines: 40- + :lines: 3- Use the following command from the prompt to run: -.. code-block:: +.. code-block:: bash python main.py |