From fd82ce8375050054ebd38f24c05cb28ea828ed7e Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Henrik=20Grubbstr=C3=B6m=20=28Grubba=29?=
 <grubba@grubba.org>
Date: Sun, 30 Mar 1997 21:07:41 +0200
Subject: [PATCH] Added pikedoc-comments

Rev: lib/modules/Sql.pmod/sql.pike:1.4
Rev: lib/modules/Sql.pmod/sql_result.pike:1.2
---
 lib/modules/Sql.pmod/sql.pike        | 83 ++++++++++++++++++++++++++--
 lib/modules/Sql.pmod/sql_result.pike | 37 ++++++++++++-
 2 files changed, 114 insertions(+), 6 deletions(-)

diff --git a/lib/modules/Sql.pmod/sql.pike b/lib/modules/Sql.pmod/sql.pike
index 6130c22d2b..842e0736d3 100644
--- a/lib/modules/Sql.pmod/sql.pike
+++ b/lib/modules/Sql.pmod/sql.pike
@@ -1,18 +1,44 @@
 /*
- * $Id: sql.pike,v 1.3 1997/03/30 14:29:56 grubba Exp $
+ * $Id: sql.pike,v 1.4 1997/03/30 19:07:40 grubba Exp $
  *
  * Implements the generic parts of the SQL-interface
  *
  * Henrik Grubbstr�m 1996-01-09
  */
 
+//.
+//. File:	sql.pike
+//. RCSID:	$Id: sql.pike,v 1.4 1997/03/30 19:07:40 grubba Exp $
+//. Author:	Henrik Grubbstr�m (grubba@infovav.se)
+//.
+//. Synopsis:	Implements the generic parts of the SQL-interface.
+//.
+//. +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
+//.
+//. Implements those functions that need not be present in all SQL-modules.
+//.
+
 #define throw_error(X)	throw(({ (X), backtrace() }))
 
 import Array;
 import Simulate;
 
+//. + master_sql
+//.   Object to use for the actual SQL-queries.
 object master_sql;
 
+//. - create
+//.   Create a new generic SQL object.
+//. > host
+//.   object - Use this object to access the SQL-database.
+//.   string - Use any available database server on this host.
+//.            If "" or 0, access through UNIX-domain socket.
+//. > database
+//.   Select this database.
+//. > user
+//.   User name to access the database as.
+//. > password
+//.   Password to access the database.
 void create(void|string|object host, void|string db,
 	    void|string user, void|string password)
 {
@@ -78,27 +104,44 @@ static private array(mapping(string:mixed)) res_obj_to_array(object res_obj)
     return(0);
   }
 }
-  
+
+//. - error
+//.   Return last error message.  
 int|string error()
 {
   return(master_sql->error());
 }
 
+//. - select_db
+//.   Select database to access.
 void select_db(string db)
 {
   master_sql->select_db(db);
 }
 
-array(mapping(string:mixed)) query(string s)
+//. - query
+//.   Send an SQL query to the underlying SQL-server. The result is returned
+//.   as an array of mappings indexed on the name of the columns.
+//.   Returns 0 if the query didn't return any result (e.g. INSERT or similar).
+//. > q
+//.   Query to send to the SQL-server.
+array(mapping(string:mixed)) query(string q)
 {
   object res_obj;
 
   if (functionp(master_sql->query)) {
-    return(master_sql->query(s));
+    return(master_sql->query(q));
   }
-  return(res_obj_to_array(master_sql->big_query(s)));
+  return(res_obj_to_array(master_sql->big_query(q)));
 }
 
