Return-Path: Delivered-To: apmail-db-torque-dev-archive@www.apache.org Received: (qmail 48546 invoked from network); 8 May 2009 20:43:37 -0000 Received: from hermes.apache.org (HELO mail.apache.org) (140.211.11.3) by minotaur.apache.org with SMTP; 8 May 2009 20:43:37 -0000 Received: (qmail 50807 invoked by uid 500); 8 May 2009 20:43:37 -0000 Delivered-To: apmail-db-torque-dev-archive@db.apache.org Received: (qmail 50745 invoked by uid 500); 8 May 2009 20:43:37 -0000 Mailing-List: contact torque-dev-help@db.apache.org; run by ezmlm Precedence: bulk List-Unsubscribe: List-Help: List-Post: List-Id: "Apache Torque Developers List" Reply-To: "Apache Torque Developers List" Delivered-To: mailing list torque-dev@db.apache.org Received: (qmail 50735 invoked by uid 99); 8 May 2009 20:43:37 -0000 Received: from nike.apache.org (HELO nike.apache.org) (192.87.106.230) by apache.org (qpsmtpd/0.29) with ESMTP; Fri, 08 May 2009 20:43:37 +0000 X-ASF-Spam-Status: No, hits=2.2 required=10.0 tests=HTML_MESSAGE,SPF_HELO_PASS,SPF_PASS X-Spam-Check-By: apache.org Received-SPF: pass (nike.apache.org: domain of greg.monroe@dukece.com designates 67.202.195.198 as permitted sender) Received: from [67.202.195.198] (HELO dukece.com) (67.202.195.198) by apache.org (qpsmtpd/0.29) with ESMTP; Fri, 08 May 2009 20:43:27 +0000 Received: from ([10.123.20.180]) by smtpgw2.dukece.com with ESMTP with TLS id 4440156.438595; Fri, 08 May 2009 16:42:45 -0400 Received: from durham-e2k7mb1.dukece.com ([10.123.20.181]) by durham-e2k7ca1.dukece.com ([10.123.20.180]) with mapi; Fri, 8 May 2009 16:42:43 -0400 From: Greg Monroe To: 'Apache Torque Developers List' Date: Fri, 8 May 2009 16:42:43 -0400 Subject: DbName issues Thread-Topic: DbName issues Thread-Index: AcnQHYj4+8ciDULaTgKfzQgtDIoEoQ== Message-ID: <55B8568AFA5F144F886F18186BAD5B2C056D7EDC61@durham-e2k7mb1.dukece.com> Accept-Language: en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: acceptlanguage: en-US MIME-Version: 1.0 Content-Type: multipart/alternative; boundary="_000_55B8568AFA5F144F886F18186BAD5B2C056D7EDC61durhame2k7mb1_" X-Virus-Checked: Checked by ClamAV on apache.org --_000_55B8568AFA5F144F886F18186BAD5B2C056D7EDC61durhame2k7mb1_ Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: quoted-printable I was thinking the other day about how to resolve the fact that the same=0D= =0ADBName is used to find the connection information AND the schema informa= tion=2E=0D=0AThis leads to a lot of new user confusion and make it harder t= han it should to=0D=0Ause the same DB schema object set with different DB c= onnections=2E=0D=0A=0D=0AHere's a mostly thought through solution:=0D=0A=0D= =0AFirst, add a optional new runtime property (I can hear the groans now) o= f the format:=0D=0A=0D=0Atorque=2Edatabase=2E=2Eschema=3D=0D=0A=0D=0AWhere:=0D=0A is something like "bookstore"= =2E=0D=0A is the name used in the schema XML=0D=0A=0D=0ANext= , the Database object would have a schemaName property added=2E This gets= =0D=0Aset from the config property above or uses the name property if the p= roperty does=0D=0Anot exist=2E=0D=0A=0D=0AThe getDatabaseMap() method in th= is class would be modified to use the new=0D=0AschemaName property to find = the appropriate schema info=2E=0D=0A=0D=0ANext, the DATABASE_NAME static pr= operty in the Base* classes should be=0D=0Adeprecated and replaced with a D= B_SCHEMA_NAME (or similar) property=2E=0D=0ATo make it clear what this prop= erty is used for=2E=0D=0A=0D=0AWhile we're at it, the TorqueInstance probab= ly needs to have a separate=0D=0ADatabaseMap collection like the existing D= atabase collection=2E=0D=0A=0D=0AThis would allow for multiple db handles t= o be defined that use the same schema=0D=0ADatabaseMap collection=2E The i= ntended purpose is to make the term DBName indicate the=0D=0Akey to the Dat= abase object (and related DB connection info) and the term DBSchemaName=0D= =0Aindicate the key to the DatabaseMap object=2E=0D=0A=0D=0AOnce we're ther= e, the generated Base Table classes should have a dbName property=0D=0Aadde= d=2E This should be set when the object is populated based on the dbName s= etting=0D=0Ain the Criteria object used=2E If set, this would be used to d= etermine the connection=0D=0Ainformation to use when the object was saved= =2E=0D=0A=0D=0ASo, if you wanted to use an alternate DB connection with the= same classes, all you=0D=0Aneed to do is define another set of torque=2Eda= tabase=2E* properties in the config file and=0D=0Awrite some code like:=0D= =0A=0D=0ACriteria c =3D new Criteria(anotherDbName);=0D=0Ac=2Eadd(MyTableP= eer=2EColA, 3);=0D=0AList results =3D MyTablePeer=2EdoSelect( c );=0D=0A=0D= =0AAnd the result object could be just modified and save() as needed=2E=0D= =0A=0D=0AIMHO, this would be much cleaner than having to deal with getting = connections that=0D=0Ahave to be closed and wrapped in final statements, et= c=2E=0D=0A=0D=0AThoughts on what I am missing? Are there "gotcha's" in the= Manager code or Id generator=0D=0Acode?=0D=0A=0D=0AGreg Monroe (919)680-5050=0D=0ALearning Technologies Group - Solutions Team = Lead=0D=0ADuke Corporate Education, Inc=2E=0D=0A330 Blackwell St=2E=0D=0ADu= rham, NC 27701=0D=0A=0D=0A=0D=0A=0D=0ADukeCE Privacy Statement:=0D=0APlease= be advised that this e-mail and any files transmitted with=0Ait are confid= ential communication or may otherwise be privileged or=0Aconfidential and a= re intended solely for the individual or entity=0Ato whom they are addresse= d=2E If you are not the intended recipient=0Ayou may not rely on the conten= ts of this email or any attachments,=0Aand we ask that you please not read,= copy or retransmit this=0Acommunication, but reply to the sender and destr= oy the email, its=0Acontents, and all copies thereof immediately=2E Any una= uthorized=0Adissemination, distribution or copying of this communication is= =0Astrictly prohibited=2E --_000_55B8568AFA5F144F886F18186BAD5B2C056D7EDC61durhame2k7mb1_--