Re: SQL file,
| From: | Brad Bonkoski | Date: | Sat, 21 Sep 2002 13:27:54 +0000 |
| Subject: | Re: SQL file, | ||
| References: | 1 2 3 | Groups: | php.db |
| Request: | Send a blank email to php-db+get-21890@lists.php.net to get a copy of this message | ||
I don't think it quite works that way through PHP. You could send the
_contents_ of the file through PHP, like open the file, and read it into a
buffer, and send that as a query. I actually create the files and then go into
my database system (MySQL -or- PostgreSQL) and then execute a command. I think
for MySQL it is:
mysql> \i <name_of_file>
and then that will step through the file executing the SQL statements.
-Brad
Bryan McLemore wrote:
> So I would send the file through with a sql query?
>
> -Bryan
> ----- Original Message -----
> From: "Brad Bonkoski" <bbonkosk@tampabay.rr.com>
> To: "Bryan McLemore" <paradox@ipstudios.net>
> Cc: "PHP DB LIST" <php-db@lists.php.net>
> Sent: Saturday, September 21, 2002 8:18 AM
> Subject: Re: [PHP-DB] SQL file,
>
> > Typically, it is a text file that has SQL in it.
> > Like:
> > CREATE DATABASE some_name (
> > ID int NOT NULL AUTO_INCREMENT PRIMARY KEY,
> > NAME varchar(30),
> > etc....
> >
> > Usually they are used to store the database information, and can be used
> in many of the database systems. Within the database itself, there is a
> command to insert from a file. Not sure off the top of my head, but the
> help menu should provide that
> > information, then the database would go through your file and execute
> those commands as if you were entering them in manually on the command line.
> Espescially helpful for huge tables where you might be open to a typo, and
> have to start all over.
> > HTH
> > -Brad
> >
> > Bryan McLemore wrote:
> >
> > > in an example I saw in a book while I was leafing through it at barnes
> and nobles I saw a .sql file. It appeared to have the schema for a db in
> it. I was wondering what exactly what it is and how one could use it in a
> php application like he was doing.
> > >
> > > Thanks,
> > > Bryan
> >
> >
> > --
> > PHP Database Mailing List (http://www.php.net/)
> > To unsubscribe, visit: http://www.php.net/unsub.php
> >
>
> --
> PHP Database Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php