From: Jess Robinson Date: Mon, 10 Jul 2006 13:06:30 +0000 (+0000) Subject: More FAQs! X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=commitdiff_plain;h=7f613f3abf507feffb920890d245d325520d55c0;p=dbsrgits%2FDBIx-Class-Historic.git More FAQs! --- diff --git a/lib/DBIx/Class/Manual/FAQ.pod b/lib/DBIx/Class/Manual/FAQ.pod index d2fa3bc..5dd234e 100644 --- a/lib/DBIx/Class/Manual/FAQ.pod +++ b/lib/DBIx/Class/Manual/FAQ.pod @@ -57,6 +57,18 @@ Create your classes manually, as above. Write a script that calls L. See there for details, or the L. +=item .. connect to my database? + +Once you have created all the appropriate table/source classes, and an +overall L class, you can start using +them in an application. To do this, you need to create a central +Schema object, which is used to access all the data in the various +tables. See L for details. The actual +connection does not happen until you actually request data, so don't +be alarmed if the error from incorrect connection details happens a +lot later. + + =back =head2 Relationships @@ -113,16 +125,60 @@ Use it's name. An accessor is created using the name. See examples in L object, as mentioned above in ".. connect to my +database". Find the +L that you want +to search in, and call C on it. See +L. + =item .. search using database functions? +Supplying something like: + + ->search({'mydatefield' => 'now()'}) + +to search, will probably not do what you expect. It will quote the +text "now()", instead of trying to call the function. To provide +literal, unquoted text you need to pass in a scalar reference, like +so: + + ->search({'mydatefield' => \'now()'}) + =item .. sort the results of my search? +Supply a list of columns you want to sort by, to the C +attribute, see L. + +=item .. sort my results based on fields I've aliased using C? + +You don't. You'll need to supply the same functions/expressions to +C, as you did to C. + =item .. filter the results of my search? =item .. search in several tables simultaneously? +=item .. create joins with conditions other than column equality? + +=item .. search using greater-than or less-than and database functions? +NOT + my $interval = "now() - interval '12 hours'"; + last_attempt => { '<' => \$interval }, +BUT +08:44 <@castaway> my $interval = "< now() - interval '12 hours'"; .. + last_attempt => \$interval , + + =item .. find more help on constructing searches? Behind the scenes, DBIx::Class uses L to help construct