+//. - big_query
+//.   Send an SQL query to the underlying SQL-server. The result is returned
+//.   as a Sql.sql_result object. This allows for having results larger than
+//.   the available memory, and returning some more info on the result.
+//.   Returns 0 if the query didn't return any result (e.g. INSERT or similar).
+//. > q
+//.   Query to send to the SQL-server.
 object big_query(string q)
 {
   if (functionp(master_sql->big_query)) {
@@ -107,16 +150,26 @@ object big_query(string q)
   return(Sql.sql_result(master_sql->query(q)));
 }
 
+//. - create_db
+//.   Create a new database.
+//. > db
+//.   Name of database to create.
 void create_db(string db)
 {
   master_sql->create_db(db);
 }
 
+//. - drop_db
+//.   Drop database
+//. > db
+//.   Name of database to drop.
 void drop_db(string db)
 {
   master_sql->drop_db(db);
 }
 
+//. - shutdown
+//.   Shutdown a database server.
 void shutdown()
 {
   if (functionp(master_sql->shutdown)) {
@@ -126,6 +179,8 @@ void shutdown()
   }
 }
 
+//. - reload
+//.   Reload the tables.
 void reload()
 {
   if (functionp(master_sql->reload)) {
@@ -135,6 +190,8 @@ void reload()
   }
 }
 
+//. - server_info
+//.   Return info about the current SQL-server.
 string server_info()
 {
   if (functionp(master_sql->server_info)) {
@@ -143,6 +200,8 @@ string server_info()
   return("Unknown SQL-server");
 }
 
+//. - host_info
+//.   Return info about the connection to the SQL-server.
 string host_info()
 {
   if (functionp(master_sql->host_info)) {
@@ -151,6 +210,10 @@ string host_info()
   return("Unknown connection to host");
 }
 
+//. - list_dbs
+//.   List available databases on this SQL-server.
+//. > wild
+//.   Optional wildcard to match against.
 array(string) list_dbs(string|void wild)
 {
   array(string)|array(mapping(string:mixed))|object res;
@@ -173,6 +236,10 @@ array(string) list_dbs(string|void wild)
   return(res);
 }
 
+//. - list_tables
+//.   List tables available in the current database.
+//. > wild
+//.   Optional wildcard to match against.
 array(string) list_tables(string|void wild)
 {
   array(string)|array(mapping(string:mixed))|object res;
@@ -195,6 +262,12 @@ array(string) list_tables(string|void wild)
   return(res);
 }
 
+//. - list_fields
+//.   List fields available in the specified table
+//. > table
+//.   Table to list the fields of.
+//. > wild
+//.   Optional wildcard to match against.
 array(mapping(string:mixed)) list_fields(string table, string|void wild)
 {
   array(mapping(string:mixed))|object res;
diff --git a/lib/modules/Sql.pmod/sql_result.pike b/lib/modules/Sql.pmod/sql_result.pike
index 74851bbba1..6166d3700b 100644
--- a/lib/modules/Sql.pmod/sql_result.pike
+++ b/lib/modules/Sql.pmod/sql_result.pike
@@ -1,18 +1,39 @@
 /*
- * $Id: sql_result.pike,v 1.1 1997/03/06 21:21:03 grubba Exp $
+ * $Id: sql_result.pike,v 1.2 1997/03/30 19:07:41 grubba Exp $
  *
  * Implements the generic result module of the SQL-interface
  *
  * Henrik Grubbstr�m 1996-01-09
  */
 
+//.
+//. File:	sql_result.pike
+//. RCSID:	$Id: sql_result.pike,v 1.2 1997/03/30 19:07:41 grubba Exp $
+//. Author:	Henrik Grubbstr�m (grubba@infovav.se)
+//.
+//. Synopsis:	Implements the generic result of the SQL-interface.
+//.
+//. +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
+//.
+//. Used to return results from SQL.sql->big_query().
+//.
+
 #define throw_error(X)	throw(({ (X), backtrace() }))
 
+//. + master_res
+//.   The actual result.
 object|array master_res;
+
+//. + index
+//.   If the result was an array, this is the current row.
 int index;
 
 import Array;
 
+//. - create
+//.   Create a new Sql.sql_result object
+//. > res
+//.   Result to use as base.
 void create(object|array res)
 {
   if (!(master_res = res) || (!arrayp(res) && !objectp(res))) {
@@ -21,6 +42,8 @@ void create(object|array res)
   index = 0;
 }
 
+//. - num_rows
+//.   Returns the number of rows in the result.
 int num_rows()
 {
   if (arrayp(master_res)) {
@@ -29,6 +52,8 @@ int num_rows()
   return(master_res->num_rows());
 }
 
+//. - num_fields
+//.   Returns the number of fields in the result.
 int num_fields()
 {
   if (arrayp(master_res)) {
@@ -37,6 +62,8 @@ int num_fields()
   return(master_res->num_fields());
 }
 
+//. - eof
+//.   Returns non-zero if there are no more rows.
 int eof()
 {
   if (arrayp(master_res)) {
@@ -45,6 +72,8 @@ int eof()
   return(master_res->eof());
 }
 
+//. - fetch_fields
+//.   Return information about the available fields.
 array(mapping(string:mixed)) fetch_fields()
 {
   if (arrayp(master_res)) {
@@ -60,6 +89,10 @@ array(mapping(string:mixed)) fetch_fields()
   return(master_res->fetch_fields());
 }
 
+//. - seek
+//.   Skip past a number of rows.
+//. > skip
+//.   Number of rows to skip.
 void seek(int skip)
 {
   if (skip < 0) {
@@ -76,6 +109,8 @@ void seek(int skip)
   }
 }
 
+//. - fetch_row
+//.   Fetch the next row from the result.
 int|array(string|int) fetch_row()
 {
   if (arrayp(master_res)) {
-- 
GitLab