lafcadio 0.9.3 → 0.9.4

Sign up to get free protection for your applications and to get access to all the features.
@@ -16,7 +16,7 @@
16
16
  # http://lafcadio.rubyforge.org/tutorial.html.
17
17
 
18
18
  module Lafcadio
19
- Version = "0.9.3"
19
+ Version = "0.9.4"
20
20
 
21
21
  require 'lafcadio/depend'
22
22
  require 'lafcadio/domain'
@@ -1,5 +1,5 @@
1
- # Lafcadio is an object-relational mapping library for Ruby and MySQL. Its
2
- # design has a few aspects in mind:
1
+ # Lafcadio is an object-relational mapping library for Ruby. It currently
2
+ # supports MySQL and PostgreSQL. Its design has a few aspects in mind:
3
3
  # * The importance of unit-testing. Lafcadio includes a MockObjectStore which
4
4
  # can take the place of the ObjectStore for unit tests, so you can test
5
5
  # complex database-driven logic. Committing domain objects, running queries,
@@ -16,7 +16,7 @@
16
16
  # http://lafcadio.rubyforge.org/tutorial.html.
17
17
 
18
18
  module Lafcadio
19
- Version = "0.9.2"
19
+ Version = "0.9.3"
20
20
 
21
21
  require 'lafcadio/depend'
22
22
  require 'lafcadio/domain'
@@ -645,7 +645,6 @@ module Lafcadio
645
645
  end
646
646
 
647
647
  def self.try_load_xml_parser # :nodoc:
648
- require 'lafcadio/domain'
649
648
  if ( dirName = LafcadioConfig.new['classDefinitionDir'] )
650
649
  xmlFileName = self.basename + '.xml'
651
650
  xmlPath = File.join( dirName, xmlFileName )
@@ -1,6 +1,7 @@
1
1
  require 'extensions/module'
2
2
  require 'lafcadio/objectField'
3
3
  require 'lafcadio/util'
4
+ require 'monitor'
4
5
  require 'rexml/document'
5
6
 
6
7
  module Lafcadio
@@ -277,6 +278,7 @@ module Lafcadio
277
278
  # different levels.
278
279
  class DomainObject
279
280
  @@subclass_records = Hash.new do |h, k| h[k] = SubclassRecord.new( k ); end
281
+ @@subclass_records.extend MonitorMixin
280
282
 
281
283
  include DomainComparable
282
284
 
@@ -603,7 +605,7 @@ module Lafcadio
603
605
  end
604
606
 
605
607
  def self.subclass_record # :nodoc:
606
- @@subclass_records[self]
608
+ @@subclass_records.synchronize { @@subclass_records[self] }
607
609
  end
608
610
 
609
611
  def self.subclasses #:nodoc:
@@ -562,6 +562,7 @@ module Lafcadio
562
562
  db_object
563
563
  )
564
564
  statements_and_binds.each do |sql, binds|
565
+ maybe_log sql
565
566
  @db_conn.do( sql, *binds )
566
567
  end
567
568
  if statements_and_binds[0].first =~ /insert/
@@ -596,13 +597,15 @@ module Lafcadio
596
597
  config = LafcadioConfig.new
597
598
  if config['logSql'] == 'y'
598
599
  sqllog = Log4r::Logger['sql'] || Log4r::Logger.new( 'sql' )
599
- filename = File.join(
600
- config['logdir'], config['sqlLogFile'] || 'sql'
601
- )
602
- outputter = Log4r::FileOutputter.new(
603
- 'outputter', { :filename => filename }
604
- )
605
- sqllog.outputters = outputter
600
+ if sqllog.outputters.empty?
601
+ filename = File.join(
602
+ config['logdir'], config['sqlLogFile'] || 'sql'
603
+ )
604
+ outputter = Log4r::FileOutputter.new(
605
+ 'outputter', { :filename => filename }
606
+ )
607
+ sqllog.outputters = outputter
608
+ end
606
609
  sqllog.info sql
607
610
  end
608
611
  end
@@ -575,7 +575,15 @@ module Lafcadio
575
575
  def get_last_pk_id_inserted( domain_class )
576
576
  pair = self.class.last_inserted_pk_id_pair( domain_class )
577
577
  sql = 'select ' + pair.first
578
- select_all( sql ).first[pair.last].to_i
578
+ begin
579
+ select_all( sql ).first[pair.last].to_i
580
+ rescue RuntimeError
581
+ error_msg =
582
+ "The field \"" + domain_class.sql_primary_key_name +
583
+ "\" can\'t be found in the table \"" +
584
+ domain_class.table_name + "\"."
585
+ raise FieldMatchError, error_msg, caller
586
+ end
579
587
  end
580
588
 
581
589
  def group_query( query )
@@ -610,7 +618,7 @@ module Lafcadio
610
618
 
611
619
  def select_dobjs(query)
612
620
  domain_class = query.domain_class
613
- select_all( query.to_sql ).collect { |row_hash|
621
+ select_all( query.to_sql( ObjectStore.db_type ) ).collect { |row_hash|
614
622
  dobj = domain_class.new(
615
623
  SqlToRubyValues.new( domain_class, row_hash )
616
624
  )
metadata CHANGED
@@ -3,8 +3,8 @@ rubygems_version: 0.8.11
3
3
  specification_version: 1
4
4
  name: lafcadio
5
5
  version: !ruby/object:Gem::Version
6
- version: 0.9.3
7
- date: 2006-03-21 00:00:00 -08:00
6
+ version: 0.9.4
7
+ date: 2006-05-01 00:00:00 -04:00
8
8
  summary: Lafcadio is an object-relational mapping layer
9
9
  require_paths:
10
10
  - lib
@@ -15,7 +15,7 @@ description: Lafcadio is an object-relational mapping layer for Ruby. It lets yo
15
15
  autorequire: lafcadio
16
16
  default_executable:
17
17
  bindir: bin
18
- has_rdoc: false
18
+ has_rdoc: true
19
19
  required_ruby_version: !ruby/object:Gem::Version::Requirement
20
20
  requirements:
21
21
  - - ">"
@@ -52,8 +52,9 @@ files:
52
52
  - lib/lafcadio/test/testconfig.dat
53
53
  test_files: []
54
54
 
55
- rdoc_options: []
56
-
55
+ rdoc_options:
56
+ - --main
57
+ - lib/lafcadio.rb
57
58
  extra_rdoc_files: []
58
59
 
59
60
  executables: