Column.class.php
2.56 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
<?php
/**
* ----------------------------------------------------------------
* XBase
* XBaseColumn.class.php
*
* Developer : Erwin Kooi
* released at : Nov 2005
* last modified by : Erwin Kooi
* date modified : Jan 2006
*
* You're free to use this code as long as you don't alter it
* Copyright (c) 2005 Cyane Dynamic Web Solutions
* Info? Mail to info@cyane.nl
*
* --------------------------------------------------------------
*
* This class represents a DBF column
* Do not construct an instance yourself, it's useless that way.
*
**/
class XBaseColumn {
var $name;
var $rawname;
var $type;
var $memAddress;
var $length;
var $decimalCount;
var $workAreaID;
var $setFields;
var $indexed;
var $bytePos;
var $colIndex;
function XBaseColumn(
$name,
$type,
$memAddress,
$length,
$decimalCount,
$reserved1,
$workAreaID,
$reserved2,
$setFields,
$reserved3,
$indexed,
$colIndex,
$bytePos
) {
$this->rawname=$name;
$this->name=strpos($name,0x00)!==false?substr($name,0,strpos($name,0x00)):$name;
$this->type=$type;
$this->memAddress=$memAddress;
$this->length=$length;
$this->decimalCount=$decimalCount;
$this->workAreaID=$workAreaID;
$this->setFields=$setFields;
$this->indexed=$indexed;
$this->bytePos=$bytePos;
$this->colIndex=$colIndex;
}
function getDecimalCount() {
return $this->decimalCount;
}
function isIndexed() {
return $this->indexed;
}
function getLength() {
return $this->length;
}
function getDataLength() {
switch ($this->type) {
case DBFFIELD_TYPE_DATE : return 8;
case DBFFIELD_TYPE_DATETIME : return 8;
case DBFFIELD_TYPE_LOGICAL : return 1;
case DBFFIELD_TYPE_MEMO : return 10;
default : return $this->length;
}
}
function getMemAddress() {
return $this->memAddress;
}
function getName() {
return $this->name;
}
function isSetFields() {
return $this->setFields;
}
function getType() {
return $this->type;
}
function getWorkAreaID() {
return $this->workAreaID;
}
function toString() {
return $this->name;
}
function getBytePos() {
return $this->bytePos;
}
function getRawname() {
return $this->rawname;
}
function getColIndex() {
return $this->colIndex;
}
}
?>