majkel89 / dbase Goto Github PK
View Code? Open in Web Editor NEWLibrary for processing dbase / xbase / dbf database files
License: MIT License
Library for processing dbase / xbase / dbf database files
License: MIT License
Hello,
thank's for these awesome package!
Is it possible to specify the charset for the file? My file is ISO-8859-1.
At the moment I have to use
utf8_encode($record['xxx']);
Thanks an best regards!
A lot of the examples don't seem to work.
Eg: several examples perform inserts/updates but don't specify Table::MODE_READWRITE when the file is opened, which causes them to fail silently. Also $dbf->update() takes two parameters but there's only one in the example.
When trying to read a FoxPro DBF file, I got: "Format dBASE III PLUS
does not support field T
"
This is not an issue, it just doesn't support it and I thought you might explicitely say so in documentation to avoid confusion.
I have read #11 and #12 where said that issue is resolved so may be it's problem with my file.
I only see integers but builtin php dBase extension can process floats here.
Please take a look https://drive.google.com/open?id=1lAL7t9XsbQ35HB9gCeo7vlGr9NClgHR2
SUM column must be float
Hi
require_once 'vendor/autoload.php'
use org.majkel\dbase\src\Table;
$dbf = Table::fromFile('EMPLOYEE.DBF');
( ! ) Parse error: syntax error, unexpected 'use' (T_USE) in C:\wamp64\www\yii2-basic\testdbf.php on line 4
How to fix the parsing error from Eclipse PDT
I'm using this library to generate dbf files with floating point values but they are truncated at integer.
Is there a way to write decimals?
The project doesn't support Float fields yet.
I tried opening a dbase file that had a Float column.
Here is the error:
Fatal error: Uncaught org\majkel\dbase\Exception: Format dBASE III PLUS
does not support field F
I can try adding it myself and see if I can get it working.
If I get it working I will make a pull request for it if that is ok.
What other fields should be supported?
Others I see on https://www.dbase.com/Knowledgebase/INT/db7_file_fmt.htm
Long, Double, Binary
I am not sure which one of these I will need for my project.
PR: #23
I might be doing something wrong, but...
$dbf->addField(
Field::create(Field::TYPE_NUMERIC)->setName('Decimals')->setLength(8)->setDecimalCount(2) );
It creates correct header with 2 decimals, but...
$record = new Record();
$record->Decimals = 11.23;
It always adds like 11, because NumericField.php says DecimalCount=0
※ErrorMessage: Format dBASE III PLUS
does not support field ``
※ErrorFile: vendor\org.majkel\dbase\src\Format.php
※ErrorLine: 486
※ErrorTrace:
--#1 org\majkel\dbase\Format->createField() On line 459 In file "vendor\org.majkel\dbase\src\Format.php"
---- With the args in json format: [{"n":"","t":"\u0000","rr1":0,"ll":0,"dd":0,"rr2":0,"wa":0,"rr3":0,"sff":0,"rr4":0}]
--#2 org\majkel\dbase\Format->readHeader() On line 66 In file "vendor\org.majkel\dbase\src\Format.php"
---- With the args in json format: []
--#3 org\majkel\dbase\Format->getHeader() On line 75 In file "vendor\org.majkel\dbase\src\Format.php"
---- With the args in json format: []
--#4 org\majkel\dbase\Format->isValid() On line 99 In file "vendor\org.majkel\dbase\src\FormatFactory.php"
---- With the args in json format: []
--#5 call_user_func() On line 43 In file "vendor\org.majkel\dbase\src\FormatFactory.php"
---- With the args in json format: [{},"all1.dbf","rb"]
--#6 org\majkel\dbase\FormatFactory->getFormat() On line 61 In file "vendor\org.majkel\dbase\src\Table.php"
---- With the args in json format: ["auto","all1.dbf","rb"]
--#7 org\majkel\dbase\Table::fromFile() On line 10 In file "maincnt\zhaosheng\luqu-import.php"
---- With the args in json format: ["all1.dbf"]
When writing to a field defined as a numeric field, the data is not aligned to the right. Can I be solved to get the database aligned right?
Was trunc-ing all numbers.
I changed (int) to (float) on lines 31 and 38 /field/NumericField.php.
After exporting data I see that-
1. Column names are truncated if their lengths are more than 11 in case of TYPE_CHARACTER
2. Some columns along with their data are truncated
Could anyone please help me out to solve these issues?
I can connect to the dbf when it's in the same directory, but I get an error when the file is in another network unit. The error I get is:
"Unable to detect format of \xampserver\C\xampp\dbf\Diary.dbf
"
My url is "\xampserver\C\xampp\dbf\Diary.dbf", but in the error I only see one "" in the begining
I made a method for renaming a field.
I will add a pull request for it.
It will make it possible to do this:
$builder = Builder::fromFile('file.dbf')->renameField("name", "newname")->build('file2.dbf');
Instead of this:
$builder = Builder::fromFile('file.dbf');
$builder->getField("name")->setName("newname");
$builder->build('file2.dbf');
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.