pax_global_header00006660000000000000000000000064116337101010014503gustar00rootroot0000000000000052 comment=23f5458d36de8e3064bacaad318a4ed35d4d6e40 ruby-dbd-pg-0.3.9+gem2deb/000077500000000000000000000000001163371010100151315ustar00rootroot00000000000000ruby-dbd-pg-0.3.9+gem2deb/ChangeLog000066400000000000000000003042251163371010100167110ustar00rootroot00000000000000== 0.4.0 - 08/23/2008 === Summary * Type conversion is now universally managed amongst DBDs. Please see DBI::Type and DBI::TypeUtil and the DBI::StatementHandle#bind_coltype method. * Rubygems support! All DBDs and DBI will now install and appropriately fetch prerequisites (when possible) via the 'gem' command and other Rubygems interfaces. * Lots of code has been cleaned up and the filesystem has been significantly reorganized. * Many bugfixes due to inconsistencies between DBDs. * DBDs that were deprecated in 0.2.0 have been removed, as have the Proxy and Trace libraries (they didn't work anyways.) Proxy and Trace will be revisited in the future. * Several calls and classes have been deprecated in favor of native ruby replacements. * Tons of new documentation for both DBI users and DBD developers alike. commit:: c717f76f0f9e3645d8a0e3a4d4daa6e0f2380273 Author:: Erik Hollensbe Date:: Sat Aug 23 01:48:08 2008 -0700 * Fixed test1.rb to include StatementHandle#finish. commit:: 0f1ef6e5e8babb9741b8300ed63d826eeeb6b98f Author:: Erik Hollensbe Date:: Sat Aug 23 00:59:46 2008 -0700 * Made the examples a little more in-your-face in the README. commit:: 10c81ba90ff766b0c28288ba065472d7ab2497d2 Author:: Erik Hollensbe Date:: Tue Aug 19 13:29:13 2008 -0700 * Changes to DBD version handling: DBI::VERSION is now used for comparison, and the comparison actually works. commit:: 10272829eb255580a40967458f0490649ea0584a Author:: Erik Hollensbe Date:: Tue Aug 19 12:52:37 2008 -0700 * Made native binding toggleable commit:: 0fba5e6125a48b4c38fe95818e96092ff2d46e0c Author:: Erik Hollensbe Date:: Tue Aug 19 11:40:46 2008 -0700 * Fix for new pg driver commit:: c4692c89ab6c392a9da0a82f4e43abf01a009bbc Author:: Erik Hollensbe Date:: Mon Aug 18 04:13:28 2008 -0700 * test to prove #20489 wrong commit:: af530d0103a80c16f305ea0e5fb6db1263119b50 Author:: Erik Hollensbe Date:: Fri Aug 15 11:51:48 2008 -0700 * "standard" pl/sql replacement for plpgsql function used for testing the last bug. not all postgres installations have plpgsql and there were other issues. commit:: 04c3371efb7fe37b5dbad88efd069e14287e9654 Author:: Erik Hollensbe Date:: Fri Aug 15 11:06:39 2008 -0700 * 0.4.0 fix for #21567, part 2. commit:: 2782db825e809bb0ebd93ac39d4a9318c3c76058 Author:: Erik Hollensbe Date:: Fri Aug 15 08:38:34 2008 -0700 * DBD::Pg documentation. commit:: 53d08b7b87b20b36bc0088498ec9aacc43e12def Author:: Erik Hollensbe Date:: Fri Aug 15 07:32:09 2008 -0700 * DBD::ODBC documentation commit:: 24c99b9296c9175082f67266327a6178442b0e69 Author:: Erik Hollensbe Date:: Fri Aug 15 07:14:35 2008 -0700 * A couple of touchups on the SQLite3 documentation commit:: dfe4a9faa80cb21d57d1535e41697fefd2ff717b Author:: Erik Hollensbe Date:: Thu Aug 14 13:06:46 2008 -0700 * Fix for #21567, modified for 0.4.0 * As a result, removed unnecessary fill_array method in Tuples class. commit:: 00fac0444f1e37404b1540e6ca7e8837e3627f63 Author:: Erik Hollensbe Date:: Wed Aug 13 06:13:40 2008 -0700 * DBD::SQLite3 commit:: 7fd22432756e088090aa8411063cbdf18c968ebe Author:: Erik Hollensbe Date:: Wed Aug 13 05:30:23 2008 -0700 * DBD::SQLite docs commit:: 1febe97a63a0da70869c46d6ec608e73ba66b310 Author:: Erik Hollensbe Date:: Wed Aug 13 03:47:39 2008 -0700 * Mysql::Statement docs * Fixed some formatting issues related to bullet lists and :: commit:: 9c8df9cbeb61a9520671837ac66d8ad0c8422c9b Author:: Erik Hollensbe Date:: Wed Aug 13 02:34:19 2008 -0700 * Mysql::Driver commit:: e1409c0fb791ddeca483c95aa32cf9e9f2a8c3c3 Author:: Erik Hollensbe Date:: Wed Aug 13 02:26:51 2008 -0700 * First stab at MySQL Docs * Base Namespace and Database documented commit:: 2646f291c2fb48ffdbe6b3c684a92fd89e8ddd9c Author:: Pistos Date:: Tue Aug 12 14:28:50 2008 -0400 Added English comment to gem installation lines. commit:: 7f4a757dc2bed50ebdaf6993062f4688a6d9b7d0 Author:: Pistos Date:: Tue Aug 12 14:26:09 2008 -0400 English edits on Exceptions section of DBI_SPEC. commit:: 11b8e19fb8a93fe2c9ad4691862d6e577a4cebcb Author:: Pistos Date:: Tue Aug 12 14:18:25 2008 -0400 Added "DBI::" namespace to titles for clarity. commit:: c83b56ee84115247d64f96fb921d04d289c8785a Author:: Pistos Date:: Tue Aug 12 14:15:07 2008 -0400 English edits in Classes section of DBI_SPEC. commit:: fdf38829a89a885a83d7d6a4625bff35e891d717 Author:: Pistos Date:: Tue Aug 12 14:12:08 2008 -0400 Changed UPPERCASE titles to Title Case. commit:: e9a22e7e0c38a0d2c5bca233b059b5e7a3e65a1c Author:: Pistos Date:: Tue Aug 12 14:11:48 2008 -0400 English edits on Design section of DBI_SPEC. commit:: 4b3d7bf730182cb320f7f76520586a79af53a6e7 Author:: Pistos Date:: Tue Aug 12 14:03:02 2008 -0400 English edits on DBI_SPEC foreword. commit:: a1a6fba702e308562b8f13e9d6a8373332f43961 Author:: Pistos Date:: Tue Aug 12 13:44:14 2008 -0400 Adjusted kitebird link title. commit:: 49ed014939701f4bdce9c359a46160b93c3e18d9 Author:: Pistos Date:: Tue Aug 12 13:44:05 2008 -0400 Added URI to github repo. commit:: cd58249dec1d26771d97c612020bbdf0f53be4c7 Author:: Pistos Date:: Tue Aug 12 13:41:25 2008 -0400 Changed most indentation in README from 3 to 4 spaces. commit:: e9b3e43176b39207562216cfde6d233943d7f95b Author:: Pistos Date:: Tue Aug 12 13:41:04 2008 -0400 English edit in README. commit:: 98511628a6316be2506cb3d61ec214b398032220 Author:: Pistos Date:: Tue Aug 12 13:33:48 2008 -0400 Added test/sql.log to .gitignore. commit:: 64d66c276e633496e1241f9fc5c0bd8a53c73496 Author:: Pistos Date:: Tue Aug 12 13:32:16 2008 -0400 Added .gitignore. Currently only ignoring rdocs. commit:: 89ed83c8ff1a61b46aaaa4765948fdffa9155efa Author:: Pistos Date:: Mon Aug 11 23:55:26 2008 -0400 Minor English change in README. commit:: 8e64908cc68797a3022cea8a281645c7c7852e55 Author:: Erik Hollensbe Date:: Sat Aug 9 22:51:49 2008 -0700 * New DBD_SPEC. Not sure if I like it yet. commit:: cdba7c7f461734e860b7f7ad140679418274022a Author:: Erik Hollensbe Date:: Sat Aug 9 05:49:33 2008 -0700 * Some cleanup on LICENSE and README commit:: c0825d7056fcb0c562d2481e5215eac05478419c Author:: Erik Hollensbe Date:: Sat Aug 9 05:41:52 2008 -0700 * DBI::Utils namespace complete commit:: 308533d39dd35a8f350d833b6f17fb84224cd49c Author:: Erik Hollensbe Date:: Sat Aug 9 05:20:30 2008 -0700 * DBI::Type, DBI::Type::*, DBI::TypeUtil commit:: 16cadf97edb581b1ba09bd73dcf03682e2e220e2 Author:: Erik Hollensbe Date:: Sat Aug 9 04:36:41 2008 -0700 * DBI::Row, DBI::SQL, DBI::SQL::PreparedStatement * Some start in on DBI::Type commit:: 0e67d266f30284418c8cf3bc6725a67991da7049 Author:: Erik Hollensbe Date:: Sat Aug 9 04:17:06 2008 -0700 * StatementHandle commit:: 1b3fd5b85a419742216e6e1644e0add6cc7d6377 Author:: Erik Hollensbe Date:: Sat Aug 9 02:55:24 2008 -0700 * DBI::Binary, DBI::ColumnInfo, All Handle classes except StatementHandle. commit:: bd90081b59da321d41ca5abb4704f74b24a67f3c Author:: Erik Hollensbe Date:: Sat Aug 9 02:00:30 2008 -0700 * DBI, BaseDatabase, BaseStatement, BaseDriver documented. * Some rdoc task tweaks. commit:: f69083b1e578c234614e79b954ed2cd8120c91bc Author:: Erik Hollensbe Date:: Fri Aug 8 03:57:38 2008 -0700 * Revised DBI SPEC commit:: fb4248efff21b4b929c179be2407750d88c29de7 Author:: Erik Hollensbe Date:: Fri Aug 8 03:11:42 2008 -0700 * README commit:: de1fe2b859109fe7be7c414917b77cbb93a83555 Author:: Erik Hollensbe Date:: Fri Aug 8 03:00:25 2008 -0700 * Rendered trace module impotent; this is going to have to be addressed in 0.6.0 commit:: f76bd745213c56394d1529748d6c5c479b561c25 Author:: Erik Hollensbe Date:: Fri Aug 8 02:08:35 2008 -0700 * bind_coltype implementation * DBI 0.4.0 is feature-complete commit:: 752532a90082986f21a3feec2c29951bdafa293c Author:: Erik Hollensbe Date:: Thu Jul 31 02:30:16 2008 -0700 * You can now turn off type management by twiddling the convert_types bit on DBI, and the Driver, Database, and Statement handles. * These changes will propogate upwards as new items are constructed * This is tested in test_types * Lots, lots, lots of fixes were made so this works properly commit:: 047576e57fcc5c2043115c7fe8df7c2ed963020b Author:: Erik Hollensbe Date:: Thu Jul 31 01:02:22 2008 -0700 * Fixed another regression I missed earlier * DBI::Row did shallow copies of the delegated array, which was causing problems with Pg arrays. Using a marshal dump/load method now, hope it's not too slow. commit:: 5a985a202efc3c0bc7dd7ef19ffe93a1ddd15b6d Author:: Erik Hollensbe Date:: Wed Jul 30 23:55:04 2008 -0700 * Found a pretty ugly bug in DBI::Row, which caused a lot of regressions that should have happened when I started the type changes. * Started to add some new tests commit:: fb3112aa212114c28fe1084030f470474219bc7c Author:: Erik Hollensbe Date:: Wed Jul 30 23:39:19 2008 -0700 * DBI::Row changes for convert_types; no tests yet commit:: 3299bcb6493cd46959641dd129be5f6d58ee01f2 Author:: Erik Hollensbe Date:: Wed Jul 30 23:34:23 2008 -0700 * Added convert_types to DBI, this is propogated up through the various handles. * Reformatted lib/dbi.rb commit:: 4d0f31673a840528b527b27719652bbf0a6ab8e2 Author:: Erik Hollensbe Date:: Wed Jul 30 23:28:52 2008 -0700 * Ok, convert_types works through the whole handler chain now (still untested) commit:: 45091467537e68cffd03c5be56a58d5b1f32b064 Author:: Erik Hollensbe Date:: Wed Jul 30 23:18:16 2008 -0700 * All handles now have a "convert_types" attribute * DatabaseHandles now use the "convert_types" attribute to determine if they are to convert types :) * the columns() method is now a required method for Database classes. Will raise NotSupportedError otherwise. commit:: 74ededbef484b7d4bfe8d16c34c0dc418b89a62a Author:: Erik Hollensbe Date:: Wed Jul 30 22:59:25 2008 -0700 * Converted all tests running w/ system() previously to now use rake's ruby(). This'll ensure the right ruby gets executed. commit:: c04f2e9f2328f2def41ee77925660fe7a78748e2 Author:: Erik Hollensbe Date:: Wed Jul 30 22:58:10 2008 -0700 * Rakefile changes: * test_dbi and test_dbd targets added to DBI rakefile. These test the DBD and DBI individually. * test target in DBI rakefile now depends on the above targets commit:: 2cb5402815de46f94ff72ea9a34ffe18d27061aa Author:: Erik Hollensbe Date:: Tue Jul 29 22:35:06 2008 -0700 * Removed a lot of obsolete files in the build/ directory commit:: 2d0f6b402449912f11999e89877b250e92b5bcb1 Author:: Erik Hollensbe Date:: Tue Jul 29 20:54:16 2008 -0700 * Gem prereqs for DBDs commit:: 9824637cdd2563627a95386fb05d4e1967dd65e1 Author:: Erik Hollensbe Date:: Tue Jul 29 20:01:14 2008 -0700 * ODBC fixes commit:: 0fb69f4f7af40df665afd29db13be7db8bbabced Author:: Erik Hollensbe Date:: Sun Jul 27 21:25:57 2008 -0700 * Fix for #5336 commit:: d993fd1b78981ee26d2d91218646f4fde500166e Author:: Erik Hollensbe Date:: Sun Jul 27 20:38:26 2008 -0700 * Q&D fix for null result set -> tableformatter - fix for #4944 commit:: 09fc86af845dc5bb8dbf2281c5b97b4716fe842f Author:: Erik Hollensbe Date:: Sun Jul 27 20:17:01 2008 -0700 * Finally fixed files left around from the postgresql/test_blob.rb test. Thanks again Mike Pomraning. commit:: a7519cbf170283b5e6f565d05982e0f753b572d1 Author:: Erik Hollensbe Date:: Sun Jul 27 20:09:06 2008 -0700 * Pg: integrated Mike Pomraning's patches from #18925: * async support * Native binds (yay) * TypeUtil: conversion cascade changes * Instead of checking if our object changed during a conversion attempt and cascading down if it didn't, we now have a cascade flag (true or false) which is used. This allows the driver to be more explicit. * Many, many, many of these changes were the result of this modification. commit:: 062447a9e228d66cdaf44ab1cdb73c2e09139149 Author:: Erik Hollensbe Date:: Sat Jul 26 17:24:49 2008 -0700 * Fix for Pg array parser and varchar elements (regression from \ fix in earlier commit) commit:: 7511f9b9794a9504f314159a073f6e3885a5aa83 Author:: Erik Hollensbe Date:: Sat Jul 26 17:08:36 2008 -0700 * Mysql couldn't store blobs properly (the blob test wasn't running.. whoops) * All strings were not properly escaping \ characters. commit:: 4426ac9a65fd05d84a09354e2a0e06f5331894d5 Author:: Erik Hollensbe Date:: Sat Jul 26 16:53:43 2008 -0700 * Some statement tests for ODBC commit:: afdda9620818e270666e5534851291db16122a87 Author:: Erik Hollensbe Date:: Sat Jul 26 16:46:57 2008 -0700 * ODBC working w/ general DBD tests * Reformatted lib/dbi/row.rb commit:: 5f5771a6bc69746f12e61622ee6b3f347253f520 Author:: Erik Hollensbe Date:: Sat Jul 26 13:50:35 2008 -0700 * Updated test/dbi/tc_dbi.rb reflecting Proxy.rb change commit:: 2e3d8a1d2aa1c94b4821ac1b3273dfbb9037db5c Author:: Erik Hollensbe Date:: Sat Jul 26 13:44:53 2008 -0700 * Proxy files are a goner; we'll resurrect them in 0.6.0 commit:: 4b447421ce0b4efdd93e49363db5c3389a445d1c Author:: Erik Hollensbe Date:: Sat Jul 26 13:41:40 2008 -0700 * TODO updates * bin/dbd_proxy never worked, it's now removed from release... hoping to touch on it in 0.6.0 * Removed un-used build/Rakefile.dbd.rb * Updated Rakefile.dbi.rb gemspec to contain 'dbi' as an executable commit:: 2f94d9439b06978cfa4f32b6050d3fa9c75db25e Author:: Erik Hollensbe Date:: Sat Jul 26 13:20:09 2008 -0700 * Lots of fixes to bin/dbi commit:: 2e9471d1b688aaaa6e2d4f493b0c267924af930f Author:: Erik Hollensbe Date:: Sat Jul 26 12:33:45 2008 -0700 * A few fixes to tableformatter and bin/dbi commit:: 68a62555c54897dd7d3ce2eef607739aa076f667 Author:: Erik Hollensbe Date:: Sat Jul 26 00:41:56 2008 -0700 * Fix for the DBI test that tests the version commit:: 76fbf73f56bb1f4c008299eab1c23d80f337bfa7 Author:: Erik Hollensbe Date:: Sat Jul 26 00:40:31 2008 -0700 * Bumped version on DBI so gems will still work and have proper deps commit:: d67ba5f69c8d47aa4dd007086f879ef5a685f6b1 Author:: Erik Hollensbe Date:: Sat Jul 26 00:37:20 2008 -0700 * Added dependencies for DBI * Played around with lib/dbi/trace.rb; it's not going to stay. updated TODO commit:: 0c1c2109f2599b96d22f2df2cb0accfb61d7a457 Author:: Erik Hollensbe Date:: Fri Jul 25 20:30:46 2008 -0700 * DBI and DBD Rakefiles both work as expected: * DBI Rakefile includes the right files in DBI and DBD packages * DBD .tar.gz and .zip files include all the tools to make gems, test, and repackage * DBDs now attempt to require DBI, this is to ensure that testing works without DBI in the package. commit:: e1eec1157fc79426d5d00ec6582bc16029a140ae Author:: Erik Hollensbe Date:: Thu Jul 24 18:13:44 2008 -0700 * new required DBD constant: DESCRIPTION, which describes the DBD's purpose. * Rakefile.dbi.rb is properly generating packages again commit:: 1136a81721598dee5812a9723690d0dfaa7b4212 Author:: Erik Hollensbe Date:: Thu Jul 24 17:55:20 2008 -0700 * Stage 2 of Rakefile changes commit:: 39c0cbb9e8a6c01653fac9c93e0ff188c2eb49dd Author:: Erik Hollensbe Date:: Thu Jul 24 17:25:13 2008 -0700 * Moved /Rakefile -> build/Rakefile.dbi - alterations will come in next commit commit:: 82a6d26d3e054239c72d528bab15c933537ec6f1 Author:: Erik Hollensbe Date:: Thu Jul 24 09:01:18 2008 -0700 * Created Rakefile.dbd (which does not work yet) for using with DBD packages * Removed the DOC_FILES addition in most package specs, this was already being included elsewhere commit:: 904ab1d452100b7c77e1b83dd679a83cb7b8630f Author:: Erik Hollensbe Date:: Thu Jul 24 08:16:26 2008 -0700 * Rakefile changes: * Stock 3.4.1 setup.rb in all .tar.gz's and .zip's now * LICENSE/README/etc in all packages * fixes to ensure all dbd portions are included * DBD-specific tests are now included in packages commit:: 556e08726d9716e5b06d558b8250eb9f0d06df9e Author:: Erik Hollensbe Date:: Wed Jul 23 17:28:00 2008 -0700 * removed bin/PATHCONV and translated the affected filenames commit:: 6d19af7147e4be01363613426610d29e00f72faa Author:: Erik Hollensbe Date:: Wed Jul 23 17:26:51 2008 -0700 * Moved scripts to bin directory instead of the subdir thing they were in commit:: e4b250f620eab7a2aa2f29de8fe70d066e0fdc1b Author:: Erik Hollensbe Date:: Wed Jul 23 17:16:27 2008 -0700 * Sybase DBD is GONE * New setup.rb commit:: b40c85c821a3ef36918386f7097646226d21c2eb Author:: Erik Hollensbe Date:: Wed Jul 23 16:08:10 2008 -0700 * Removed that nasty ColumnInfo mixin in the Mysql DBD commit:: 724ac6bf6d5642442eacd8e1b6254740574997ea Author:: Erik Hollensbe Date:: Wed Jul 23 16:06:44 2008 -0700 * Fixed DBD tests re: forcing all ColumnInfo keys to symbol commit:: b5c21526df27da7eafea5a9969d46d3fdd681e0a Author:: Erik Hollensbe Date:: Wed Jul 23 15:55:19 2008 -0700 * Removed a lot of cruft from ColumnInfo & Tests * Added deprecation warnings to the aliases provided in ColumnInfo commit:: 89ec97e6eb14268d7cc0a117bf4b3c7245a9a802 Author:: Erik Hollensbe Date:: Wed Jul 23 14:23:02 2008 -0700 * ColumnInfo is now a DelegateClass of Hash, instead of inheriting from Hash directly. commit:: bd9ff5bc608fadda89c9df4b57f321b35a5a83dd Author:: Erik Hollensbe Date:: Fri Jul 18 07:53:18 2008 -0700 * Added a nullable requirement for all drivers in dbh#columns. * Fixed a pretty nasty bug getting pkey/unique information in the Pg driver commit:: a12c25181800a258c4085a48925e15eb96295863 Author:: Erik Hollensbe Date:: Fri Jul 18 06:50:42 2008 -0700 * Precision/Scale tests: now works both in columns and column_info output for all drivers commit:: fa6df70c17e589d6977831543ceaf43885a5ba9d Author:: Erik Hollensbe Date:: Fri Jul 18 04:18:46 2008 -0700 * Integrated precision_test table into column and columninfo tests. Required collateral changes below. * New Type: DBI::Type::Decimal to represent DECIMAL and NUMERIC types, falls back to Float, parses to stdlib BigDecimal. * TypeUtil's generic conversion map was updated to handle this type and appropriately communicate it in a query. * MySQL treats NUMERIC/DECIMAL as type 246, which isn't in the TYPE_MAP and therefor never got mapped properly. * This impacted the sum bugfix from pre-0.2.0, converting it to BigDecimal. I think this is an improvement. commit:: b3584e283d86a95f128cf87133f6c355f57b0306 Author:: Erik Hollensbe Date:: Fri Jul 18 03:37:22 2008 -0700 * Added precision_test table to all DBD tests commit:: 73de88a98b1d4477c8309759bf3772e06a053d3c Author:: Erik Hollensbe Date:: Fri Jul 18 03:27:10 2008 -0700 * sth#column_info tests commit:: 989aa098eff6fa306a123d5cac6f6b0441c732fc Author:: Erik Hollensbe Date:: Fri Jul 18 03:12:35 2008 -0700 * Some dbh#columns tests that validate columninfo data across all DBDs commit:: ed963700ac6bdfaa91178d2fca56abb39fce4c34 Author:: Erik Hollensbe Date:: Fri Jul 18 02:58:30 2008 -0700 * Renamed ColumnInfo to DBI::ColumnInfo commit:: f6f18a7d39a689af1bc6cf426c9df9b5797677de Author:: Erik Hollensbe Date:: Fri Jul 18 02:38:14 2008 -0700 * Deprecated with warnings: DBI::Date, DBI::Timestamp, DBI::Time * Added gem dependency 'deprecated' gem commit:: 55322e5554dd690066f24b82bb4d152b07cb7bee Author:: Erik Hollensbe Date:: Wed Jul 16 10:26:25 2008 -0700 * Boolean tests commit:: 878a057cd7e0dac6982ebafe991d6c374a5cfd32 Author:: Erik Hollensbe Date:: Wed Jul 16 10:22:19 2008 -0700 * NULL type coercion * Fixed a *lot* of bugs related to these tests :) commit:: e9a8f0bf8da1a9a3314c0edce88c62e8ec5dd309 Author:: Erik Hollensbe Date:: Wed Jul 16 09:03:45 2008 -0700 * More type system tests commit:: afad45a26658ee9431b01983ef2eda1aed206cdf Author:: Erik Hollensbe Date:: Wed Jul 16 08:19:53 2008 -0700 * More type tests commit:: 172c87f5e6cb122094940727a3e939ddb0a0f76e Author:: Erik Hollensbe Date:: Wed Jul 16 08:11:13 2008 -0700 * test/dbi/tc_types.rb: DBI::Type and DBI::TypeUtil tests commit:: e0df6c9ae41c1f81a5156a9ab97d0e0defd052a2 Author:: Erik Hollensbe Date:: Wed Jul 16 07:32:00 2008 -0700 * Broke up SQLite3 driver commit:: c9d39cc800deb4f5738ad6f838d4024d16d2b7c3 Author:: Erik Hollensbe Date:: Wed Jul 16 07:18:22 2008 -0700 * Broke up SQLite driver commit:: d88476b1f969053bd1a577914c74329e7ad70dd7 Author:: Erik Hollensbe Date:: Wed Jul 16 07:14:35 2008 -0700 * Broke up Pg DBD commit:: 7ecc56e48076bd6e67aa054a2be120ec4b334a69 Author:: Erik Hollensbe Date:: Wed Jul 16 07:01:30 2008 -0700 * Even more readable commit:: 310d615b266ca7572dd0fcf6e64834419972b141 Author:: Erik Hollensbe Date:: Wed Jul 16 07:00:34 2008 -0700 * Base Mysql DBD a little more readable now commit:: 74de7ae7cb2ca09172a08208cb86d5b2cbc8e5fa Author:: Erik Hollensbe Date:: Wed Jul 16 06:59:26 2008 -0700 * Mysql DBD broken into several parts commit:: 7db39811774f0fd7e488784fa5376f45ae330ff2 Author:: Erik Hollensbe Date:: Wed Jul 16 06:39:29 2008 -0700 * removed unused version.rb file commit:: ca71d1cabc6c794928bb6dfe96deab0c083d6ee7 Author:: Erik Hollensbe Date:: Wed Jul 16 06:38:23 2008 -0700 * Moved DBI::TypeUtil to separate file commit:: d0f196c972f41e9abb1b766514b58265041bb75a Author:: Erik Hollensbe Date:: Wed Jul 16 06:34:22 2008 -0700 * Moved DBI::SQL:PreparedStatement to its own file commit:: 31aaffe228e109a8414102ad67bb80fc6701309b Author:: Erik Hollensbe Date:: Wed Jul 16 06:30:41 2008 -0700 * DBI::SQL::BasicBind and DBI::SQL::BasicQuote are now things of the past commit:: b53d794f89461972ef304656ba84679800c91a4b Author:: Erik Hollensbe Date:: Wed Jul 16 06:20:24 2008 -0700 * Broke up DBI::Utils::* namespace into separate files commit:: f8c4f21bfcfc23afeee9046e4df9b837aa9d91ad Author:: Erik Hollensbe Date:: Wed Jul 16 06:09:07 2008 -0700 * Nixed superfluous find require commit:: 748ab1688fd37e139fcef820cf4c44a01287681a Author:: Erik Hollensbe Date:: Wed Jul 16 06:08:17 2008 -0700 * Moved DBI::Base::* to separate files commit:: 0174ee2952308ca7f4528047372a4e2af6490b79 Author:: Erik Hollensbe Date:: Wed Jul 16 06:03:23 2008 -0700 * Broke handle classes out into separate files commit:: 001b38df88f6ac86a4c83fdcdee7503b85bdea2e Author:: Erik Hollensbe Date:: Wed Jul 16 05:57:06 2008 -0700 * Yanked DBI::Binary, Exception classes, and SQL_* constants out into their own files commit:: 6651c7ecacb195c89212e0899b2f24e8f8cac0b2 Author:: Erik Hollensbe Date:: Wed Jul 16 04:23:42 2008 -0700 * DBI and SQLite binding API slightly differs and both produce mildly different results when testing, the tests were modified to take advantage of this without copying code. commit:: d92b9e3a31f599ab0fb3502b5af87f1c49f99324 Author:: Erik Hollensbe Date:: Wed Jul 16 04:01:03 2008 -0700 * SQLite3 driver now works with new type system * Removed some deprecated fetch specializations that would never be called due to the new way fetch is handled commit:: f88beb99ddea04ed25b47a2148e759f777a65e39 Author:: Erik Hollensbe Date:: Tue Jul 15 23:28:26 2008 -0700 * Case-insensitive require fixes in DBI * Binding API fixes for MySQL commit:: 204ab87a01022a79d4a5e7781e22911944ab79f8 Author:: Erik Hollensbe Date:: Mon Jul 14 19:29:28 2008 -0700 * Cleaned up DBI tests. Removed several. commit:: eafb622a020b08664db9dffbbd7f28da96caf48a Author:: Erik Hollensbe Date:: Mon Jul 14 19:05:18 2008 -0700 * WARNING: Most DBI tests are broken right now * Gutted quoting system entirely, favoring the new type system to handle it. * ByteA is now a type, PGcoerce module is gone, gone, gone. * Removed quote instance methods in Pg, replaced with a quote class method for aiding types * All complex types use the E'' quoting syntax now, which should make Pg happier. * Small changes to the type system: * Conversions will now only cascade if the object remains unchanged. This prevents double-quoting. * All recognized types should be properly quoted now. commit:: 7c8e5242ef7f2b4764a07882769d1a920a934f6d Author:: Erik Hollensbe Date:: Mon Jul 14 16:46:11 2008 -0700 * Type conversion seems to be doing its job * ByteA probably still isn't working right. commit:: 1d9307bdb592168ac64bb6884b0d29c9231cfe5e Author:: Erik Hollensbe Date:: Mon Jul 14 15:05:03 2008 -0700 * New method: DBI::TypeUtil.type_name_to_module converts the type_name from columns output into a class * original functionality decoupled from DBI#column_types * DBI::DBD::Pg::Type::Array now has a base_type attribute to explain the encapsulated type * Pg columns now returns array types as a dbi_type with a constructed Array object as the value * More tests for Pg arrays commit:: 8df9e250bc88a1e5af242b2ebe7340afbf1262e9 Author:: Erik Hollensbe Date:: Mon Jul 14 14:44:11 2008 -0700 * Pg array -> Ruby array parser (with types) working now commit:: c0747f49424fe482d503008c1ffebbb973b22534 Author:: Erik Hollensbe Date:: Mon Jul 14 13:05:38 2008 -0700 * An attempt at converting ruby arrays to Pg arrays in the Pg driver commit:: a43f3e3c1b4878c4ecb65c9d64ff79eb58680803 Author:: Erik Hollensbe Date:: Mon Jul 14 12:16:22 2008 -0700 * Shifted types of arrays: * Types in columns output will now reflect the base type of the array (integer, varchar, etc) * The flag "array_of_type" will be set to true if the column is an array * Note: there is still no indication of the dimensions or any information about those dimensions. commit:: f3c802c35b417118b29a948c91d3c736fd62c882 Author:: Erik Hollensbe Date:: Mon Jul 14 11:32:17 2008 -0700 * Lots of healthy TODO modification * test/dbd/postgresql/test_arrays.rb filled out a little bit commit:: 8aa84cd97503244f204efcf07afede10cc2827ea Author:: Erik Hollensbe Date:: Mon Jul 14 09:36:04 2008 -0700 * array table added for Pg commit:: e685648e01aed1cfbc47415faa6d7c4b94609798 Author:: Erik Hollensbe Date:: Mon Jul 7 03:16:30 2008 -0700 * DBI::DBD::DIR is *gone* * load_driver rewritten and simplified * new support methods to enumerate available DBDs commit:: 5481609ad0a18a56727b1582b15c33a0692011d9 Author:: Erik Hollensbe Date:: Mon Jul 7 02:40:34 2008 -0700 * Removed all deprecated drivers (see TODO list for current exceptions) * Updated TODO commit:: 7ac4465c99a24708d93d3f99dd688db0c981e4f2 Author:: Erik Hollensbe Date:: Mon Jul 7 02:39:13 2008 -0700 * Pg array test stub commit:: 4bc3429cb83caec67e6019a94c75d80577d41dab Author:: Erik Hollensbe Date:: Thu Jun 12 12:50:03 2008 -0700 * Fixed a faulty tables test that will never be consistent across many postgresql versions commit:: 4553990f05884ec9e57bd7b4a21bc9f12eb3edc2 Author:: Erik Hollensbe Date:: Fri Apr 25 04:37:55 2008 -0700 * Indentation fixes to Mysql driver commit:: e7f7fcbff57f79da9ff5b99c702ea9d77c06cedb Author:: Erik Hollensbe Date:: Fri Apr 25 04:33:40 2008 -0700 * Mysql driver/tests updated for types API commit:: bce8e2388b5b4cc911ebe6ac047f20bf942ee269 Author:: Erik Hollensbe Date:: Fri Apr 25 04:13:51 2008 -0700 * Added a couple of comments. commit:: 458f3212cdee4fa7ccfae696d63b4d59df59946c Author:: Erik Hollensbe Date:: Fri Apr 25 04:12:50 2008 -0700 * Removed dead code commit:: a68b55ccf2eaa8f46b095c91820efd423159f446 Author:: Erik Hollensbe Date:: Fri Apr 25 04:11:51 2008 -0700 * Some indentation fixes commit:: 58fced679c997a34533a3b73b9a2c61a44976959 Author:: Erik Hollensbe Date:: Fri Apr 25 04:07:10 2008 -0700 * Postgresql driver/tests working commit:: 0c4fb698b5b87a4c359223c54626e841be746ff1 Author:: Erik Hollensbe Date:: Fri Apr 25 02:21:54 2008 -0700 * Fixed DBI tests commit:: aace8131284ec5dea62d147eb4f1486aa88211ee Author:: Erik Hollensbe Date:: Fri Apr 25 02:15:10 2008 -0700 * Fixed sqlite tests commit:: 6345cd1a6929ef396c4f661220e1a8e1eda9f1d2 Author:: Erik Hollensbe Date:: Fri Apr 25 02:14:10 2008 -0700 * Fixed sqlite3 tests commit:: ec003651a813c8dc1a3408bc332fb139dd02a3a4 Author:: Erik Hollensbe Date:: Wed Apr 23 21:19:39 2008 -0700 * Starting in on fixes to the pg driver * Lots of test changes -- mostly storing statement handles as a class var so we can finish them if the test fails commit:: 87d084e9e12fbe1e9e853d3ad3c4c73f21b4c033 Author:: Erik Hollensbe Date:: Thu Apr 17 17:18:01 2008 -0700 * Fix for the Rakefile that tests the ability to require the drivers before building namespaces for them * Many fixes to test/dbd/general/test_types * Many fixes to SQLite3 driver regarding type handling commit:: 41e082f10a697ab072fa77cf125d91d3131c726d Author:: Erik Hollensbe Date:: Thu Apr 17 14:22:18 2008 -0700 * removed some commented out code from the SQLite3 driver. commit:: 6801d689c01782242d92546fe290142cabbd589a Author:: Erik Hollensbe Date:: Thu Apr 17 14:06:58 2008 -0700 * Null handling * removed type conversion from SQLite driver commit:: 6b53384d47c2b946e811128a49c844c4f49dd921 Author:: Erik Hollensbe Date:: Thu Apr 17 13:53:08 2008 -0700 * Fixed Date/Time parsing commit:: 8b76da9c00dcb6cbb32c88ae00f116443eb8905e Author:: Erik Hollensbe Date:: Thu Apr 17 13:43:26 2008 -0700 * Inbound parameter conversion commit:: f72d55ab4dd321b4668dfc239758c9c68ba8d83b Author:: Erik Hollensbe Date:: Thu Apr 17 12:27:19 2008 -0700 * Moved parse logic from SQLite3 driver to DBI::StatementHandle#column_types commit:: 27938c99e9986cc4ba9cc2fe395dd25909772c80 Author:: Erik Hollensbe Date:: Thu Apr 17 12:21:48 2008 -0700 * A basic dry-run of DBI::Type.parse for various types commit:: 2cc28948db2205073fc2f86067cd7fafc189bd16 Author:: Erik Hollensbe Date:: Thu Apr 17 11:23:58 2008 -0700 * Added dbi/types to require list * Added a copyright notice in the source commit:: fadc02793d86ffdf4dea84cb71f727a8b5ce9f72 Author:: Erik Hollensbe Date:: Mon Apr 14 12:00:54 2008 -0700 * Added a StatementHandle#dbh parameter to get the dbh that created the statement handle commit:: 99304f17ca5cc5cbe8b7caddc917f259d2d71d70 Author:: Erik Hollensbe Date:: Mon Apr 14 10:06:21 2008 -0700 * Added a "driver_name" property to DatabaseHandles that yields the driver name information as a string. * Reformatted the majority of dbi.rb commit:: ec63e12741da5cd40b9a7ac3b26e15ee622d4d4c Author:: Erik Hollensbe Date:: Fri Apr 4 08:38:51 2008 -0700 ColumnInfo sanity patch by Pistos commit:: b87cd704db9a6bf031255ae7ca30b70e0df621e0 Author:: Erik Hollensbe Date:: Sun Mar 30 22:20:23 2008 -0700 * Initial (untested) types implementation. Still workin' on it. commit:: f0c124d920ef6996ea63400686a563c6e89cf694 Author:: Erik Hollensbe Date:: Mon Mar 24 09:24:48 2008 -0700 * basic prototype/description of type handling commit:: 8a97a5dd173de711ed22a66d829fcb6b4cd06250 Author:: Erik Hollensbe Date:: Mon Mar 17 08:49:37 2008 -0700 * Rakefile's a little easier to decipher now * Each DBD has it's own version! commit:: d32cf2f2ceb161fb63768657b89f4ee2fd783b06 Author:: Erik Hollensbe Date:: Mon Mar 17 08:25:44 2008 -0700 * Reworked Rakefile to gem all supported DBDs and DBI separately == 0.2.0 - 03/16/2008 === Summary * SQLite (2.x) driver rewritten in ruby * SQLite (3.x) driver provided by Jun Mukai * Migrated DBD::Pg to 'pg' low-level library * bytea and LOB support for DBD::Pg * New DBD Test suite * Tons of bug fixes commit:: 7bc29dd74badd75daa99b4c1f2c97e93dbc6a405 Author:: Erik Hollensbe Date:: Fri Mar 14 11:13:48 2008 -0700 * Fixed two bugs in the Pg driver (thanks again Mike Pomraning): * A tables bug where the system tables were not being sent back. * A columns bug where the columns were not properly selected when the schema search path was altered. commit:: eaf228bdf1c992cd8c523872057e5d2e1901eb6d Author:: Erik Hollensbe Date:: Wed Mar 12 15:35:08 2008 -0700 * Fix for timestamp type handling under mysql commit:: ce4c59e0a60f0dc4bbd66cc84c1b2a50df17c6ca Author:: Erik Hollensbe Date:: Tue Mar 11 10:58:18 2008 -0700 * Some fixes for timestamp handling for SQLite3 commit:: beb4c5b31b355180761df024c6933e1b67a2f59c Author:: Erik Hollensbe Date:: Tue Mar 11 09:09:37 2008 -0700 * Patch provided by Mike Pomraning that gets timestamps in a sane fashion! commit:: a6d70ffb23bb0493cd73ebe38dd413a9d86173bd Author:: Erik Hollensbe Date:: Sat Mar 8 19:05:58 2008 -0800 * Fixed a DBI::Timestamp#to_s error commit:: 48690de14c144ac030b12a2a627db611a0ca257c Author:: Erik Hollensbe Date:: Sat Mar 8 01:19:42 2008 -0800 * Fix for #3916 - sth.any? and sth.rows.zero? not consistent across DBDs commit:: 55f118d3e54dc546b133083271d80caccf00ab53 Author:: Erik Hollensbe Date:: Sat Mar 8 00:34:51 2008 -0800 * Peter Schiller's thread-safety patch * Some more tests surrounding the row count and fetchable? commit:: b496e0d981891fad6291dc49161963a15f05472a Author:: Erik Hollensbe Date:: Thu Mar 6 22:55:07 2008 -0800 * Plenty of DBI::Time fixes (based on a patch from #7710 and tests that were written as generals) commit:: 679bde33924ee368322f7ece4509822e07e68955 Author:: Erik Hollensbe Date:: Thu Mar 6 21:42:00 2008 -0800 * #6965 Fix and test (not ideal, but it does work) commit:: 3819bd468b941465abaffd6b7adc5afa1ddd0406 Author:: Erik Hollensbe Date:: Thu Mar 6 21:11:06 2008 -0800 * #4727 integrated commit:: 32c0e5e6fea308cd52891bf6dac589ad84b29ba4 Author:: Erik Hollensbe Date:: Thu Mar 6 20:57:00 2008 -0800 * Applied patch from ticket #7711 commit:: 34286112df17fbdb7588f45b176a42fb3a77aaae Author:: Erik Hollensbe Date:: Sun Feb 24 12:56:35 2008 -0800 * Fixed bug #10466 commit:: 1f19663fd9b31b0f2f0a111f227220d5ee8cbe1d Author:: Erik Hollensbe Date:: Sun Feb 24 12:09:44 2008 -0800 * Fixed #1082 commit:: f3e6e077e4073c892d8449ec6e1912ffe9f76f95 Author:: Erik Hollensbe Date:: Sun Feb 24 12:02:23 2008 -0800 * ByteA fixes! commit:: 8668eb0c1561b49b144f4a56c3edc2bce90bc2a0 Author:: Erik Hollensbe Date:: Sun Feb 24 00:29:00 2008 -0800 * Fixed most of the LOB support (yay!) commit:: 32ac057631b16429051c90fa9aab3ed1bb560e32 Author:: Erik Hollensbe Date:: Sat Feb 23 23:35:19 2008 -0800 * Initial porting attempt from ruby-postgres to ruby-pg * Test fixes and additions == 0.1.2 - 02-Sep-2006 === General * Paul DuBois: test/dbi/tc_dbi.rb: DBI version number test failed because it was expected to be 0.1.0. (Should have been 0.1.1.) But 0.1.1 has been released, so update DBI version number and expected number in test to 0.1.2. == 0.1.1 - 12-Aug-2006 === General * Paul DuBois: README: Added URLs for the RubyForge DBI project. * Patrick May: removed misleading space in setup.rb config example. * Francis Hwang: fixed bug 597: behaviour of StatementHandle#fetch doesn't match DBI specification * incorporated Matthew Bloch's patch for handling bad timestamps like '0000-00-00 00:00:00' === MySQL * Paul DuBois: Mysql.rb. Expose additional attributes through Database::func(): :client_info (String), :client_version (Fixnum), :host_info (String), :info (String), :proto_info (Fixnum), :server_info (String), :stat (String), :thread_id (Fixnum). * Paul DuBois: Mysql.rb. Modified column_info method to support standard sql_type and type_name column attributes and MySQL-specific mysql_type_name attribute. MYSQL_to_XOPEN hash: Added LONGTEXT and BIT members, corrected length for BLOB and MEDIUMBLOB members. * Paul DuBois: Mysql.rb. Renamed column info attributes/methods: _type, _length, _max_length, _flags are now mysql_type, mysql_length, mysql_max_length, mysql_flags * Paul DuBois: Mysql.rb. Modified column_info method to support standard column attributes: nullable, primary, unique, indexed Modify column_info method to support MySQL-specific column attributes: _type, _length, _max_length, _flags * Paul DuBois: Mysql.rb. Test for sqlstate method using respond_to? rather than by raising an exception. Implemented mysql_compression={0|1} option in DSN to disable/enable compression of client/server protocol. (Default off.) Implemented mysql_client_found_rows={0|1} option in DSN to cause server to return rows-changed counts (0) or rows-matched counts (1) for statements that modify rows (mostly relevant for UPDATE). (Default is rows-changed counts) Bugfix: column_info calculated precision as col.length - col.decimals. Should be col.length (precision is not just the digits to left of decimal point). * Paul DuBois: Mysql.rb: Added state member value to DBI::DatabaseError exceptions for MySQL. If mysql-ruby doesn't define a sqlstate method that provides the SQLSTATE value, state is set to nil (which is the default value anyway). * Paul DuBois: Mysql.rb: Enabled use of mysql_read_default_file and mysql_read_default_group options in DSN for MySQL. These options enable option files to be read. This change addresses bug #1951. * Paul DuBois: MySQL supports transactions. === SQLite * Daniel Berger: Removed hardcoded search paths to search path; Modified dir_config name to lower case == 0.1.0 - 16-Feb-2006 * Project taken over by Kirk Haines, Francis Hwang, Patrick May and Daniel Berger as of January, 2006 (with the permission of Michael Neumann). * Changelog style changed from diff style to summary style. If you want diffs, you can watch the CVS commits at http://ruby-dbi.rubyforge.org/statcvs/commit_log.html. * Old RUnit tests replaced with Test/Unit style tests. * Updated the README file to actually include useful documentation instead of pointing to an html document. * Lots of internal file/directory reorganization and renaming - none of which should matter to you. * General refactoring of the DBI::Row class including a bug fix where using multiple column references did not return the proper values. * Corresponding test suite additions and changes for DBI::Row. * Removed the dbrc.rb file from this distribution. The dbi-dbrc package can be downloaded separately from the RAA or installed as a gem. * Fixed bug #2793 (silent driver load failure). This also covers patch #603. * Fixed bug #1304 (comparing DBI::Timestamp with nil). * Fixed bugs #2099 (permissions issues on Windows). This also covers bug #2567. 2004-05-20 10:36 tag dbi-0-0-23 2004-05-20 10:36 Michael Neumann Changed: lib/dbi/version.rb (1.9), "Exp", lines: +2 -2 increased version 2004-05-20 10:33 Michael Neumann Added: build/README (1.1) initial creation 2004-05-20 10:31 Michael Neumann Changed: build/USER (1.4), "Exp", lines: +1 -0 added whole name of user andreas (for CVS changelog) 2004-05-20 10:28 Michael Neumann Changed: lib/dbd_odbc/ODBC.rb (1.10), "Exp", lines: +2 -2 modified email and copyright 2004-05-20 10:27 Michael Neumann Changed: lib/dbd_odbc/ODBC.rb (1.9), "Exp", lines: +20 -3 Implemented DNS-less connections, see [ruby-talk:67352] and [ruby-talk:100837] 2004-05-19 20:31 Michael Neumann Changed: lib/dbi/test/testsqlquote.rb (1.9), "Exp", lines: +1 -1 lib/dbi/sql.rb (1.18), "Exp", lines: +5 -2 Fixed problems with quoting Time's in Postgres (and probably some other databases). Time's are now represented as RFC-2822 strings, with numeric timezones and not timezone abbreviations (e.g. now +0200 instead CEST). According to Brad Hilton, there are problems with e.g. the IDT timezone which is used in different timezones. 2004-05-19 20:20 Michael Neumann Changed: lib/dbi/test/testsqlquote.rb (1.8), "Exp", lines: +6 -0 added testcase for quoting of Dates 2004-05-18 13:30 Andreas Schwarz Changed: ext/dbd_sqlite/SQLite.c (1.10), "Exp", lines: +3 -2 return number of changed rows in do(); closes #558 2004-05-13 14:24 Michael Neumann Changed: lib/dbd_oracle/Oracle.rb (1.7), "Exp", lines: +4 -3 Database#tables now returns tables AND views 2004-04-27 16:29 Michael Neumann Changed: lib/dbi/dbi.rb (1.42), "Exp", lines: +9 -1 lib/dbi/sql.rb (1.17), "Exp", lines: +3 -3 lib/dbi/test/testsqlcoerce.rb (1.5), "Exp", lines: +8 -0 * added comparison method DBI::Timestamp#== * DBI::SQL::BasicQuote::Coerce#as_timestampe: fixed conversion of timestamps when timezones like "+08:00" are given (instead "+08"). (Marek Janukowicz) 2004-04-26 08:40 Michael Neumann Changed: ext/dbd_sqlite/SQLite.c (1.9), "Exp", lines: +12 -2 raise exception if sql statement contains NUL characters (patch by Shirai,Kaoru) 2004-04-22 20:44 Michael Neumann Changed: build/package.sh (1.9), "Exp", lines: +4 -5 * 2004-04-22 20:10 tag dbi-0-0-22 2004-04-22 20:10 Michael Neumann Changed: lib/dbi/version.rb (1.8), "Exp", lines: +2 -2 new version 2004-04-22 20:08 Michael Neumann Changed: setup.rb (1.5), "Exp", lines: +1 -1 lib/dbd_pg/test/testdbipg.rb (1.2), "Exp", lines: +4 -4 lib/dbi/test/testrow.rb (1.6), "Exp", lines: +2 -2 lib/dbi/test/testsqlbind.rb (1.10), "Exp", lines: +4 -4 lib/dbi/test/testsqlcoerce.rb (1.4), "Exp", lines: +2 -2 lib/dbi/test/testsqlquote.rb (1.7), "Exp", lines: +2 -2 removed "don't put space before argument parentheses" warnings (ruby18) 2004-04-22 19:59 Michael Neumann Deleted: build/DBI-VERSIONS (1.7) build/create_changelog.rb (1.3) build/cvs2cl (1.2) doc/sf_logo.html (1.2) Added: build/cvs2cl.pl (1.1) Changed: build/Makefile (1.5), "Exp", lines: +3 -3 build/package.sh (1.8), "Exp", lines: +6 -14 doc/ToDo (1.2), "Exp", lines: +1 -0 doc/index.rd (1.34), "Exp", lines: +5 -3 moved to rubyforge. modified changelog generation. 2004-04-22 19:57 Michael Neumann Added: lib/dbd_frontbase/FrontBase.rb (1.1) lib/dbd_frontbase/README (1.1) Changed: lib/PATHCONV (1.11), "Exp", lines: +1 -0 imported FrontBase DBD (from Cail Borrell) 2004-04-22 18:46 Michael Neumann Changed: doc/index.rd (1.33), "Exp", lines: +18 -8 moved to rubyforge 2004-04-22 17:59 Michael Neumann Changed: setup.rb (1.4), "Exp", lines: +1 -1 remove parens warning 2003-11-05 20:46 Michael Neumann Changed: lib/dbi/dbi.rb (1.41), "Exp", lines: +2 -1 StatementHandle#execute returns nil instead for internal use intended DBI::Row object 2003-09-16 07:46 Michael Neumann Changed: lib/dbd_pg/Pg.rb (1.33), "Exp", lines: +13 -2 added methods Database#__set_notice_processor, Database#as_timestamp fixed unneeded overhead in Database#fill_array (submitted by Dennis Vshivkov) 2003-09-14 09:35 Michael Neumann Changed: ext/dbd_sqlite/SQLite.c (1.8), "Exp", lines: +2 -2 add timezone UTC to format (MoonWolf) 2003-09-11 20:57 Michael Neumann Changed: lib/dbi/dbi.rb (1.40), "Exp", lines: +3 -2 fixed warning (due to method redefinition) 2003-09-11 16:10 Michael Neumann Changed: doc/index.rd (1.32), "Exp", lines: +3 -1 added contributor 2003-09-11 16:08 Michael Neumann Changed: lib/dbd_db2/DB2.rb (1.7), "Exp", lines: +90 -41 added Database#columns method (by S. Veit) 2003-09-07 12:44 tag dbi-0-0-21 2003-09-07 12:44 Michael Neumann Changed: build/USER (1.3), "Exp", lines: +2 -2 modified email address 2003-09-07 12:41 Michael Neumann Changed: lib/dbi/version.rb (1.7), "Exp", lines: +2 -2 build/DBI-VERSIONS (1.6), "Exp", lines: +1 -0 new version 2003-09-07 12:40 Michael Neumann Changed: build/package.sh (1.7), "Exp", lines: +7 -0 added further dialog 2003-09-07 12:36 Michael Neumann Added: build/test.rb (1.1) lib/dbi/test/require_dispatch.rb (1.1) Changed: lib/dbi/row.rb (1.8), "Exp", lines: +3 -1 lib/dbi/test/testrow.rb (1.5), "Exp", lines: +13 -0 lib/dbi/test/testsqlbind.rb (1.9), "Exp", lines: +21 -2 lib/dbi/test/testsqlcoerce.rb (1.3), "Exp", lines: +3 -2 lib/dbi/test/testsqlquote.rb (1.6), "Exp", lines: +2 -1 * fixed DBI::Row.dup bug that occures in Ruby 1.8. * added tests for this and the SQL parse bug (/) 2003-06-10 21:40 Michael Neumann Changed: lib/dbi/sql.rb (1.16), "Exp", lines: +2 -1 lib/dbi/test/testsqlbind.rb (1.8), "Exp", lines: +7 -0 fixed SQL tokenizer bug: single slashes are preserved 2003-06-06 10:54 tag dbi-0-0-20 2003-06-06 10:54 Michael Neumann Changed: build/DBI-VERSIONS (1.5), "Exp", lines: +1 -0 lib/dbi/version.rb (1.6), "Exp", lines: +2 -2 new version 2003-06-06 10:48 Michael Neumann Changed: doc/index.rd (1.31), "Exp", lines: +5 -2 contributors added 2003-06-03 18:46 Michael Neumann Changed: lib/dbi/utils.rb (1.12), "Exp", lines: +4 -3 TableFormatter: convert false to "false", not "NULL" (MoonWolf) 2003-06-03 18:42 Michael Neumann Changed: ext/dbd_sqlite/SQLite.c (1.7), "Exp", lines: +62 -1 Database#columns method added (MoonWolf) 2003-05-31 15:52 Michael Neumann Changed: lib/dbi/utils.rb (1.11), "Exp", lines: +2 -2 fixed quoting bug ('\"' should be '"') in textconv (Brian Candler) 2003-05-18 20:18 Michael Neumann Changed: lib/dbd_pg/Pg.rb (1.32), "Exp", lines: +141 -24 applied array patches by Oliver M. Bolzer (DBD::Pg can now handle Postgres arrays) 2003-05-16 09:50 Michael Neumann Changed: doc/index.rd (1.30), "Exp", lines: +12 -2 new contributors; link to OCI8 DBD 2003-05-16 09:44 Michael Neumann Changed: lib/dbi/test/testsqlbind.rb (1.7), "Exp", lines: +12 -1 added new test cases for "-" bug 2003-05-16 09:43 Michael Neumann Changed: lib/dbi/test/testrow.rb (1.4), "Exp", lines: +1 -1 lib/dbi/test/testsqlcoerce.rb (1.2), "Exp", lines: +1 -1 lib/dbi/test/testsqlquote.rb (1.5), "Exp", lines: +1 -1 verbose mode 2003-05-16 09:43 Michael Neumann Changed: lib/dbi/sql.rb (1.15), "Exp", lines: +2 -1 bug fixed: "SELECT 1 - 3" was incorrectly transformed into "SELECT 1 3" 2003-05-14 19:52 Michael Neumann Added: ext/dbd_sqlite/test/segfault-bug.rb (1.1) Changed: ext/dbd_sqlite/SQLite.c (1.6), "Exp", lines: +2 -2 fixed bug: Prepared statement is executed twice: once with no match, once with a match. The second case fails and segfaults. 2003-05-14 18:36 Michael Neumann Added: ext/dbd_sqlite/test/test.rb (1.1) Changed: ext/dbd_sqlite/SQLite.c (1.5), "Exp", lines: +33 -6 Patch by : * fix Row Processed Count(sqlite_changes() function) * fix DBI::Timestamp quote format for Timestamp sorting before '2003-2-13 1.2.3.0' => after '2003-02-13 01:02:03' 2003-05-11 15:29 Michael Neumann Changed: lib/dbd_pg/Pg.rb (1.31), "Exp", lines: +25 -18 added NonBlocking execution mode 2003-05-11 15:27 Michael Neumann Changed: lib/dbi/dbi.rb (1.39), "Exp", lines: +13 -5 class Timestamp: - fraction nil by default - fractions may be of type float (as well as integer) - #to_s do not show fraction if it's nil 2003-05-09 19:54 Michael Neumann Changed: lib/dbi/dbi.rb (1.38), "Exp", lines: +5 -5 zero-pad date/time/timestamps (classes Date/Time/Timestamp method to_s) 2003-04-27 19:18 Michael Neumann Changed: build/package.sh (1.6), "Exp", lines: +1 -1 fixed RAA entry update address 2003-04-27 18:51 tag dbi-0-0-19 2003-04-27 18:51 Michael Neumann Changed: build/DBI-VERSIONS (1.4), "Exp", lines: +1 -0 build/USER (1.2), "Exp", lines: +1 -0 lib/dbi/version.rb (1.5), "Exp", lines: +2 -2 new version 2003-04-27 17:42 Michael Neumann Changed: lib/dbi/dbi.rb (1.37), "Exp", lines: +2 -2 bug fix in class DBI::Time (wrong named variable) 2003-04-27 17:40 Michael Neumann Changed: doc/index.rd (1.29), "Exp", lines: +4 -1 new contributor 2003-04-27 17:37 Michael Neumann Changed: lib/dbi/sql.rb (1.14), "Exp", lines: +4 -4 Fixed bug in DBI::SQL::BasicQuote::Coerce#as_time Mysql time columns (like "13:32:33") could not be converted into DBI::Time objects (thanks to Tim Bates) 2003-04-21 18:09 eliask Changed: lib/dbd_db2/DB2.rb (1.6.4.2), "Exp", lines: +34 -3 DB2 driver support for columns(table) 2003-04-02 15:42 Paul Dubois Changed: lib/dbd_mysql/Mysql.rb (1.21), "Exp", lines: +4 -4 Modify transaction support to use self.do rather than @handler.query so that query execution is routed through the mutex. 2003-02-08 02:26 Paul Dubois Changed: lib/dbi/dbi.rb (1.36), "Exp", lines: +19 -2 Fix bug in case insensitive driver name lookup on case insensitive filesystems 2003-02-08 02:03 Paul Dubois Changed: lib/dbd_mysql/Mysql.rb (1.20), "Exp", lines: +40 -3 Add transaction support: commit and rollback methods, AutoCommit database handle attribute 2003-02-08 01:46 Paul Dubois Changed: lib/dbd_mysql/Mysql.rb (1.19), "Exp", lines: +10 -10 return MySQL error number on exceptions, not just error message 2003-02-08 01:37 Paul Dubois Changed: lib/dbd_mysql/Mysql.rb (1.18), "Exp", lines: +5 -1 port and flag connection parameters must be passed as numbers 2003-02-08 00:37 Paul Dubois Changed: lib/dbd_mysql/Mysql.rb (1.17), "Exp", lines: +4 -4 Do not force user to provide database name when connecting 2003-02-01 13:51 Michael Neumann Changed: lib/dbi/test/testsqlbind.rb (1.6), "Exp", lines: +6 -0 added comment test 2003-02-01 13:45 Michael Neumann Changed: lib/dbi/sql.rb (1.13), "Exp", lines: +20 -5 method BasicBind#tokens: added support for C-style (non-nesting) and Ada/SQL92-style comments 2003-01-22 10:55 Michael Neumann Changed: doc/index.rd (1.27), "Exp", lines: +6 -1 added contributor, added Articles section 2003-01-22 10:52 Michael Neumann Changed: doc/DBD_SPEC (1.3), "Exp", lines: +2 -2 doc/DBI_SPEC (1.3), "Exp", lines: +2 -2 fixed wrong email address 2003-01-22 10:45 Michael Neumann Changed: doc/DBD_SPEC (1.2), "Exp", lines: +107 -103 doc/DBI_SPEC (1.2), "Exp", lines: +95 -92 Fix typos and formatting (by Paul DuBois). 2002-12-28 14:36 eliask Changed: lib/dbd_db2/DB2.rb (1.6.4.1), "Exp", lines: +216 -55 experimental support for BLOBs via SQLBindParameter 2002-10-28 11:18 Michael Neumann Changed: build/package.sh (1.5), "Exp", lines: +0 -3 # Removed the removing of empty dirs. Use cvs -P option (implicit) instead. 2002-10-28 11:05 Michael Neumann Changed: build/Makefile (1.4), "Exp", lines: +1 -1 build/package.sh (1.4), "Exp", lines: +1 -1 * 2002-10-25 12:48 Michael Neumann Changed: lib/dbd_pg/Pg.rb (1.30), "Exp", lines: +2 -2 rollback transactions on disconnect 2002-10-22 15:28 tag dbi-0-0-18 2002-10-22 15:28 Michael Neumann Changed: build/DBI-VERSIONS (1.3), "Exp", lines: +1 -0 * 2002-10-22 15:25 Michael Neumann Changed: doc/index.rd (1.26), "Exp", lines: +3 -1 contributor added 2002-10-22 15:15 Michael Neumann Changed: lib/dbi/trace.rb (1.3), "Exp", lines: +2 -1 remove warnings 2002-10-22 15:06 Michael Neumann Changed: lib/dbi/dbi.rb (1.35), "Exp", lines: +21 -12 Driver URLs are now case-sensitive when in SAFE mode >= 1. This prevent a security error. 2002-10-22 14:53 Michael Neumann Changed: lib/dbd_pg/Pg.rb (1.29), "Exp", lines: +70 -10 reverted to old transaction handling schema; removed usage of SET AUTOCOMMIT TO ON|OFF. 2002-10-22 14:00 Michael Neumann Changed: lib/dbd_pg/Pg.rb (1.28), "Exp", lines: +32 -6 Use PostgreSQL specific quoting function (PGconn.quote) instead of default if available. Use PGconn.escape_bytea instead of own __escape_bytea function if available. 2002-10-03 10:21 Michael Neumann Changed: build/package.sh (1.3), "Exp", lines: +2 -2 fixed bug 2002-10-03 09:53 tag dbi-0-0-17 2002-10-03 09:53 Michael Neumann Changed: lib/dbi/version.rb (1.3), "Exp", lines: +2 -2 new version 2002-10-03 09:49 Michael Neumann Added: build/package.sh (1.1) initial creation; handles all release steps 2002-10-02 18:56 Michael Neumann Deleted: doc/create_html (1.2) removed 2002-10-02 18:26 Michael Neumann Deleted: doc/html/index.html (1.26) removed 2002-10-02 18:10 Michael Neumann Added: doc/DBD_SPEC (1.1) doc/DBI_SPEC (1.1) doc/ToDo (1.1) moved from ../lib/dbi/doc 2002-10-02 18:04 Michael Neumann Added: build/DBI-VERSIONS (1.1) build/Makefile (1.1) build/USER (1.1) build/cl2html.sh (1.1) build/create_changelog.rb (1.1) build/cvs2cl (1.1) initial import 2002-10-02 17:53 Michael Neumann Changed: setup.rb (1.3), "Exp", lines: +7 -2 install on debian-unstable into /usr/local/lib/site_ruby/ (by Brad Hilton) 2002-09-26 18:41 Michael Neumann Changed: doc/index.rd (1.24), "Exp", lines: +3 -1 * 2002-09-26 18:37 Michael Neumann Changed: lib/dbd_mysql/Mysql.rb (1.16), "Exp", lines: +40 -8 add support for coercing column values (patch by Brad Hilton) 2002-09-26 13:40 Michael Neumann Changed: lib/dbd_pg/Pg.rb (1.27), "Exp", lines: +9 -14 removed method send_sql and inlined it's code instead (little speed improvement) 2002-09-26 13:32 Michael Neumann Changed: lib/dbd_pg/Pg.rb (1.26), "Exp", lines: +196 -196 converted tabs to spaces 2002-09-26 13:28 Michael Neumann Changed: lib/dbd_pg/Pg.rb (1.25), "Exp", lines: +22 -55 rewritten transaction handling (uses now Postgres' "SET AUTOCOMMIT ON|OFF") 2002-09-13 09:10 Michael Neumann Changed: lib/dbd_pg/Pg.rb (1.24), "Exp", lines: +13 -5 fix quoting backslashes bug (Brad Hilton) 2002-08-02 13:59 Michael Neumann Changed: contrib/dbrc/dbrc.rb (1.2), "Exp", lines: +18 -1 added dsn method, minor doc additions 2002-08-01 19:00 Michael Neumann Changed: lib/dbi/dbi.rb (1.34), "Exp", lines: +37 -16 added Date#to_time/to_date/mday/mday= Time#to_time Timestamp#mday/mday= (Dave Thomas) 2002-07-26 20:43 Michael Neumann Changed: lib/dbi/dbi.rb (1.33), "Exp", lines: +3 -3 Time/Date => ::Time/::Date 2002-07-26 20:41 Michael Neumann Changed: setup.rb (1.2), "Exp", lines: +1 -0 skip CVS directories (Dave Thomas) 2002-07-26 18:14 Michael Neumann Changed: doc/html/index.html (1.25), "Exp", lines: +23 -15 * 2002-07-26 18:13 Michael Neumann Changed: doc/index.rd (1.23), "Exp", lines: +5 -1 added contributors 2002-07-26 18:12 Michael Neumann Added: contrib/dbrc/README (1.1) contrib/dbrc/dbrc.rb (1.1) initial import 2002-07-26 17:56 Michael Neumann Changed: lib/dbd_pg/Pg.rb (1.23), "Exp", lines: +15 -11 enhanced conversion: default is to_str, added timestamp (with/without timezone) 2002-07-26 17:51 Michael Neumann Changed: lib/dbi/dbi.rb (1.32), "Exp", lines: +18 -4 added methods Timestamp#to_time/to_date (Dave Thomas) 2002-07-03 20:09 tag dbi-0-0-16 2002-07-03 20:09 Michael Neumann Changed: lib/dbi/version.rb (1.2), "Exp", lines: +2 -2 new version 2002-07-03 20:08 Michael Neumann Changed: doc/html/index.html (1.24), "Exp", lines: +19 -15 * 2002-07-03 20:07 Michael Neumann Changed: doc/index.rd (1.22), "Exp", lines: +3 -2 added contributor 2002-07-03 19:56 Michael Neumann Changed: lib/dbd_pg/Pg.rb (1.22), "Exp", lines: +37 -8 added Statement#fetch_scroll (patch by Stephen Davies) 2002-07-03 19:24 Michael Neumann Changed: lib/dbi/dbi.rb (1.31), "Exp", lines: +10 -1 Added StatementHandle#[] and #[]=. Updated DBI and DBD specs. 2002-07-03 19:22 Michael Neumann Changed: lib/dbd_pg/Pg.rb (1.21), "Exp", lines: +20 -2 Fixed semantic of method Statement#rows (affects also Database#do): Now returns the Row Processed Count instead of the number of rows in the result. The old behaviour is still available through method Statement#['pg_row_count']. 2002-07-03 16:51 Michael Neumann Changed: doc/html/index.html (1.23), "Exp", lines: +1 -1 * 2002-07-03 16:48 Michael Neumann Changed: bin/commandline/sqlsh.rb (1.3), "Exp", lines: +27 -2 bin/proxyserver/proxyserver.rb (1.3), "Exp", lines: +28 -2 doc/index.rd (1.21), "Exp", lines: +29 -18 doc/html/index.html (1.22), "Exp", lines: +46 -28 ext/dbd_sqlite/SQLite.c (1.4), "Exp", lines: +28 -7 lib/dbd_ado/ADO.rb (1.6), "Exp", lines: +27 -20 lib/dbd_db2/DB2.rb (1.6), "Exp", lines: +27 -10 lib/dbd_interbase/InterBase.rb (1.4), "Exp", lines: +27 -20 lib/dbd_msql/Msql.rb (1.2), "Exp", lines: +27 -18 lib/dbd_mysql/Mysql.rb (1.15), "Exp", lines: +27 -18 lib/dbd_odbc/ODBC.rb (1.8), "Exp", lines: +27 -20 lib/dbd_oracle/Oracle.rb (1.6), "Exp", lines: +29 -23 lib/dbd_pg/Pg.rb (1.20), "Exp", lines: +29 -1 lib/dbd_proxy/Proxy.rb (1.8), "Exp", lines: +27 -19 lib/dbd_sqlrelay/SQLRelay.rb (1.4), "Exp", lines: +27 -19 lib/dbi/dbi.rb (1.30), "Exp", lines: +28 -18 LICENSE (1.2), "Exp", lines: +22 -339 license changed from GNU GPL to BSD 2002-06-13 15:45 Michael Neumann Added: lib/dbd_pg/test/test_bytea.rb (1.1) initial creation 2002-06-13 15:45 Michael Neumann Changed: lib/dbd_pg/Pg.rb (1.19), "Exp", lines: +35 -4 added method Database#__encode_bytea; decode values of type bytea to string 2002-05-21 18:52 tag dbi-0-0-15 2002-05-21 18:52 Michael Neumann Changed: lib/dbd_mysql/Mysql.rb (1.14), "Exp", lines: +9 -4 added driver specific method Database#__insert_id 2002-05-21 18:41 Michael Neumann Changed: lib/dbi/dbi.rb (1.29), "Exp", lines: +2 -1 explicitly initialize @trace_mode and @trace_output in Handle#initialize (omits disturbing warning messages) 2002-05-21 18:36 Michael Neumann Added: examples/trace_test.rb (1.1) initial import 2002-05-21 18:33 Michael Neumann Added: lib/dbi/version.rb (1.1) Changed: lib/dbi/dbi.rb (1.28), "Exp", lines: +3 -5 moved VERSION from dbi.rb to version.rb 2002-05-14 18:07 tag dbi-0-0-14 2002-05-14 18:07 Michael Neumann Changed: lib/dbi/dbi.rb (1.27), "Exp", lines: +3 -3 updated version 2002-05-14 18:03 Michael Neumann Changed: lib/dbd_mysql/Mysql.rb (1.13), "Exp", lines: +24 -14 fixed bug: method #do and #execute both set query_with_result of the same underlying database object. This results in errors if you mix both method calls (not neccessarily called concurrently). Solution: Mutex. 2002-04-17 13:43 Michael Neumann Changed: doc/index.rd (1.20), "Exp", lines: +4 -2 added contributor 2002-04-17 13:38 Michael Neumann Changed: lib/dbd_pg/Pg.rb (1.18), "Exp", lines: +4 -3 cache calls to PGResult#result in class Tuples (by James F.Hranicky); which increases performance around factor 100. 2002-04-16 20:38 tag dbi-0-0-13 2002-04-16 20:38 Michael Neumann Changed: doc/index.rd (1.19), "Exp", lines: +6 -2 doc/html/index.html (1.21), "Exp", lines: +20 -16 * 2002-04-16 20:25 Michael Neumann Changed: doc/html/index.html (1.20), "Exp", lines: +40 -99 * 2002-04-16 20:24 Michael Neumann Changed: doc/index.rd (1.18), "Exp", lines: +16 -44 updates links to sf.net 2002-04-16 20:24 Michael Neumann Added: doc/sf_logo.html (1.1) initial import 2002-02-06 18:05 Michael Neumann Changed: lib/dbd_odbc/ODBC.rb (1.7), "Exp", lines: +5 -4 fixed bug in method columns 2002-02-06 17:27 Michael Neumann Changed: bin/proxyserver/proxyserver.rb (1.2), "Exp", lines: +5 -5 upgraded to DBD API 0.2 fixed bug (checking version numbers) 2002-02-06 17:26 Michael Neumann Changed: lib/dbd_proxy/Proxy.rb (1.7), "Exp", lines: +6 -7 upgraded to DBD API 0.2 2002-02-06 14:24 Michael Neumann Changed: lib/dbi/sql.rb (1.12), "Exp", lines: +2 -2 method SQL::BasicQuote::Coerce::as_timestamp: return nil if str is empty (Sean Chittenden) 2002-01-04 11:54 Michael Neumann Changed: lib/dbi/dbi.rb (1.26), "Exp", lines: +2 -2 new version 2002-01-04 11:52 Michael Neumann Changed: lib/dbd_mysql/Mysql.rb (1.12), "Exp", lines: +1 -5 lib/dbd_pg/Pg.rb (1.17), "Exp", lines: +1 -6 fixed bind_param bug by removing method bind_params 2002-01-04 11:52 Michael Neumann Changed: test/testdbi.rb (1.4), "Exp", lines: +13 -1 added test-case for bind_param bug (only in Mysql and Pg driver) 2002-01-02 00:54 Michael Neumann Changed: lib/dbd_pg/Pg.rb (1.16), "Exp", lines: +1 -5 removed duplicate definition for the [] accessor method (Sean Chittenden) 2001-12-28 14:07 tag dbi-0-0-12 2001-12-28 14:07 Michael Neumann Added: examples/xmlgen.rb (1.1) initial import 2001-12-28 13:19 Michael Neumann Changed: lib/dbd_sqlrelay/SQLRelay.rb (1.3), "Exp", lines: +128 -45 updated version by David Muse 2001-12-28 13:05 Michael Neumann Added: lib/dbi/test/testsqlcoerce.rb (1.1) initial creation 2001-12-28 10:18 Michael Neumann Changed: doc/html/index.html (1.19), "Exp", lines: +45 -24 * 2001-12-28 10:18 Michael Neumann Changed: doc/index.rd (1.17), "Exp", lines: +2 -2 fixed doc 2001-12-28 00:54 Michael Neumann Changed: lib/dbi/sql.rb (1.11), "Exp", lines: +6 -1 DBI::SQL::BasicQuote::Coerce: don't try to convert nil; instead return nil in this case 2001-12-14 15:16 Michael Neumann Changed: doc/index.rd (1.16), "Exp", lines: +17 -4 fixed doc-bug 2001-12-02 17:23 Michael Neumann Changed: lib/dbd_pg/Pg.rb (1.15), "Exp", lines: +8 -4 fixed bug (displayed wrong default values) in method columns 2001-11-26 00:12 Michael Neumann Changed: lib/dbd_oracle/Oracle.rb (1.5), "Exp", lines: +95 -7 included Jim Menards columns methods 2001-11-25 23:26 Michael Neumann Changed: lib/dbd_oracle/Oracle.rb (1.4), "Exp", lines: +17 -3 implemented ?-style parameter markers 2001-11-25 23:25 Michael Neumann Changed: lib/dbi/sql.rb (1.10), "Exp", lines: +4 -2 added attribute accessor for unbound in class PreparedStatement 2001-11-22 15:20 Michael Neumann Changed: lib/dbd_pg/Pg.rb (1.14), "Exp", lines: +16 -8 added method bind_params do no more call commit/rollback if not in transaction use class SQL::PreparedStatement 2001-11-22 14:27 Michael Neumann Changed: ext/dbd_sqlite/README (1.2), "Exp", lines: +4 -0 ext/dbd_sqlite/SQLite.c (1.3), "Exp", lines: +48 -38 ext/dbd_sqlite/extconf.rb (1.3), "Exp", lines: +4 -1 added type conversion 2001-11-22 14:27 Michael Neumann Changed: bin/PATHCONV (1.2), "Exp", lines: +1 -0 added proxyserver 2001-11-22 14:26 Michael Neumann Changed: lib/dbi/utils.rb (1.10), "Exp", lines: +11 -11 ext/dbd_sqlite/extconf.rb (1.4), "Exp", lines: +1 -4 * 2001-11-22 14:25 Michael Neumann Changed: lib/dbi/test/testsqlbind.rb (1.5), "Exp", lines: +54 -0 added test for class PreparedStatement 2001-11-22 14:25 Michael Neumann Changed: lib/dbi/dbi.rb (1.25), "Exp", lines: +31 -8 added constant SQL_TYPE_NAMES, for SQL_XXX constant to SQL type name mapping 2001-11-22 14:23 Michael Neumann Changed: lib/dbi/sql.rb (1.9), "Exp", lines: +60 -2 added class PreparedStatement 2001-11-22 14:21 Michael Neumann Changed: lib/dbd_odbc/ODBC.rb (1.6), "Exp", lines: +48 -32 fixed tables added ping, columns extended column_info 2001-11-22 14:19 Michael Neumann Changed: lib/dbd_mysql/Mysql.rb (1.11), "Exp", lines: +13 -19 use SQL::PreparedStatement to improve speed 2001-11-21 15:03 Michael Neumann Changed: ext/dbd_sqlite/SQLite.c (1.2), "Exp", lines: +219 -18 added conversion routine 2001-11-21 15:01 Michael Neumann Added: test/michael/sqlite.cfg (1.1) test/michael/sqlite/config.sh (1.1) test/michael/sqlite/setup.sh (1.1) test/michael/sqlite/teardown.sh (1.1) ext/dbd_sqlite/README (1.1) initial import 2001-11-17 17:17 Michael Neumann Added: bin/proxyserver/proxyserver.rb (1.1) moved from examples/ 2001-11-17 17:17 Michael Neumann Deleted: examples/proxyserver.rb (1.6) moved to bin/proxyserver 2001-11-17 15:53 Michael Neumann Changed: bin/commandline/sqlsh.rb (1.2), "Exp", lines: +41 -20 command-line option --file 2001-11-17 14:55 Michael Neumann Added: bin/PATHCONV (1.1) initial import 2001-11-17 14:54 Michael Neumann Added: bin/commandline/sqlsh.rb (1.1) refactored code; new feature irb/rb; moved from examples dir 2001-11-17 14:52 Michael Neumann Deleted: examples/sqlsh.rb (1.11) moved to bin/commandline 2001-11-14 14:11 tag dbi-0-0-11 2001-11-14 14:11 Michael Neumann Changed: lib/dbd_pg/test/test_blob.rb (1.2), "Exp", lines: +37 -4 improved blob test 2001-11-14 14:04 Michael Neumann Changed: ext/dbd_sqlite/extconf.rb (1.2), "Exp", lines: +2 -2 fixed 2001-11-14 14:04 Michael Neumann Changed: doc/html/index.html (1.18), "Exp", lines: +2 -2 * 2001-11-14 14:00 Michael Neumann Changed: doc/index.rd (1.14), "Exp", lines: +5 -1 doc/html/index.html (1.17), "Exp", lines: +3 -1 doc/index.rd (1.15), "Exp", lines: +2 -2 * 2001-11-14 13:41 Michael Neumann Changed: lib/dbi/dbi.rb (1.24), "Exp", lines: +2 -2 DatabaseError.new without arguments 2001-11-14 13:38 Michael Neumann Changed: ext/PATHCONV (1.2), "Exp", lines: +2 -1 new dbd 2001-11-14 13:38 Michael Neumann Added: ext/dbd_sqlite/SQLite.c (1.1) ext/dbd_sqlite/extconf.rb (1.1) initial import 2001-11-13 14:53 Michael Neumann Changed: examples/sqlsh.rb (1.10), "Exp", lines: +2 -2 abort table output with "a" 2001-11-13 14:52 Michael Neumann Changed: doc/html/index.html (1.16), "Exp", lines: +0 -0 * 2001-11-13 14:25 Michael Neumann Changed: lib/dbd_mysql/Mysql.rb (1.10), "Exp", lines: +18 -8 fixed quote fixed finish (method do => no result handle => nil.free => exception) 2001-11-13 14:25 tag dbi-0-0-10 2001-11-13 14:25 Michael Neumann Added: lib/dbd_mysql/test/blob_test.rb (1.1) initial import 2001-11-13 11:31 Michael Neumann Changed: lib/dbd_odbc/ODBC.rb (1.5), "Exp", lines: +2 -2 small fix 2001-11-13 11:29 Michael Neumann Changed: doc/html/index.html (1.15), "Exp", lines: +36 -20 * 2001-11-13 11:29 Michael Neumann Changed: doc/index.rd (1.13), "Exp", lines: +16 -1 lib/dbi/dbi.rb (1.23), "Exp", lines: +3 -3 new version 2001-11-13 11:00 Michael Neumann Changed: lib/dbd_pg/Pg.rb (1.13), "Exp", lines: +8 -4 improved Database#ping 2001-11-13 11:00 Michael Neumann Added: lib/dbd_pg/test/test_ping.rb (1.1) initial import 2001-11-12 20:27 Michael Neumann Changed: lib/PATHCONV (1.10), "Exp", lines: +1 -0 added SQLRelay 2001-11-12 20:25 Michael Neumann Changed: lib/dbd_sqlrelay/SQLRelay.rb (1.2), "Exp", lines: +69 -22 added AutoCommit, added fetch_scroll... 2001-11-12 19:40 Michael Neumann Added: lib/dbd_pg/test/test_blob.rb (1.1) initial creation 2001-11-12 19:37 Michael Neumann Changed: lib/dbd_pg/Pg.rb (1.12), "Exp", lines: +87 -2 added Databaseattribute: pg_client_encoding added driver specific functions in Database: blob_import, blob_export, blob_create, blob_open, blob_unlink and blob_read convert DBI::Binary objects to OID's and insert the content as BLOB 2001-11-11 20:57 Michael Neumann Added: lib/dbd_sqlrelay/SQLRelay.rb (1.1) initial import 2001-11-09 16:08 Michael Neumann Changed: lib/dbd_mysql/Mysql.rb (1.9), "Exp", lines: +3 -3 modified method column_info 2001-11-09 01:32 Michael Neumann Changed: lib/dbd_db2/DB2.rb (1.5), "Exp", lines: +59 -30 fixed several bugs 2001-11-08 23:45 Michael Neumann Added: test/michael/pg.cfg (1.1) test/michael/pg/config.sh (1.1) test/michael/pg/setup.sh (1.1) test/michael/pg/teardown.sh (1.1) initial import 2001-11-08 23:45 Michael Neumann Changed: test/testdbi.rb (1.3), "Exp", lines: +1 -1 fixed bug (skaro) 2001-11-08 23:31 Michael Neumann Changed: lib/dbi/sql.rb (1.8), "Exp", lines: +2 -2 corrected type prefix (DBI::) 2001-11-08 23:30 Michael Neumann Changed: lib/dbi/test/testsqlbind.rb (1.4), "Exp", lines: +1 -1 lib/dbi/test/testsqlquote.rb (1.4), "Exp", lines: +1 -1 fixed require (dbi instead of just sql) 2001-11-08 22:39 Michael Neumann Changed: lib/dbi/utils.rb (1.9), "Exp", lines: +9 -3 TableFormatter#ascii modified 2001-11-08 22:38 Michael Neumann Changed: lib/dbd_pg/Pg.rb (1.11), "Exp", lines: +21 -7 method columns: extract default value 2001-11-08 21:51 Michael Neumann Changed: examples/sqlsh.rb (1.9), "Exp", lines: +66 -12 added commands \dt (describe table), \s (short select) and \pl (page length) 2001-10-30 12:51 Michael Neumann Changed: doc/html/index.html (1.14), "Exp", lines: +2 -2 * 2001-10-30 12:51 Michael Neumann Changed: doc/index.rd (1.12), "Exp", lines: +2 -2 fixed typo 2001-10-22 16:08 Michael Neumann Changed: doc/html/index.html (1.13), "Exp", lines: +21 -15 * 2001-10-22 16:07 Michael Neumann Changed: doc/index.rd (1.11), "Exp", lines: +6 -2 new release 2001-10-22 16:05 Michael Neumann Changed: lib/dbi/dbi.rb (1.22), "Exp", lines: +17 -3 preced driver specific functions with __ 2001-10-22 15:59 Michael Neumann Changed: lib/dbd_odbc/ODBC.rb (1.4), "Exp", lines: +9 -3 added odbc_ignorecase option (submitted by Sean O'Halpin) 2001-10-10 13:33 Michael Neumann Changed: lib/dbd_mysql/Mysql.rb (1.8), "Exp", lines: +130 -7 added method StatementHandle#fetch_scroll added createdb, dropdb, reload, shutdown 2001-10-10 10:47 Michael Neumann Changed: lib/dbi/dbi.rb (1.21), "Exp", lines: +47 -40 method DBI.get_driver renamed to DBI._get_full_driver new method DBI.get_driver now returns only DriverHandle object added attribute reader for DBI::Handle 2001-10-10 10:39 Michael Neumann Changed: examples/proxyserver.rb (1.5), "Exp", lines: +2 -2 DBI.get_driver => DBI._get_full_driver 2001-09-07 13:39 tag dbi-0-0-9 2001-09-07 13:39 Michael Neumann Changed: doc/index.rd (1.10), "Exp", lines: +4 -1 doc/html/index.html (1.12), "Exp", lines: +19 -13 * 2001-09-05 21:56 Michael Neumann Changed: lib/dbi/sql.rb (1.7), "Exp", lines: +2 -2 fixed bug in "quote" (found by Steven Davies) 2001-08-30 14:34 Michael Neumann Changed: lib/dbd_pg/Pg.rb (1.10), "Exp", lines: +3 -3 lib/dbd_mysql/Mysql.rb (1.7), "Exp", lines: +5 -5 columns: size=>precision; decimal_digits=>scale 2001-08-30 14:30 Michael Neumann Changed: lib/dbi/dbi.rb (1.20), "Exp", lines: +4 -17 changed SQL_type constants 2001-08-30 14:10 Michael Neumann Changed: lib/dbd_db2/DB2.rb (1.4), "Exp", lines: +59 -10 column_info returns more info's 2001-08-30 14:06 Michael Neumann Changed: examples/proxyserver.rb (1.4), "Exp", lines: +2 -2 changed DBD version checking 2001-08-30 14:06 Michael Neumann Changed: lib/dbd_proxy/Proxy.rb (1.6), "Exp", lines: +8 -2 changed version checking 2001-08-30 14:05 Michael Neumann Changed: lib/dbd_odbc/ODBC.rb (1.3), "Exp", lines: +6 -4 removed patch required for Ruby/ODBC 0.4 2001-08-30 14:02 Michael Neumann Changed: doc/html/index.html (1.11), "Exp", lines: +77 -23 * 2001-08-30 14:01 Michael Neumann Changed: doc/index.rd (1.9), "Exp", lines: +44 -8 added more contributors; new example; updated dbd_odbc (required newer version) 2001-08-30 13:34 Michael Neumann Changed: lib/dbi/dbi.rb (1.19), "Exp", lines: +6 -47 moved DBI::ColumnInfo to own file columninfo.rb removed DBD::COMPATIBLE_API_VERSIONS (now use major/minor) 2001-08-30 13:31 Michael Neumann Changed: lib/dbi/row.rb (1.7), "Exp", lines: +4 -0 * 2001-08-30 13:31 Michael Neumann Added: lib/dbi/columninfo.rb (1.1) initial import (moved from dbi.rb) 2001-08-23 22:11 Michael Neumann Changed: lib/dbi/dbi.rb (1.18), "Exp", lines: +3 -2 added DBI::DBD::COMPATIBLE_API_VERSIONS 2001-08-23 22:09 Michael Neumann Changed: lib/dbd_proxy/Proxy.rb (1.5), "Exp", lines: +2 -2 fixed DBD problems 2001-08-23 22:09 Michael Neumann Changed: examples/proxyserver.rb (1.3), "Exp", lines: +2 -2 fixed DBD version problems 2001-08-23 22:05 Michael Neumann Changed: lib/dbd_proxy/Proxy.rb (1.4), "Exp", lines: +3 -3 fixed problems with different DBD version on the server side 2001-08-23 22:04 Michael Neumann Changed: lib/dbd_mysql/Mysql.rb (1.6), "Exp", lines: +105 -4 added Database#columns; by Eli Green 2001-08-23 21:47 Michael Neumann Changed: lib/dbd_pg/Pg.rb (1.9), "Exp", lines: +107 -2 added Database#columns from Eli Green 2001-08-23 20:59 Michael Neumann Changed: lib/dbi/dbi.rb (1.17), "Exp", lines: +107 -11 StatementHandle#column_info returns now array of DBI::ColumnInfo added class DBI::ColumnInfo added method DatabaseHandle#columns(table) and BaseDatabase#columns(table) 2001-08-21 21:01 Michael Neumann Changed: lib/dbi/utils.rb (1.8), "Exp", lines: +3 -3 fixed bug in XMLFormatter.table (found by Jim Menard) 2001-07-28 12:07 tag dbi-0-0-8 2001-07-28 12:07 Michael Neumann Added: examples/persistence.rb (1.1) Changed: doc/html/index.html (1.10), "Exp", lines: +90 -183 * 2001-07-28 11:58 Michael Neumann Changed: doc/index.rd (1.8), "Exp", lines: +8 -1 new version 2001-07-26 00:56 jweirich Changed: lib/dbi/row.rb (1.6), "Exp", lines: +3 -0 lib/dbi/test/testrow.rb (1.3), "Exp", lines: +28 -16 Fixed row.rb so that dup and clone work 2001-07-19 09:37 Michael Neumann Changed: lib/dbi/dbi.rb (1.16), "Exp", lines: +2 -3 fixed bug in load_driver (thanks to John Gorman) 2001-07-17 16:57 Michael Neumann Changed: lib/dbi/sql.rb (1.6), "Exp", lines: +3 -2 corrected quoting for Time, Date and DateTime 2001-07-11 21:54 Michael Neumann Changed: doc/index.rd (1.7), "Exp", lines: +5 -1 doc/html/index.html (1.8), "Exp", lines: +10 -3 * 2001-07-10 15:07 tag dbi-0-0-7 2001-07-10 15:07 Michael Neumann Changed: lib/dbi/dbi.rb (1.15), "Exp", lines: +3 -1 fixed bug; missing else-branch and return 2001-07-06 19:36 tag dbi-0-0-6 2001-07-06 19:36 Michael Neumann Changed: doc/html/index.html (1.7), "Exp", lines: +10 -3 * 2001-07-06 19:35 Michael Neumann Changed: lib/dbi/dbi.rb (1.14), "Exp", lines: +2 -1 fixed bug in load_driver (added return found) 2001-07-06 18:21 Michael Neumann Changed: doc/index.rd (1.6), "Exp", lines: +6 -2 new release 2001-07-06 18:16 Michael Neumann Changed: lib/dbd_pg/Pg.rb (1.8), "Exp", lines: +3 -2 added DBI URI parameter database additionally to dbname 2001-07-06 18:14 Michael Neumann Changed: lib/dbd_proxy/Proxy.rb (1.3), "Exp", lines: +8 -4 rewritten DBI URI parser (due to dsn=...;...;) 2001-07-06 18:14 Michael Neumann Changed: lib/dbi/utils.rb (1.7), "Exp", lines: +11 -3 added patch by John Gorman for Utils.parse_params to allow database:host instead of database=...;host=... 2001-07-06 18:13 Michael Neumann Changed: lib/dbi/dbi.rb (1.13), "Exp", lines: +35 -6 added case-insensitive DBD name patch by John Gorman (e.g. dbi:Mysql:... and dbi:mysql:... should both work) 2001-06-29 17:18 Michael Neumann Changed: lib/dbi/dbi.rb (1.12), "Exp", lines: +3 -3 lib/dbi/sql.rb (1.5), "Exp", lines: +1 -2 lib/dbi/utils.rb (1.6), "Exp", lines: +4 -4 removed some warnings 2001-06-29 03:27 jweirich Changed: test/testdbi.rb (1.2), "Exp", lines: +17 -17 Removed spaces before arg lists (warnings using -w) 2001-06-22 12:28 jweirich Deleted: lib/dbi/test/testdbi.rb (1.3) Added: test/README (1.1) test/testdbi.rb (1.1) test/example/config.sh (1.1) test/example/example.cfg (1.1) test/example/setup.sh (1.1) test/example/teardown.sh (1.1) Moved testdbi.rb to toplevel test dir. Added configurability 2001-06-18 13:59 Michael Neumann Changed: examples/sqlsh.rb (1.8), "Exp", lines: +76 -6 added input/output support 2001-06-18 13:49 Michael Neumann Changed: lib/dbi/utils.rb (1.5), "Exp", lines: +17 -1 added conv_param to convert Date/Time arguments to DBI::Date/Time 2001-06-18 13:48 Michael Neumann Changed: lib/dbi/sql.rb (1.4), "Exp", lines: +65 -1 added Masatoshi SEKI's Coerce class 2001-06-18 13:47 Michael Neumann Changed: lib/dbi/dbi.rb (1.11), "Exp", lines: +44 -9 improved DBI:: Date/Time/Timestamp classes, added automatic coercion from Date/automatic Time to DBI::Date/Time in parmeters 2001-06-18 13:45 Michael Neumann Changed: lib/dbd_pg/Pg.rb (1.7), "Exp", lines: +13 -19 added coercing from Masatoshi SEKI 2001-06-18 12:02 Michael Neumann Changed: lib/dbd_pg/Pg.rb (1.6), "Exp", lines: +16 -23 connection changed to "dbi:Pg:dbname=..;host=...;port=...;tty=;options=" 2001-06-17 20:04 jweirich Changed: lib/dbi/sql.rb (1.3), "Exp", lines: +41 -21 lib/dbi/test/testdbi.rb (1.2), "Exp", lines: +1 -1 lib/dbi/test/testsqlbind.rb (1.3), "Exp", lines: +71 -0 lib/dbi/test/testsqlquote.rb (1.3), "Exp", lines: +1 -1 Updated the sql binding methods to correctly ignore ? in a string. Tests also updated. 2001-06-11 12:59 Michael Neumann Changed: examples/sqlsh.rb (1.7), "Exp", lines: +2 -2 output available DBDs (call sqlsh.rb without params) even if an error occured 2001-06-11 12:58 Michael Neumann Changed: lib/dbi/trace.rb (1.2), "Exp", lines: +2 -1 added require "dbi" to work as "ruby -r dbi/trace myprog.rb" 2001-06-11 10:46 Michael Neumann Changed: doc/html/index.html (1.6), "Exp", lines: +22 -14 * 2001-06-11 10:45 Michael Neumann Changed: doc/index.rd (1.5), "Exp", lines: +13 -5 ChangeLog and ToDo section 2001-06-11 10:44 Michael Neumann Changed: lib/dbi/dbi.rb (1.10), "Exp", lines: +2 -21 version => 0.0.6, moved ToDo's into file doc/ToDo 2001-06-11 00:11 Michael Neumann Changed: lib/dbi/sql.rb (1.2), "Exp", lines: +19 -11 fixed bug found by Masatoshi SEKI in bind(self, "WHERE a=?", ["connected?"]) 2001-06-11 00:09 Michael Neumann Changed: lib/dbi/test/testrow.rb (1.2), "Exp", lines: +1 -1 lib/dbi/test/testsqlbind.rb (1.2), "Exp", lines: +10 -1 lib/dbi/test/testsqlquote.rb (1.2), "Exp", lines: +1 -1 require files in the directory below instead of installed (e.g. ../sql instead of dbi/sql) extended testsqlbind.rb (to check for a bug occured in 0.0.5) 2001-06-08 20:30 tag dbi-0-0-5 2001-06-08 20:30 Michael Neumann Changed: doc/index.rd (1.4), "Exp", lines: +2 -2 doc/html/index.html (1.5), "Exp", lines: +1 -1 changed downloads 2001-06-08 20:28 Michael Neumann Changed: lib/dbd_odbc/ODBC.rb (1.2), "Exp", lines: +2 -2 corrected data_sources ("dbi:ODBC:" + ...) 2001-06-08 20:21 Michael Neumann Added: lib/dbi/trace.rb (1.1) Changed: lib/dbi/dbi.rb (1.9), "Exp", lines: +36 -3 added tracing to DBI 2001-06-07 20:13 Michael Neumann Changed: examples/sqlsh.rb (1.6), "Exp", lines: +8 -4 added resuce when showing the available DSN 2001-06-07 19:12 Michael Neumann Changed: doc/html/index.html (1.4), "Exp", lines: +9 -1 lib/dbd_db2/DB2.rb (1.3), "Exp", lines: +40 -13 added fetch_scroll as well as Date/Time convertion for DB2 2001-06-07 19:10 Michael Neumann Changed: doc/index.rd (1.3), "Exp", lines: +6 -1 added ODBC 2001-06-07 19:06 Michael Neumann Changed: lib/dbi/dbi.rb (1.8), "Exp", lines: +29 -3 added classes Date and Time 2001-06-07 19:06 Michael Neumann Added: lib/dbd_odbc/ODBC.rb (1.1) Changed: lib/PATHCONV (1.9), "Exp", lines: +1 -0 initial import 2001-06-07 13:52 Michael Neumann Added: lib/dbd_msql/Msql.rb (1.1) Changed: doc/html/index.html (1.3), "Exp", lines: +8 -1 lib/PATHCONV (1.8), "Exp", lines: +1 -0 lib/dbd_mysql/Mysql.rb (1.5), "Exp", lines: +14 -5 added method do in Mysql initial import of Msql 2001-06-07 13:52 Michael Neumann Changed: doc/index.rd (1.2), "Exp", lines: +5 -1 mSQL added 2001-06-07 10:42 Michael Neumann Changed: lib/dbd_ado/ADO.rb (1.5), "Exp", lines: +12 -13 lib/dbd_db2/DB2.rb (1.2), "Exp", lines: +2 -2 lib/dbd_interbase/InterBase.rb (1.3), "Exp", lines: +30 -13 lib/dbd_mysql/Mysql.rb (1.4), "Exp", lines: +13 -16 lib/dbd_oracle/Oracle.rb (1.3), "Exp", lines: +38 -16 lib/dbd_pg/Pg.rb (1.5), "Exp", lines: +3 -3 lib/dbd_proxy/Proxy.rb (1.2), "Exp", lines: +21 -2 lib/dbi/dbi.rb (1.7), "Exp", lines: +2 -2 changed raising DBI::Error to DBI::DatabaseError changed method DBI::DatabaseError.new 2001-06-06 15:32 Michael Neumann Changed: lib/dbi/utils.rb (1.4), "Exp", lines: +5 -5 extended XMLFormatter methods row and table 2001-06-05 22:33 Michael Neumann Changed: lib/dbd_pg/doc/README (1.2), "Exp", lines: +10 -8 adapted towards new version 0.0.5 2001-06-05 22:30 Michael Neumann Changed: ext/dbd_sybase/doc/README (1.3), "Exp", lines: +4 -1 outdated 2001-06-05 22:28 Michael Neumann Changed: doc/html/index.html (1.2), "Exp", lines: +196 -1 added content 2001-06-05 22:25 Michael Neumann Added: doc/create_html (1.1) doc/index.rd (1.1) doc/html/rubyStyle.css (1.1) new README file 2001-06-05 22:23 Michael Neumann Changed: README (1.2), "Exp", lines: +1 -92 removed content, forward to doc/index.rd 2001-06-05 12:17 Michael Neumann Changed: examples/proxyserver.rb (1.2), "Exp", lines: +14 -5 improved some code 2001-06-05 12:14 Michael Neumann Changed: lib/dbd_interbase/InterBase.rb (1.2), "Exp", lines: +20 -4 added error handling => DBI::Error 2001-06-05 12:07 Michael Neumann Changed: lib/dbd_pg/Pg.rb (1.4), "Exp", lines: +4 -4 changed $! (.dup) to $!.type.to_s (to fix the DRbUnknown DBD::Proxy bug) 2001-06-05 12:06 Michael Neumann Changed: lib/dbd_mysql/Mysql.rb (1.3), "Exp", lines: +48 -12 added error handling -> DBI::Error added ?-parameter markers binding removed ::Mysql.quote because it didn't worked as expected 2001-06-05 10:28 Michael Neumann Changed: lib/dbd_ado/ADO.rb (1.4), "Exp", lines: +10 -3 fixed misbehaviour in #finish. now supports parameter markers 2001-06-05 09:44 Michael Neumann Changed: lib/dbi/utils.rb (1.3), "Exp", lines: +2 -2 fixed bug (one parenthese too much) 2001-06-04 14:24 Michael Neumann Changed: lib/PATHCONV (1.7), "Exp", lines: +1 -0 added Proxy 2001-06-04 14:23 Michael Neumann Added: lib/dbd_proxy/Proxy.rb (1.1) examples/proxyserver.rb (1.1) initial import 2001-06-04 14:22 Michael Neumann Changed: lib/dbi/dbi.rb (1.6), "Exp", lines: +25 -6 added DBI.get_driver (to access the underlying DBD-Driver), needed by ProxyServer @@driver_map contains now arrays of DBI::DriverHandle and DBD::Driver -> modified all methods which use it added checks in DatabaseHandle select_one, select_all, [], []= if it is already closed -> raise exemption 2001-06-04 14:15 Michael Neumann Changed: lib/dbi/row.rb (1.5), "Exp", lines: +10 -1 added methods to_h, field_names (alias to column_names) and fixed typo-bug 2001-06-04 14:13 Michael Neumann Changed: lib/dbd_pg/Pg.rb (1.3), "Exp", lines: +10 -0 added method DatabaseHandle#tables and modified load_type_map to return CHAR's 2001-06-02 19:20 Rainer Perl Changed: ext/dbd_sybase/extconf.rb (1.2), "Exp", lines: +1 -6 applied patch from Akinori MUSHA 2001-06-02 18:06 Rainer Perl Added: doc/html/index.html (1.1) added example web-index 2001-06-01 11:04 Michael Neumann Changed: lib/dbd_oracle/Oracle.rb (1.2), "Exp", lines: +117 -43 improved speed, fixed some bugs 2001-05-31 14:34 Michael Neumann Changed: examples/sqlsh.rb (1.5), "Exp", lines: +1 -2 fixed bug (rescue instead ensure), which had the consequence readline was never used 2001-05-31 14:18 Michael Neumann Changed: lib/dbd_mysql/Mysql.rb (1.2), "Exp", lines: +1 -1 changed in datasource, mysql to Mysql 2001-05-31 14:17 Michael Neumann Changed: lib/dbi/row.rb (1.4), "Exp", lines: +2 -0 added "include Enumerable" 2001-05-31 14:16 Michael Neumann Changed: lib/PATHCONV (1.6), "Exp", lines: +1 -1 install wrapper together with dbi 2001-05-31 13:54 Michael Neumann Changed: lib/dbi/row.rb (1.3), "Exp", lines: +4 -2 fixed bug, so size_or_arr can now be nil, which creates an Array of size col_names.size 2001-05-31 13:53 Michael Neumann Added: lib/wrapper/dbi.rb (1.1) initial creation 2001-05-31 13:53 Michael Neumann Changed: lib/PATHCONV (1.5), "Exp", lines: +1 -0 add directory wrapper which installs directly into site-ruby 2001-05-31 13:52 Michael Neumann Changed: examples/sqlsh.rb (1.4), "Exp", lines: +1 -1 removed double :: in DSN output 2001-05-31 13:28 Michael Neumann Added: lib/dbi/test/testdbi.rb (1.1) lib/dbi/test/testrow.rb (1.1) lib/dbi/test/testsqlbind.rb (1.1) lib/dbi/test/testsqlquote.rb (1.1) initial import of test-cases, from Jim Weirichs Postgesql DBD 2001-05-31 13:27 Michael Neumann Changed: lib/dbi/utils.rb (1.2), "Exp", lines: +47 -1 move some methods from dbi/dbi into this file 2001-05-31 13:26 Michael Neumann Added: lib/dbi/sql.rb (1.1) initial creation. extracted from Jim Weirichs basicquote.rb, basicbind.rb and Postgresql.rb (query?) 2001-05-31 13:25 Michael Neumann Changed: lib/dbi/row.rb (1.2), "Exp", lines: +120 -83 use delegator to Array many features added, e.g dbrow["firstname", "lastname", ...] => ['Michael', 'Neumann', ...] passed Jims testcase 2001-05-31 13:23 Michael Neumann Changed: lib/dbi/dbi.rb (1.5), "Exp", lines: +8 -42 moved module Utils into file dbi/utils.rb use Jim Weirichs SQL::BasicQuote 2001-05-31 13:19 Michael Neumann Changed: lib/dbd_ado/ADO.rb (1.3), "Exp", lines: +2 -2 use SQL.query? instead of own version 2001-05-31 13:18 Michael Neumann Added: lib/dbd_pg/test/testdbipg.rb (1.1) initial import from Jim Weirichs ruby-dbi-postgresql-28.05.2001.7.tgz changed Postgres to Pg 2001-05-31 13:17 Michael Neumann Added: lib/dbd_pg/doc/README (1.1) initial import from Jim Weirichs ruby-dbi-postgresql-28.05.2001.7.tgz 2001-05-31 13:16 Michael Neumann Changed: lib/dbd_pg/Pg.rb (1.2), "Exp", lines: +3 -12 extracted some goodies to dbi/sql.rb changed Postgresql to Pg 2001-05-31 13:14 Michael Neumann Added: lib/dbd_pg/Pg.rb (1.1) initial import from Jim Weirichs ruby-dbi-postgesql-28.05.2001.7.tgz 2001-05-31 13:13 Michael Neumann Changed: lib/PATHCONV (1.4), "Exp", lines: +1 -0 added dbd_pg 2001-05-31 10:21 Michael Neumann Changed: lib/dbd_ado/ADO.rb (1.2), "Exp", lines: +94 -12 fixed several bugs in fetch/fetch_scroll, now has more functionality 2001-05-31 10:20 Michael Neumann Changed: lib/dbi/dbi.rb (1.4), "Exp", lines: +5 -5 fixed constant multiple-assignment bug, (1..6) -> (1..6).to_a fixed exception-raising bug, parameters in DBI::Error now all optional fixed bug in fetch_scroll (rows -> row) 2001-05-31 10:18 Michael Neumann Changed: examples/sqlsh.rb (1.3), "Exp", lines: +64 -10 added new commands (commit, rollback, autocommit) fixed readline-bug, readline -> $stdin.readline 2001-05-30 18:59 Michael Neumann Changed: lib/dbi/dbi.rb (1.3), "Exp", lines: +9 -5 added StatementHandle#finished? added check in DatabaseHandle#execute/#prepare in block-form, if finished? before calling #finish changed require "x" -> require "dbi/x" 2001-05-30 18:43 Michael Neumann Added: lib/dbd_ado/ADO.rb (1.1) initial import 2001-05-30 18:40 Michael Neumann Changed: lib/PATHCONV (1.3), "Exp", lines: +1 -0 added ADO entry 2001-05-30 18:37 Michael Neumann Changed: examples/sqlsh.rb (1.2), "Exp", lines: +17 -3 don't rely on "readline", works now without 2001-05-30 12:51 Michael Neumann Added: examples/sqlsh.rb (1.1) examples/sqlsh.rb.new (1.1) examples/test1.pl (1.1) examples/test_blob.rb (1.1) examples/xmltest.rb (1.1) Changed: examples/test1.rb (1.2), "Exp", lines: +9 -22 initial import 2001-05-30 12:43 Michael Neumann Changed: lib/dbd_mysql/doc/HISTORY (1.2), "Exp", lines: +4 -1 lib/dbd_mysql/doc/README (1.2), "Exp", lines: +2 -2 new entry 2001-05-30 12:40 Michael Neumann Added: lib/dbd_oracle/Oracle.rb (1.1) initial import 2001-05-30 12:40 Michael Neumann Added: lib/dbd_interbase/InterBase.rb (1.1) added new DBDs initial import initial import 2001-05-30 12:40 Michael Neumann Added: lib/dbd_db2/DB2.rb (1.1) added new DBDs initial import 2001-05-30 12:40 Michael Neumann Changed: lib/PATHCONV (1.2), "Exp", lines: +5 -2 added new DBDs 2001-05-30 12:36 Michael Neumann Deleted: lib/dbd_mysql/dbd_mysql.rb (1.2) Added: lib/dbd_mysql/Mysql.rb (1.1) upgraded to new version 0.5 2001-05-29 11:22 Michael Neumann Changed: lib/dbi/dbi.rb (1.2), "Exp", lines: +852 -138 almost complete rewrite of DBI by Michael Neumann 2001-05-29 11:16 Michael Neumann Added: lib/dbi/row.rb (1.1) lib/dbi/utils.rb (1.1) initial import 2001-05-08 14:05 tag dbd_sybase-0-0-3 2001-05-08 14:05 Rainer Perl Changed: ext/dbd_sybase/dbd_sybase.c (1.2), "Exp", lines: +34 -39 ext/dbd_sybase/doc/HISTORY (1.2), "Exp", lines: +3 -0 ext/dbd_sybase/doc/README (1.2), "Exp", lines: +4 -21 Updated dbd_sybase (now 0.0.3) 2001-05-06 17:59 tag dbd_mysql-0-0-4 2001-05-06 17:59 tag dbd_sybase-0-0-2 2001-05-06 17:59 tag dbi-0-0-4 2001-05-06 17:59 tag start 2001-05-06 17:59 Rainer Perl Changed: LICENSE (1.1.1.1), "Exp", lines: +0 -0 README (1.1.1.1), "Exp", lines: +0 -0 setup.rb (1.1.1.1), "Exp", lines: +0 -0 examples/test1.rb (1.1.1.1), "Exp", lines: +0 -0 ext/PATHCONV (1.1.1.1), "Exp", lines: +0 -0 ext/dbd_sybase/dbd_sybase.c (1.1.1.1), "Exp", lines: +0 -0 ext/dbd_sybase/extconf.rb (1.1.1.1), "Exp", lines: +0 -0 ext/dbd_sybase/doc/HISTORY (1.1.1.1), "Exp", lines: +0 -0 ext/dbd_sybase/doc/README (1.1.1.1), "Exp", lines: +0 -0 lib/PATHCONV (1.1.1.1), "Exp", lines: +0 -0 lib/dbd_mysql/dbd_mysql.rb (1.1.1.1), "Exp", lines: +0 -0 lib/dbd_mysql/doc/HISTORY (1.1.1.1), "Exp", lines: +0 -0 lib/dbd_mysql/doc/README (1.1.1.1), "Exp", lines: +0 -0 lib/dbi/dbi.rb (1.1.1.1), "Exp", lines: +0 -0 Imported sources 2001-05-06 17:59 Rainer Perl Added: LICENSE (1.1) README (1.1) setup.rb (1.1) examples/test1.rb (1.1) ext/PATHCONV (1.1) ext/dbd_sybase/dbd_sybase.c (1.1) ext/dbd_sybase/extconf.rb (1.1) ext/dbd_sybase/doc/HISTORY (1.1) ext/dbd_sybase/doc/README (1.1) lib/PATHCONV (1.1) lib/dbd_mysql/dbd_mysql.rb (1.1) lib/dbd_mysql/doc/HISTORY (1.1) lib/dbd_mysql/doc/README (1.1) lib/dbi/dbi.rb (1.1) Initial revision ruby-dbd-pg-0.3.9+gem2deb/LICENSE000066400000000000000000000026421163371010100161420ustar00rootroot00000000000000(C) 2008 Erik Hollensbe . All rights reserved. Please see "README" for earlier copyrights. Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met: 1. Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer. 2. Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution. 3. The name of the author may not be used to endorse or promote products derived from this software without specific prior written permission. THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. ruby-dbd-pg-0.3.9+gem2deb/README000066400000000000000000000175271163371010100160250ustar00rootroot00000000000000= Description The DBI package is a vendor independent interface for accessing databases. It is similar, but not identical to, Perl's DBI module. = Synopsis require 'dbi' # Connect to a database, old style dbh = DBI.connect('DBI:Mysql:test', 'testuser', 'testpwd') # Insert some rows, use placeholders 1.upto(13) do |i| sql = "insert into simple01 (SongName, SongLength_s) VALUES (?, ?)" dbh.do(sql, "Song #{i}", "#{i*10}") end # Select all rows from simple01 sth = dbh.prepare('select * from simple01') sth.execute # Print out each row while row=sth.fetch do p row end # Close the statement handle when done sth.finish # Don't prepare, just do it! dbh.do('delete from simple01 where internal_id > 10') # And finally, disconnect dbh.disconnect # Same example, but a little more Ruby-ish DBI.connect('DBI:Mysql:test', 'testuser', 'testpwd') do | dbh | sql = "insert into simple01 (SongName, SongLength_s) VALUES (?, ?)" dbh.prepare(sql) do | sth | 1.upto(13) { |i| sth.execute("Song #{i}", "#{i*10}") } end dbh.select_all('select * from simple01') do | row | p row end dbh.do('delete from simple01 where internal_id > 10') end = Prerequisites Ruby 1.8.6 or later is the test target, however you may have success with earlier 1.8.x versions of Ruby. = RubyForge Project General information: http://ruby-dbi.rubyforge.org Project information: http://rubyforge.org/projects/ruby-dbi/ Downloads: http://rubyforge.org/frs/?group_id=234 = Installation There are many database drivers (DBDs) available. You only need to install the DBDs for the database software that you will be using. == Gem setup: gem install dbi # One or more of: gem install dbd-mysql gem install dbd-pg gem install dbd-sqlite3 gem install dbd-sqlite == Without rubygems: ruby setup.rb config ruby setup.rb setup ruby setup.rb install == The bleeding edge: git clone git://hollensbe.org/git/ruby-dbi.git git checkout -b development origin/development Also available at git clone git://github.com/erikh/ruby-dbi.git = Available Database Drivers (DBDs) == DBD::MySQL MySQL Depends on the mysql-ruby package from http://www.tmtm.org/mysql or available from the RAA. == DBD::ODBC ODBC Depends on the ruby-odbc package (0.5 or later, 0.9.3 or later recommended) at http://www.ch-werner.de/rubyodbc or available from the RAA. Works together with unix-odbc. == DBD::OCI8 OCI8 (Oracle) Depends on the the ruby-oci8 package, available on the RAA and RubyForge. == DBD::Pg PostgreSQL Depends on the pg package, available on RubyForge. == DBD::SQLite SQLite (versions 2.x and earlier) Depends on the sqlite-ruby package, available on rubyforge. == DBD::SQLite3 SQLite 3.x Depends on the sqlite3-ruby package, available on rubyforge. = Additional Documentation See the directories doc/* for DBI and DBD specific information. The DBI specification is at doc/DBI_SPEC.rdoc. The DBD specification is at doc/DBD_SPEC.rdoc. = Articles == Tutorial: Using the Ruby DBI Module http://www.kitebird.com/articles/ruby-dbi.html = Applications == dbi The SQL command line interpreter dbi is available in directory bin/. It gets installed by default. = License Copyright (c) 2008 Erik Hollensbe Copyright (c) 2005-2006 Kirk Haines, Francis Hwang, Patrick May and Daniel Berger. Copyright (c) 2001, 2002, 2003, 2004 Michael Neumann and others (see the beginning of each file for copyright holder information). All rights reserved. Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met: 1. Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer. 2. Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution. 3. The name of the author may not be used to endorse or promote products derived from this software without specific prior written permission. THIS SOFTWARE IS PROVIDED 'AS IS' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. This is the BSD license which is less restrictive than GNU's GPL (General Public License). = Contributors Pistos Too much to specify. Infinite patience and help. Christopher Maujean Lots of initial help when reviving the project. Jun Mukai Contributed initial SQLite3 DBD. John J. Fox IV Lots of help testing on multiple platforms. Kirk Haines One of the authors of the rewrite effort (January 2006). Francis Hwang One of the authors of the rewrite effort (January 2006). Patrick May One of the authors of the rewrite effort (January 2006). Daniel Berger One of the authors of the rewrite effort (January 2006). Michael Neumann Original author of Ruby/DBI; wrote the DBI and most of the DBDs. Rainer Perl Author of Ruby/DBI 0.0.4 from which many good ideas were taken. Jim Weirich Original author of DBD::Pg. Wrote additional code (e.g. sql.rb, testcases). Gave many helpful hints and comments. Eli Green Implemented DatabaseHandle#columns for Mysql and Pg. Masatoshi SEKI For his version of module BasicQuote in sql.rb. John Gorman For his case insensitive load_driver patch and parameter parser. David Muse For testing the DBD::SQLRelay and for his initial DBD. Jim Menard Extended DBD::Oracle for method columns. Joseph McDonald Fixed bug in DBD::Pg (default values in method columns). Norbert Gawor Fixed bug in DBD::ODBC (method columns) and proxyserver. James F. Hranicky Patch for DBD::Pg (cache PGResult#result in Tuples) which increased performance by a factor around 100. Stephen Davies Added method Statement#fetch_scroll for DBD::Pg. Dave Thomas Several enhancements. Brad Hilton Column coercing patch for DBD::Mysql. Sean Chittenden Originally a co-owner of the project. Submitted several patches and helped with lots of comments. MoonWolf Provided the quote/escape_byte patch for DBD::Pg, DBD::SQLite patch and Database#columns implementation. Further patches. Paul DuBois Fixed typos and formatting. Maintains DBD::Mysql. Tim Bates Bug fixes for Mysql and DBI. Brian Candler Zero-padding date/time/timestamps fix. Florian G. Pflug Discussion and helpful comments/benchmarks about DBD::Pg async_exec vs. exec. Oliver M. Bolzer Patches to support Postgres arrays for DBD::Pg. Stephen R. Veit ruby-db2 and DBD::DB2 enhancements. Dennis Vshivkov DBD::Pg patches Cail Borrell from frontbase.com For the Frontbase DBD and C interface. ruby-dbd-pg-0.3.9+gem2deb/lib/000077500000000000000000000000001163371010100156775ustar00rootroot00000000000000ruby-dbd-pg-0.3.9+gem2deb/lib/dbd/000077500000000000000000000000001163371010100164305ustar00rootroot00000000000000ruby-dbd-pg-0.3.9+gem2deb/lib/dbd/Pg.rb000066400000000000000000000146531163371010100173340ustar00rootroot00000000000000#-- # DBD::Pg # # Copyright (c) 2001, 2002, 2003 Jim Weirich, Michael Neumann # Copyright (c) 2008 Erik Hollensbe, Christopher Maujean # # All rights reserved. # # Redistribution and use in source and binary forms, with or without # modification, are permitted provided that the following conditions # are met: # 1. Redistributions of source code must retain the above copyright # notice, this list of conditions and the following disclaimer. # 2. Redistributions in binary form must reproduce the above copyright # notice, this list of conditions and the following disclaimer in the # documentation and/or other materials provided with the distribution. # 3. The name of the author may not be used to endorse or promote products # derived from this software without specific prior written permission. # # THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, # INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY # AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL # THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, # EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, # PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; # OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, # WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR # OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF # ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. #++ begin require 'rubygems' gem 'pg' gem 'dbi' rescue Exception => e end require 'dbi' require 'pg' module DBI module DBD # # DBD::Pg - Database Driver for the PostgreSQL database system. # # Requires DBI and the 'pg' gem or package to work. # # Only things that extend DBI's results are documented. # module Pg VERSION = "0.3.9" DESCRIPTION = "PostgreSQL DBI DBD" # # returns 'Pg' # # See DBI::TypeUtil#convert for more information. # def self.driver_name "Pg" end # # This method takes a ruby Array and converts it to PostgreSQL array syntax. # def self.generate_array(obj) # XXX yarr, there be recursion here, and it's probably not a good idea. output = "{" obj.each do |item| case item when ::Array output += generate_array(item) else generated = DBI::TypeUtil.convert(driver_name, item) generated = case item when String # in strings, escapes are doubled and the quotes are different. # this gets *really* ugly and needs to be well-tested "\"#{generated.gsub(/\\/) { "\\\\" }}\"" when Fixnum generated.to_s end output += generated end output += "," # FIXME technically, delimiters are variable end output.sub(/,$/, '}') end # # A quote helper, this uses the new syntax in PostgreSQL 8.2 and up. # def self.quote(value) "E'#{ value.gsub(/\\/){ '\\\\' }.gsub(/'/){ '\\\'' } }'" end # # Parse a postgresql type. Returns a hash with these fields (as Symbol) # # * ftype: the full type, as passed in to this method. # * type: the type stripped of all attribute information. # * size: the LHS of the attribute information, typically the precision. # * decimal: the RHS of the attribute information, typically the scale. # * array: true if this type is actually an array of that type. # def self.parse_type(ftype) type = ftype pos = ftype.index('(') decimal = nil size = nil array_of_type = nil if pos != nil type = ftype[0..pos-1] size = ftype[pos+1..-2] pos = size.index(',') if pos != nil size, decimal = size.split(',', 2) size = size.to_i decimal = decimal.to_i else size = size.to_i end end if type =~ /\[\]$/ type.sub!(/\[\]$/, '') array_of_type = true end return { :ftype => ftype.dup, :type => type, :size => size, :decimal => decimal, :array => array_of_type } end # # See DBI::BaseDriver. # class Driver < DBI::BaseDriver def initialize super("0.4.0") end ## List of datasources for this database. def data_sources [] end ## Connect to a database. def connect(dbname, user, auth, attr) Database.new(dbname, user, auth, attr) end end end # module Pg end # module DBD end # module DBI require 'dbd/pg/type' require 'dbd/pg/database' require 'dbd/pg/statement' require 'dbd/pg/tuples' require 'dbd/pg/exec' pg = DBI::DBD::Pg DBI::TypeUtil.register_conversion(pg.driver_name) do |obj| newobj = case obj when ::DateTime obj.strftime("%Y-%m-%dT%H:%M:%S.%N") when ::Time ::DateTime.parse(obj.to_s).strftime("%H:%M:%S.%N") when ::Date obj.strftime("%Y-%m-%d") when ::Array pg.generate_array(obj) when DBI::DBD::Pg::Type::ByteA obj.escaped else obj end [newobj, false] end ruby-dbd-pg-0.3.9+gem2deb/lib/dbd/pg/000077500000000000000000000000001163371010100170365ustar00rootroot00000000000000ruby-dbd-pg-0.3.9+gem2deb/lib/dbd/pg/database.rb000066400000000000000000000414161163371010100211350ustar00rootroot00000000000000# # See DBI::BaseDatabase. # class DBI::DBD::Pg::Database < DBI::BaseDatabase # type map POSTGRESQL_to_XOPEN = { "boolean" => [DBI::SQL_CHAR, 1, nil], "character" => [DBI::SQL_CHAR, 1, nil], "char" => [DBI::SQL_CHAR, 1, nil], "real" => [DBI::SQL_REAL, 4, 6], "double precision" => [DBI::SQL_DOUBLE, 8, 15], "smallint" => [DBI::SQL_SMALLINT, 2], "integer" => [DBI::SQL_INTEGER, 4], "bigint" => [DBI::SQL_BIGINT, 8], "numeric" => [DBI::SQL_NUMERIC, nil, nil], "time with time zone" => [DBI::SQL_TIME, nil, nil], "timestamp with time zone" => [DBI::SQL_TIMESTAMP, nil, nil], "bit varying" => [DBI::SQL_BINARY, nil, nil], #huh?? "character varying" => [DBI::SQL_VARCHAR, nil, nil], "bit" => [DBI::SQL_TINYINT, nil, nil], "text" => [DBI::SQL_VARCHAR, nil, nil], nil => [DBI::SQL_OTHER, nil, nil] } attr_reader :type_map # # See DBI::BaseDatabase#new. These attributes are also supported: # # * pg_async: boolean or strings 'true' or 'false'. Indicates if we're to # use PostgreSQL's asyncrohonous support. 'NonBlocking' is a synonym for # this. # * AutoCommit: 'unchained' mode in PostgreSQL. Commits after each # statement execution. # * pg_client_encoding: set the encoding for the client. # * pg_native_binding: Boolean. Indicates whether to use libpq native # binding or DBI's inline binding. Defaults to true. # def initialize(dbname, user, auth, attr) hash = DBI::Utils.parse_params(dbname) if hash['dbname'].nil? and hash['database'].nil? raise DBI::InterfaceError, "must specify database" end hash['options'] ||= nil hash['tty'] ||= '' hash['port'] = hash['port'].to_i unless hash['port'].nil? @connection = PGconn.new(hash['host'], hash['port'], hash['options'], hash['tty'], hash['dbname'] || hash['database'], user, auth) @exec_method = :exec @in_transaction = false # set attribute defaults, and look for pg_* attrs in the DSN @attr = { 'AutoCommit' => true, 'pg_async' => false } hash.each do |key, value| @attr[key] = value if key =~ /^pg_./ end @attr.merge!(attr || {}) if @attr['pg_async'].is_a?(String) case @attr['pg_async'].downcase when 'true' @attr['pg_async'] = true when 'false' @attr['pg_async'] = false else raise InterfaceError, %q{'pg_async' must be 'true' or 'false'} end end @attr.each { |k,v| self[k] = v} @attr["pg_native_binding"] = true unless @attr.has_key? "pg_native_binding" load_type_map self['AutoCommit'] = true # Postgres starts in unchained mode (AutoCommit=on) by default rescue PGError => err raise DBI::OperationalError.new(err.message) end def disconnect if not @attr['AutoCommit'] and @in_transaction _exec("ROLLBACK") # rollback outstanding transactions end @connection.close end def ping answer = _exec("SELECT 1") if answer return answer.num_tuples == 1 else return false end rescue PGError return false ensure answer.clear if answer end def database_name @connection.db end def tables stmt = execute("SELECT c.relname FROM pg_catalog.pg_class c WHERE c.relkind IN ('r','v') and pg_catalog.pg_table_is_visible(c.oid)") res = stmt.fetch_all.collect {|row| row[0]} stmt.finish res end # # See DBI::BaseDatabase. # # These additional attributes are also supported: # # * nullable: true if NULL values are allowed in this column. # * indexed: true if this column is a part of an index. # * primary: true if this column is a part of a primary key. # * unique: true if this column is a part of a unique key. # * default: what will be insert if this column is left out of an insert query. # * array_of_type: true if this is actually an array of this type. # +dbi_type+ will be the type authority if this is the case. # def columns(table) sql1 = %[ select a.attname, i.indisprimary, i.indisunique from pg_class bc inner join pg_index i on bc.oid = i.indrelid inner join pg_class c on c.oid = i.indexrelid inner join pg_attribute a on c.oid = a.attrelid where bc.relname = ? and bc.relkind in ('r', 'v') and pg_catalog.pg_table_is_visible(bc.oid); ] sql2 = %[ SELECT a.attname, a.atttypid, a.attnotnull, a.attlen, format_type(a.atttypid, a.atttypmod) FROM pg_catalog.pg_class c, pg_attribute a, pg_type t WHERE a.attnum > 0 AND a.attrelid = c.oid AND a.atttypid = t.oid AND c.relname = ? AND c.relkind IN ('r','v') AND pg_catalog.pg_table_is_visible(c.oid) ] # by Michael Neumann (get default value) # corrected by Joseph McDonald sql3 = %[ SELECT pg_attrdef.adsrc, pg_attribute.attname FROM pg_attribute, pg_attrdef, pg_catalog.pg_class WHERE pg_catalog.pg_class.relname = ? AND pg_attribute.attrelid = pg_catalog.pg_class.oid AND pg_attrdef.adrelid = pg_catalog.pg_class.oid AND pg_attrdef.adnum = pg_attribute.attnum AND pg_catalog.pg_class.relkind IN ('r','v') AND pg_catalog.pg_table_is_visible(pg_catalog.pg_class.oid) ] dbh = DBI::DatabaseHandle.new(self) dbh.driver_name = DBI::DBD::Pg.driver_name indices = {} default_values = {} dbh.select_all(sql3, table) do |default, name| default_values[name] = default end dbh.select_all(sql1, table) do |name, primary, unique| indices[name] = [primary, unique] end ########## ret = [] dbh.execute(sql2, table) do |sth| ret = sth.collect do |row| name, pg_type, notnullable, len, ftype = row #name = row[2] indexed = false primary = nil unique = nil if indices.has_key?(name) indexed = true primary, unique = indices[name] end typeinfo = DBI::DBD::Pg.parse_type(ftype) typeinfo[:size] ||= len if POSTGRESQL_to_XOPEN.has_key?(typeinfo[:type]) sql_type = POSTGRESQL_to_XOPEN[typeinfo[:type]][0] else sql_type = POSTGRESQL_to_XOPEN[nil][0] end row = {} row['name'] = name row['sql_type'] = sql_type row['type_name'] = typeinfo[:type] row['nullable'] = ! notnullable row['indexed'] = indexed row['primary'] = primary row['unique'] = unique row['precision'] = typeinfo[:size] row['scale'] = typeinfo[:decimal] row['default'] = default_values[name] row['array_of_type'] = typeinfo[:array] if typeinfo[:array] row['dbi_type'] = DBI::DBD::Pg::Type::Array.new( DBI::TypeUtil.type_name_to_module(typeinfo[:type]) ) end row end # collect end # execute return ret end def prepare(statement) DBI::DBD::Pg::Statement.new(self, statement) end def [](attr) case attr when 'pg_client_encoding' @connection.client_encoding when 'NonBlocking' @attr['pg_async'] else @attr[attr] end end def []=(attr, value) case attr when 'AutoCommit' if @attr['AutoCommit'] != value then if value # turn AutoCommit ON if @in_transaction # TODO: commit outstanding transactions? _exec("COMMIT") @in_transaction = false end else # turn AutoCommit OFF @in_transaction = false end end # value is assigned below when 'NonBlocking', 'pg_async' # booleanize input value = value ? true : false @pgexec = (value ? DBI::DBD::Pg::PgExecutorAsync : DBI::DBD::Pg::PgExecutor).new(@connection) # value is assigned to @attr below when 'pg_client_encoding' @connection.set_client_encoding(value) when 'pg_native_binding' @attr[attr] = value else if attr =~ /^pg_/ or attr != /_/ raise DBI::NotSupportedError, "Option '#{attr}' not supported" else # option for some other driver - quitly ignore return end end @attr[attr] = value end def commit if @in_transaction _exec("COMMIT") @in_transaction = false else # TODO: Warn? end end def rollback if @in_transaction _exec("ROLLBACK") @in_transaction = false else # TODO: Warn? end end # # Are we in an transaction? # def in_transaction? @in_transaction end # # Forcibly initializes a new transaction. # def start_transaction _exec("BEGIN") @in_transaction = true end def _exec(sql, *parameters) @pgexec.exec(sql, parameters) end def _exec_prepared(stmt_name, *parameters) @pgexec.exec_prepared(stmt_name, parameters) end def _prepare(stmt_name, sql) @pgexec.prepare(stmt_name, sql) end private # special quoting if value is element of an array def quote_array_elements( value ) # XXX is this method still being used? case value when Array '{'+ value.collect{|v| quote_array_elements(v) }.join(',') + '}' when String '"' + value.gsub(/\\/){ '\\\\' }.gsub(/"/){ '\\"' } + '"' else quote( value ).sub(/^'/,'').sub(/'$/,'') end end def parse_type_name(type_name) case type_name when 'bool' then DBI::Type::Boolean when 'int8', 'int4', 'int2' then DBI::Type::Integer when 'varchar' then DBI::Type::Varchar when 'float4','float8' then DBI::Type::Float when 'time', 'timetz' then DBI::Type::Timestamp when 'timestamp', 'timestamptz' then DBI::Type::Timestamp when 'date' then DBI::Type::Timestamp when 'decimal', 'numeric' then DBI::Type::Decimal when 'bytea' then DBI::DBD::Pg::Type::ByteA when 'enum' then DBI::Type::Varchar end end # # Gathers the types from the postgres database and attempts to # locate matching DBI::Type objects for them. # def load_type_map @type_map = Hash.new res = _exec("SELECT oid, typname, typelem FROM pg_type WHERE typtype IN ('b', 'e')") res.each do |row| rowtype = parse_type_name(row["typname"]) @type_map[row["oid"].to_i] = { "type_name" => row["typname"], "dbi_type" => if rowtype rowtype elsif row["typname"] =~ /^_/ and row["typelem"].to_i > 0 then # arrays are special and have a subtype, as an # oid held in the "typelem" field. # Since we may not have a mapping for the # subtype yet, defer by storing the typelem # integer as a base type in a constructed # Type::Array object. dirty, i know. # # These array objects will be reconstructed # after all rows are processed and therefore # the oid -> type mapping is complete. # DBI::DBD::Pg::Type::Array.new(row["typelem"].to_i) else DBI::Type::Varchar end } end # additional conversions @type_map[705] ||= DBI::Type::Varchar # select 'hallo' @type_map[1114] ||= DBI::Type::Timestamp # TIMESTAMP WITHOUT TIME ZONE # remap array subtypes @type_map.each_key do |key| if @type_map[key]["dbi_type"].class == DBI::DBD::Pg::Type::Array oid = @type_map[key]["dbi_type"].base_type if @type_map[oid] @type_map[key]["dbi_type"] = DBI::DBD::Pg::Type::Array.new(@type_map[oid]["dbi_type"]) else # punt @type_map[key] = DBI::DBD::Pg::Type::Array.new(DBI::Type::Varchar) end end end end public # return the postgresql types for this session. returns an oid -> type name mapping. def __types(force=nil) load_type_map if (!@type_map or force) @type_map end # deprecated. def __types_old h = { } _exec('select oid, typname from pg_type').each do |row| h[row["oid"].to_i] = row["typname"] end return h end # # Import a BLOB from a file. # def __blob_import(file) start_transaction unless @in_transaction @connection.lo_import(file) rescue PGError => err raise DBI::DatabaseError.new(err.message) end # # Export a BLOB to a file. # def __blob_export(oid, file) start_transaction unless @in_transaction @connection.lo_export(oid.to_i, file) rescue PGError => err raise DBI::DatabaseError.new(err.message) end # # Create a BLOB. # def __blob_create(mode=PGconn::INV_READ) start_transaction unless @in_transaction @connection.lo_creat(mode) rescue PGError => err raise DBI::DatabaseError.new(err.message) end # # Open a BLOB. # def __blob_open(oid, mode=PGconn::INV_READ) start_transaction unless @in_transaction @connection.lo_open(oid.to_i, mode) rescue PGError => err raise DBI::DatabaseError.new(err.message) end # # Remove a BLOB. # def __blob_unlink(oid) start_transaction unless @in_transaction @connection.lo_unlink(oid.to_i) rescue PGError => err raise DBI::DatabaseError.new(err.message) end # # Read a BLOB and return the data. # def __blob_read(oid, length) blob = @connection.lo_open(oid.to_i, PGconn::INV_READ) if length.nil? data = @connection.lo_read(blob) else data = @connection.lo_read(blob, length) end # FIXME it doesn't like to close here either. # @connection.lo_close(blob) data rescue PGError => err raise DBI::DatabaseError.new(err.message) end # # Write the value to the BLOB. # def __blob_write(oid, value) start_transaction unless @in_transaction blob = @connection.lo_open(oid.to_i, PGconn::INV_WRITE) res = @connection.lo_write(blob, value) # FIXME not sure why PG doesn't like to close here -- seems to be # working but we should make sure it's not eating file descriptors # up before release. # @connection.lo_close(blob) return res rescue PGError => err raise DBI::DatabaseError.new(err.message) end # # FIXME DOCUMENT # def __set_notice_processor(proc) @connection.set_notice_processor proc rescue PGError => err raise DBI::DatabaseError.new(err.message) end end # Database ruby-dbd-pg-0.3.9+gem2deb/lib/dbd/pg/exec.rb000066400000000000000000000027341163371010100203150ustar00rootroot00000000000000module DBI::DBD::Pg ################################################################ # Convenience adaptor to hide details command execution API calls. # See PgExecutorAsync subclass class PgExecutor def initialize(pg_conn) @pg_conn = pg_conn end def exec(sql, parameters = nil) @pg_conn.exec(sql, parameters) end def exec_prepared(stmt_name, parameters = nil) @pg_conn.exec_prepared(stmt_name, parameters) end def prepare(stmt_name, sql) @pg_conn.prepare(stmt_name, sql) end end # Asynchronous implementation of PgExecutor, useful for 'green # thread' implementations (e.g., MRI <= 1.8.x) which would otherwise # suspend other threads while awaiting query results. #-- # FIXME: PQsetnonblocking + select/poll would make the exec* # methods truly 'async', though this is rarely needed in # practice. class PgExecutorAsync < PgExecutor def exec(sql, parameters = nil) @pg_conn.async_exec(sql, parameters) end def exec_prepared(stmt_name, parameters = nil) @pg_conn.send_query_prepared(stmt_name, parameters) @pg_conn.block() @pg_conn.get_last_result() end def prepare(stmt_name, sql) @pg_conn.send_prepare(stmt_name, sql) @pg_conn.block() @pg_conn.get_last_result() end end end ruby-dbd-pg-0.3.9+gem2deb/lib/dbd/pg/statement.rb000066400000000000000000000101461163371010100213710ustar00rootroot00000000000000# # See DBI::BaseStatement, and DBI::DBD::Pg::Tuples. # #-- # Peculiar Statement responsibilities: # - Translate dbi params (?, ?, ...) to Pg params ($1, $2, ...) # - Translate DBI::Binary objects to Pg large objects (lo_*) class DBI::DBD::Pg::Statement < DBI::BaseStatement PG_STMT_NAME_PREFIX = 'ruby-dbi:Pg:' def initialize(db, sql) super(db) @db = db @sql = sql @stmt_name = PG_STMT_NAME_PREFIX + self.object_id.to_s + Time.now.to_f.to_s @result = nil @bindvars = [] @prepared = false rescue PGError => err raise DBI::ProgrammingError.new(err.message) end def bind_param(index, value, options) @bindvars[index-1] = value end # # See DBI::BaseDatabase#execute. # # This method will make use of PostgreSQL's native BLOB support if # DBI::Binary objects are passed in. # def execute # replace DBI::Binary object by oid returned by lo_import @bindvars.collect! do |var| if var.is_a? DBI::Binary then oid = @db.__blob_create(PGconn::INV_WRITE) @db.__blob_write(oid, var.to_s) oid else var end end internal_prepare if not @db['AutoCommit'] then # if not SQL.query?(boundsql) and not @db['AutoCommit'] then @db.start_transaction unless @db.in_transaction? end if @db["pg_native_binding"] pg_result = @db._exec_prepared(@stmt_name, *@bindvars) else pg_result = @db._exec_prepared(@stmt_name) end @result = DBI::DBD::Pg::Tuples.new(@db, pg_result) rescue PGError, RuntimeError => err raise DBI::ProgrammingError.new(err.message) end def fetch @result.fetchrow end def fetch_scroll(direction, offset) @result.fetch_scroll(direction, offset) end def finish internal_finish @result = nil @db = nil end # # See DBI::DBD::Pg::Tuples#column_info. # def column_info @result.column_info end def rows if @result @result.rows_affected else nil end end # # Attributes: # # If +pg_row_count+ is requested and the statement has already executed, # postgres will return what it believes is the row count. # def [](attr) case attr when 'pg_row_count' if @result @result.row_count else nil end else @attr[attr] end end private # # A native binding helper. # class DummyQuoter # dummy to substitute ?-style parameter markers by :1 :2 etc. def quote(str) str end end # finish the statement at a lower level def internal_finish @result.finish if @result @db._exec("DEALLOCATE \"#{@stmt_name}\"") if @prepared rescue nil end # prepare the statement at a lower level. def internal_prepare if @db["pg_native_binding"] unless @prepared @stmt = @db._prepare(@stmt_name, translate_param_markers(@sql)) end else internal_finish @stmt = @db._prepare(@stmt_name, DBI::SQL::PreparedStatement.new(DBI::DBD::Pg, @sql).bind(@bindvars)) end @prepared = true end # Prepare the given SQL statement, returning its PostgreSQL string # handle. ?-style parameters are translated to $1, $2, etc. #-- # TESTME do ?::TYPE qualifers work? # FIXME: DBI ought to supply a generic param converter, e.g.: # sql = DBI::Utils::convert_placeholders(sql) do |i| # '$' + i.to_s # end def translate_param_markers(sql) translator = DBI::SQL::PreparedStatement.new(DummyQuoter.new, sql) if translator.unbound.size > 0 arr = (1..(translator.unbound.size)).collect{|i| "$#{i}"} sql = translator.bind( arr ) end sql end end # Statement ruby-dbd-pg-0.3.9+gem2deb/lib/dbd/pg/tuples.rb000066400000000000000000000065671163371010100207150ustar00rootroot00000000000000# # Tuples is a class to represent result sets. # # Many of these methods are extremely similar to the methods that deal with # result sets in DBI::BaseStatement and are wrapped by the StatementHandle. # Unless you plan on working on this driver, these methods should never be # called directly. # class DBI::DBD::Pg::Tuples def initialize(db, pg_result) @db = db @pg_result = pg_result @index = -1 @row = [] end # See DBI::BaseStatement#column_info. Additional attributes: # # * array_of_type: True if this is actually an array of this type. In this # case, +dbi_type+ will be the type authority for conversion. # def column_info a = [] 0.upto(@pg_result.num_fields-1) do |i| str = @pg_result.fname(i) typeinfo = nil begin typmod = @pg_result.fmod(i) rescue end if typmod and typ = @pg_result.ftype(i) res = @db._exec("select format_type(#{typ}, #{typmod})") typeinfo = DBI::DBD::Pg.parse_type(res[0].values[0]) end map = @db.type_map[@pg_result.ftype(i)] || { } h = { "name" => str }.merge(map) if typeinfo h["precision"] = typeinfo[:size] h["scale"] = typeinfo[:decimal] h["type"] = typeinfo[:type] h["array_of_type"] = typeinfo[:array] if typeinfo[:array] h['dbi_type'] = DBI::DBD::Pg::Type::Array.new( DBI::TypeUtil.type_name_to_module(typeinfo[:type]) ) end end a.push h end return a end def fetchrow @index += 1 if @index < @pg_result.num_tuples && @index >= 0 @row = Array.new 0.upto(@pg_result.num_fields-1) do |x| @row.push(@pg_result.getvalue(@index, x)) end @row else nil end end # # Just don't use this method. It'll be fixed soon. # def fetch_scroll(direction, offset) # Exact semantics aren't too closely defined. I attempted to follow the DBI:Mysql example. case direction when SQL_FETCH_NEXT # Nothing special to do, besides the fetchrow when SQL_FETCH_PRIOR @index -= 2 when SQL_FETCH_FIRST @index = -1 when SQL_FETCH_LAST @index = @pg_result.num_tuples - 2 when SQL_FETCH_ABSOLUTE # Note: if you go "out of range", all fetches will give nil until you get back # into range, this doesn't raise an error. @index = offset-1 when SQL_FETCH_RELATIVE # Note: if you go "out of range", all fetches will give nil until you get back # into range, this doesn't raise an error. @index += offset - 1 else raise NotSupportedError end self.fetchrow end # # The number of rows returned. # def row_count @pg_result.num_tuples end # # The row processed count. This is analogue to DBI::StatementHandle#rows. # def rows_affected @pg_result.cmdtuples end def finish @pg_result.clear end end # Tuples ruby-dbd-pg-0.3.9+gem2deb/lib/dbd/pg/type.rb000066400000000000000000000164711163371010100203550ustar00rootroot00000000000000# # Type Management for PostgreSQL-specific types. # # See DBI::Type and DBI::TypeUtil for more information. # module DBI::DBD::Pg::Type # # ByteA is a special escaped form of binary data, suitable for inclusion in queries. # # This class is an attempt to abstract that type so you do not have to # concern yourself with the conversion issues. # class ByteA attr_reader :original attr_reader :escaped # # Build a new ByteA object. # # The data supplied is the unescaped binary data you wish to put in the # database. # def initialize(obj) @original = obj @escaped = escape_bytea(obj) @original.freeze @escaped.freeze end # # Escapes the supplied data. Has no effect on the object. # def escape_bytea(str) PGconn.escape_bytea(str) end # # Returns the original data. # def to_s return @original.dup end # # Class method to escape the data into ByteA format. # def self.escape_bytea(str) self.new(str).escaped end # # Class method to unescape the ByteA data and present it as a string. # def self.parse(obj) return nil if obj.nil? # FIXME there's a bug in the upstream 'pg' driver that does not # properly decode bytea, leaving in an extra slash for each decoded # character. # # Fix this for now, but beware that we'll have to unfix this as # soon as they fix their end. ret = PGconn.unescape_bytea(obj) # XXX # String#split does not properly create a full array if the the # string ENDS in the split regex, unless this oddball -1 argument is supplied. # # Another way of saying this: # if foo = "foo\\\\\" and foo.split(/\\\\/), the result will be # ["foo"]. You can add as many delimiters to the end of the string # as you'd like - the result is no different. # ret = ret.split(/\\\\/, -1).collect { |x| x.length > 0 ? x.gsub(/\\[0-7]{3}/) { |y| y[1..3].oct.chr } : "" }.join("\\") ret.gsub!(/''/, "'") return ret end end # # PostgreSQL arrays are simply a specification that sits on top of normal # types. They have a specialized string grammar and this class facilitates # converting that syntax and the types within those arrays. # class Array attr_reader :base_type # # +base_type+ is a DBI::Type that is used to parse the inner types when # a non-array one is found. # # For instance, if you had an array of integer, one would pass # DBI::Type::Integer here. # def initialize(base_type) @base_type = base_type end # # Object method. Please note that this is different than most DBI::Type # classes! One must initialize an Array object with an appropriate # DBI::Type used to convert the indices of the array before this method # can be called. # # Returns an appropriately converted array. # def parse(obj) if obj.nil? nil elsif obj.index('{') == 0 and obj.rindex('}') == (obj.length - 1) convert_array(obj) else raise "Not an array" end end # # Parse a PostgreSQL-Array output and convert into ruby array. This # does the real parsing work. # def convert_array(str) array_nesting = 0 # nesting level of the array in_string = false # currently inside a quoted string ? escaped = false # if the character is escaped sbuffer = '' # buffer for the current element result_array = ::Array.new # the resulting Array str.each_byte { |char| # parse character by character char = char.chr # we need the Character, not it's Integer if escaped then # if this character is escaped, just add it to the buffer sbuffer += char escaped = false next end case char # let's see what kind of character we have #------------- {: beginning of an array ----# when '{' if in_string then # ignore inside a string sbuffer += char next end if array_nesting >= 1 then # if it's an nested array, defer for recursion sbuffer += char end array_nesting += 1 # inside another array #------------- ": string deliminator --------# when '"' in_string = !in_string #------------- \: escape character, next is regular character # when "\\" # single \, must be extra escaped in Ruby if array_nesting > 1 sbuffer += char else escaped = true end #------------- ,: element separator ---------# when ',' if in_string or array_nesting > 1 then # don't care if inside string or sbuffer += char # nested array else if !sbuffer.is_a? ::Array then sbuffer = @base_type.parse(sbuffer) end result_array << sbuffer # otherwise, here ends an element sbuffer = '' end #------------- }: End of Array --------------# when '}' if in_string then # ignore if inside quoted string sbuffer += char next end array_nesting -=1 # decrease nesting level if array_nesting == 1 # must be the end of a nested array sbuffer += char sbuffer = convert_array( sbuffer ) # recurse, using the whole nested array elsif array_nesting > 1 # inside nested array, keep it for later sbuffer += char else # array_nesting = 0, must be the last } if !sbuffer.is_a? ::Array then sbuffer = @base_type.parse( sbuffer ) end result_array << sbuffer unless sbuffer.nil? # upto here was the last element end #------------- all other characters ---------# else sbuffer += char # simply append end } return result_array end # convert_array() end end ruby-dbd-pg-0.3.9+gem2deb/metadata.yml000066400000000000000000000045561163371010100174460ustar00rootroot00000000000000--- !ruby/object:Gem::Specification name: dbd-pg version: !ruby/object:Gem::Version prerelease: false segments: - 0 - 3 - 9 version: 0.3.9 platform: ruby authors: - Erik Hollensbe - Christopher Maujean autorequire: bindir: bin cert_chain: [] date: 2010-03-06 00:00:00 -05:00 default_executable: dependencies: - !ruby/object:Gem::Dependency name: dbi prerelease: false requirement: &id001 !ruby/object:Gem::Requirement requirements: - - ">=" - !ruby/object:Gem::Version segments: - 0 - 4 - 0 version: 0.4.0 type: :runtime version_requirements: *id001 - !ruby/object:Gem::Dependency name: pg prerelease: false requirement: &id002 !ruby/object:Gem::Requirement requirements: - - ">=" - !ruby/object:Gem::Version segments: - 0 version: "0" type: :runtime version_requirements: *id002 description: PostgreSQL DBI DBD email: ruby-dbi-users@rubyforge.org executables: [] extensions: [] extra_rdoc_files: - README - LICENSE - ChangeLog files: - test/dbd/general/test_database.rb - test/dbd/general/test_statement.rb - test/dbd/general/test_types.rb - test/dbd/postgresql/testdbipg.rb - test/dbd/postgresql/test_blob.rb - test/dbd/postgresql/test_timestamp.rb - test/dbd/postgresql/up.sql - test/dbd/postgresql/base.rb - test/dbd/postgresql/down.sql - test/dbd/postgresql/test_bytea.rb - test/dbd/postgresql/test_async.rb - test/dbd/postgresql/test_ping.rb - test/dbd/postgresql/test_transactions.rb - test/dbd/postgresql/test_arrays.rb - lib/dbd/Pg.rb - lib/dbd/pg/type.rb - lib/dbd/pg/statement.rb - lib/dbd/pg/tuples.rb - lib/dbd/pg/database.rb - lib/dbd/pg/exec.rb - test/DBD_TESTS - README - LICENSE - ChangeLog has_rdoc: true homepage: http://www.rubyforge.org/projects/ruby-dbi licenses: [] post_install_message: rdoc_options: [] require_paths: - lib required_ruby_version: !ruby/object:Gem::Requirement requirements: - - ">=" - !ruby/object:Gem::Version segments: - 1 - 8 - 0 version: 1.8.0 required_rubygems_version: !ruby/object:Gem::Requirement requirements: - - ">=" - !ruby/object:Gem::Version segments: - 0 version: "0" requirements: [] rubyforge_project: ruby-dbi rubygems_version: 1.3.6 signing_key: specification_version: 3 summary: PostgreSQL DBI DBD test_files: - test/ts_dbd.rb ruby-dbd-pg-0.3.9+gem2deb/test/000077500000000000000000000000001163371010100161105ustar00rootroot00000000000000ruby-dbd-pg-0.3.9+gem2deb/test/DBD_TESTS000066400000000000000000000035271163371010100174150ustar00rootroot00000000000000================================================================================ Using DBD tests ================================================================================ Before you do anything, read the TESTING file. Create a YAML file named .ruby-dbi.test-config.yaml in your home directory. This file is a hash of keys that determine what you want to test and how you access the databases related to those tests. The key 'dbtypes' is an array which determines what tests you want to run. They *do not* correspond to the driver names, they correspond to the test directories that were made for them. Each 'dbtype' has a key that contains a hash of values: - username: the username of your account - password: the password for your account - dbname: the name of the database to connect to NOTE that tests expect to connect to a database on localhost currently. This may be fixed in the future, especially when we start writing Oracle and SQLServer tests. Each DBD test relies on database semantics which may not match up entirely with this configuration. For instance, the postgresql tests expect you to be able to work with the database directly via the `psql' client. This is something which will eventually be remedied as time and ability allows. Here is a sample configuration to get you started with the postgresql tests: ################################################################################ --- dbtypes: - postgresql postgresql: username: erikh password: monkeys dbname: rubytest ################################################################################ NOTE the --- is part of the file and is not a separator. ================================================================================ Writing DBD tests ================================================================================ Coming soon. ruby-dbd-pg-0.3.9+gem2deb/test/dbd/000077500000000000000000000000001163371010100166415ustar00rootroot00000000000000ruby-dbd-pg-0.3.9+gem2deb/test/dbd/general/000077500000000000000000000000001163371010100202565ustar00rootroot00000000000000ruby-dbd-pg-0.3.9+gem2deb/test/dbd/general/test_database.rb000066400000000000000000000161621163371010100234140ustar00rootroot00000000000000@class = Class.new(DBDConfig.testbase(DBDConfig.current_dbtype)) do def test_last_statement @sth = @dbh.prepare("select * from names") @sth.finish assert_equal "select * from names", @dbh.last_statement @sth = @dbh.execute("select * from names") @sth.finish assert_equal "select * from names", @dbh.last_statement @dbh.do("select * from names") assert_equal "select * from names", @dbh.last_statement end def test_empty_query ["", " ", "\t"].each do |str| [:do, :prepare, :execute, :select_one, :select_all].each do |call| assert_raises(DBI::InterfaceError) do @dbh.send(call, str) end end end end def test_ping assert @dbh.ping # XXX if it isn't obvious, this should be tested better. Not sure what # good behavior is yet. end def test_columns assert_nothing_raised do cols = @dbh.columns("precision_test") assert(cols) assert_kind_of(Array, cols) assert_equal(4, cols.length) # the first column should always be "text_field" and have the following # properties: assert_equal("text_field", cols[0]["name"]) assert(!cols[0]["nullable"]) assert_equal(20, cols[0]["precision"]) # scale can be either nil or 0 for character types. case cols[0]["scale"] when nil assert_equal(nil, cols[0]["scale"]) when 0 assert_equal(0, cols[0]["scale"]) else flunk "scale can be either 0 or nil for character types" end assert_equal( DBI::Type::Varchar.object_id, DBI::TypeUtil.type_name_to_module(cols[0]["type_name"]).object_id ) # the second column should always be "integer_field" and have the following # properties: assert_equal("integer_field", cols[1]["name"]) assert(cols[1]["nullable"]) assert_equal(1, cols[2]["scale"]) assert_equal(2, cols[2]["precision"]) assert_equal( DBI::Type::Integer.object_id, DBI::TypeUtil.type_name_to_module(cols[1]["type_name"]).object_id ) # the second column should always be "integer_field" and have the following # properties: assert_equal("decimal_field", cols[2]["name"]) assert(cols[2]["nullable"]) assert_equal(1, cols[2]["scale"]) assert_equal(2, cols[2]["precision"]) assert_equal( DBI::Type::Decimal.object_id, DBI::TypeUtil.type_name_to_module(cols[2]["type_name"]).object_id ) # the second column should always be "numeric_field" and have the following # properties: assert_equal("numeric_field", cols[3]["name"]) assert(cols[3]["nullable"]) assert_equal(6, cols[3]["scale"]) assert_equal(30, cols[3]["precision"]) assert_equal( DBI::Type::Decimal.object_id, DBI::TypeUtil.type_name_to_module(cols[3]["type_name"]).object_id ) # finally, we ensure that every column in the array is a ColumnInfo # object cols.each { |col| assert_kind_of(DBI::ColumnInfo, col) } end end def test_prepare @sth = @dbh.prepare('select * from names') assert @sth assert_kind_of DBI::StatementHandle, @sth @sth.finish end def test_do assert_equal 1, @dbh.do("insert into names (name, age) values (?, ?)", "Billy", 21) @sth = @dbh.prepare("select * from names where name = ?") @sth.execute("Billy") assert_equal ["Billy", 21], @sth.fetch @sth.finish end def test_tables tables = @dbh.tables.sort # since this is a general test, let's prune the system tables # FIXME not so sure if this should be a general test anymore. if dbtype == "odbc" tables -= [ "administrable_role_authorizations", "applicable_roles", "attributes", "check_constraint_routine_usage", "check_constraints", "column_domain_usage", "column_privileges", "column_udt_usage", "columns", "constraint_column_usage", "constraint_table_usage", "data_type_privileges", "domain_constraints", "domain_udt_usage", "domains", "element_types", "enabled_roles", "information_schema_catalog_name", "key_column_usage", "parameters", "referential_constraints", "role_column_grants", "role_routine_grants", "role_table_grants", "role_usage_grants", "routine_privileges", "routines", "schemata", "sequences", "sql_features", "sql_implementation_info", "sql_languages", "sql_packages", "sql_parts", "sql_sizing", "sql_sizing_profiles", "table_constraints", "table_privileges", "tables", "triggered_update_columns", "triggers", "usage_privileges", "view_column_usage", "view_routine_usage", "view_table_usage", "views" ] end case dbtype when "postgresql" tables.reject! { |x| x =~ /^pg_/ } assert_equal %w(array_test bit_test blob_test boolean_test bytea_test db_specific_types_test enum_type_test field_types_test names precision_test time_test timestamp_test view_names), tables when 'sqlite3' assert_equal %w(bit_test blob_test boolean_test db_specific_types_test field_types_test names names_defined_with_spaces precision_test time_test timestamp_test view_names), tables else assert_equal %w(bit_test blob_test boolean_test db_specific_types_test field_types_test names precision_test time_test timestamp_test view_names), tables end end def test_attrs # test defaults assert @dbh["AutoCommit"] # should be true # test setting assert !(@dbh["AutoCommit"] = false) assert !@dbh["AutoCommit"] # test committing an outstanding transaction @sth = @dbh.prepare("insert into names (name, age) values (?, ?)") @sth.execute("Billy", 22) @sth.finish assert @dbh["AutoCommit"] = true # should commit at this point @sth = @dbh.prepare("select * from names where name = ?") @sth.execute("Billy") assert_equal [ "Billy", 22 ], @sth.fetch @sth.finish end end ruby-dbd-pg-0.3.9+gem2deb/test/dbd/general/test_statement.rb000066400000000000000000000237161163371010100236570ustar00rootroot00000000000000@class = Class.new(DBDConfig.testbase(DBDConfig.current_dbtype)) do def prep_status_statement @sth.finish if (@sth and !@sth.finished?) @sth = @dbh.prepare("select * from names order by age") @sth.raise_error = true end def test_status names_rc = 3 [:fetch, :fetch_hash, :each, :fetch_all].each do |call| assert_raise(DBI::InterfaceError, DBI::NotSupportedError) do prep_status_statement @sth.send(call) end end # for these next three, it doesn't really matter what the args are, it should fail assert_raises(DBI::InterfaceError, DBI::NotSupportedError) do prep_status_statement @sth.fetch_many(1) end assert_raises(DBI::InterfaceError, DBI::NotSupportedError) do prep_status_statement @sth.fetch_scroll(0, 0) end assert_raises(DBI::InterfaceError, DBI::NotSupportedError) do prep_status_statement @sth.each { |x| } end assert_raises(DBI::InterfaceError) do prep_status_statement @sth.execute 2.times { @sth.fetch_all } end assert_raises(DBI::InterfaceError) do prep_status_statement @sth.execute # XXX fetch_many won't know it can't fetch anything until the third time around. 3.times { @sth.fetch_many(names_rc) } end end def test_execute assert_nothing_raised do @dbh.execute("select * from names order by age") do |sth| assert_equal([["Joe", 19], ["Bob", 21], ["Jim", 30]], sth.fetch_all) end end end def test_quoting # FIXME breaks sqlite-ruby to a segfault - research @sth = nil assert_nothing_raised do if dbtype == "postgresql" @sth = @dbh.prepare('select E\'\\\\\'') else @sth = @dbh.prepare('select \'\\\\\'') end @sth.execute row = @sth.fetch assert_equal ['\\'], row @sth.finish end end def test_duplicate_columns assert_nothing_raised do @sth = @dbh.prepare("select name, name from names where name = ?") @sth.execute("Bob") assert_equal [["Bob", "Bob"]], @sth.fetch_all @sth.finish end end def test_columninfo @sth = nil assert_nothing_raised do @sth = @dbh.prepare("select * from precision_test") @sth.execute cols = @sth.column_info assert(cols) assert_kind_of(Array, cols) assert_equal(4, cols.length) # the first column should always be "text_field" and have the following # properties: assert_equal("text_field", cols[0]["name"]) assert_equal(20, cols[0]["precision"]) # scale can be either nil or 0 for character types. case cols[0]["scale"] when nil assert_equal(nil, cols[0]["scale"]) when 0 assert_equal(0, cols[0]["scale"]) else flunk "scale can be either 0 or nil for character types" end assert_equal( DBI::Type::Varchar.object_id, DBI::TypeUtil.type_name_to_module(cols[0]["type_name"]).object_id ) # the second column should always be "integer_field" and have the following # properties: assert_equal("integer_field", cols[1]["name"]) # if these aren't set on the field, they should not exist # FIXME mysql does not follow this rule, neither does ODBC if dbtype == "mysql" assert_equal(0, cols[1]["scale"]) assert_equal(11, cols[1]["precision"]) elsif dbtype == "odbc" assert_equal(0, cols[1]["scale"]) assert_equal(10, cols[1]["precision"]) else assert(!cols[1]["scale"]) assert(!cols[1]["precision"]) end assert_equal( DBI::Type::Integer.object_id, DBI::TypeUtil.type_name_to_module(cols[1]["type_name"]).object_id ) # the second column should always be "integer_field" and have the following # properties: assert_equal("decimal_field", cols[2]["name"]) assert_equal(1, cols[2]["scale"]) assert_equal(2, cols[2]["precision"]) assert_equal( DBI::Type::Decimal.object_id, DBI::TypeUtil.type_name_to_module(cols[2]["type_name"]).object_id ) # the second column should always be "numeric_field" and have the following # properties: assert_equal("numeric_field", cols[3]["name"]) assert_equal(6, cols[3]["scale"]) assert_equal(30, cols[3]["precision"]) assert_equal( DBI::Type::Decimal.object_id, DBI::TypeUtil.type_name_to_module(cols[3]["type_name"]).object_id ) cols.each { |col| assert_kind_of(DBI::ColumnInfo, col) } @sth.finish end end def test_duplicate_columns assert_nothing_raised do @sth = @dbh.prepare("select name, name from names where name = ?") @sth.execute("Bob") assert_equal [["Bob", "Bob"]], @sth.fetch_all @sth.finish end end def test_rows @sth = nil assert_nothing_raised do @sth = @dbh.prepare("insert into names (name, age) values (?, ?)") @sth.execute("Bill", 22); end assert 1, @sth.rows @sth.finish @sth = nil assert_nothing_raised do @sth = @dbh.prepare("delete from names where name = ?") @sth.execute("Bill"); end assert 1, @sth.rows @sth.finish assert_nothing_raised do @sth = @dbh.prepare("select * from names") @sth.execute end assert_equal 0, @sth.rows assert @sth.fetchable? assert @sth.any? assert @sth.rows.zero? @sth.finish end def test_prepare_execute assert_nothing_raised do @sth = @dbh.prepare("select * from names") @sth.execute @sth.finish end assert_nothing_raised do @sth = @dbh.prepare("select * from names where name = ?") @sth.execute("Bob") @sth.finish end assert_nothing_raised do @sth = @dbh.prepare("insert into names (name, age) values (?, ?)") @sth.execute("Bill", 22); @sth.finish end end def test_prepare_execute_with_transactions @dbh["AutoCommit"] = false config = DBDConfig.get_config['sqlite3'] # rollback 1 (the right way) @sth = nil @sth2 = nil assert_nothing_raised do @sth = @dbh.prepare("insert into names (name, age) values (?, ?)") @sth.execute("Billy", 23) @sth2 = @dbh.prepare("select * from names where name = ?") @sth2.execute("Billy") end assert_equal ["Billy", 23 ], @sth2.fetch @sth2.finish @sth.finish assert_nothing_raised { @dbh.rollback } @sth = @dbh.prepare("select * from names where name = ?") @sth.execute("Billy") assert_nil @sth.fetch @sth.finish # rollback 2 (without closing statements first) @sth = nil @sth2 = nil assert_nothing_raised do @sth = @dbh.prepare("insert into names (name, age) values (?, ?)") @sth.execute("Billy", 23) @sth2 = @dbh.prepare("select * from names where name = ?") @sth2.execute("Billy") end assert_equal ["Billy", 23], @sth2.fetch # FIXME some throw here, some don't. we should probably normalize this @dbh.rollback rescue true @sth2.finish @sth.finish assert_nothing_raised { @dbh.rollback } @sth = @dbh.prepare("select * from names where name = ?") @sth.execute("Billy") assert_nil @sth.fetch @sth.finish # commit @sth = nil @sth2 = nil assert_nothing_raised do @sth = @dbh.prepare("insert into names (name, age) values (?, ?)") @sth.execute("Billy", 23) @sth2 = @dbh.prepare("select * from names where name = ?") @sth2.execute("Billy") end assert_equal ["Billy", 23 ], @sth2.fetch @sth2.finish @sth.finish assert_nothing_raised { @dbh.commit } @sth = @dbh.prepare("select * from names where name = ?") @sth.execute("Billy") assert_equal ["Billy", 23 ], @sth.fetch @sth.finish end def test_fetch @sth = nil assert_nothing_raised do @sth = @dbh.prepare("select * from names order by age") @sth.execute end # this tests that we're getting the rows in the right order, # and that the types are being converted. assert_equal ["Joe", 19], @sth.fetch assert_equal ["Bob", 21], @sth.fetch assert_equal ["Jim", 30], @sth.fetch assert_nil @sth.fetch @sth.finish end def test_transaction_block @dbh["AutoCommit"] = false # this transaction should not fail because it called return early @dbh.transaction do |dbh| dbh.do('INSERT INTO names (name, age) VALUES (?, ?)', "Cooter", 69) return 42 end @sth = @dbh.prepare("select * from names where name = ?") @sth.execute("Cooter") row = @sth.fetch assert row assert_equal ["Cooter", 69], row @sth.finish end end ruby-dbd-pg-0.3.9+gem2deb/test/dbd/general/test_types.rb000066400000000000000000000206251163371010100230130ustar00rootroot00000000000000@class = Class.new(DBDConfig.testbase(DBDConfig.current_dbtype)) do def skip_bit # FIXME this test fails because DBI's type system blows goats. @sth = nil assert_nothing_raised do @sth = @dbh.prepare("insert into bit_test (mybit) values (?)") @sth.bind_param(1, 0, DBI::SQL_TINYINT) @sth.execute # if dbtype == "postgresql" # @sth.execute("0") # else # @sth.execute(0) # end @sth.finish end assert_nothing_raised do @sth = @dbh.prepare("select * from bit_test") @sth.execute row = @sth.fetch @sth.finish assert_equal [0], row end end def test_numeric_types assert(@dbh.convert_types) @sth = @dbh.prepare("insert into precision_test (text_field, integer_field, decimal_field, numeric_field) values (?, ?, ?, ?)") assert(@sth.convert_types) 1.step(5) do |x| @sth.execute("poop#{x}", x, x + 0.123, x + 0.234) end @sth.finish @sth = @dbh.prepare("select integer_field, decimal_field, numeric_field from precision_test") @sth.execute col_info = @sth.column_info 1.step(5) do |x| row = @sth.fetch assert_kind_of(Integer, row[0]) assert_kind_of(BigDecimal, row[1]) assert_kind_of(BigDecimal, row[2]) # FIXME BigDecimal requires a string and some databases will pad # decimal/numeric with constrained precision. We should account for # this, but I'm not quite sure how yet. end @sth.finish end # FIXME # Ideally, this test should be split across the DBI tests and DBD, but for # now testing against the DBDs really doesn't cost us anything other than # debugging time if something breaks. def test_bind_coltype # ensure type conv didn't get turned off somewhere. assert(DBI.convert_types) assert(@dbh.convert_types) assert_nothing_raised do @sth = @dbh.prepare("select name, age from names order by age") assert(@sth.convert_types) # again @sth.execute @sth.bind_coltype(2, DBI::Type::Varchar) assert_equal( [ ["Joe", "19"], ["Bob", "21"], ["Jim", "30"], ], @sth.fetch_all ) @sth.finish end # just to be sure.. assert_nothing_raised do @sth = @dbh.prepare("select name, age from names order by age") @sth.execute @sth.bind_coltype(2, DBI::Type::Float) @sth.fetch_all.collect { |x| assert_kind_of(Float, x[1]) } @sth.finish end # now, let's check some failure cases @sth = @dbh.prepare("select name, age from names order by age") # can't bind_coltype before execute assert_raises(DBI::InterfaceError) { @sth.bind_coltype(1, DBI::Type::Float) } # can't index < 1 assert_raises(DBI::InterfaceError) { @sth.bind_coltype(0, DBI::Type::Float) } end def test_noconv # XXX this test will fail the whole test suite miserably if it fails at any point. assert(DBI.convert_types) DBI.convert_types = false @sth.finish rescue nil @dbh.disconnect set_base_dbh assert(!@dbh.convert_types) assert_nothing_raised do @sth = @dbh.prepare("select * from names order by age") assert(!@sth.convert_types) @sth.execute assert_equal( [ ["Joe", "19"], ["Bob", "21"], ["Jim", "30"], ], @sth.fetch_all ) @sth.finish end DBI.convert_types = true @sth.finish rescue nil @dbh.disconnect set_base_dbh assert(DBI.convert_types) assert(@dbh.convert_types) assert_nothing_raised do @sth = @dbh.prepare("select * from names order by age") assert(@sth.convert_types) @sth.execute assert_equal( [ ["Joe", 19], ["Bob", 21], ["Jim", 30], ], @sth.fetch_all ) @sth.finish end @dbh.convert_types = false assert_nothing_raised do @sth = @dbh.prepare("select * from names order by age") assert(!@sth.convert_types) @sth.execute assert_equal( [ ["Joe", "19"], ["Bob", "21"], ["Jim", "30"], ], @sth.fetch_all ) @sth.finish end @dbh.convert_types = true assert_nothing_raised do @sth = @dbh.prepare("select * from names order by age") assert(@sth.convert_types) @sth.convert_types = false @sth.execute assert_equal( [ ["Joe", "19"], ["Bob", "21"], ["Jim", "30"], ], @sth.fetch_all ) @sth.finish end rescue Exception => e DBI.convert_types = true @sth.finish @dbh.disconnect set_base_dbh raise e end def test_null assert_nothing_raised do @sth = @dbh.prepare('insert into names (name, age) values (?, ?)') @sth.execute("'NULL'", 201) @sth.execute(nil, 202) @sth.execute("NULL", 203) @sth.finish end assert_nothing_raised do @sth = @dbh.prepare('select * from names where age > 200 order by age') @sth.execute assert_equal(["'NULL'", 201], @sth.fetch) assert_equal([nil, 202], @sth.fetch) assert_equal(["NULL", 203], @sth.fetch) @sth.finish end end def test_time @sth = nil t = nil assert_nothing_raised do @sth = @dbh.prepare("insert into time_test (mytime) values (?)") t = Time.now @sth.execute(t) @sth.finish end assert_nothing_raised do @sth = @dbh.prepare("select * from time_test") @sth.execute row = @sth.fetch assert_kind_of DateTime, row[0] assert_equal t.hour, row[0].hour assert_equal t.min, row[0].min assert_equal t.sec, row[0].sec @sth.finish end end def test_timestamp @sth = nil # We omit fractional second testing here -- timestamp precision # is a very slippery, dependent on driver and driver version. t = DBI::Timestamp.new(2008, 3, 8, 10, 39, 1) assert_nothing_raised do @sth = @dbh.prepare("insert into timestamp_test (mytimestamp) values (?)") @sth.execute(t) @sth.finish end assert_nothing_raised do @sth = @dbh.prepare("select * from timestamp_test") @sth.execute row = @sth.fetch assert_kind_of DateTime, row[0] assert_equal t.year, row[0].year assert_equal t.month, row[0].month assert_equal t.day, row[0].day assert_equal t.hour, row[0].hour assert_equal t.min, row[0].min assert_equal t.sec, row[0].sec # omit fractional tests @sth.finish end end def test_boolean_return @sth = nil unless dbtype == "odbc" # ODBC has no boolean type assert_nothing_raised do @sth = @dbh.prepare("insert into boolean_test (num, mybool) values (?, ?)") @sth.execute(1, true) @sth.execute(2, false) @sth.finish end assert_nothing_raised do @sth = @dbh.prepare("select * from boolean_test order by num") @sth.execute pairs = @sth.fetch_all assert_equal( [ [1, true], [2, false], ], pairs ) @sth.finish end end end end ruby-dbd-pg-0.3.9+gem2deb/test/dbd/postgresql/000077500000000000000000000000001163371010100210445ustar00rootroot00000000000000ruby-dbd-pg-0.3.9+gem2deb/test/dbd/postgresql/base.rb000066400000000000000000000016121163371010100223030ustar00rootroot00000000000000require 'fileutils' DBDConfig.set_testbase(:postgresql, Class.new(Test::Unit::TestCase) do def dbtype "postgresql" end def test_base assert_equal(@dbh.driver_name, "Pg") assert_kind_of(DBI::DBD::Pg::Database, @dbh.instance_variable_get(:@handle)) end def set_base_dbh config = DBDConfig.get_config['postgresql'] @dbh = DBI.connect("dbi:Pg:#{config['dbname']}", config['username'], config['password']) end def setup set_base_dbh DBDConfig.inject_sql(@dbh, dbtype, "dbd/postgresql/up.sql") end def teardown @sth.finish if @sth && !@sth.finished? config = DBDConfig.get_config['postgresql'] DBDConfig.inject_sql(@dbh, dbtype, "dbd/postgresql/down.sql") @dbh.disconnect end end ) ruby-dbd-pg-0.3.9+gem2deb/test/dbd/postgresql/down.sql000066400000000000000000000007141163371010100225360ustar00rootroot00000000000000drop view view_names; --- drop table names; --- drop table blob_test; --- drop table boolean_test; --- drop table time_test; --- drop table timestamp_test; --- drop table bit_test; --- drop table field_types_test; --- drop table db_specific_types_test; --- drop table array_test; --- drop table bytea_test; --- drop table precision_test; --- drop table enum_type_test; --- drop type enum_test; --- drop schema schema1 cascade; --- drop schema schema2 cascade; ruby-dbd-pg-0.3.9+gem2deb/test/dbd/postgresql/test_arrays.rb000066400000000000000000000140711163371010100237340ustar00rootroot00000000000000class TestPostgresArray < DBDConfig.testbase(:postgresql) def test_array_type assert_nothing_raised do cols = @dbh.columns("array_test") assert_equal( [ { :name =>"foo", :default =>nil, :primary =>nil, :scale =>nil, :sql_type =>DBI::SQL_INTEGER, :nullable =>true, :indexed =>false, :precision =>-1, :type_name =>"integer", :unique =>nil, :array_of_type => true }, { :name =>"bar", :default =>nil, :primary =>nil, :scale =>nil, :sql_type =>DBI::SQL_INTEGER, :nullable =>true, :indexed =>false, :precision =>-1, :type_name =>"integer", :unique =>nil, :array_of_type => true }, { :name =>"baz", :default =>nil, :primary =>nil, :scale =>nil, :sql_type =>DBI::SQL_INTEGER, :nullable =>true, :indexed =>false, :precision =>-1, :type_name =>"integer", :unique =>nil, :array_of_type => true }, { :array_of_type=>true, :unique=>nil, :precision=>-1, :name=>"quux", :default=>nil, :indexed=>false, :scale=>nil, :primary=>nil, :sql_type=>12, :nullable=>true, :type_name=>"character varying" } ], cols.collect { |x| x.reject { |key, value| key == :dbi_type } } ) assert_equal(([DBI::DBD::Pg::Type::Array] * 4), cols.collect { |x| x["dbi_type"].class }) assert_equal((([DBI::Type::Integer] * 3) + [DBI::Type::Varchar]), cols.collect { |x| x["dbi_type"].base_type }) end end def test_array_parser # string representation assert_nothing_raised do sth = @dbh.prepare('insert into array_test (foo) values (?)') sth.execute('{1,2,3}') sth.finish end assert_nothing_raised do sth = @dbh.prepare('insert into array_test (foo) values (?)') sth.execute([1,2,3]) sth.finish end assert_nothing_raised do sth = @dbh.prepare('insert into array_test (quux) values (?)') sth.execute(["Hello\\ World", "Again\\"]) sth.finish end assert_nothing_raised do sth = @dbh.prepare('select foo from array_test where foo is not null') sth.execute assert_equal( [ [[1,2,3]], [[1,2,3]], ], sth.fetch_all ) sth.finish sth = @dbh.prepare('select quux from array_test where quux is not null') sth.execute assert_equal( [ [["Hello\\ World", "Again\\"]] ], sth.fetch_all ) sth.finish end end def test_array_boundaries # bar has a max extents of 3 sth = @dbh.prepare('insert into array_test (bar) values (?)') assert_nothing_raised do sth.execute('{1,2,3}') end # XXX postgresql does not enforce extents on single-dimension arrays assert_nothing_raised do sth.execute('{1,2,3,4}') end sth.finish sth = @dbh.prepare('insert into array_test(baz) values (?)') assert_nothing_raised do sth.execute('{{1,2,3}, {1,2,3}}') end assert_nothing_raised do # XXX for the record, I have no fucking idea why this works, what # it's technically represented as and what backwards array # implementation would allow it to work. # # I'm hoping it'll break on some future version of postgresql so I # can fix it. sth.execute('{1,2,3}') end assert_raises(DBI::ProgrammingError) do sth.execute('{{1,2,3,4}, {1,2,3}}') end assert_raises(DBI::ProgrammingError) do sth.execute('{{1,2,3}, {1,2,3,4}}') end sth.finish end def test_array_type_parser pc = DBI::DBD::Pg::Type::Array assert_nothing_raised do po = pc.new(DBI::Type::Integer) assert_equal([1,2,3], po.parse("{1,2,3}")) assert_equal([[1,2,3],[4,5,6]], po.parse("{{1,2,3},{4,5,6}}")) end assert_nothing_raised do po = pc.new(DBI::Type::Varchar) assert_equal(["one", "two", "three"], po.parse("{\"one\",\"two\",\"three\"}")) assert_equal([["one"], ["two\\"]], po.parse("{{\"one\"},{\"two\\\\\"}}")) assert_equal([["one", "two\\"], ["three\\", "four"]], po.parse("{{\"one\",\"two\\\\\"},{\"three\\\\\",\"four\"}}")) end end def test_array_generator pg = DBI::DBD::Pg assert_nothing_raised do assert_equal("{1,2,3}", pg.generate_array([1,2,3])) assert_equal("{{1,2,3},{1,2,3}}", pg.generate_array([[1,2,3],[1,2,3]])) assert_equal("{\"one\",\"two\"}", pg.generate_array(["one", "two"])) assert_equal("{\"hello\\\\ world\",\"again\"}", pg.generate_array(["hello\\ world", "again"])) end end end ruby-dbd-pg-0.3.9+gem2deb/test/dbd/postgresql/test_async.rb000066400000000000000000000100431163371010100235430ustar00rootroot00000000000000class TestPostgresAsync < DBDConfig.testbase(:postgresql) def get_dbh config = DBDConfig.get_config['postgresql'] DBI.connect("dbi:Pg:#{config['dbname']}", config['username'], config['password']) end def get_db_info config = DBDConfig.get_config['postgresql'] dsn = "dbi:Pg:database=#{config['dbname']}" user = config['username'] pass = config['password'] return [dsn, user, pass] end def test_async_default dsn, user, pass = get_db_info DBI.connect(dsn, user, pass) do |dbh| assert_equal false, dbh['pg_async'] assert_equal false, dbh['NonBlocking'] dbh.prepare('SELECT 1') do |sth| # Statement inherits assert_equal false, sth['pg_async'] assert_equal false, sth['NonBlocking'] end end end def test_async_dsn_enable dsn, user, pass = get_db_info for enable in ['true', 'TRUE', 'tRuE'] DBI.connect(dsn + ";pg_async=#{enable}", user, pass) do |dbh| assert_equal true, dbh['pg_async'] assert_equal true, dbh['NonBlocking'] dbh.prepare('SELECT 1') do |sth| # Statement inherits assert_equal true, sth['pg_async'] assert_equal true, sth['NonBlocking'] end end end end def test_async_attr_enable dsn, user, pass = get_db_info for enable in ['true', 'TRUE', 'tRuE'] DBI.connect(dsn, user, pass, { 'pg_async' => enable } ) do |dbh| assert_equal true, dbh['pg_async'] assert_equal true, dbh['NonBlocking'] dbh.prepare('SELECT 1') do |sth| # Statement inherits assert_equal true, sth['pg_async'] assert_equal true, sth['NonBlocking'] end end end end def test_async_dsn_disable dsn, user, pass = get_db_info for disable in ['false', 'FALSE', 'fAlSe'] DBI.connect(dsn + ";pg_async=#{disable}", user, pass) do |dbh| assert_equal false, dbh['pg_async'] assert_equal false, dbh['NonBlocking'] dbh.prepare('SELECT 1') do |sth| # Statement inherits assert_equal false, sth['pg_async'] assert_equal false, sth['NonBlocking'] end end end end def test_async_attr_disable dsn, user, pass = get_db_info for disable in ['false', 'FALSE', 'fAlSe'] DBI.connect(dsn, user, pass, { 'pg_async' => disable }) do |dbh| assert_equal false, dbh['pg_async'] assert_equal false, dbh['NonBlocking'] dbh.prepare('SELECT 1') do |sth| # Statement inherits assert_equal false, sth['pg_async'] assert_equal false, sth['NonBlocking'] end end end end def test_manual_enable dsn, user, pass = get_db_info DBI.connect(dsn, user, pass) do |dbh| dbh['pg_async'] = true assert_equal true, dbh['pg_async'] assert_equal true, dbh['NonBlocking'] dbh.prepare('SELECT 1') do |sth| # Statement inherits assert_equal true, sth['pg_async'] assert_equal true, sth['NonBlocking'] end end end def test_async_commands dsn, user, pass = get_db_info DBI.connect(dsn + ";pg_async=true", user, pass) do |dbh| assert_equal true, dbh['pg_async'] assert_equal true, dbh['NonBlocking'] ret = dbh.select_all('SELECT 1') assert_equal [[1]], ret ret = dbh.select_all(%q{SELECT 1 WHERE 'foo' = ?}, 'bar') assert_equal [], ret dbh.prepare(%q{SELECT 1 WHERE 'foo' = ?}) do |sth| sth.execute('bar') assert_equal [], sth.fetch_all end end end end ruby-dbd-pg-0.3.9+gem2deb/test/dbd/postgresql/test_blob.rb000066400000000000000000000025071163371010100233520ustar00rootroot00000000000000class TestPostgresBlob < DBDConfig.testbase(:postgresql) DATA = "this is my new binary object" def test_insert assert @dbh assert @dbh.ping # test with DBI::Binary assert_equal 1, @dbh.do("INSERT INTO blob_test (name, data) VALUES (?,?)", "test", DBI::Binary.new(DATA)) # test with blob_create directly blob = @dbh.func(:blob_create, PGconn::INV_WRITE) assert blob assert @dbh.func(:blob_write, blob, DATA) assert_equal 1, @dbh.do("INSERT INTO blob_test (name, data) VALUES (?,?)", "test (2)", blob) # test with blob_import directly File.open('/tmp/pg_dbi_import_test', 'w') { |f| f << DATA } blob = @dbh.func(:blob_import, '/tmp/pg_dbi_import_test') assert blob assert_equal 1, @dbh.do("INSERT INTO blob_test (name, data) VALUES (?,?)", "test (2)", blob) index = 0 @dbh.select_all("SELECT name, data FROM blob_test") do |name, data| index += 1 assert_equal DATA, @dbh.func(:blob_read, data, DATA.length) @dbh.func(:blob_export, data, '/tmp/pg_dbi_read_test') assert_equal DATA, File.read('/tmp/pg_dbi_read_test') end assert_equal 3, index File.unlink("/tmp/pg_dbi_read_test") File.unlink("/tmp/pg_dbi_import_test") end end ruby-dbd-pg-0.3.9+gem2deb/test/dbd/postgresql/test_bytea.rb000066400000000000000000000047721163371010100235460ustar00rootroot00000000000000require 'dbd/Pg' begin require 'rubygems' gem 'pg' rescue Exception => e end require 'pg' LEN = 50 class TestPostgresByteA < DBDConfig.testbase(:postgresql) # FIXME the 'pg' module is broken and doesn't encode/decode properly. # this test should prove that the 'pg' module works so we can back out our # hacks. def skip_underlying_driver str = generate_random_string encoded = PGconn.escape_bytea(str.dup) decoded = PGconn.unescape_bytea(encoded) assert_equal str, decoded end def test_encode_decode bytea = DBI::DBD::Pg::Type::ByteA # some specific cases that were failing intermittenly # poor \\ handling str = "\236\000\257\202G<\371\035TPEO\211\005*AH'H\3136\360\004\245\261\037\340u\003s\\772X\231\002\200\n\327\202\217\353\177r\317o\341\237\341" encoded = bytea.escape_bytea(str) decoded = bytea.parse(encoded) assert_equal str, decoded # the split hack not working str = "\343\336e\260\337\373\314\026\323#\237i\035\0302\024\346X\274\016\324\371\206\036\230\374\206#rA\n\214\272\316\330\025\374\000\2663\244M\255x\360\002\266q\336\231" encoded = bytea.escape_bytea(str) decoded = bytea.parse(encoded) assert_equal str, decoded # delimiter at the end str = "\343\336e\260\337\373\314\026\323#\237i\035\0302\024\346X\274\016\324\371\206\036\230\374\206#rA\n\214\272\316\330\025\374\000\2663\244M\255x\360\002\266q\336\231\\\\\\\\" encoded = bytea.escape_bytea(str) decoded = bytea.parse(encoded) assert_equal str, decoded # a huge test to weed out all the stragglers 5_000.times do str = generate_random_string encoded = bytea.escape_bytea(str) decoded = bytea.parse(encoded) assert_equal str, decoded end end def test_insert_retrieve assert_nothing_raised do str = generate_random_string sth = @dbh.prepare('insert into bytea_test (foo) values (?)') sth.execute(DBI::DBD::Pg::Type::ByteA.new(str)) sth.finish sth = @dbh.prepare('select * from bytea_test') sth.execute assert_equal([str], sth.fetch) sth.finish end end def generate_random_string # random string test str = " " * LEN for i in 0...LEN str[i] = (rand * 256).to_i.chr end return str end end ruby-dbd-pg-0.3.9+gem2deb/test/dbd/postgresql/test_ping.rb000066400000000000000000000005451163371010100233710ustar00rootroot00000000000000class TestPostgresPing < DBDConfig.testbase(:postgresql) def test_ping config = DBDConfig.get_config['postgresql'] dbh = DBI.connect("dbi:Pg:#{config['dbname']}", config['username'], config['password']) assert dbh assert dbh.ping dbh.disconnect assert_raises(DBI::InterfaceError) { dbh.ping } end end ruby-dbd-pg-0.3.9+gem2deb/test/dbd/postgresql/test_timestamp.rb000066400000000000000000000047331163371010100244420ustar00rootroot00000000000000class TestPostgresTimestamp < DBDConfig.testbase(:postgresql) def get_tstamp DateTime.parse("2008-03-08 10:39:01.012300") end # XXX DateTime is not allowed to modify the sec_fraction component, so this test is moot. # perhaps we need to fix DateTime. def skip_test_timestamp_altered_fraction ts = nil assert_nothing_raised do @sth = @dbh.prepare("insert into timestamp_test (mytimestamp) values (?)") ts = DateTime.parse(Time.now.to_s) ts.sec_fraction = 22200000 @sth.execute(ts) @sth.finish end assert_nothing_raised do @sth = @dbh.prepare("select * from timestamp_test") @sth.execute row = @sth.fetch @sth.finish assert_equal ts.sec_fraction, row[0].sec_fraction end end def test_current_timestamp assert @dbh # syntax db-specific (e.g., "from dual", "...timestamp()", etc.) ts = @dbh.select_one("SELECT CURRENT_TIMESTAMP")[0] assert_kind_of DateTime, ts assert_not_nil ts.sec_fraction end # Just like the 'general' test, but checking for fractional seconds def test_timestamp_fractional assert @dbh @sth = nil t = get_tstamp assert_nothing_raised do @sth = @dbh.prepare("insert into timestamp_test (mytimestamp) values (?)") @sth.execute(t) @sth.finish end assert_nothing_raised do @sth = @dbh.prepare("select * from timestamp_test") @sth.execute row = @sth.fetch assert_kind_of DateTime, row[0] assert_equal t.year, row[0].year assert_equal t.month, row[0].month assert_equal t.day, row[0].day assert_equal t.hour, row[0].hour assert_equal t.min, row[0].min assert_equal t.sec, row[0].sec assert_not_nil row[0].sec_fraction assert_equal t.sec_fraction, row[0].sec_fraction @sth.finish end end # Is our DBI::Timestamp equivalent to its canonical string literal # form cast appropriately? def test_timestamp_from_cast assert @dbh sql_ts = "SELECT CAST('2008-03-08 10:39:01.012300' AS TIMESTAMP)" row = @dbh.select_one(sql_ts) assert_not_nil row assert_equal 1, row.size assert_kind_of DateTime, row[0] assert_equal row[0], get_tstamp end end ruby-dbd-pg-0.3.9+gem2deb/test/dbd/postgresql/test_transactions.rb000066400000000000000000000031721163371010100251430ustar00rootroot00000000000000class TestPostgresTransaction < DBDConfig.testbase(:postgresql) def test_rollback dbh = get_dbh dbh["AutoCommit"] = false @sth = dbh.prepare('insert into names (name, age) values (?, ?)') @sth.execute("Foo", 51) dbh.rollback assert_equal 1, @sth.rows @sth.finish @sth = dbh.prepare('select name, age from names where name=?') @sth.execute("Foo") assert !@sth.fetch @sth.finish dbh.disconnect end def test_commit dbh = get_dbh dbh["AutoCommit"] = false @sth = dbh.prepare('insert into names (name, age) values (?, ?)') @sth.execute("Foo", 51) dbh.commit assert_equal 1, @sth.rows @sth.finish @sth = dbh.prepare('select name, age from names where name=?') @sth.execute("Foo") row = @sth.fetch assert row assert_equal "Foo", row[0] assert_equal 51, row[1] @sth.finish dbh.disconnect end def test_select_transaction # per bug #10466 dbh = get_dbh dbh["AutoCommit"] = false @sth = dbh.prepare('select * from test_insert(?, ?)'); @sth.execute("Foo", 51) dbh.rollback @sth.finish @sth = dbh.prepare('select name, age from names where name=?') @sth.execute("Foo") assert !@sth.fetch @sth.finish dbh.disconnect end def get_dbh config = DBDConfig.get_config DBI.connect("dbi:Pg:#{config['postgresql']['dbname']}", config['postgresql']['username'], config['postgresql']['password']) end end ruby-dbd-pg-0.3.9+gem2deb/test/dbd/postgresql/testdbipg.rb000066400000000000000000000213731163371010100233640ustar00rootroot00000000000000require 'dbd/Pg' module DBI class ForcedError < ::DBI::Error end end ###################################################################### # Test the PostgreSql DBD driver. This test exercises options # difficult to test through the standard DBI interface. # class TestDbdPostgres < DBDConfig.testbase(:postgresql) # FIXME this is a feature that should be there, but currently isn't. # def test_connect # dbd = get_dbd # assert_not_nil dbd.connection # assert_equal 'localhost', dbd.connection.host # assert_equal 'erikh', dbd.connection.user # assert_equal 'rubytest', dbd.connection.db # assert_equal 5432, dbd.connection.port # ensure # dbd.disconnect if dbd # end # this monkeypatch is used for the following test... NEVER integrate this into DBI proper. class DBI::StatementHandle < DBI::Handle def stmt_name @handle.instance_variable_get(:@stmt_name) end end def test_database_name assert_nothing_raised do assert_equal DBDConfig.get_config[dbtype]['dbname'], @dbh.database_name end end def test_enum_type assert_nothing_raised do assert(@dbh.convert_types) @sth = @dbh.prepare("insert into enum_type_test values (?)") @sth.execute("one") @sth.finish @sth = @dbh.prepare("select foo from enum_type_test") @sth.execute assert_equal(@sth.fetch, ['one']) @sth.finish end end def test_statement_finish_deallocates_sth assert_nothing_raised do @sth = @dbh.prepare("select * from names") @sth.execute sth_internal_name = @sth.stmt_name assert(sth_internal_name) assert(!sth_internal_name.empty?) @sth.finish # at this point, the statement name should no longer exist # # XXX this is a potentially horrible way of doing it since it'll # create another prepared statement, but *at this time*, I don't # see any drawbacks and the alternative is considerably uglier. @sth = @dbh.prepare("select count(*) from pg_prepared_statements where name = ?") @sth.execute(sth_internal_name) assert_equal([0], @sth.fetch) @sth.finish end end def test_binding assert(@dbh["pg_native_binding"]) assert_raises(DBI::ProgrammingError) do @sth = @dbh.prepare("select * from names where age IS NOT ?") @sth.execute("NULL") @sth.finish end assert_nothing_raised do @dbh["pg_native_binding"] = false @sth = @dbh.prepare("select * from names where age IS NOT ? order by age") @sth.execute("NULL") assert_equal( [ ["Joe", 19], ["Bob", 21], ["Jim", 30], ], @sth.fetch_all ) @sth.finish @sth = @dbh.prepare("select * from names where age = ?") @sth.execute(19) assert_equal( [ ["Joe", 19] ], @sth.fetch_all ) @sth.finish end end def test_function_multiple_return_values @sth = @dbh.prepare("SELECT age, select_subproperty(age, NULL), select_subproperty(age, 1) FROM names WHERE age = 19") @sth.execute assert_equal([[19, nil, 19]], @sth.fetch_all) @sth.finish end def test_columns assert_equal( [ { :name =>"age", :default =>nil, :primary =>nil, :scale =>nil, :sql_type =>4, :nullable =>true, :indexed =>false, :precision =>4, :type_name =>"integer", :unique =>nil, :array_of_type =>nil }, { :name =>"name", :default =>nil, :primary =>nil, :scale =>nil, :sql_type =>12, :nullable =>true, :indexed =>false, :precision =>255, :type_name =>"character varying", :unique =>nil, :array_of_type =>nil } ], @dbh.columns("names").sort_by { |x| x["name"] }) assert_equal(2, @dbh.columns("names").size) # make sure this works before the search path change assert_equal(0, @dbh.columns("tbl").size) # tbl doesn't exist in public @dbh.do('SET search_path TO schema1,schema2,"$user",public') assert_equal(1, @dbh.columns('tbl').size); assert_equal( [ { :name =>"foo", :default =>nil, :primary =>nil, :scale =>nil, :sql_type =>4, :nullable =>true, :indexed =>false, :precision =>4, :type_name =>"integer", :unique =>nil, :array_of_type =>nil } ], @dbh.columns('tbl') ) end def test_statement_name_uniqueness 5000.times do begin @dbh.prepare('SELECT 1').execute() raise DBI::ForcedError sth.finish # never reached rescue DBI::ProgrammingError => e # ERROR: prepared statement "ruby-dbi:Pg:-604926268" already exists # This should never happen raise e rescue DBI::ForcedError # no-op end end end def test_connect_errors dbd = nil ex = assert_raises(DBI::OperationalError) { dbd = DBI::DBD::Pg::Database.new('rubytest:1234', 'jim', nil, {}) } ex = assert_raises(DBI::OperationalError) { dbd = DBI::DBD::Pg::Database.new('bad_db_name', 'jim', nil, {}) } # this corresponds to the test_parse_url_expected_errors test in tc_dbi.rb assert_raises(DBI::InterfaceError) do DBI.connect("dbi:Pg").disconnect end ensure dbd.disconnect if dbd end def skip_test_type_map dbd = get_dbd def dbd.type_map @type_map end assert dbd.type_map assert_equal 21, dbd.convert("21", 23) assert_equal "21", dbd.convert("21", 1043) assert_equal 21.5, dbd.convert("21.5", 701) end def test_simple_command dbd = get_dbd res = dbd.do("INSERT INTO names (name, age) VALUES('Dan', 16)") assert_equal 1, res @sth = get_dbi.prepare("SELECT name FROM names WHERE age=16") @sth.execute assert @sth.fetchable? # XXX FIXME This is a bug in the DBD. #rows should equal 1 for select statements. assert_equal 0, @sth.rows ensure dbd.do("DELETE FROM names WHERE age < 20") dbd.disconnect if dbd end def test_bad_command dbd = get_dbd assert_raises(DBI::ProgrammingError) { dbd.do("INSERT INTO bad_table (name, age) VALUES('Dave', 12)") } ensure dbd.disconnect if dbd end def test_query_single dbd = get_dbi res = dbd.prepare("SELECT name, age FROM names WHERE age=21;") assert res res.execute fields = res.column_info assert_equal 2, fields.length assert_equal 'name', fields[0]['name'] assert_equal 'varchar', fields[0]['type_name'] assert_equal 'age', fields[1]['name'] assert_equal 'int4', fields[1]['type_name'] row = res.fetch assert_equal 'Bob', row[0] assert_equal 21, row[1] row = res.fetch assert_nil row res.finish ensure dbd.disconnect if dbd end def test_query_multi dbd = get_dbd res = dbd.prepare("SELECT name, age FROM names WHERE age > 20;") expected_list = ['Jim', 'Bob', 'Charlie'] res.execute while row=res.fetch expected = expected_list.shift assert_equal expected, row[0] end res.finish ensure dbd.disconnect if dbd end def test_tables_call # per bug #1082, views do not show up in tables listing. assert get_dbi.tables.include?("view_names") end def get_dbi config = DBDConfig.get_config DBI.connect("dbi:Pg:#{config['postgresql']['dbname']}", config['postgresql']['username'], config['postgresql']['password']) end def get_dbd config = DBDConfig.get_config['postgresql'] result = DBI::DBD::Pg::Database.new(config['dbname'], config['username'], config['password'], {}) result['AutoCommit'] = true result end end # -------------------------------------------------------------------- ruby-dbd-pg-0.3.9+gem2deb/test/dbd/postgresql/up.sql000066400000000000000000000032451163371010100222150ustar00rootroot00000000000000create table names ( name varchar(255), age integer ); --- insert into names (name, age) values ('Joe', 19); --- insert into names (name, age) values ('Jim', 30); --- insert into names (name, age) values ('Bob', 21); --- create table precision_test (text_field varchar(20) primary key not null, integer_field integer, decimal_field decimal(2,1), numeric_field numeric(30,6)); --- CREATE TABLE blob_test (name VARCHAR(30), data OID); --- create view view_names as select * from names; --- create or replace function test_insert (varchar(255), integer) returns integer language sql as 'insert into names (name, age) values ($1, $2); select age from names where name = $1'; --- create table boolean_test (num integer, mybool boolean); --- create table time_test (mytime time); --- create table timestamp_test (mytimestamp timestamp); --- create table bit_test (mybit bit); --- create table field_types_test (foo integer not null primary key default 1); --- create type enum_test as ENUM ('one', 'two', 'three'); --- create table enum_type_test (foo enum_test); --- create table db_specific_types_test (foo integer); --- create table array_test (foo integer[], bar integer[3], baz integer[3][3], quux varchar[2]); --- create table bytea_test (foo bytea); --- create schema schema1; --- create schema schema2; --- create table schema1.tbl (foo integer); --- create table schema2.tbl (bar integer); --- create or replace function select_subproperty(value names.age%TYPE, sub names.age%TYPE, out retval names.age%TYPE) as $$ select case when $2 is not null then $1 else null end $$ language sql; ruby-dbd-pg-0.3.9+gem2deb/test/ts_dbd.rb000066400000000000000000000067641163371010100177110ustar00rootroot00000000000000require 'rubygems' gem 'test-unit' # figure out what tests to run require 'yaml' require 'test/unit/testsuite' require 'test/unit/ui/console/testrunner' if File.basename(Dir.pwd) == "test" $:.unshift('../lib') else $:.unshift('lib') end module Test::Unit::Assertions def build_message(head, template=nil, *arguments) template += "\n" + "DATABASE: " + dbtype template &&= template.chomp return AssertionMessage.new(head, template, arguments) end end class Class def name=(klass_name) @name = klass_name end def name return @name || super end end module DBDConfig @testbase = { } @current_dbtype = nil def self.get_config config = nil begin config = YAML.load_file(File.join(ENV["HOME"], ".ruby-dbi.test-config.yaml")) rescue Exception => e config = { } config["dbtypes"] = [ ] end return config end def self.inject_sql(dbh, dbtype, file) # splits by --- in the file, strips newlines and the semicolons. # this way we can still manually import the file, but use it with our # drivers for client-independent injection. File.open(file).read.split(/\n*---\n*/, -1).collect { |x| x.gsub!(/\n/, ''); x.sub(/;\z/, '') }.each do |stmt| tmp = STDERR.dup STDERR.reopen('sql.log', 'a') begin dbh.commit rescue nil dbh["AutoCommit"] = true rescue nil dbh.do(stmt) dbh.commit unless dbtype == 'sqlite3' rescue Exception => e tmp.puts "Error injecting '#{stmt}' for db #{dbtype}" tmp.puts "Error: #{e.message}" end STDERR.reopen(tmp) end end def self.current_dbtype @current_dbtype end def self.current_dbtype=(setting) @current_dbtype = setting end def self.testbase(klass_name) return @testbase[klass_name] end def self.set_testbase(klass_name, klass) @testbase[klass_name] = klass klass.name = klass_name.to_s end def self.suite @suite ||= [] end end if __FILE__ == $0 Dir.chdir("..") if File.basename(Dir.pwd) == "test" $LOAD_PATH.unshift(File.join(Dir.pwd, "lib")) Dir.chdir("test") rescue nil begin require 'dbi' rescue LoadError => e begin require 'rubygems' gem 'dbi' require 'dbi' rescue LoadError => e abort "DBI must already be installed or must come with this package for tests to work." end end Deprecate.set_action(proc { }) config = DBDConfig.get_config config["dbtypes"] = ENV["DBTYPES"].split(/\s+/) if ENV["DBTYPES"] if config and config["dbtypes"] config["dbtypes"].each do |dbtype| unless config[dbtype] warn "#{dbtype} is selected for testing but not configured; see test/DBD_TESTS" next end # base.rb is special, see DBD_TESTS require "dbd/#{dbtype}/base.rb" Dir["dbd/#{dbtype}/test*.rb"].each { |file| require file } # run the general tests DBDConfig.current_dbtype = dbtype.to_sym Dir["dbd/general/test*.rb"].each { |file| load file; @class.name = file; DBDConfig.suite << @class } end elsif !config["dbtypes"] warn "Please see test/DBD_TESTS for information on configuring DBD tests." end end