Re: [sqlite] Error in FTS documentation?

2012-02-04 Thread Dan Kennedy

On 02/05/2012 09:07 AM, Nils D. wrote:

Maybe this is old, but there is - as far as I understand the
descriptions and the results - an error in the fts documentation.
In section 4.3 http://www.sqlite.org/fts3.html#matchinfo in the example it says:

"-- The format string for this query is "nl". The output array will therefore
-- contain 3 integer values - 1 for "n" and 2 for "l". The query returns
-- two rows (the first two rows in the table match). The values returned are:
--
-- 3  1 1
-- 3  2 0
--
-- The first value in the matchinfo array returned for both rows is 3 (the
-- number of rows in the table). The following two values are the lengths
-- of the longest common subsequence of phrase matches in each column.
SELECT matchinfo(t1, 'nl') FROM t1 WHERE t1 MATCH 'default transaction';"

Isn't that an "s" instead of "l"?


It should be, yes. Thanks.

Dan.
___
sqlite-users mailing list
sqlite-users@sqlite.org
http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users


Re: [sqlite] Accessing temporary tables

2012-02-04 Thread Peter Aronson
Each database has  a SQLITE_TEMP_MASTER table for temp tables and temp 
triggers.  See http://www.sqlite.org/faq.html#q7

Best regards,

Peter





From: Pete 
To: sqlite-users@sqlite.org
Sent: Sat, February 4, 2012 5:26:21 PM
Subject: [sqlite] Accessing temporary tables

I'd like to get some guidance on accessing and using temporary tables, i.e.
those created using the TEMPORARY keyword.

How do I get a list of any temporary tables in a database? They don't
appear in the sqlite_master table.

Once I have a list, can I use some form of PRAGMA table_info to get a list
of the columns in a temp table?

Thanks,

-- 
Pete
___
sqlite-users mailing list
sqlite-users@sqlite.org
http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users
___
sqlite-users mailing list
sqlite-users@sqlite.org
http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users


[sqlite] Error in FTS documentation?

2012-02-04 Thread Nils D.
Maybe this is old, but there is - as far as I understand the
descriptions and the results - an error in the fts documentation.
In section 4.3 http://www.sqlite.org/fts3.html#matchinfo in the example it says:

"-- The format string for this query is "nl". The output array will therefore
-- contain 3 integer values - 1 for "n" and 2 for "l". The query returns
-- two rows (the first two rows in the table match). The values returned are:
--
-- 3  1 1
-- 3  2 0
--
-- The first value in the matchinfo array returned for both rows is 3 (the
-- number of rows in the table). The following two values are the lengths
-- of the longest common subsequence of phrase matches in each column.
SELECT matchinfo(t1, 'nl') FROM t1 WHERE t1 MATCH 'default transaction';"

Isn't that an "s" instead of "l"?

Best regards.
___
sqlite-users mailing list
sqlite-users@sqlite.org
http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users


Re: [sqlite] Accessing temporary tables

2012-02-04 Thread Roger Binns
-BEGIN PGP SIGNED MESSAGE-
Hash: SHA1

On 04/02/12 16:26, Pete wrote:
> How do I get a list of any temporary tables in a database?

There is a separate database named 'temp' that contains temporary tables.
 (The main database is named 'main' and you can omit its name.)

sqlite> pragma database_list;
seq|name|file
0|main|
1|temp|

> Once I have a list, can I use some form of PRAGMA table_info to get a
> list of the columns in a temp table?

sqlite> create temporary table foo(x);
sqlite> pragma temp.table_info(foo);
cid|name|type|notnull|dflt_value|pk
0|x||0||0

Note that non-obviously you put the database name before the pragma name.

Roger
-BEGIN PGP SIGNATURE-
Version: GnuPG v1.4.11 (GNU/Linux)

iEYEARECAAYFAk8t2wwACgkQmOOfHg372QRifwCfTd6IRXXgQNvKzf20Qig+Rh2r
03QAnimZata5WgnUt3QmHFtnTqbKN7vU
=sofJ
-END PGP SIGNATURE-
___
sqlite-users mailing list
sqlite-users@sqlite.org
http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users


[sqlite] Accessing temporary tables

2012-02-04 Thread Pete
I'd like to get some guidance on accessing and using temporary tables, i.e.
those created using the TEMPORARY keyword.

