MIOLO20
Carregando...
Procurando...
Nenhuma entrada encontrada
query.class
Ir para a documentação deste ficheiro.
1<?php
2#+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
3# @title
4# MsSQL Query
5#
6# @description
11# This file contains de query class definitions
12#
13# @see miolo/database.class,
14# miolo/mssql_connection.class,
15#
16# @topics db, business
17#
18# @created
19# 2001/08/14
20#
21# @organisation
22# MIOLO - Miolo Development Team - UNIVATES Centro Universitario
23# http://miolo.codigolivre.org.br
24#
25# @legal
26# CopyLeft (L) 2001-2002 UNIVATES, Lajeado/RS - Brasil
27# Licensed under GPL (see COPYING.TXT or FSF at www.fsf.org for
28# further details)
29#
30# @contributors
31# Vilson Cristiano Gartner [author] [vgartner@univates.br]
32# Thomas Spriestersbach [author] [ts@interact2000.com.br]
33# Clausius Duque G. Reis [clausius@ufv.br]
34#
35# @maintainers
36# Vilson Cristiano Gartner [author] [vgartner@univates.br]
37# Thomas Spriestersbach [author] [ts@interact2000.com.br]
38# Clausius Duque G. Reis [clausius@ufv.br]
39#
40# history: see miolo cvs.
41#
42# @id $Id: mssql_query.class,v 1.2 2003/09/12 11:18:00 clausius Exp $
43#---------------------------------------------------------------------
44
53{
57 var $conf; // name of database configuration
58
62 var $conn; // the connection id
63
67 var $sql; // the SQL command string
68
72 var $result; // the SQL command result set
73
77 var $row; // the current row index
78
82 var $error; // the query's error message from the query execution
83
84
94 function MssqlQuery($conf)
95 {
96 $this->conf = $conf;
97 }
98
106 function GetError()
107 {
108 return $this->error;
109 }
110
118 function Open()
119 { global $MIOLO;
120
121 $MIOLO->LogSQL($this->sql,false,$this->conf);
122
123 $this->result = mssql_query($this->conn->id,$this->sql);
124 $this->row = -1;
125
126 $this->error = mssql_get_last_message();;
127
128 return $this->result != null;
129 }
130
138 function Close()
139 {
140 if ( $this->result != null )
141 {
143
144 $this->result = null;
145 }
146 }
147
155 function MovePrev()
156 {
157 if ( $this->row >= 0 )
158 {
159 $this->row--;
160
161 return true;
162 }
163
164 return false;
165 }
166
174 function MoveNext()
175 {
176 if ( $this->row + 1 < $this->GetRowCount() )
177 {
178 $this->row++;
179
180 return true;
181 }
182
183 return false;
184 }
185
193 function GetRowCount()
194 {
195 if ($this->result != 0) {
196 return mssql_num_rows($this->result);
197 }
198 }
199
207 function GetColumnCount()
208 {
209 return mssql_num_fields($this->result);
210 }
211
222 {
223 return mssql_field_name($this->result,$col-1);
224 }
225
235 function GetValue($col)
236 {
237 return mssql_result($this->result,$this->row,$col-1);
238 }
239
247 function GetRowValues()
248 {
249 return mssql_fetch_row($this->result,$this->row);
250 }
251
262 {
263 $this->conn = $c;
264 }
265
275 function SetSQL($sql)
276 {
277 $this->sql = $sql;
278 }
279}
280
281?>
GetRowValues()
Definição query.class:247
GetRowCount()
Definição query.class:193
GetValue($col)
Definição query.class:235
MssqlQuery($conf)
Definição query.class:94
SetConnection($c)
Definição query.class:261
GetColumnCount()
Definição query.class:207
SetSQL($sql)
Definição query.class:275
GetColumnName($col)
Definição query.class:221