first - thanks for all the insights.
the versions are different (Ugh) but that raises a new question "how do i
correct that?"
these versions were defined by the download of PHP and Python (IE i didn't get
the choice)
below is the PHP code and Python code i used, followed by a hex dump of the
beginning of the database file
========================
php code=================
<?php
$yourfile = 'DTrial.sqlite';
$database = new SQLiteDatabase($yourfile, 0666, $error);
if (!$database) {
$error = (file_exists($yourfile)) ? "Impossible to open, check permissions"
: "Impossible to create, check permissions";
die($error);
}
print("<br/> Version: " . sqlite_libversion() . "<br/>");
$query = $database->query("SELECT name FROM sqlite_master WHERE type='table'",
SQLITE_ASSOC, $query_error); #Lists all tables
if ($query_error)
die("Error: $query_error"); #This means that most probably we catch a
syntax error
if (!$query)
die("Impossible to execute query.") ;
// #As reported above, this means that the db owner is different from the
web server's one,
// but we did not commit any syntax mistake.
print ("<br/> Number of rows: " . $query->numRows() . "<br/>") ;
while ($row = $query->fetch())
print($row['name']."\n");
?>
result
Version: 2.8.17
Number of rows: 1
TRIAL <----------------------- valid file name
=========================
python code=============
import sqlite3 as lite
>>> import sys
>>> con = None
>>> con = lite.connect(''DTrial.sqlite')
SyntaxError: invalid syntax
>>> con = lite.connect('DTrial.sqlite')
>>> cur = con.cursor()
>>> cur.execute('SELECT SQLITE_VERSION()')
<sqlite3.Cursor object at 0x1085db260>
>>> data = cur.fetchone()
>>> print "SQLite version: %s" % data
SQLite version: 3.7.12
>>> cur2 = con.cursor()
>>> cur2.execute("select * from sqlite_master ;")
Traceback (most recent call last):
File "<pyshell#11>", line 1, in <module>
cur2.execute("select * from sqlite_master ;")
DatabaseError: file is encrypted or is not a database
>>>
============================================
hex dump
0000: 2A 2A 20 54 68 69 73 20 66 69 6C 65 20 63 6F 6E ** This file con
0010: 74 61 69 6E 73 20 61 6E 20 53 51 4C 69 74 65 20 tains an SQLite
0020: 32 2E 31 20 64 61 74 61 62 61 73 65 20 2A 2A 00 2.1 database **.
0030: 28 75 E3 DA 00 00 00 00 00 00 00 00 25 00 00 00 (u..........%...
0040: 04 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ................
0050: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ................
0060: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ................
0070: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ............….
=============================================
Thanks
Paul Alagna
cell - 732 322 5641
_______________________________________________
sqlite-users mailing list
[email protected]
http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users