How do I get a list of any temporary tables in a database? They don't
appear in the sqlite_master table.

Once I have a list, can I use some form of PRAGMA table_info to get a list
of the columns in a temp table?

Thanks,

-- 
Pete
___
sqlite-users mailing list
sqlite-users@sqlite.org
http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users


Re: [sqlite] SQLite and EF and Generate DB from Model

2012-02-04 Thread Joe Mistachkin

Based on the attached exception you provided, it looks like you are trying
to
run the "test.exe" application included in the precompiled binary package?

Since that application attempts to create a database in the same directory
as
the application, it would need to be run with administrator privileges (i.e.
in order to be able to write to a directory underneath "Program Files").

--
Joe Mistachkin

___
sqlite-users mailing list
sqlite-users@sqlite.org
http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users


Re: [sqlite] Re; update problem

2012-02-04 Thread inq1ltd

 self.con.commit() 
 wins the prize.

Thanks, 
now if I can just find () on the keyboard

jd




On Saturday, February 04, 2012 03:04:27 PM Black, Michael wrote:
> I think I found your problem.
> 
> 
> 
> Change
> 
> self.con.commit
> 
> To
> 
> self.con.commit()
> 
> 
> 
> In your Fupdate function
> 
> 
> 
> sqlite> .dump
> PRAGMA foreign_keys=OFF;
> BEGIN TRANSACTION;
> CREATE TABLE abc800_111__FIRST
> (pink varchar,
> green varchar,
> rec_Rowname varchar,
> row_1 varchar,
> ent_1 varchar,
> notes varchar,
> rowcount
> );
> INSERT INTO "abc800_111__FIRST" VALUES('abc','800 111 ','FIRST','1) 
>   Add New Name','','','1');
> 
> 
> 
> Michael D. Black
> 
> Senior Scientist
> 
> Advanced Analytics Directorate
> 
> Advanced GEOINT Solutions Operating Unit
> 
> Northrop Grumman Information Systems
> 
>
___
sqlite-users mailing list
sqlite-users@sqlite.org
http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users


Re: [sqlite] Re; update problem

2012-02-04 Thread inq1ltd

Thanks for responding,

Every time this module runs,  it calls 
 the Kupdate  class.

 In the Kupdate class 
 the data in the collumn named "row_1"
 should be updated to contain the value,
 '1) Add New Name'
 
  see >>  self.divAddName = '1)Add New Name'   << in Kupdate

  When finished updating,  Kupdate calls  Kselect,

 Kselect always returns   >>  '1)No Row Name'  <<

 I expect Kselect  to return  >> '1)Add New Name'   << 

Why doesn't Kupdate  update the data in the table ?

I appreciate the help,

jd



On Saturday, February 04, 2012 01:40:50 PM Black, Michael wrote:
> I don't know python for squatso this is what I get with your
> codewhat do you expect?
> 
> 
> 
> ./py
> abc800_111__FIRST ## tablename sql_test 24
> 
> ## locate sql_test 34
> 
> [] ## Rcount sql_test 69
> 
> ['abc', '800 111 ', 'FIRST'] ## vRecordKey sql_test 97
> 
> [(u'1)No Row Name',)] ## divcolinfo sql_test 170
> 
> sqlite> .dump
> PRAGMA foreign_keys=OFF;
> BEGIN TRANSACTION;
> CREATE TABLE abc800_111__FIRST
> (pink varchar,
> green varchar,
> rec_Rowname varchar,
> row_1 varchar,
> ent_1 varchar,
> notes varchar,
> rowcount
> );
> INSERT INTO "abc800_111__FIRST" VALUES('abc','800 111 ','FIRST','1) 
>   No Row Name','','','1'); COMMIT;
> 
> 
> 
> Michael D. Black
> 
> Senior Scientist
> 
> Advanced Analytics Directorate
> 
> Advanced GEOINT Solutions Operating Unit
> 
> Northrop Grumman Information Systems
> 
> 
> From: sqlite-users-boun...@sqlite.org [sqlite-users-boun...@sqlite.org] on
> behalf of inq1ltd [inq1...@inqvista.com] Sent: Friday, February 03, 2012
> 4:32 PM
> To: sqlite-users@sqlite.org
> Subject: EXT :[sqlite] Re; update problem
> 
> #!/usr/bin/env python
> # -*- coding: utf-8 -*-
> 
> import sqlite3
> 
> 
> This email copy may be easier to work with rather than the previous one.
> 
>  If someone has the time I would appreciate it if you
>  could run this module.
> 
>  Everything works except the class Kupdate.
>  For some reason I don't get any complaints from
>  python or sqlite but when selecting from the table I
>  cannot retrieve the last update on line 113,  (  '1)
> Add New Name' ). any suggestions would be
>  helpful.
> 
> jd
> 
> 
> class KmkSql:
> 
> 
> def __init__(self) :
> 
> self.sqldb = 'ZZSQL_TEST.sql'
> KmkSql.sqldb = self.sqldb
> 
> self.tablename = tablename = 'abc800_111__FIRST'
> print tablename,  '## tablename sql_test 24 \n'
> 
> self.vRecordKey = ['abc', '800 111 ', 'FIRST' ]
> 
> self.FmkSql_01()
> 
> 
> 
> def FmkSql_01(self) :
> 
> print   '## locate sql_test 34\n'
> self.con = sqlite3.connect(self.sqldb)
> self.cursor = self.con.cursor()
> 
> 
> self.cursor.execute ("""CREATE TABLE IF NOT EXISTS """ +
> self.tablename + """
> (pink varchar,
> green varchar,
> rec_Rowname varchar,
> row_1 varchar,
> ent_1 varchar,
> notes varchar,
> rowcount
> )"""
> );
> 
> self.con.commit()
> 
> self.FaddDefault()
> 
> 
> def FaddDefault(self) :
> 
> vrowcount = 'rowcount'
> vpink = str(self.vRecordKey[0] )
> vgreen = str(self.vRecordKey[1] )
> rec_Rowname = str(self.vRecordKey[2] )
> 
> self.cursor.execute("""SELECT """ + vrowcount + """ FROM """ +
> self.tablename + """ WHERE pink = (?) AND green = (?) AND rec_Rowname = (?)
> """, [self.vRecordKey[0], self.vRecordKey[1], self.vRecordKey[2] ]);
> self.con.commit()
> 
> Rcount = self.cursor.fetchall()  ## unicode
> self.con.commit()
> 
> print Rcount, '## Rcount sql_test 69  \n'
> 
> if Rcount == [] :
> 
> Kinsert( self.sqldb, self.tablename, self.vRecordKey )
> 
> Kupdate (self.sqldb, self.tablename, self.vRecordKey)
> 
> else :
> self.con.close()
> Kupdate(self.sqldb, self.tablename, self.vRecordKey )
> 
> 
> class Kinsert:
> 
> def __init__(self, sqldb, tablename, vRecordKey ) :
> 
> self.tablename = tablename
> 
> self.vRecordKey = vRecordKey
> print vRecordKey,  '## vRecordKey sql_test 97 \n'
> 
> self.sqldb = sqldb
> 
> self.Finsert()
> 

Re: [sqlite] Re; update problem

2012-02-04 Thread Black, Michael (IS)
I think I found your problem.



Change

self.con.commit

To

self.con.commit()



In your Fupdate function



sqlite> .dump
PRAGMA foreign_keys=OFF;
BEGIN TRANSACTION;
CREATE TABLE abc800_111__FIRST
(pink varchar,
green varchar,
rec_Rowname varchar,
row_1 varchar,
ent_1 varchar,
notes varchar,
rowcount
);
INSERT INTO "abc800_111__FIRST" VALUES('abc','800 111 ','FIRST','1)
Add New Name','','','1');



Michael D. Black

Senior Scientist

Advanced Analytics Directorate

Advanced GEOINT Solutions Operating Unit

Northrop Grumman Information Systems


From: sqlite-users-boun...@sqlite.org [sqlite-users-boun...@sqlite.org] on 
behalf of inq1ltd [inq1...@inqvista.com]
Sent: Friday, February 03, 2012 4:32 PM
To: sqlite-users@sqlite.org
Subject: EXT :[sqlite] Re; update problem

#!/usr/bin/env python
# -*- coding: utf-8 -*-

import sqlite3


This email copy may be easier to work with rather than the previous one.

 If someone has the time I would appreciate it if you
 could run this module.

 Everything works except the class Kupdate.
 For some reason I don't get any complaints from
 python or sqlite but when selecting from the table I
 cannot retrieve the last update on line 113,  (  '1)
Add New Name' ). any suggestions would be
 helpful.

jd


class KmkSql:


def __init__(self) :

self.sqldb = 'ZZSQL_TEST.sql'
KmkSql.sqldb = self.sqldb

self.tablename = tablename = 'abc800_111__FIRST'
print tablename,  '## tablename sql_test 24 \n'

self.vRecordKey = ['abc', '800 111 ', 'FIRST' ]

self.FmkSql_01()



def FmkSql_01(self) :

print   '## locate sql_test 34\n'
self.con = sqlite3.connect(self.sqldb)
self.cursor = self.con.cursor()


self.cursor.execute ("""CREATE TABLE IF NOT EXISTS """ +
self.tablename + """
(pink varchar,
green varchar,
rec_Rowname varchar,
row_1 varchar,
ent_1 varchar,
notes varchar,
rowcount
)"""
);

self.con.commit()

self.FaddDefault()


def FaddDefault(self) :

vrowcount = 'rowcount'
vpink = str(self.vRecordKey[0] )
vgreen = str(self.vRecordKey[1] )
rec_Rowname = str(self.vRecordKey[2] )

self.cursor.execute("""SELECT """ + vrowcount + """ FROM """ +
self.tablename + """ WHERE pink = (?) AND green = (?) AND rec_Rowname = (?)
""", [self.vRecordKey[0], self.vRecordKey[1], self.vRecordKey[2] ]);
self.con.commit()

Rcount = self.cursor.fetchall()  ## unicode
self.con.commit()

print Rcount, '## Rcount sql_test 69  \n'

if Rcount == [] :

Kinsert( self.sqldb, self.tablename, self.vRecordKey )

Kupdate (self.sqldb, self.tablename, self.vRecordKey)

else :
self.con.close()
Kupdate(self.sqldb, self.tablename, self.vRecordKey )


class Kinsert:

def __init__(self, sqldb, tablename, vRecordKey ) :

self.tablename = tablename

self.vRecordKey = vRecordKey
print vRecordKey,  '## vRecordKey sql_test 97 \n'

self.sqldb = sqldb

self.Finsert()


def Finsert(self) :

vpink = str(self.vRecordKey[0] )
vgreen = str(self.vRecordKey[1] )
rec_Rowname = str(self.vRecordKey[2] )

norow =  '1)No Row Name'

self.con = sqlite3.connect(self.sqldb) # open DB
self.cursor = self.con.cursor()

self.cursor.execute ("""INSERT INTO """ + self.tablename + """ VALUES
(?,?,?,?,?,?,?)  """ , [ vpink, vgreen, rec_Rowname,  norow, '', '', '1'  ]  )
;

self.con.commit()
self.con.close()




class Kupdate :

def __init__(self, sqldb, tablename, vRecordKey ) :

self.tablename = tablename

self.colname = 'row_1'
self.divAddName = '1)Add New Name'

self.sqldb = sqldb

self.vRecordKey = vRecordKey

self.Fupdate()


def Fupdate(self) :

vpink = str(self.vRecordKey[0] )
vgreen = str(self.vRecordKey[1] )
rec_Rowname = str(self.vRecordKey[2] )

self.con = sqlite3.connect(self.sqldb) # open DB
self.cursor = self.con.cursor()

self.cursor.execute (""" UPDATE """ + self.tablename + """ 

[sqlite] Segmentation fault on sqlite3_create_module

2012-02-04 Thread larry_brasfield
> > change this code:
> >  typedef struct NiuRoutingStruct {
> >  sqlite3_vtab vtab;
> >  } NiuRouting;
> > to this:
> >  struct NiuRouting : public sqlite3_vtab vtab {
> >   ... // your implementation, eventually
> >  };
> >
> > This way, the casting is unnecessary and any pointer offsetting will be
> > done correctly.
>
> Just for my curiosity:
> Is the above really equivalent to the C definition like:
> typedef struct NiuRoutingStruct {
>sqlite3_vtab vtab;
> ... // your implementation, eventually
> } NiuRouting;
>
> ?
>
> Reason I'm asking: sqlite uses a pointer to that structure to access
> "sqlite3_vtab vtab" member - in machine code that would be
> memory offset 0, all other private members start at
> +sizeof(sqlite3_vtab)+optional alignment.
> Now, I'm wondering if a c++ style of inheritance is defined
> in the same way - Note that sqlite relies on that, or better
> say "the compiler that produced the sqlite machine code relies
> on that".
> Just in case the c++ compiler rearrange the byte offset differently
> it will crash rights away, I think.
>
> Thanks.

Without my copy/paste error, (the 'vtab' should be gone, leaving just the
struct name), it would be equivalent provided that the alignment of a
sqlite3_vtab was no less restrictive than the alignment of
NiuRoutingStruct as it is finally defined.  However, static_casting from
derived to base automatically incorporates the correct offset, (as would
taking the address of an embedded sqlite3_vtab member, instead of using
the OP's reinterpret cast), so the crash you worry about (with good
reason) would  be made less likely.

I think all SQLite relies upon is getting correct pointers to its portion
of whatever object it is passing around.  That virtual table API is
designed to make it agnostic as to any other, tag-along content.

Best regards,
-- 
Larry Brasfield

___
sqlite-users mailing list
sqlite-users@sqlite.org
http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users


[sqlite] SQLite and EF and Generate DB from Model

2012-02-04 Thread Martin Allen



  ** Exception Text **
System.Data.SQLite.SQLiteException (0x80004005): Unable to open the database 
file
   at System.Data.SQLite.SQLite3.Open(String strFilename, SQLiteOpenFlagsEnum 
flags, Int32 maxPoolSize, Boolean usePool) in 
c:\dev\sqlite\dotnet\System.Data.SQLite\SQLite3.cs:line 239
   at System.Data.SQLite.SQLiteConnection.Open() in 
c:\dev\sqlite\dotnet\System.Data.SQLite\SQLiteConnection.cs:line 1022
   at test.TestCaseBase..ctor(DbProviderFactory factory, String 
connectionString) in c:\dev\sqlite\dotnet\test\TestCases.cs:line 2231
   at test.TestCases..ctor(DbProviderFactory factory, String connectionString) 
in c:\dev\sqlite\dotnet\test\TestCases.cs:line 32
   at test.TestCasesDialog.runButton_Click(Object sender, EventArgs e) in 
c:\dev\sqlite\dotnet\test\TestCasesDialog.cs:line 113
   at System.Windows.Forms.Control.OnClick(EventArgs e)
   at System.Windows.Forms.Button.OnClick(EventArgs e)
   at System.Windows.Forms.Button.OnMouseUp(MouseEventArgs mevent)
   at System.Windows.Forms.Control.WmMouseUp(Message& m, MouseButtons button, 
Int32 clicks)
   at System.Windows.Forms.Control.WndProc(Message& m)
   at System.Windows.Forms.ButtonBase.WndProc(Message& m)
   at System.Windows.Forms.Button.WndProc(Message& m)
   at System.Windows.Forms.Control.ControlNativeWindow.OnMessage(Message& m)
   at System.Windows.Forms.Control.ControlNativeWindow.WndProc(Message& m)
   at System.Windows.Forms.NativeWindow.Callback(IntPtr hWnd, Int32 msg, IntPtr 
wparam, IntPtr lparam)


** Loaded Assemblies **
mscorlib
Assembly Version: 4.0.0.0
Win32 Version: 4.0.30319.17020 built by: FXM3REL
CodeBase: file:///C:/Windows/Microsoft.NET/Framework/v4.0.30319/mscorlib.dll

test
Assembly Version: 1.0.79.0
Win32 Version: 1.0.79.0
CodeBase: file:///C:/Program%20Files/System.Data.SQLite/2010/bin/test.exe

System.Windows.Forms
Assembly Version: 4.0.0.0
Win32 Version: 4.0.30319.17020 built by: FXM3REL
CodeBase: 
file:///C:/Windows/Microsoft.Net/assembly/GAC_MSIL/System.Windows.Forms/v4.0_4.0.0.0__b77a5c561934e089/System.Windows.Forms.dll

System.Drawing
Assembly Version: 4.0.0.0
Win32 Version: 4.0.30319.17020 built by: FXM3REL
CodeBase: 
file:///C:/Windows/Microsoft.Net/assembly/GAC_MSIL/System.Drawing/v4.0_4.0.0.0__b03f5f7f11d50a3a/System.Drawing.dll

System
Assembly Version: 4.0.0.0
Win32 Version: 4.0.30319.17020 built by: FXM3REL
CodeBase: 
file:///C:/Windows/Microsoft.Net/assembly/GAC_MSIL/System/v4.0_4.0.0.0__b77a5c561934e089/System.dll

System.Data
Assembly Version: 4.0.0.0
Win32 Version: 4.0.30319.17020 built by: FXM3REL
CodeBase: 
file:///C:/Windows/Microsoft.Net/assembly/GAC_32/System.Data/v4.0_4.0.0.0__b77a5c561934e089/System.Data.dll

System.Core
Assembly Version: 4.0.0.0
Win32 Version: 4.0.30319.17020 built by: FXM3REL
CodeBase: 
file:///C:/Windows/Microsoft.Net/assembly/GAC_MSIL/System.Core/v4.0_4.0.0.0__b77a5c561934e089/System.Core.dll

System.Xml
Assembly Version: 4.0.0.0
Win32 Version: 4.0.30319.17020 built by: FXM3REL
CodeBase: 
file:///C:/Windows/Microsoft.Net/assembly/GAC_MSIL/System.Xml/v4.0_4.0.0.0__b77a5c561934e089/System.Xml.dll

System.Configuration
Assembly Version: 4.0.0.0
Win32 Version: 4.0.30319.17020 built by: FXM3REL
CodeBase: 
file:///C:/Windows/Microsoft.Net/assembly/GAC_MSIL/System.Configuration/v4.0_4.0.0.0__b03f5f7f11d50a3a/System.Configuration.dll

System.Numerics
Assembly Version: 4.0.0.0
Win32 Version: 4.0.30319.17020 built by: FXM3REL
CodeBase: 
file:///C:/Windows/Microsoft.Net/assembly/GAC_MSIL/System.Numerics/v4.0_4.0.0.0__b77a5c561934e089/System.Numerics.dll

System.Data.OracleClient
Assembly Version: 4.0.0.0
Win32 Version: 4.0.30319.17020 built by: FXM3REL
CodeBase: 
file:///C:/Windows/Microsoft.Net/assembly/GAC_32/System.Data.OracleClient/v4.0_4.0.0.0__b77a5c561934e089/System.Data.OracleClient.dll

System.Data.SQLite
Assembly Version: 1.0.79.0
Win32 Version: 1.0.79.0
CodeBase: 
file:///C:/Program%20Files/System.Data.SQLite/2010/bin/System.Data.SQLite.DLL

System.Data.Entity
Assembly Version: 4.0.0.0
Win32 Version: 4.0.30319.17020 built by: FXM3REL
CodeBase: 
file:///C:/Windows/Microsoft.Net/assembly/GAC_MSIL/System.Data.Entity/v4.0_4.0.0.0__b77a5c561934e089/System.Data.Entity.dll

System.Transactions
Assembly Version: 

Re: [sqlite] Re; update problem

2012-02-04 Thread Black, Michael (IS)
I don't know python for squatso this is what I get with your codewhat 
do you expect?



./py
abc800_111__FIRST ## tablename sql_test 24

## locate sql_test 34

[] ## Rcount sql_test 69

['abc', '800 111 ', 'FIRST'] ## vRecordKey sql_test 97

[(u'1)No Row Name',)] ## divcolinfo sql_test 170

sqlite> .dump
PRAGMA foreign_keys=OFF;
BEGIN TRANSACTION;
CREATE TABLE abc800_111__FIRST
(pink varchar,
green varchar,
rec_Rowname varchar,
row_1 varchar,
ent_1 varchar,
notes varchar,
rowcount
);
INSERT INTO "abc800_111__FIRST" VALUES('abc','800 111 ','FIRST','1)
No Row Name','','','1');
COMMIT;



Michael D. Black

Senior Scientist

Advanced Analytics Directorate

Advanced GEOINT Solutions Operating Unit

Northrop Grumman Information Systems


From: sqlite-users-boun...@sqlite.org [sqlite-users-boun...@sqlite.org] on 
behalf of inq1ltd [inq1...@inqvista.com]
Sent: Friday, February 03, 2012 4:32 PM
To: sqlite-users@sqlite.org
Subject: EXT :[sqlite] Re; update problem

#!/usr/bin/env python
# -*- coding: utf-8 -*-

import sqlite3


This email copy may be easier to work with rather than the previous one.

 If someone has the time I would appreciate it if you
 could run this module.

 Everything works except the class Kupdate.
 For some reason I don't get any complaints from
 python or sqlite but when selecting from the table I
 cannot retrieve the last update on line 113,  (  '1)
Add New Name' ). any suggestions would be
 helpful.

jd


class KmkSql:


def __init__(self) :

self.sqldb = 'ZZSQL_TEST.sql'
KmkSql.sqldb = self.sqldb

self.tablename = tablename = 'abc800_111__FIRST'
print tablename,  '## tablename sql_test 24 \n'

self.vRecordKey = ['abc', '800 111 ', 'FIRST' ]

self.FmkSql_01()



def FmkSql_01(self) :

print   '## locate sql_test 34\n'
self.con = sqlite3.connect(self.sqldb)
self.cursor = self.con.cursor()


self.cursor.execute ("""CREATE TABLE IF NOT EXISTS """ +
self.tablename + """
(pink varchar,
green varchar,
rec_Rowname varchar,
row_1 varchar,
ent_1 varchar,
notes varchar,
rowcount
)"""
);

self.con.commit()

self.FaddDefault()


def FaddDefault(self) :

vrowcount = 'rowcount'
vpink = str(self.vRecordKey[0] )
vgreen = str(self.vRecordKey[1] )
rec_Rowname = str(self.vRecordKey[2] )

self.cursor.execute("""SELECT """ + vrowcount + """ FROM """ +
self.tablename + """ WHERE pink = (?) AND green = (?) AND rec_Rowname = (?)
""", [self.vRecordKey[0], self.vRecordKey[1], self.vRecordKey[2] ]);
self.con.commit()

Rcount = self.cursor.fetchall()  ## unicode
self.con.commit()

print Rcount, '## Rcount sql_test 69  \n'

if Rcount == [] :

Kinsert( self.sqldb, self.tablename, self.vRecordKey )

Kupdate (self.sqldb, self.tablename, self.vRecordKey)

else :
self.con.close()
Kupdate(self.sqldb, self.tablename, self.vRecordKey )


class Kinsert:

def __init__(self, sqldb, tablename, vRecordKey ) :

self.tablename = tablename

self.vRecordKey = vRecordKey
print vRecordKey,  '## vRecordKey sql_test 97 \n'

self.sqldb = sqldb

self.Finsert()


def Finsert(self) :

vpink = str(self.vRecordKey[0] )
vgreen = str(self.vRecordKey[1] )
rec_Rowname = str(self.vRecordKey[2] )

norow =  '1)No Row Name'

self.con = sqlite3.connect(self.sqldb) # open DB
self.cursor = self.con.cursor()

self.cursor.execute ("""INSERT INTO """ + self.tablename + """ VALUES
(?,?,?,?,?,?,?)  """ , [ vpink, vgreen, rec_Rowname,  norow, '', '', '1'  ]  )
;

self.con.commit()
self.con.close()




class Kupdate :

def __init__(self, sqldb, tablename, vRecordKey ) :

self.tablename = tablename

self.colname = 'row_1'
self.divAddName = '1)Add New Name'

self.sqldb = sqldb

self.vRecordKey = vRecordKey

self.Fupdate()


def Fupdate(self) :

vpink = str(self.vRecordKey[0] )
vgreen = str(self.vRecordKey[1] )
 

[sqlite] About new ticket "Per page/region checksums"

2012-02-04 Thread Alexey Pechnikov
It's very important but there are some questions about
http://www.sqlite.org/src/info/72b01a982a
Some times ago DRH wrote that checksum calculation don't slow down
SQLite significantly.
But can be this realized in current SQLite 3.x branch? When checksum
can help to restore
damaged pages/database? Does powersave overwrite feature conflicts
with idea of per pages
checksums?

P.S. The article "Berkeley DB Recoverability" provides some info about
WAL+checksum mode:
http://help.bdbxml.net/html/ed539869-eebd-478f-97de-7e5377e87f66.htm

-- 
Best regards, Alexey Pechnikov.
http://pechnikov.tel/
___
sqlite-users mailing list
sqlite-users@sqlite.org
http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users