MIOLO20
Carregando...
Procurando...
Nenhuma entrada encontrada
mquery.class
Ir para a documentação deste ficheiro.
1
<?php
2
3
class
ODBCQuery
extends
MQuery
4
{
5
var
$id_result
;
6
7
function
__construct
()
8
{
9
parent::__construct();
10
}
11
12
function
_query
()
13
{
14
$this->
fetched
=
false
;
15
$this->
sql
= $this->
maxrows
? $this->
sql
.
" LIMIT $this->maxrows"
:
$this->sql
;
16
$this->
sql
= $this->
offset
? $this->
sql
.
" OFFSET $this->offset"
:
$this->sql
;
17
$this->
id_result
=
odbc_exec
($this->
conn
->id,
$this
->sql);
18
$this->error = $this->
_error
();
19
20
if
(!$this->error)
21
{
22
$this->rowCount =
odbc_num_rows
($this->
id_result
);
23
24
for
(
$n
= 0;
$n
<
$this->rowCount
; $this->
result
[
$n
++] =
odbc_fetch_array
($this->
id_result
,
$n
));
25
26
$this->
fetched
=
true
;
27
$this->
colCount
=
odbc_num_fields
($this->
id_result
);
28
}
29
else
30
{
31
throw
new
EDatabaseQueryException
($this->error);
32
}
33
34
return
(!$this->error);
35
}
36
37
function
_error
()
38
{
39
return
((
$error
=
odbc_error
($this->
conn
->id)) ?
odbc_errormsg
($this->
conn
->id) :
false
);
40
}
41
42
function
_close
()
43
{
44
if
($this->
id_result
)
45
{
46
odbc_free_result
($this->
id_result
);
47
unset
($this->
id_result
);
48
}
49
}
50
51
function
_setmetadata
()
52
{
53
$numCols =
$this->colCount
;
54
$this->
metadata
=
array
();
55
for
(
$i
= 1;
$i
<= $numCols;
$i
++)
56
{
57
$name =
strtoupper
(
odbc_field_name
($this->
id_result
,
$i
));
58
$name = (
$p
=
strpos
($name,
'.'
)) ?
substr
($name,
$p
+ 1) : $name;
59
$this->
metadata
[
'fieldname'
][
$i
- 1] = $name;
60
$this->
metadata
[
'fieldtype'
][$name] = $this->
_getmetatype
(
strtoupper
(
odbc_field_name
($this->
id_result
,
$i
)));
61
$this->
metadata
[
'fieldlength'
][$name] =
odbc_field_len
($this->
id_result
,
$i
);
62
$this->
metadata
[
'fieldpos'
][$name] =
$i
- 1;
63
}
64
}
65
66
function
_getmetatype
(
$type
)
67
{
68
$type
=
strtoupper
(
$type
);
69
$rType
=
'N'
;
70
71
if
(
$type
==
"VARCHAR"
)
72
{
73
$rType
=
'C'
;
74
}
75
elseif
(
$type
==
"CHAR"
)
76
{
77
$rType
=
'C'
;
78
}
79
elseif
(
$type
==
"NUMBER"
)
80
{
81
$rType
=
'N'
;
82
}
83
elseif
(
$type
==
"INTEGER"
)
84
{
85
$rType
=
'N'
;
86
}
87
elseif
(
$type
==
"DATE"
)
88
{
89
$rType
=
'T'
;
90
}
91
elseif
(
$type
==
"TIMESTAMP"
)
92
{
93
$rType
=
'T'
;
94
}
95
96
return
$rType
;
97
}
98
}
99
?>
EDatabaseQueryException
Definição
mexception.class:62
MDataSet\$rowCount
$rowCount
Definição
mdataset.class:21
MDataSet\$colCount
$colCount
Definição
mdataset.class:26
MDataSet\$type
$type
Definição
mdataset.class:46
MDataSet\$row
$row
Definição
mdataset.class:16
MQuery
Definição
mquery.class:3
MQuery\$sql
$sql
Definição
mquery.class:6
MQuery\$error
$error
Definição
mquery.class:7
ODBCQuery
Definição
mquery.class:4
ODBCQuery\__construct
__construct()
Definição
mquery.class:7
ODBCQuery\_close
_close()
Definição
mquery.class:42
ODBCQuery\_setmetadata
_setmetadata()
Definição
mquery.class:51
ODBCQuery\_error
_error()
Definição
mquery.class:37
ODBCQuery\_query
_query()
Definição
mquery.class:12
ODBCQuery\$id_result
$id_result
Definição
mquery.class:5
ODBCQuery\_getmetatype
_getmetatype($type)
Definição
mquery.class:66
sql
Definição
compatibility.class:18
classes
database
odbc
mquery.class
Gerado por
1.10.0