Help | Site Map
Connecting Tech Pros Worldwide
 
 
LinkBack Thread Tools
  #1  
Old July 4th, 2008, 04:35 AM
Chuck Anderson
Guest
 
Posts: n/a
Default Opening Firefox 3 sqlite files

Firefox 3 uses sqlite files for bookmarks, browse history, form
history, cookies, ......

When I execute :
$sqlite_db_file = 'cookies.sqlite';
$db = sqlite_open($sqlite_db_file, 0666, $sqlite_error);

I get the following error:
Error: file is encrypted or is not a database.

(using Php5.2.5 on Windows XP)

Has anyone had any luck opening the Firefox sqlite files with the Php
sqlite library functions?

--
*****************************
Chuck Anderson • Boulder, CO
http://www.CycleTourist.com
Nothing he's got he really needs
Twenty first century schizoid man.
***********************************

  #2  
Old July 5th, 2008, 09:05 PM
Chuck Anderson
Guest
 
Posts: n/a
Default PDO sqlite and table column names

I figured out how to get at my firefox sqlite files. I need to use the
PDO functions as they are in sqlite 3 format.

Anyway .... what I want to do now is the equivalent of SHOW COLUMNS (in
MySQL), so that I can open any table and see it's structure. I have yet
to find a way. Does anyone know how to use PDO SQLite to display a
tables columns?

--
*****************************
Chuck Anderson • Boulder, CO
http://www.CycleTourist.com
Nothing he's got he really needs
Twenty first century schizoid man.
***********************************

  #3  
Old July 9th, 2008, 10:45 AM
David Gillen
Guest
 
Posts: n/a
Default Re: PDO sqlite and table column names

On Sat, 5 Jul 2008 Chuck Anderson <websiteaddress@seemy.sigwrote:
Quote:
I figured out how to get at my firefox sqlite files. I need to use the
PDO functions as they are in sqlite 3 format.
>
Anyway .... what I want to do now is the equivalent of SHOW COLUMNS (in
MySQL), so that I can open any table and see it's structure. I have yet
to find a way. Does anyone know how to use PDO SQLite to display a
tables columns?
>
Google "firefox extension sqlite manager" if you just want to take a look at
the contents.

D.
--
God kicks with both feet and keeps his shoes clean.
  #4  
Old July 9th, 2008, 11:25 AM
Tim Streater
Guest
 
Posts: n/a
Default Re: PDO sqlite and table column names

In article <qu2dnXh3ydsQTvLVnZ2dnUVZ_rjinZ2d@comcast.com>,
Chuck Anderson <websiteaddress@seemy.sigwrote:
Quote:
I figured out how to get at my firefox sqlite files. I need to use the
PDO functions as they are in sqlite 3 format.
>
Anyway .... what I want to do now is the equivalent of SHOW COLUMNS (in
MySQL), so that I can open any table and see it's structure. I have yet
to find a way. Does anyone know how to use PDO SQLite to display a
tables columns?
Try this code:

<?

echo "\nDatabase dumper V001\n\n";

echo "Enter database name: ";
$database = trim (fgets (STDIN), "\n ");
echo "\n";

if (file_exists($database)==false)
{
echo "Error - database does not exist\n\n";
echo "Abnormal termination\n\n";
exit ();
}

echo "Enter table name: ";
$table = trim (fgets (STDIN), "\n ");
echo "\n";

$dbh = new PDO ("sqlite:" . $database);

$resq = $dbh->query ("PRAGMA table_info(" . $table . ")");
$cols = $resq->fetchAll (PDO::FETCH_BOTH);
$num = count ($cols);
echo "Number of columns = " . $num . "\n\n";
for ($i=0; $i<$num; $i++)
{
$numfld = count ($cols[$i]);
for ($j=0; $j<$numfld; $j++)
{
echo $cols[$i][$j] . " ";
}
echo "\n";
}

?>
  #5  
Old July 10th, 2008, 12:25 AM
Chuck Anderson
Guest
 
Posts: n/a
Default Re: PDO sqlite and table column names

