Date: 02/01/00
- Next message: ssilk: "[PHPLIB-DEV] cvs commit"
- Previous message: ssilk: "[PHPLIB-DEV] cvs commit"
- Next in thread: ssilk: "[PHPLIB-DEV] cvs commit"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
From: ssilk
Date: Wed Feb 2 00:59:32 2000
Modified files:
php-lib/php/query_sql.inc
Log message:
Slight changes to this class
- does not need $special-array anymore everywhere
- new function getrow_where(), which returns the first line of a select-where
Index: php-lib/php/query_sql.inc
diff -u php-lib/php/query_sql.inc:1.9 php-lib/php/query_sql.inc:1.10
--- php-lib/php/query_sql.inc:1.9 Fri Jan 14 06:42:43 2000
+++ php-lib/php/query_sql.inc Wed Feb 2 00:59:01 2000
@@ -9,7 +9,7 @@
* is based in November 1997,
* it was a collection of functions for PHP/FI and mSQL.
*
- * $Id: query_sql.inc,v 1.9 2000/01/14 05:42:43 ssilk Exp $
+ * $Id: query_sql.inc,v 1.10 2000/02/01 23:59:01 ssilk Exp $
*
*/
@@ -197,7 +197,8 @@
## returns the insert clause. It's on you to modify it
## and send it to your DB
##
- function insert_plain_Clause ($table,$fields,$special,$check="soft") {
+ function insert_plain_Clause ($table,$fields,$special='',$check="soft") {
+ if (''==$special) $special=ARRAY();
$meta=$this->metadata_buffered($table);
for ($i=0; $i < $meta["num_fields"]; $i++) {
@@ -218,7 +219,8 @@
}
# Replace, a special mySQL-function, same as INSERT
- function replace_plain_Clause ($table,$fields,$special,$check="soft") {
+ function replace_plain_Clause ($table,$fields,$special='',$check="soft") {
+ if (''==$special) $special=ARRAY();
$meta=$this->metadata_buffered($table);
for ($i=0; $i < $meta["num_fields"]; $i++) {
@@ -245,7 +247,8 @@
## weak enables you to sent a query without $where (enables you
## to update the hole table)
##
- function update_plain_Clause ($table,$fields,$special,$where,$check="soft") {
+ function update_plain_Clause ($table,$fields,$special='',$where='',$check="soft") {
+ if (''==$special) $special=ARRAY();
$meta=$this->metadata_buffered($table);
if (!$where && $check!="weak") {
echo "ERROR: update_plain_Clause(): Parameter \$where is empty!<BR>";
@@ -286,7 +289,8 @@
## weak enables you to sent a query without $where (enables you
## to update the hole table)
##
- function update_Clause ($table,$fields,$special,$where,$check="soft") {
+ function update_Clause ($table,$fields,$special='',$where='',$check="soft") {
+ if (''==$special) $special=ARRAY();
$meta=$this->metadata_buffered($table);
if (!$where && $check!="weak") {
echo "ERROR: update_Clause(): Parameter \$where is empty!<BR>";
@@ -326,7 +330,7 @@
## $check can be "soft" and "weak". Weak let's you delete the
## hole table, if you want
##
- function delete_Clause ($table,$where,$check="soft") {
+ function delete_Clause ($table,$where='',$check="soft") {
if (!$where && $check!="weak") {
echo "ERROR: delete_Clause(): Parameter \$where is empty!<BR>";
return(false);
@@ -384,6 +388,31 @@
}
}
+ ##
+ ## This function is like getrow(), and returns
+ ## an assoc array of the first found row, or false if nothing found
+ ## The where-parameter is a where-clause - could be generated by
+ ## where_clause()...
+ ##
+ function getrow_where ($table,$where) {
+ if ($where) {
+ if (!eregi("^[[:space:]]*WHERE",$where)) {
+ $where="WHERE $where";
+ }
+ }
+ $q=sprintf("SELECT * FROM %s %s",
+ $table,$where);
+ $this->_QDebug($q);
+ $this->query($q);
+ if ($this->next_record()) {
+ return($this->Record);
+ } else {
+ return(false);
+ }
+ }
+
+
+
##
@@ -524,7 +553,7 @@
## This functions writes warnings, if your where-clause
## returns more than one row or nothing
##
- function all_changed_vars ($table,$fields,$where,$check='soft') {
+ function all_changed_vars ($table,$fields,$where='',$check='soft') {
$meta=$this->metadata_buffered($table);
$q1="SELECT * FROM $table $where";
-
PHPLIB Developers Mailing List. Send messages to <phplib-dev <email protected>>.
To unsubscribe, send "unsubscribe" to <phplib-dev-request <email protected>> in
the body, not the subject, of your message.
- Next message: ssilk: "[PHPLIB-DEV] cvs commit"
- Previous message: ssilk: "[PHPLIB-DEV] cvs commit"
- Next in thread: ssilk: "[PHPLIB-DEV] cvs commit"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]

