ruby-monetdb-sql 0.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -0,0 +1,55 @@
1
+ # The contents of this file are subject to the MonetDB Public License
2
+ # Version 1.1 (the "License"); you may not use this file except in
3
+ # compliance with the License. You may obtain a copy of the License at
4
+ # http://monetdb.cwi.nl/Legal/MonetDBLicense-1.1.html
5
+ #
6
+ # Software distributed under the License is distributed on an "AS IS"
7
+ # basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See the
8
+ # License for the specific language governing rights and limitations
9
+ # under the License.
10
+ #
11
+ # The Original Code is the MonetDB Database System.
12
+ #
13
+ # The Initial Developer of the Original Code is CWI.
14
+ # Portions created by CWI are Copyright (C) 1997-July 2008 CWI.
15
+ # Copyright August 2008-2011 MonetDB B.V.
16
+ # All Rights Reserved.
17
+
18
+ # Exception classes for the ruby-monetdb driver
19
+
20
+ class MonetDBQueryError < StandardError
21
+ def initialize(e)
22
+ $stderr.puts e
23
+ end
24
+ end
25
+
26
+ class MonetDBDataError < StandardError
27
+ def initialize(e)
28
+ $stderr.puts e
29
+ end
30
+ end
31
+
32
+ class MonetDBCommandError < StandardError
33
+ def initialize(e)
34
+ $stderr.puts e
35
+ end
36
+ end
37
+
38
+ class MonetDBConnectionError < StandardError
39
+ def initialize(e)
40
+ $stderr.puts e
41
+ end
42
+ end
43
+
44
+
45
+ class MonetDBSocketError < StandardError
46
+ def initialize(e)
47
+ $stderr.puts e
48
+ end
49
+ end
50
+
51
+ class MonetDBProtocolError < StandardError
52
+ def initialize(e)
53
+ $stderr.puts e
54
+ end
55
+ end
@@ -0,0 +1,56 @@
1
+ # The contents of this file are subject to the MonetDB Public License
2
+ # Version 1.1 (the "License"); you may not use this file except in
3
+ # compliance with the License. You may obtain a copy of the License at
4
+ # http://monetdb.cwi.nl/Legal/MonetDBLicense-1.1.html
5
+ #
6
+ # Software distributed under the License is distributed on an "AS IS"
7
+ # basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See the
8
+ # License for the specific language governing rights and limitations
9
+ # under the License.
10
+ #
11
+ # The Original Code is the MonetDB Database System.
12
+ #
13
+ # The Initial Developer of the Original Code is CWI.
14
+ # Portions created by CWI are Copyright (C) 1997-July 2008 CWI.
15
+ # Copyright August 2008-2011 MonetDB B.V.
16
+ # All Rights Reserved.
17
+
18
+ require 'digest/md5'
19
+ require 'digest/sha1'
20
+ require 'digest/sha2'
21
+
22
+ class Hasher
23
+ # Constructor
24
+ # method = "SHA1" or "MD5"
25
+ # pwd = Password
26
+ def initialize(method, pwd)
27
+ if (method.upcase == "SHA1")
28
+ @hashfunc = Digest::SHA1.new
29
+ @hashname = method.upcase
30
+ elsif (method.upcase == "SHA256")
31
+ @hashfunc = Digest::SHA256.new
32
+ @hashname = method.upcase
33
+ elsif (method.upcase == "SHA384")
34
+ @hashfunc = Digest::SHA384.new
35
+ @hashname = method.upcase
36
+ elsif (method.upcase == "SHA512")
37
+ @hashfunc = Digest::SHA512.new
38
+ @hashname = method.upcase
39
+ else
40
+ # default to MD5
41
+ @hashfunc = Digest::MD5.new
42
+ @hashname = "MD5"
43
+ end
44
+ @pwd = pwd
45
+ end
46
+
47
+
48
+ def hashname
49
+ @hashname
50
+ end
51
+
52
+ # Compute hash code
53
+ def hashsum
54
+ return @hashfunc.hexdigest(@pwd)
55
+ end
56
+ end
metadata ADDED
@@ -0,0 +1,51 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: ruby-monetdb-sql
3
+ version: !ruby/object:Gem::Version
4
+ version: '0.1'
5
+ prerelease:
6
+ platform: ruby
7
+ authors:
8
+ - G Modena
9
+ autorequire:
10
+ bindir: bin
11
+ cert_chain: []
12
+ date: 2009-04-27 00:00:00.000000000 Z
13
+ dependencies: []
14
+ description: Pure Ruby database driver for monetdb5/sql
15
+ email: gm@cwi.nl
16
+ executables: []
17
+ extensions: []
18
+ extra_rdoc_files: []
19
+ files:
20
+ - README
21
+ - lib/MonetDB.rb
22
+ - lib/MonetDBConnection.rb
23
+ - lib/MonetDBData.rb
24
+ - lib/MonetDBExceptions.rb
25
+ - lib/hasher.rb
26
+ homepage: http://monetdb.cwi.nl/
27
+ licenses: []
28
+ post_install_message:
29
+ rdoc_options: []
30
+ require_paths:
31
+ - ./lib
32
+ required_ruby_version: !ruby/object:Gem::Requirement
33
+ none: false
34
+ requirements:
35
+ - - ! '>='
36
+ - !ruby/object:Gem::Version
37
+ version: 1.8.0
38
+ required_rubygems_version: !ruby/object:Gem::Requirement
39
+ none: false
40
+ requirements:
41
+ - - ! '>='
42
+ - !ruby/object:Gem::Version
43
+ version: '0'
44
+ requirements: []
45
+ rubyforge_project:
46
+ rubygems_version: 1.8.15
47
+ signing_key:
48
+ specification_version: 3
49
+ summary: Pure Ruby database driver for monetdb5/sql
50
+ test_files: []
51
+ has_rdoc: true