Tim Streater wrote:
Quote:
In article <qu2dnXh3ydsQTvLVnZ2dnUVZ_rjinZ2d@comcast.com>,
Chuck Anderson <websiteaddress@seemy.sigwrote:
>
>
Quote:
>I figured out how to get at my firefox sqlite files. I need to use the
>PDO functions as they are in sqlite 3 format.
>>
>Anyway .... what I want to do now is the equivalent of SHOW COLUMNS (in
>MySQL), so that I can open any table and see it's structure. I have yet
>to find a way. Does anyone know how to use PDO SQLite to display a
>tables columns?
>>
>
Try this code:
>
<?
>
echo "\nDatabase dumper V001\n\n";
>
echo "Enter database name: ";
$database = trim (fgets (STDIN), "\n ");
echo "\n";
>
if (file_exists($database)==false)
{
echo "Error - database does not exist\n\n";
echo "Abnormal termination\n\n";
exit ();
}
>
echo "Enter table name: ";
$table = trim (fgets (STDIN), "\n ");
echo "\n";
>
$dbh = new PDO ("sqlite:" . $database);
>
$resq = $dbh->query ("PRAGMA table_info(" . $table . ")");
$cols = $resq->fetchAll (PDO::FETCH_BOTH);
$num = count ($cols);
echo "Number of columns = " . $num . "\n\n";
for ($i=0; $i<$num; $i++)
{
$numfld = count ($cols[$i]);
for ($j=0; $j<$numfld; $j++)
{
echo $cols[$i][$j] . " ";
}
echo "\n";
}
>
?>
>
Excellent. Thank you!

And now knowing what search for, I'm reading the sqlite PRAGMA
statements reference:
http://www.sqlite.org/pragma.html

Thanks!

(Getting past this hurdle was important for me. Now I can open and view
any (most?) sqlite database files.)

--
*****************************
Chuck Anderson • Boulder, CO
http://www.CycleTourist.com
Nothing he's got he really needs
Twenty first century schizoid man.
***********************************

  #6  
Old July 10th, 2008, 12:25 AM
Chuck Anderson
Guest
 
Posts: n/a
Default Re: PDO sqlite and table column names

David Gillen wrote:
Quote:
On Sat, 5 Jul 2008 Chuck Anderson <websiteaddress@seemy.sigwrote:
>
Quote:
>I figured out how to get at my firefox sqlite files. I need to use the
>PDO functions as they are in sqlite 3 format.
>>
>Anyway .... what I want to do now is the equivalent of SHOW COLUMNS (in
>MySQL), so that I can open any table and see it's structure. I have yet
>to find a way. Does anyone know how to use PDO SQLite to display a
>tables columns?
>>
>>
Google "firefox extension sqlite manager" if you just want to take a look at
the contents.
>
D.
>
Yep. I've already got that. I wanted to be able to write my own sqlite
handling routines, though, too.

But, thanks.

--
*****************************
Chuck Anderson • Boulder, CO
http://www.CycleTourist.com
Nothing he's got he really needs
Twenty first century schizoid man.
***********************************

  #7  
Old July 10th, 2008, 10:45 AM
Tim Streater
Guest
 
Posts: n/a
Default Re: PDO sqlite and table column names

In article <5fGdnYwYLPVJ2ujVnZ2dnUVZ_t_inZ2d@comcast.com>,
Chuck Anderson <websiteaddress@seemy.sigwrote:
Quote:
Tim Streater wrote:
Quote:
In article <qu2dnXh3ydsQTvLVnZ2dnUVZ_rjinZ2d@comcast.com>,
Chuck Anderson <websiteaddress@seemy.sigwrote:

Quote:
I figured out how to get at my firefox sqlite files. I need to use the
PDO functions as they are in sqlite 3 format.
>
Anyway .... what I want to do now is the equivalent of SHOW COLUMNS (in
MySQL), so that I can open any table and see it's structure. I have yet
to find a way. Does anyone know how to use PDO SQLite to display a
tables columns?
>
Try this code:
[snip]
Quote:
Excellent. Thank you!
>
And now knowing what search for, I'm reading the sqlite PRAGMA
statements reference:
http://www.sqlite.org/pragma.html
>
Thanks!
>
(Getting past this hurdle was important for me. Now I can open and view
any (most?) sqlite database files.)
You're welcome. I only found out about pragma myself the other day from
another post. Well - I'd seen it on the sqlite site but somehow it
hadn't struck me that that was what I needed.
  #8  
Old July 11th, 2008, 01:25 AM
AnrDaemon
Guest
 
Posts: n/a
Default Re: PDO sqlite and table column names

