Date: 06/29/00
- Next message: kir: "[phplib-dev] cvs commit"
- Previous message: toby cabot: "[phplib-dev] bug in db_pgsql.inc"
- Next in thread: kir: "[phplib-dev] cvs commit"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
From: ssilk
Date: Fri Jun 30 03:55:54 2000
Modified files:
php-lib/php/query_sql.inc
Log message:
Changed getrow() to parse also for an array (like exists())
Index: php-lib/php/query_sql.inc
diff -u php-lib/php/query_sql.inc:1.17 php-lib/php/query_sql.inc:1.18
--- php-lib/php/query_sql.inc:1.17 Mon May 8 03:51:37 2000
+++ php-lib/php/query_sql.inc Fri Jun 30 03:55:23 2000
@@ -18,7 +18,7 @@
* is based in November 1997,
* it was a collection of functions for PHP/FI and mSQL.
*
- * $Id: query_sql.inc,v 1.17 2000/05/08 01:51:37 ssilk Exp $
+ * $Id: query_sql.inc,v 1.18 2000/06/30 01:55:23 ssilk Exp $
*
*/
@@ -746,12 +746,19 @@
## an assoc array of the first found row, or false if nothing found
## field $name is set with value $val
##
- function getrow ($table,$name,$val) {
+ function getrow ($table,$name_or_fields,$val) {
$meta=$this->metadata_buffered($table);
- $j=$meta[meta][$name];
- list($k)=$this->convert($val,$meta[$j]);
- $q=sprintf("SELECT * FROM %s WHERE %s=%s",
- $table,$name,$k);
+ list($fields,$name)=$this->special_or_where($name_or_fields);
+
+ if (empty($name)) {
+ $where=$this->where_Clause($table,$fields,'strong');
+ } elseif ($name && !emtpy($val) ) {
+ $where=$this->where_Clause($table,ARRAY($name=>$val),'strong');
+ } else {
+ $this->halt("exists(): Val was not set");
+ }
+ $q=sprintf("SELECT * FROM %s%s",
+ $table,$where);
$this->_QDebug($q);
$this->query($q);
if ($this->next_record()) {
---------------------------------------------------------------------
To unsubscribe, e-mail: phplib-dev-unsubscribe <email protected>
For additional commands, e-mail: phplib-dev-help <email protected>
- Next message: kir: "[phplib-dev] cvs commit"
- Previous message: toby cabot: "[phplib-dev] bug in db_pgsql.inc"
- Next in thread: kir: "[phplib-dev] cvs commit"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]

