|
|
scott wrote:
> I just need to revise some SQL now and first of all work out how to
> create databases and tables from my code.
You do it with SQL. Probably something along the lines of
CREATE DATABASE mystuff;
CREATE TABLE mytable (
somenumber INTEGER NOT NULL,
comestring VARCHAR(50) DEFAULT '',
primary key somenumber
);
Look up those keywords.
You'll also need to figure out how to connect in the first place. Grep the
manual for "connection string", which is usually how it's described. It
tells basically the address of the server (IP & port, usually) plus user
plus password.
Warp wrote:
> If you need to output the data in some special format, after it has been
> processed, I really don't know what tools, if any, SQL offers for this.
SQL doesn't offer too many tools as such, i.e., not in a portable way.
Particular engines might give you the option of generating XML or CSV or
some such. If you can generate XML, you could run it thru an XSLT script and
output pretty much whatever format you need without writing anything but
shell scripts, if you bashed it hard enough with a baseball bat (or with
bash). If your language has the equivalent of system() and you don't mind
being kludgey, you could put the queries on the command line and output to a
CSV and parse that up.
You could also use metakit (from equi4.com) if you want a nice embeddable
database that isn't SQL (it's not even normalized). Just a plug for a great
product. It's the sort of thing a lot of small wiki servers use for their
database back end. A good replacement for Access. Lots of interfaces from
lots of languages. Not bad if you don't need a lot of relational joins and
such.
You can also use "SQL Server Everywhere", which is Microsoft's SQL server in
a form that you link it into your program. There's another one called "star
db" or "db star" or "SQL*" or something, that's from Sun I think, that isn't
windows-specific. This will save you the hassle of installing SQL servers
everywhere you want this stuff to run, if that's a problem for you. One less
thing to go wrong.
Don't confuse "embedded SQL server" with "embedded SQL". The first is a SQL
server that runs in the same process and address space as the client. The
second is a way of writing SQL statements directly in the source file of
your program and having a preprocessor turn it into function calls to the
client library.
PHP is OK for doing database stuff, but it's kludgey, so if you expect the
system to grow, or other people to work on it, it's probably something to
stay away from unless you need it for some other reason anyway. It's a way
to quickly hack together web front ends, and its use as a desktop tool is poor.
--
Darren New, San Diego CA, USA (PST)
"Ouch ouch ouch!"
"What's wrong? Noodles too hot?"
"No, I have Chopstick Tunnel Syndrome."
Post a reply to this message
|
|