Greetings, Tim Streater.
In reply to Your message dated Wednesday, July 9, 2008, 14:24:09,
Quote:
Quote:
>I figured out how to get at my firefox sqlite files. I need to use the
>PDO functions as they are in sqlite 3 format.
>>
>Anyway .... what I want to do now is the equivalent of SHOW COLUMNS (in
>MySQL), so that I can open any table and see it's structure. I have yet
>to find a way. Does anyone know how to use PDO SQLite to display a
>tables columns?
Quote:
Try this code:
Quote:
<?
Please DON'T use short open tags in examples. Even if you are using them in
your code (I dunno - why?), don't do that when you are providing examples.


--
Sincerely Yours, AnrDaemon <anrdaemon@freemail.ru>

  #9  
Old July 11th, 2008, 10:45 AM
Tim Streater
Guest
 
Posts: n/a
Default Re: PDO sqlite and table column names

In article <1461817766.20080711041901@freemail.ru>,
AnrDaemon <anrdaemon@freemail.ruwrote:
Quote:
Greetings, Tim Streater.
In reply to Your message dated Wednesday, July 9, 2008, 14:24:09,
>
Quote:
Quote:
I figured out how to get at my firefox sqlite files. I need to use the
PDO functions as they are in sqlite 3 format.
>
Anyway .... what I want to do now is the equivalent of SHOW COLUMNS (in
MySQL), so that I can open any table and see it's structure. I have yet
to find a way. Does anyone know how to use PDO SQLite to display a
tables columns?
>
Quote:
Try this code:
>
Quote:
<?
>
Please DON'T use short open tags in examples. Even if you are using them in
your code (I dunno - why?), don't do that when you are providing examples.
Why not?
  #10  
Old July 21st, 2008, 02:35 AM
Peter H. Coffin
Guest
 
Posts: n/a
Default Re: PDO sqlite and table column names

On Fri, 11 Jul 2008 10:41:15 +0100, Tim Streater wrote:
Quote:
In article <1461817766.20080711041901@freemail.ru>,
AnrDaemon <anrdaemon@freemail.ruwrote:
>
Quote:
>Greetings, Tim Streater.
>In reply to Your message dated Wednesday, July 9, 2008, 14:24:09,
>>
Quote:
>I figured out how to get at my firefox sqlite files. I need to use the
>PDO functions as they are in sqlite 3 format.
>>
>Anyway .... what I want to do now is the equivalent of SHOW COLUMNS (in
>MySQL), so that I can open any table and see it's structure. I have yet
>to find a way. Does anyone know how to use PDO SQLite to display a
>tables columns?
>>
Quote:
Try this code:
>>
Quote:
<?
>>
>Please DON'T use short open tags in examples. Even if you are using them in
>your code (I dunno - why?), don't do that when you are providing examples.
>
Why not?
They mix poorly with XML documents, which start '<?XML'. The PHP
processor doens't have a "Use short tags that aren't XML tags" setting.

--
It is impossible to sharpen a pencil with a blunt axe. It is equally vain
to try to do it with ten blunt axes instead -- E.W Dijkstra, 1930-2002
  #11  
Old July 21st, 2008, 10:25 AM
Tim Streater
Guest
 
Posts: n/a
Default Re: PDO sqlite and table column names

In article <slrng87oq5.uuk.hellsop@abyss.ninehells.com>,
"Peter H. Coffin" <hellsop@ninehells.comwrote:
Quote:
On Fri, 11 Jul 2008 10:41:15 +0100, Tim Streater wrote:
Quote:
In article <1461817766.20080711041901@freemail.ru>,
AnrDaemon <anrdaemon@freemail.ruwrote:
Quote:
Greetings, Tim Streater.
In reply to Your message dated Wednesday, July 9, 2008, 14:24:09,
>
I figured out how to get at my firefox sqlite files. I need to use the
PDO functions as they are in sqlite 3 format.
>
Anyway .... what I want to do now is the equivalent of SHOW COLUMNS (in
MySQL), so that I can open any table and see it's structure. I have
yet
to find a way. Does anyone know how to use PDO SQLite to display a
tables columns?
>
Try this code:
>
<?
>
Please DON'T use short open tags in examples. Even if you are using them
in
your code (I dunno - why?), don't do that when you are providing examples.
Why not?
>
They mix poorly with XML documents, which start '<?XML'. The PHP
processor doens't have a "Use short tags that aren't XML tags" setting.
Ah! A sensible reason. Thanks.
 

Bookmarks


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are Off
[IMG] code is Off
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On

What is Bytes?

We are a network of experts and professionals in IT and software development that help one another with answers to tough questions and share insights. Get the best answers to your questions from over network members.
Post your question now . . .
It's fast and it's free

Popular Articles