On 6/29/06, Jonathan Vanasco <[EMAIL PROTECTED]> wrote: > this works, just checking to see if its the idiomatic way-- as the > docs didn't point to it... > > basically: > a query in a manager for non-key fields... > results are stuffed into $results > check scalar @$ to see if there are results > > i *think* @$results is the right way to handle it. $results is a > rosedb object, but overloads make it seem like an arrayref > [...] > my $results= $class->get_item(
If get_item() is a wrapper around get_objects(), then $results is a reference to an array (or undef if your ->meta->error_mode is not set to something that causes an exception to be thrown), not an RDBO object. To check for any items in that array, yes, [EMAIL PROTECTED] will work. If you just want to see if any results exist, you can limit your query to 1 item to keep it from fetching many of them: limit => 1. You can also use get_objects_count() (or the auto-generated wrapper around it) to just return a number of items. Finally, you can use get_objects_sql() and then manually wrap the generated SQL in something db-specific (e.g., some sort of EXISTS query) and then run that using plain old DBI. Which is "best" depends on your data and your db. -John Using Tomcat but need to do more? Need to support web services, security? Get stuff done quickly with pre-integrated technology to make your job easier Download IBM WebSphere Application Server v.1.0.1 based on Apache Geronimo http://sel.as-us.falkag.net/sel?cmd=lnk&kid=120709&bid=263057&dat=121642 _______________________________________________ Rose-db-object mailing list Rose-db-object@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/rose-db-object