Comments (16)
👍 to removing both, and just throwing an exception.
Maybe in the long run, we'll want something like a notification system (for errors and other events), but that feels like premature optimization so far.
from dbiish.
I tought having the raiserror option would be a good thing as it allows to continue with the program until the programmer decides to handle errors (e.g. log something first).
from dbiish.
A thought from an outside observer: "allows to continue with the program ..." sounds a lot like a Failure object to me. Whatever gets decided should probably follow Perl 6's error handling model and not carry forward Perl 5's.
from dbiish.
I always set PrintError false and RaiseError true. Why would I want to test every DBI call.
from dbiish.
@abraxxa are you going to supply a patch?
from dbiish.
I plan that for after the merge of DBDish::Oracle.
from dbiish.
I'm guessing that the final replacement in the user's code would be something like
use fatal; # replaces RaiseError => 1
...
# replace PrintError => 1
CATCH { when (DBIish::Exception) { .say; .resume; } }
And that works fine, so long as DBIish.pm6
contains something like
class DBIish::Exception is Exception {}
And DBDish.pm6 contains it's own
DBDish::Exception is DBIish::Exception
from which the actual drivers could inherit or just use outright. DBIish
must define an Exception class so the user can reference it in and DBDish.pm
must also define an Exception class which inherits from DBIish::Exception
so the individual Drivers can inherit from them, or the individual drivers must use DBIish;
. Both cases seem to me to be a bit of a code smell indicating that the distinction between DBIish and DBDish aren't really reflecting the real world.
So my question is, does there really need to be a separation of DBIish and DBDish, or is that, like the RaiseError/PrintError issue the result of a desire to mimic the perl 5 DBI?
from dbiish.
I'd say at some point the individual drivers do need to be separated, it's alright with three or four databases but with possibly tens of them (I stopped counting the P5 DBD modules at thirty,) it would become a nightmare of maintenance, plus a barrier to further contribution of drivers.
from dbiish.
I'm sorry, I wasn't at all clear about what I meant. Currently there is a DBIish.pm6
and a DBDish.pm6
(though there isn't an actual perl 5 DBD.pm
), and it seems to me that DBDish.pm6 could be folded into DBIish.pm6, and possibly a DBDish.pod if necessary.
I'm guessing that the perl5 DBI/DBD namespace separation was to reserve the DBI namespace entirely for bits and pieces maintained by the DBI folk, while DBD was set aside for stuff that wasn't. And other than the perl6 DBDish.pm
that could easily be the case with DBIish/DBDish.
from dbiish.
@abraxxa any update on DBDish::Oracle?
👍 for throwing exceptions implicitly.
from dbiish.
I've got it working with the 2015.11 release but a bug in the 6.c release (RT#127001) prevents it from functioning with it. All code is at my github fork.
from dbiish.
The current state of affairs about error handling:
- Oracle: Simply die on errors inside the driver. The caller needs a CATCH block.
- All others: die if
RaiseError
isTrue
, otherwise the errors are ignored even inside the drivers!!!
The methods for error reporting at DBIsh
, DBDish's driver level and Connection level ($dbh
) are no-ops.
Only at the StatementHandler level ($sth
) the user can call the .errstr
method to fetch the last error message.
I plan to use and generate X::DBIish::*
typed Exception to throw
or fail
depending on RaiseError
or the pragma.
I would like to preserve RaiseError
for fine-grained user cases, for example at the prepared statement level.
from dbiish.
Now DBIish follow Perl 6's model regards exception handling, any additional details can be discussed as subsequent issues.
from dbiish.
👍
from dbiish.
I still don't see the point why DBIish should follow any stupid Perl 6 DBI API decisions...
Keeping the last exception in an attribute instead of just throwing it makes no sense and will lead to weird bugs and maybe even memory leaks due to circular refs.
from dbiish.
@abraxxa , We are not here to judge established API decisions, our work is to satisfy users expectations, the more of them, the better.
As documented somewhere else, the Exception throwned we keep for the benefit of the $h.err
and $.errstr
APIs, is short-lived and replaced (or erased) at the following API call.
If the current implementation, or its current defaults, causes to you or your applications, some issues, please open an specific cause.
(Personally I would have preferred .fail
over .trow
as default, i.e RaiseErrors => False
)
from dbiish.
Related Issues (20)
- $sth.allrows(:array-of-hash) not an exact replacement for $sth.fetchall_hashref('KEY') HOT 1
- Oracle Support - Forcing SELECT'ed field names to lower-case is bad mojo HOT 5
- Cannot avoid DBDish::Oracle: Error: ORA-01000: maximum open cursors exceeded HOT 6
- Failure to self manage statement handles causes DBDish::Oracle: Error: ORA-01000: maximum open cursors exceeded HOT 4
- CI Test Oracle for Oracle driver
- Support default value in insert&update HOT 1
- Places for placeholders HOT 1
- SQLite Threads: Getting errors on macos during install HOT 6
- Add support to firebird database HOT 4
- Native call expected argument 1 to reference a native integer, but got CPointer HOT 6
- DBDish::mysql error - Unsupported Concurrency: Connection used by multiple threads simultaneously HOT 7
- Oracle InstantClient 18 not used? HOT 10
- DBIish: DBDish::Pg needs 'pq', not found HOT 12
- BLOB support for Oracle?
- Cryptic error message on using disconnect HOT 2
- MySQL driver cannot handle bigint unsigned in `execute( )` HOT 14
- zef install test failures HOT 5
- Non-repeatable test failures in Github cron job HOT 2
- X::AdHoc: Cannot look up attributes in a VMNull type object. Did you forget a '.new'? HOT 10
- Some MySQL administrative queries return empty results HOT 2
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from dbiish.