Re: PDBPLUS
| From: | Tomas V.V.Cox | Date: | Tue, 05 Feb 2002 08:22:34 +0000 |
| Subject: | Re: PDBPLUS | ||
| References: | 1 2 3 4 | Groups: | php.pear.dev |
| Request: | Send a blank email to pear-dev+get-4405@lists.php.net to get a copy of this message | ||
"Stig S. Bakken" wrote:
>
> On Sat, 2002-02-02 at 20:24, Tomas V.V.Cox wrote:
> > Yavor Shahpasov wrote:
> > >
> > > Here is a list of things I would expect from this
> > >
> > > [...]
> > >
> > > e) Some editor features, like editing a long sql or writing a stored
> > > procedure)
> >
> > If someone knows how to launch a console editor from PHP I'll be glad to
> > hear him.
>
> Run the command in the environment variable $EDITOR (default to "vi") on
> a temporary file?
Hehe, I can imagine that too ;-). My concern was more about how to
launch it. I can't just do a system('joe') because the editor won't take
the control of the term. I guess I would need to exit the program,
launch the editor and relauch pdbplus :-?
> Btw, great idea Tomas :-)
>
Thanks :) I'll come up with some import/export options soon (I'm sick
of always being writing small scripts to import/export data from/to
different sources).
This importer/exporter should be able to do:
- I/E from CSV files (comma separated values)
- I/E from other databases
- I/E from text files with SQL commands (a common db dump)
Also should be able to check the integrity of the data I/E. This will
mean that some kind of schema managment will be needed. For ex, if the
source is a CSV like:
Foo;Bar;Bubar Stree, 27;Some city;Some country
and the target is a database, there could be something like a "I/E file
definition format" describing the destination of the data (I guess that
perhaps is not too difficult to discover the format of the source). For
ex:
<source>CSV file separated with ";"</source>
<target>Database with DSN blah</target>
<field>
<type>ID</type> // type is special to PDBPLUS
</field>
<field>
// put the first field of the source here
<from>field1</from>
// do this checks over the data
<check>TEXT, LENGTH=20, NOT NULL, UNIQUE</check>
// what's the name of the target field
// in case the target is a database
<name>name</name>
</field>
...
Then the I/E will read the CSV file and will build the SQL statements.
In the example above: create an incremental ID, put the first field of
the CSV in the second position named "name" and do the checks over it.
Finally the result will be:
INSERT INTO table (id, name) VALUES ($id, $name);
Basically a data transformation script.
Tomas V.V.Cox