1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 473 474 475 476 477 478 479 480 481 482 483 484 485 486 487 488 489 490 491 492 493 494 495 496 497 498 499 500 501 502 503 504 505 506 507 508 509 510 511 512 513 514 515 516 517 518 519 520 521 522 523 524 525 526 527 528 529 530 531 532 533 534 535 536 537 538 539 540 541 542 543 544 545 546 547 548 549 550 551 552 553 554 555 556 557 558 559 560 561 562 563 564 565 566 567 568 569 570 571 572 573 574 575 576 577 578 579 580 581 582 583 584 585 586 587 588 589 590 591 592 593 594 595 596 597 598 599 600 601 602 603 604 605 606 607 608 609 610 611 612 613 614 615 616 617 618 619 620 621 622 623 624 625 626 627 628 629 630 631 632 633 634 635 636 637 638 639 640 641 642 643 644 645 646 647 648 649 650 651 652 653 654 655 656 657 658 659 660 661 662 663 664 665 666 667 668 669 670 671 672 673 674 675 676 677 678 679 680 681 682 683 684 685 686 687 688 689 690 691 692 693 694 695 696 697 698 699 700 701 702 703 704 705 706 707 708 709 710 711 712 713 714 715 716 717 718 719 720 721 722 723 724 725 726 727 728 729 730 731 732 733 734 735 736 737 738 739 740 741 742 743 744 745 746 747 748 749 750 751 752 753 754 755 756 757 758 759 760 761 762 763 764 765 766 767 768 769 770 771 772 773 774 775 776 777 778 779 780 781 782 783 784 785 786 787 788 789 790 791 792 793 794 795 796 797 798 799 800 801 802 803 804 805 806 807 808 809 810 811 812 813 814 815 816 817 818 819 820 821 822 823 824 825 826 827 828 829 830 831 832 833 834 835 836 837 838 839 840 841 842 843 844 845 846 847 848 849 850 851 852 853 854 855 856 857 858 859 860 861 862 863 864 865 866 867 868 869 870 871 872 873 874 875 876 877 878 879 880 881 882 883 884 885 886 887 888 889 890 891 892 893 894 895 896 897 898 899 900 901 902 903 904 905 906 907 908 909 910 911 912 913 914 915 916 917 918 919 920 921 922 923 924
|
KInterbasDB Changelog
-----------------------------------------------------------------------------
3.1 versus 3.1_pre9
-----------------------------------------------------------------------------
BUG FIXES:
- Fixed minor problems with the Connection.database_info method.
-----------------------------------------------------------------------------
3.1_pre9 versus 3.1_pre8
-----------------------------------------------------------------------------
Version 3.1_pre9 is being released instead of 3.1 final primarily to test
Python 2.4 compatibility. Since the first beta of Python 2.4 has now been
released, it is expected that these binaries will continue to work throughout
2.4's lifespan (including maintenance releases - 2.4.x).
NEW FEATURES:
- Python 2.4 support (that is, a few build script changes and the
availability of official Windows binaries for Python 2.4).
BUG FIXES:
- kinterbasdb sometimes caused an exception to be raised during the Python
interpreter's shutdown process.
Refs:
http://sourceforge.net/tracker/index.php?func=detail&aid=1011513&group_id=9913&atid=109913
- Fixed a potential concurrency problem regarding memory allocation in
kinterbasdb's event handling code.
-----------------------------------------------------------------------------
3.1_pre8 versus 3.1_pre7
-----------------------------------------------------------------------------
Version 3.1_pre8 is the recommended stable version of kinterbasdb.
NEW FEATURES:
- kinterbasdb._RowMapping has a richer dict-like interface (now implements
__len__, __getitem__, get, __contains__, keys, values, items, __iter__,
iterkeys, itervalues, iteritems).
BUG FIXES:
- The kinterbasdb.typeconv_fixed_fixedpoint.fixed_conv_out_precise dynamic
type translator was unable to convert some NUMERIC/DECIMAL database
values.
Refs:
http://sourceforge.net/tracker/index.php?func=detail&aid=949669&group_id=9913&atid=109913
- The kinterbasdb.typeconv_text_unicode.unicode_conv_[in|out] dynamic type
translators did not work with non-default collations.
Refs:
http://sourceforge.net/tracker/index.php?func=detail&aid=876564&group_id=9913&atid=109913
- The kinterbasdb.services.Connection.getLog method should not have
accepted a database parameter; it no longer does.
- The kinterbasdb.services.Connection.backup method now returns a
gbak-style log string (as the kinterbasdb.services.Connection.restore
method has done all along).
- Applied Mac OS X compatibility patch to setup.py.
Refs:
http://sourceforge.net/tracker/index.php?func=detail&aid=909886&group_id=9913&atid=309913
- Ported to the AMD64 architecture. Tested with a prerelease version of
Firebird 1.5.1/AMD64 on Fedora Core 1/AMD64.
Refs:
http://firebird.sourceforge.net/download/prerelease/1.5.1
http://firebird.sourceforge.net/download/prerelease/1.5.1/FirebirdSS-1.5.1.4424-public3.amd64.rpm
BACKWARD-INCOMPATIBILITIES:
- The kinterbasdb.services.Connection.getEnvironmentMessage method has been
renamed to getMessageFileDir.
- The kinterbasdb.services.Connection.getLog method should not have
accepted a database parameter; it no longer does.
DOCUMENTATION CHANGES:
- Documented about 66% of the Services API (kinterbasdb.services module) in
the KInterbasDB Usage Guide.
KNOWN ISSUES:
- The third-party fixedpoint.py module contains an incompatibility with
Python 2.1 that is exposed by a bugfix applied to the
kinterbasdb.typeconv_fixed_fixedpoint module in 3.1_pre8.
No attempt will be made to fix this problem (which is a fixedpoint bug,
not a kinterbasdb bug); users should either upgrade to a newer version of
Python or refrain from using fixedpoint.
-----------------------------------------------------------------------------
3.1_pre7 versus 3.1_pre6
-----------------------------------------------------------------------------
Version 3.1_pre7 should be considered a release candidate. It is thought
to be ready for production use.
NEW FEATURES:
- Introduced dynamic type translation slot TEXT_UNICODE, which applies to
all CHAR/VARCHAR fields except those with character sets NONE, OCTETS,
or ASCII. Used in combination with the official translators in the
kinterbasdb.typeconv_text_unicode module, TEXT_UNICODE enables automatic
encoding/decoding of Unicode values.
This translator is not active by default except when kinterbasdb is
initialized with kinterbasdb.init(type_conv=100); the backward
compatibility implications are discussed in detail in the
BACKWARD-INCOMPATIBILITIES section below.
Refs:
docs/usage.html#faq_fep_unicode
- Added read-only .charset attribute to Connection.
- On Windows, kinterbasdb now conforms to the client library loading scheme
introduced in FB 1.5 RC7, so fbclient.dll need not be explicitly placed
in a directory on the PATH if the registry settings are present.
BUG FIXES:
- The type slot in cursor.description is now updated dynamically to reflect
dynamic type translation settings.
Refs:
http://sourceforge.net/tracker/index.php?func=detail&aid=814276&group_id=9913&atid=109913
- Added logic to prevent inappropriate calls to isc_dsql_free_statement,
which were observed to cause a segfault in a heavily multithreaded
environment.
- Added special case to field precision determination code to accommodate
the database client library's irregular handling of RDB$DATABASE.RDB$DB_KEY
Refs:
http://sourceforge.net/tracker/index.php?func=detail&aid=818609&group_id=9913&atid=109913
BACKWARD-INCOMPATIBILITIES:
- Programs that use BOTH of the following:
- the TEXT dynamic type translation slot
- unicode database fields
will need to be updated to take the new TEXT_UNICODE slot into account.
Since the TEXT slot is not particularly useful, this incompatibility is
expected to affect very few existing programs.
Refs:
docs/usage.html#faq_fep_unicode
- Convenience code 100 for the kinterbasdb.init function now activates the
new TEXT_UNICODE translation slot, so unicode values are automatically
encoded and decoded.
Convenience code 1 remains the default, however, and it does not
activate the TEXT_UNICODE slot. Programs that do BOTH of the following:
- invoke kinterbasdb.init(type_conv=100)
- use unicode database fields
will need to be updated to take the new TEXT_UNICODE slot into account.
Refs:
docs/usage.html#adv_param_conv_dynamic_type_translation_tbl_convenience_codes
-----------------------------------------------------------------------------
3.1_pre6 versus 3.1_pre5
-----------------------------------------------------------------------------
Version 3.1_pre6 should be considered a release candidate. It is thought
to be stable.
NEW FEATURES:
- Added support for manual control over the phases of two-phase commit.
The client programmer now has the option of triggering the first phase
manually via Connection.prepare() or ConnectionGroup.prepare().
This is useful when integrating with third-party transaction managers.
- KInterbasDB can now be compiled "out of the box" with MinGW when building
against Firebird 1.5 (but not Firebird 1.0 or Interbase).
See docs/installation-source.html for instructions.
BUG FIXES:
- Connection.drop_database() now rolls back the connection's active
transaction (if any) before dropping the database.
Previously, the database could be dropped with the transaction still
active; when the connection was subsequently garbage collected, a rollback
request was issued for the transaction (in a nonexistent database),
resulting in memory corruption.
- String values returned by input dynamic type translators were sometimes
prematurely garbage collected before the database engine had read their
contents.
- SQL fields with dynamic definitions (such as expressions in a SELECT list)
that involved fixed point data types (NUMERIC or DECIMAL) didn't get
passed through the FIXED dynamic type translator because the database
engine does not flag dynamically defined fields properly.
Though this is a bug in the database engine rather than KInterbasDB, a
workaround was added to KInterbasDB.
Thanks to Bert Hughes for reporting this bug.
- The installation action of the setup script ('setup.py install') did not
place the supporting files (documentation) in the proper directory on
Linux.
Thanks to Treeve Jelbert for reporting this bug.
-----------------------------------------------------------------------------
3.1_pre5 versus 3.1_pre4
-----------------------------------------------------------------------------
Version 3.1_pre5 should be considered a release candidate. It is thought
to be stable.
NEW FEATURES:
- Deferred loading of dynamic type translators:
KInterbasDB's choice of initial dynamic type translators for date/time
and fixed point types is now deferred as late as possible, and the
programmer has the *option* of controlling the choice via the type_conv
parameter of the new kinterbasdb.init function.
This feature is documented in the Usage Guide at:
usage.html#adv_param_conv_dynamic_type_translation_deferred_loading
- KInterbasDB's setup script is now capable of compiling the source
distribution "out of the box" with MinGW on Windows, but only with
Firebird 1.5 or later (Borland C++ can be used with Firebird 1.0).
This feature is documented in the installation guide for the source
distribution at:
installation-source.html#compiler_specific_compilation_notes
BUG FIXES:
- During blob insertion, not enough memory was allocated to hold the
blob ID returned by the database engine, resulting in an overflow.
- Implicit conversion of DATE/TIME/TIMESTAMP input parameters from strings
to the appropriate internal types was accidentally disallowed in
3.1_pre4. This feature has been enabled again.
- The Services API method kinterbasdb.services.Connection.restore was
incapable of restoring a backup into a multi-file database because it
sent the wrong cluster identifier for destination file page counts.
BACKWARD-INCOMPATIBILITIES:
- Because of the new "Deferred loading of dynamic type translators" feature,
the DB API type comparison singleton kinterbasdb.DATETIME will not compare
equal to *any* type until the kinterbasdb.init function has been called
(whether explicitly or implicitly).
This issue--which is expected to affect little or no existing code--is
documented in the Usage Guide at:
usage.html#adv_param_conv_dynamic_type_translation_deferred_loading_backcompat
- The dynamic type translation module typeconv_preferred has been renamed
to typeconv_23plus.
-----------------------------------------------------------------------------
3.1_pre4 versus 3.1_pre3
-----------------------------------------------------------------------------
Version 3.1_pre4 should be considered a late beta release. It is thought
to be stable, and there are no plans to add new features before 3.1 final
(only to fix bugs and finish updating the documentation).
Note that the KInterbasDB Usage Guide has been considerably updated, though
it is not quite complete. When complete, it will document all of the
numerous new features in kinterbasdb 3.1; it's a "must read" even now.
The Usage Guide is distributed with KInterbasDB
(kinterbasdb-installation-dir/docs/usage.html), and is available online at:
http://cvs.sourceforge.net/cgi-bin/viewcvs.cgi/*checkout*/kinterbasdb/Kinterbasdb-3.0/docs/usage.html
NEW FEATURES:
- DATABASE EVENT HANDLING has been reinstated, ported to POSIX, and timeout
support has been added.
This feature is thoroughly documented in the updated Usage Guide.
Refs:
http://sourceforge.net/tracker/index.php?func=detail&aid=637796&group_id=9913&atid=109913
- DISTRIBUTED TRANSACTIONS are now supported via the
kinterbasdb.ConnectionGroup class.
Although the Usage Guide does not yet fully document this feature, it
does contain an example program and a few hints:
http://cvs.sourceforge.net/cgi-bin/viewcvs.cgi/*checkout*/kinterbasdb/Kinterbasdb-3.0/docs/usage.html#adv_trans_control_distributed
- DYNAMIC TYPE TRANSLATION
KInterbasDB 3.1_pre4 implements two-way "dynamic type translation".
This feature allows the client programmer to change the type conversion
methods for specific SQL data types and achieve complete "type
transparency". For example, KInterbasDB 3.1_pre4 includes reference
implementations of converters for both input and output of
'mx.DateTime' and Python 2.3 stdlib 'datetime' for TIME/DATE/TIMESTAMP
fields.
One consequence of two-way dynamic type translation support is that
KInterbasDB 3.1_pre4 can be used with Python 2.3's datetime module
occupying the former role mx.DateTime. For backward compatibility,
mx.DateTime is still the default, and it will remain so.
This feature is documented in the updated Usage Guide.
- Cursor.rowcount support has been added (insofar as the database engine
supports it).
This feature is documented in the updated Usage Guide.
Refs:
http://sourceforge.net/forum/forum.php?thread_id=866629&forum_id=30917
- SAVEPOINTs (a Firebird 1.5 feature) are exposed at the Python level via
the Connection.savepoint(savepoint='name') method and the optional
$savepoint argument to the Cursor.rollback method.
This feature is documented in the updated Usage Guide.
- New attributes suggested by the "Optional DB API Extensions" section
of PEP 249:
- Access to a cursor's connection via the Cursor.connection attribute.
- Access to kinterbasdb's exception classes via connection attributes.
Refs:
http://www.python.org/peps/pep-0249.html
- A cursor can now be reused after it has caused an exception.
BUG FIXES:
- Passing the wrong number of parameters for a parameterized SQL statement
sometimes caused a crash instead of an exception with kinterbasdb 3.1_pre3.
This would not have affected client programs that were written correctly,
but it was still a bug.
- The kinterbasdb.create_database function leaked memory if it encountered
an error.
- Additional Windows binaries are being released to avoid dynamic linking
problems with Interbase 5.5 and Firebird 1.5-embedded.
Refs:
http://sourceforge.net/tracker/index.php?func=detail&aid=707644&group_id=9913&atid=109913
http://sourceforge.net/forum/forum.php?thread_id=855348&forum_id=30917
- kinterbasdb now builds with less hassle on FreeBSD.
Refs:
http://sourceforge.net/tracker/index.php?func=detail&aid=720021&group_id=9913&atid=109913
- Whenever a transactional context is needed, a transaction is now started
implicitly if the Python programmer has not started one explicitly
with Connection.begin. This implicit behavior is implicitly required
by the Python DB API specification.
Refs:
http://mail.python.org/pipermail/db-sig/2003-February/003158.html
- The mapping objects returned from the Cursor.fetch*map() method now
accept "double-quoted" field names (lookup keys). If the field name is
double-quoted, its original case will be preserved--instead of being
normalized to upper case--when the result set is searched for a field
with that name.
For example, if a table were defined this way
create table tbl ("sTRanGelyCasEDfieldnAme" integer)
and the statement
cur.execute("select * from tbl")
were executed against it, the mapping objects returned by
cur.fetchonemap()
would have rejected the lookup key 'sTRanGelyCasEDfieldnAme', converting
it instead to 'STRANGELYCASEDFIELDNAME' and then failing to find the
upper-cased field name.
The solution available in 3.1_pre4 is to perform the lookup this way:
cur.execute("select * from tbl")
mapping = cur.fetchonemap()
mapping['"sTRanGelyCasEDfieldnAme"']
^-----double-quoted-----^
which will force the preservation of the field name's case.
An easy way to avoid problems such as this is to refrain from using
quoted identifiers; in that case, the database engine will treat
identifiers in a case-insensitive manner.
Refs:
http://sourceforge.net/tracker/index.php?func=detail&aid=720130&group_id=9913&atid=109913
INTERNAL CHANGES:
- kinterbasdb now implements its standard date/time and fixed point
handling via the new, general-purpose dynamic type translation feature.
This eliminates the C-compile-time dependency on mx.DateTime. Although
mx.DateTime (for date/time types) and Connection.precision_mode (for
precise fixed point types) still function as before, dynamic type
translation allows other types to be transparently substituted (such as
those in Python 2.3's standard library datetime module for date/time
types, or those in the fixedpoint module for precise fixed point types).
For more information, see the Usage Guide.
BACKWARD-INCOMPATIBILITIES:
There are no outright incompatibilities, but there is one deprecation:
- Although Connection.precision_mode continues to function as in earlier
versions, it is deprecated in favor of dynamic type translation. The
functionality that Connection.precision_mode delivers (precise I/O of
fixed point values) is now implemented at the Python level via dynamic
type translation, rather than at the C level.
If you explicitly use both Connection.precision_mode *and* dynamic
type translation, beware that changing the value of
Connection.precision_mode
will cause changes to the registered dynamic type converters under the
hood.
For more information, see the INTERNAL CHANGES section above, and the
Usage Guide.
-----------------------------------------------------------------------------
3.1_pre3 versus 3.1_pre2
-----------------------------------------------------------------------------
Version 3.1_pre3 should be considered a beta release.
NEW FEATURES:
- database array support
Database arrays are mapped from Python sequences (except strings) on
input; to Python lists on output. On output, the lists will be nested
if the database array has multiple dimensions.
I'm not impressed by the Interbase/Firebird implementation of database
arrays. The database engine claims to support up to 16 dimensions, but
actually malfunctions catastrophically* above 10.
The arrays are of fixed size, with a predeclared number of dimensions
and number of elements per dimension. Individual array elements cannot
be set to NULL/None**, so the mapping between Python lists (which have
dynamic length and are therefore not normally null-padded) and
non-trivial database arrays is clumsy.
Arrays cannot be passed as parameters to, or returned from, stored
procedures.
Finally, many interface libraries, GUIs, and even the isql command line
utility do not support arrays.
Refs:
* http://sourceforge.net/tracker/?func=detail&aid=659610&group_id=9028&atid=109028
** Interbase 6 API Guide page 153.
- retaining commit/retaining rollback
The commit() and rollback() methods of kinterbasdb.Connection now
accept an optional boolean parameter 'retaining' (default False). If
retaining is True, the infrastructural support for the transaction active
at the time of the method call will be "retained" (efficiently and
transparently recycled) after the database server has committed or rolled
back the conceptual transaction.
In code that commits or rolls back frequently, 'retaining' the
transaction yields considerably better performance. 'retaining' will
become the default at some point in the future if the switch can be made
without serious backward compatibility issues.
Refs:
http://sourceforge.net/forum/forum.php?thread_id=799246&forum_id=30917
Interbase 6 API Guide page 74.
- unicode strings can now be executed via:
- kinterbasdb.Cursor.execute[many]()
- kinterbasdb.Cursor.callproc()
- kinterbasdb.Connection.execute_immediate()
However, the encoding of the incoming unicode string is rather
simplistic--via PyUnicode_AsASCIIString.
BUG FIXES:
- Addressed buffer overflow potential in:
- kinterbasdb.create_database()
- kinterbasdb.connect()
- kinterbasdb.Connection.begin()
- kinterbasdb.Connection.execute_immediate()
- kinterbasdb.Cursor.execute() (and thence, executemany() and callproc())
- Fixed reference count leaks in:
- exception handling (_exception_functions.c)
- field precision determination (_kiconversion_field_precision.c)
- Fixed kinterbasdb.Connection.close() bug: The physical connection to
the database server was not actually closed until the
kinterbasdb.Connection instance was garbage collected.
- Fixed a bug in the kinterbasdb.services.Connection.userExists() method.
Usernames are now normalized to upper case.
- Database version compatibility:
- kinterbasdb compiles properly against Firebird 1.5.
- kinterbasdb compiles against and ought to work with (but has not been
tested with) Interbase 5.5, albeit with some lost functionality,
namely:
- field precision determination (the precision entry in cursor.description)
- Services API support
- retaining rollback
- various data storage options, such as precise 64-bit integer storage
of NUMERIC and DECIMAL values (IB 5.5 uses doubles instead, which
is not really adequate) and more diverse date/time types.
Refs:
http://sourceforge.net/tracker/index.php?func=detail&aid=627816&group_id=9913&atid=109913
IB 6 Data Definition Guide page 65.
- Improved DB API compliance:
- Now, there need not be an active transaction before any execute(),
commit(), or rollback() call; transaction establishment is implicit in
these cases.
- Cursors no longer need to be discarded after an exception; the same
cursor can be reused. Of course if the cursor was in the process of
fetching a result set, the remainder of the set will not be available
after the exception.
INTERNAL CHANGES:
- Numerous modest optimizations, especially with regard to memory handling.
Among these is a move to take advantage of Python 2.3's specialized,
Python-oriented memory manager.
- MAJOR code refactoring and tidying.
BACKWARD-INCOMPATIBILITIES:
- Invalid argument combinations to the connect() function now raise a
ProgrammingError rather than an InterfaceError. Note that this refers to
invalid *combinations* of arguments, not necessarily to invalid *values*
for those arguments.
- Non-keyword-argument forms of connect() are now deprecated; passing
non-keyword arguments to connect() results in a DeprecationWarning being
issued via the standard Python warning framework. This is a warning, not
an incompatibility in the strict sense.
Refs:
http://www.python.org/doc/current/lib/module-warnings.html
- Official support for database event handling has been deferred until 3.2.
A Win32-only prototype will still be included with the kinterbasdb 3.1
source distribution (but not compiled by default).
Refs:
docs/usage.html#database_events_unsupported
-----------------------------------------------------------------------------
3.1_pre2 versus 3.1_pre1
-----------------------------------------------------------------------------
NEW FEATURES:
- Global Interpreter Lock management
Previously, kinterbasdb operated in a serial manner, with the sole
exception of the event handling code, whose parallelism is "under the
hood". Aside from event handling, all kinterbasdb operations, including
potentially long-running Firebird API calls, were serialized by the
Python GIL.
With the advent of kinterbasdb 3.1_pre2, kinterbasdb releases the GIL
where appropriate--that is, when it is about to make a potentially long-
running Firebird API call, and can do so without invoking the Python API,
or otherwise operating on Python structures.
However, the Firebird client library itself is not threadsafe, so
Firebird API calls must also be serialized. To that end, kinterbasdb
maintains a process-wide thread lock around which all Firebird API calls
are serialized.
When kinterbasdb is about to make a potentially long-running Firebird
API call, it follows these steps:
1. Extract necessary parameter data from Python structures
2. Release the Python GIL
3. Acquire the kinterbasdb process-wide Firebird client thread lock
4. Execute the Firebird API call
5. Release the kinterbasdb process-wide Firebird client thread lock
6. Acquire the Python GIL
7. Modify Python structures to reflect the results of the Firebird API
call
The addition of GIL management should improve kinterbasdb's maximum
possible throughput for multi-threaded Python programs on multi-processor
systems (one processor can run the Python interpreter while another
executes a Firebird client library operation). GIL management may also
yield greater "responsiveness" for multi-threaded Python programs running
on single-processor systems.
The addition of GIL management required fairly extensive internal
changes, and therefore warranted a whole prerelease version virtually
unto itself.
- Cursor name support
The read/write property Cursor.name allows the Python programmer to
perform scrolling UPDATEs or DELETions via the "SELECT ... FOR UPDATE"
syntax. If you don't know what this means, refer to the database SQL
syntax documentation of the FOR UPDATE clause of the SELECT statement.
The Cursor.name property can be ignored entirely if you don't need to
use it.
Here's an example code fragment:
----------------------------------------------
con = ... # establish a kinterbasdb.Connection
curScroll = con.cursor()
curUpdate = con.cursor()
curScroll.execute('select city from customer for update')
curScroll.name = 'city_scroller'
update = 'update customer set city=? where current of ' + curScroll.name
for (city,) in curScroll:
city = ... # make some changes to city
curUpdate.execute( update, (city,) )
----------------------------------------------
-----------------------------------------------------------------------------
3.1_pre1 versus 3.0.2
-----------------------------------------------------------------------------
Version 3.1_pre1 should be considered an early alpha release.
NEW FEATURES:
This list of new features represents the state of kinterbasdb 3.1_pre1,
which does not include some features slated for inclusion in the final
release of kinterbasdb 3.1. For a discussion of the ultimate goals of
version 3.1, see:
http://sourceforge.net/forum/forum.php?thread_id=696302&forum_id=30917
Also, the documentation has not yet been updated to cover these new
features, nor will it be for at least another month. In the meantime,
those who need to use the new features must refer to the source code.
- Cursor Iteration Support
When used with Python 2.2 or later, kinterbasdb's Cursors now support
"natural" iteration. For example:
-------------------------------------------------
# Index-based field lookup (based on Cursor.fetchone):
cur = con.cursor()
cur.execute("select col1, col2 from the_table")
for row in cur:
col1 = row[0]
-------------------------------------------------
# Key-based field lookup (based on Cursor.fetchonemap):
cur = con.cursor()
cur.execute("select col1, col2 from the_table")
for rowMap in cur.itermap():
col1 = rowMap['col1']
-------------------------------------------------
The iterator-based pattern supercedes the ugly fetch pattern of old
(though of course the old pattern will still work):
-------------------------------------------------
# Index-based field lookup (based on Cursor.fetchone):
cur = con.cursor()
cur.execute("select col1, col2 from the_table")
while 1:
row = cur.fetchone()
if not row:
break
col1 = row[0]
-------------------------------------------------
- Implicit Parameter Conversion
Implicit parameter conversion allows any SQL datatype supported by
kinterbasdb to be passed to the database engine as a Python string.
This is especially useful for parameterized statements that involve
date/time datatypes, because they can now accept server-computed "magic"
values such as 'now' and 'current_date' more naturally. Implicit
parameter conversion is also likely to yield a speedup for programs that
load external data from flat files into the database, since the incoming
values do not need to be converted from their original string
representation into an acceptable Python type before being forwarded to
the database.
For a more thorough discussion of this new feature, see:
http://sourceforge.net/tracker/index.php?func=detail&aid=531828&group_id=9913&atid=309913
- Services API Support (see IB 6 API Guide Chapter 12)
The database engine provides an API (the Services API) to facilitate
programmatic invocation of the maintenance tasks available through the
command-line tools gbak, gfix, etc.
I've wrapped nearly the entire Services API in a thick Python API of
my own design. My API design is only provisional; I seek feedback as
to how it could be made more elegant. The Services API support is
accessible via the kinterbasdb.services module.
- Database Event Support (see IB 6 API Guide Chapter 11)
The database engine allows client programs to register to be informed
of the occurrence of database events, which can be raised with the
POST_EVENT statement in stored procedures or triggers. kinterbasdb 3.1
supports a subset of this functionality (synchronous waiting only) via
the Connection.wait(eventNames) method.
The current implementation is only a rough prototype; though usable,
it is not recommended for production environments.
The current implementation suffers from a major limitation: only one
thread per process is allowed to listen for event notification. This is
so because the current implementation resorts to some roundabout trickery
to circumvent the lack of database API support for synchronous event
notification on Windows. Because the database API only starts one
asynchronous event handler thread per process, I doubt that support for
multiple event-listening threads in a single process will materialize.
BUG FIXES:
- In the past, the opaque mapping object returned by the Cursor.fetch*map
methods returned None when asked for a field not in its select list,
rather than raising a KeyError. It now raises a KeyError in such a case.
For example:
-------------------------------------------------
cur = con.cursor()
cur.execute("select col1, col2 from the_table")
for rowMap in cur.itermap():
x = rowMap['col3'] # Used to return None. Now raises KeyError,
# because col3 was not SELECTed.
-------------------------------------------------
BACKWARD-INCOMPATIBILITIES:
- Although kinterbasdb 3.1 is significantly different internally, there is
only one known API incompatibility with version 3.0.2. It would only arise
in code that relies on the erroneous behavior of the mapping-fetch bug
mentioned above.
- Python versions prior to 2.1 are no longer officially supported.
Although kinterbasdb might still compile against Python 2.0 and earlier,
I will not go out of my way to ensure that it does.
-----------------------------------------------------------------------------
3.0.2 versus 3.0.1
-----------------------------------------------------------------------------
BUG FIXES:
- Fixed a CHAR-handling bug that caused CHAR values inserted into the
database to lack their trailing spaces. Instead, the values were null-
terminated. This left CHAR values inserted by kinterbasdb incompatible
with standard tools, which expect trailing spaces.
For more information, see
http://sourceforge.net/tracker/index.php?func=detail&aid=594908&group_id=9913&atid=109913
-----------------------------------------------------------------------------
3.0.1 versus 3.0.1_pre3
-----------------------------------------------------------------------------
BUG FIXES:
- Adjusted input handling of NULL values. The new scheme raises an
exception immediately when it detects that a Python None value has
arrived for storage in a database field or parameter that disallows
NULL values.
The old scheme simply accepted the Python None value and then tried
to execute the query, relying on the database API to detect the error.
With certain data types, the database API would silently insert a bogus
value rather than detecting the error.
- Scrutinized the datetime input/output facilities, found some
incompatibilities with the DB API, and corrected them. These changes
are backward-incompatible, but are warranted because the previous
behavior was in defiance of the specification. See further notes about
the nature of these changes in the backward-incompatibilities section.
- Fixed a memory leak that affected the storage of Python string input
parameters in BLOB fields.
- Fixed a rollback-related bug that arose if a connection to a database
was established, but a transaction was never started on that connection.
In such a case, a spurious exception was raised when the connection was
garbage collected.
Normal code would not have invoked this bug, but it was still a bug.
BACKWARD-INCOMPATIBILITIES:
- Datetime input/output has changed to better comply with the DB API (see
datetime bugfix discussion above).
Code that uses the mx.DateTime module directly (rather than the
kinterbasdb DB API datetime constructors) should not be affected.
For details, see the comments in the code block in __init__.py tagged
with "DSR:2002.07.19".
-----------------------------------------------------------------------------
3.0.1_pre3 versus 3.0.1_pre2
-----------------------------------------------------------------------------
BUG FIXES:
- Bug #572326 (which was not present in kinterbasdb 3.0 and never affected
Python 2.2+) caused several numeric types to not be transferred from
Python to the database engine when they were passed as query parameters.
This was a serious bug; it caused even such fundamental operations as:
cursor.execute("insert into the_table values (?)", (1,))
to not work correctly.
-----------------------------------------------------------------------------
3.0.1_pre2 versus 3.0.1_pre1
-----------------------------------------------------------------------------
BUG FIXES:
- CHAR output now doesn't have such problems with multibyte character sets
and values shorter than the maximum declared length of the field.
CHARs are no longer returned with their trailing blanks intact. The
trailing blanks have been abandoned because they were in fact NULL
characters, not spaces. kinterbasdb would fill in the spaces manually,
except for the problems that approach causes with multibyte character
sets.
- Fixed a potential buffer overflow, but the fix only applies when compiled
against Python 2.2 or later.
BACKWARD-INCOMPATIBILITIES:
- See coverage of CHAR output changes in the 'BUG FIXES' section. In a
nutshell: CHAR output values no longer have trailing NULL bytes.
-----------------------------------------------------------------------------
3.0.1_pre1 versus 3.0
-----------------------------------------------------------------------------
NEW FEATURES:
- It is now possible to connect to a database under a specific role by using
the 'role' keyword argument of the kinterbasdb.connect function.
- The following methods now accept any sequence except a string for their
'parameter' argument, rather than demanding a tuple: Cursor.execute,
Cursor.executemany and Cursor.callproc.
BUG FIXES:
- kinterbasdb supports IB 5.x again.
Various identifiers specific to IB 6.x/Firebird had crept into unguarded
areas of __init__.py and _kinterbasdb.c, but this has been changed so
that kinterbasdb compiles gracefully with IB 5.x.
See:
http://sourceforge.net/tracker/index.php?func=detail&aid=553184&group_id=9913&atid=209913
- The distutils setup script no longer raises a ValueError on Windows 2000
or XP.
- The precision slot in Cursor.description was always zero. It now contains
the correct value if that value can reasonably be determined.
Note that the database engine records the precision of some fields as
zero (e.g., FLOAT), and the slot will also be zero in cases where the
database engine does not expose the precision of the field (e.g., dynamic
fields such as "SELECT 33.5 FROM RDB$DATABASE").
Since the database API does not provide the field's precision figure in
the XSQLVAR structure, it is necessary to query the system tables. In
order to minimize the performance hit, precision figures are cached per
Connection; the determination of a given field's precision figure in the
context of a given Connection will require only dictionary lookups after
it is determined the first time with a system table query.
An unfortunate side effect of this caching is that if a field's
precision is altered after the figure has been cached in by a Connection,
cursors based on that Connection will still show the old precision figure.
In practice, this situation will almost never arise.
See:
http://sourceforge.net/tracker/index.php?func=detail&aid=549982&group_id=9913&atid=109913
- On Linux, attempting to fetch immediately after having executed a
non-query statement resulted in a segfault. An exception is now raised
instead. The problem did not afflict Windows, which always raised the
exception.
See:
http://sourceforge.net/tracker/index.php?func=detail&aid=551098&group_id=9913&atid=109913
- The message carried by this exception grew without bound in on both
Windows and Linux. It no longer does.
- Under some circumstances, the fetched values of CHAR fields were
incorrect. CHAR values now appear as expected (they are left-padded with
spaces and always of length equal to their field's designated maximum
length).
- Cursor.fetchmany raised an error if there were no remaining values to
fetch. It now returns an empty sequence instead, as required by the DB
API Specification.
- Field domains are checked more strictly. It is now impossible to (for
example) issue a statement that attempts to insert a 12-character string
into a 10-character CHAR field without encountering an exception.
This checking is not perfect, since it validates against the field's
internal storage type rather than the field's declared type. For example,
a NUMERIC(1,1), which is stored internally as a short, will erroneously
accept the value 12.5 because 125 fits in a short.
- When operating in imprecise mode (connection.precision_mode == 0),
kinterbasdb 3.0 sometimes interpreted integer values as though it were
operating in precise mode.
-----------------------------------------------------------------------------
3.0 versus 2.0-0.3.1
-----------------------------------------------------------------------------
NEW FEATURES:
The new features are thoroughly documented in the KInterbasDB Usage Guide
(usage.html); they need not be reiterated here.
However, backward-incompatible changes *have* been documented in this
changelog (see the BACKWARD-INCOMPATIBILITIES section).
BUG FIXES:
Many bugs have been fixed, including (but not limited to) the following,
which were registered with the KInterbasDB bug tracker at SourceForge
( http://sourceforge.net/tracker/index.php?group_id=9913&atid=109913 ):
- 433090 cannot connect to firebird server
- 438130 cursor.callproc not adding param code
- 468304 fetchmany return all record
- 498086 ignores column aliases in select
- 498403 fetching after a callproc hangs program
- 498414 execute procedure message length error
- 505950 inconsistent fetch* return types
- 515974 Wrong decoding of FB isc_version
- 517093 broken fixed-point handling in 3.0
- 517840 C function normalize_double inf. loop
- 517842 fetch bug - program hangs
- 520793 poor DB API compliance
^ a *BIG* fix that entailed many changes
- 522230 error with blobs larger than (2^16) - 1
- 522774 inconsistent fixed-point conv in 3.0-rc2
- 523348 memory leak in Blob2PyObject
- immediate execution facilities unreliable in 2.x
BACKWARD-INCOMPATIBILITIES:
As a result of the changes required for some of the bugfixes (especially
#520793 - "poor DB API compliance") and general reengineering, several
areas of backward-incompatibility have arisen:
- fetch* return types
The standard fetch(one|many|all) methods now return just a sequence,
not a combined sequence/mapping. If you want a mapping, use one of
the fetch(one|many|all)map methods.
Note the "'absolutely no guarantees' except..." caveats in the
KInterbasDB Usage Guide regarding the return types of the
Cursor.fetch* methods and the contents of the Cursor.description
attribute.
This is a significant backward-incompatibility, and was not
undertaken without serious consideration (for evidence see
http://sourceforge.net/forum/forum.php?thread_id=622782&forum_id=30919
).
- Fixed point number handling
Fixed point number handling has been remodelled. By default, fixed
point numbers (NUMERIC/DECIMAL field values) are now represented
(with a potential loss of precision) as Python floats.
A Connection.precision_mode attribute has been added so that precise
representation of fixed point values as scaled Python integers (as in
KInterbasDB 2.x) can be used at will.
For more information, see the KInterbasDB Usage Guide.
- Connection.dialect
In KInterbasDB 2.x, the default connection dialect was 1 (the
backward-compatibility dialect for use with Interbase 5.5 and earlier).
KInterbasDB 3.0 is being released into quite a different climate.
Interbase 6.0 was released nearly two years ago, and Firebird 1.0 has
recently been released. Because it is expected that KInterbasDB 3.0
will be used most frequently with Interbase 6.0+ and Firebird, the
default connection dialect is 3.
Using KInterbasDB 3.0 with Interbase 5.5 and earlier is still
possible, though untested by the developers of KInterbasDB 3.0. See
the Connection.dialect documentation in the KInterbasDB Usage Guide
for an explanation of how to initialize a connection with a dialect
other than 3.
- Connection.server_version
The Connection.server_version attribute is now a string rather than
an integer. An integer simply was not expressive enough to represent
the numerous Interbase variants that exist today (including Firebird,
which does not fit neatly into the Interbase version progression).
For more information, see the KInterbasDB Usage Guide.
- kinterbasdb.execute_immediate
The kinterbasdb.execute_immediate function has been removed. A
similar function named kinterbasdb.create_database has been added.
The primary differences between kinterbasdb.execute_immediate and
kinterbasdb.create_database are:
- kinterbasdb.create_database is not as general
- kinterbasdb.create_database actually works
The execute_immediate method of the Connection class has been
retained.
For more information, see the KInterbasDB Usage Guide.
-----------------------------------------------------------------------------
|