Re: [sqlite] Can't seem to create DB with unvacuumed data [ for testing ]

2013-10-11 Thread Paul L Daniels
On Fri, 11 Oct 2013 23:15:24 -0500
Drake Wilson  wrote:

> Quoth Paul L Daniels , on 2013-10-12
> 13:57:00 +1000:
> > I've tried the pragma autovacuum=0  and journalling set to none to
> > no avail.  Every time I exit from the command line SQlite3 tool I
> > find that the data I explicitly deleted has genuinely been removed.
> >
> > Any suggestions?
> 
> PRAGMA secure_delete=0 ?

That did it nicely, many thanks for that.




-- 
Computer Repairs for Charters towers - http://ctpc.biz
A.B.N. 19 500 721 806
___
sqlite-users mailing list
sqlite-users@sqlite.org
http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users


Re: [sqlite] Can't seem to create DB with unvacuumed data [ for testing ]

2013-10-11 Thread Drake Wilson
Quoth Paul L Daniels , on 2013-10-12 13:57:00 +1000:
> I've tried the pragma autovacuum=0  and journalling set to none to no
> avail.  Every time I exit from the command line SQlite3 tool I find
> that the data I explicitly deleted has genuinely been removed.
>
> Any suggestions?

PRAGMA secure_delete=0 ?

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


[sqlite] Can't seem to create DB with unvacuumed data [ for testing ]

2013-10-11 Thread Paul L Daniels
I'm trying to create a sqlite3 db with unvacuumed data in it so I can
verify the functionality of my SQLite deleted data recovery tool
"Undark", but would you believe, other than the iPhone databases that
I've pulled from my phones I cannot seem to create a DB that has
persistent deleted rows in it.

I've tried the pragma autovacuum=0  and journalling set to none to no
avail.  Every time I exit from the command line SQlite3 tool I find
that the data I explicitly deleted has genuinely been removed.

Any suggestions?

Paul.

-- 
Computer Repairs for Charters towers - http://ctpc.biz
A.B.N. 19 500 721 806
___
sqlite-users mailing list
sqlite-users@sqlite.org
http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users


Re: [sqlite] SQLite with Windows Phone 8

2013-10-11 Thread Sascha Sertel
Did you add the Community.CsharpSqlite.WinPhone.dll as a dependency to your
project?


On Fri, Oct 11, 2013 at 5:09 AM, Tola Fasoyiro
wrote:

>
> I am attempting to use SQLite with Windows Phone. I have successfully
> installed SQLite for Windows and sqlite-net. I get an error in SQLite.cs
>  as follows:
>
> type or namespace "Community" could not be found
>
>
> #if USE_CSHARP_SQLITE
> using Sqlite3 = Community.CsharpSqlite.Sqlite3;
> using Sqlite3DatabaseHandle = Community.CsharpSqlite.Sqlite3.sqlite3;
> using Sqlite3Statement = Community.CsharpSqlite.Sqlite3.Vdbe;
> #elif USE_WP8_NATIVE_SQLITE
> using Sqlite3 = Sqlite.Sqlite3;
> using Sqlite3DatabaseHandle = Sqlite.Database;
> using Sqlite3Statement = Sqlite.Statement;
> #else
> using Sqlite3DatabaseHandle = System.IntPtr;
> using Sqlite3Statement = System.IntPtr;
> #endif
>
>
>
> Sent from Windows Mail
> ___
> 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


Re: [sqlite] Segmentation Fault With Trigger

2013-10-11 Thread techi eth
It is giving same trace what i have sent last time.

It is possible by some one to send test code snapshot of scenario of
selecting user defined function while trigger execution.

Thanks a lot...


On Fri, Oct 11, 2013 at 7:41 PM, Richard Hipp  wrote:

> On Fri, Oct 11, 2013 at 10:06 AM, techi eth  wrote:
>
> > Please provide some hint.
> >
>
> Recompile with -O0 and -g and then post the stack trace after the segfault.
>
> --
> D. Richard Hipp
> d...@sqlite.org
> ___
> 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


Re: [sqlite] Segmentation Fault With Trigger

2013-10-11 Thread techi eth
Data Info is not an problem.I am passing data information for building
query before passing to sqlite exec function.If i remove trigger for insert
then my code is working perfectly fine.

My assumption is it is due to selecting function  during trigger.Please
suggest hint by looking sequence provide by me.

Thanks


On Fri, Oct 11, 2013 at 7:41 PM, Stephan Beal  wrote:

> On Fri, Oct 11, 2013 at 4:06 PM, techi eth  wrote:
>
> > > #4  0x778e1127 in SqliteTestInsert (SQLitePrivate=0x602300,
> > > TableName_p=0x4019a0 "dbTestTbl", DataInfoList=0x4)
> >
>
> There's the problem: DataInfoList is an invalid pointer. i have no idea
> what that is, but it's not part of sqlite3's sources.
>
> --
> - stephan beal
> http://wanderinghorse.net/home/stephan/
> http://gplus.to/sgbeal
> ___
> 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


Re: [sqlite] Inserting or replacing in the same db based on one key

2013-10-11 Thread jose isaias cabrera


"James K. Lowden" wrote...

On Thu, 10 Oct 2013 12:29:21 -0400
"jose isaias cabrera"  wrote:


> INSERT INTO SimplePrices
> SELECT cust || '1', class, slang, tlang, TransferCost, Price
> FROM SimplePrices WHERE cust = 'XEROX';
>
> Kudos for the primary key declaration, btw.  :-)

Thanks for the kudos and the support.  So, are you saying that this
is also true?

INSERT INTO SimplePrices
SELECT 'XEROX1', class, slang, tlang, TransferCost, Price
FROM SimplePrices WHERE cust = 'XEROX';


Yes, that works too.  All that matters is that the values produced by
SELECT meet the requirements of the columns they're being INSERTed
into.  


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


Re: [sqlite] Segmentation Fault With Trigger

2013-10-11 Thread Stephan Beal
On Fri, Oct 11, 2013 at 4:06 PM, techi eth  wrote:

> > #4  0x778e1127 in SqliteTestInsert (SQLitePrivate=0x602300,
> > TableName_p=0x4019a0 "dbTestTbl", DataInfoList=0x4)
>

There's the problem: DataInfoList is an invalid pointer. i have no idea
what that is, but it's not part of sqlite3's sources.

-- 
- stephan beal
http://wanderinghorse.net/home/stephan/
http://gplus.to/sgbeal
___
sqlite-users mailing list
sqlite-users@sqlite.org
http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users


Re: [sqlite] Segmentation Fault With Trigger

2013-10-11 Thread Richard Hipp
On Fri, Oct 11, 2013 at 10:06 AM, techi eth  wrote:

> Please provide some hint.
>

Recompile with -O0 and -g and then post the stack trace after the segfault.

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


Re: [sqlite] Segmentation Fault With Trigger

2013-10-11 Thread techi eth
Please provide some hint.I have added some more details about function
definition & query.

/* Create function definition */
static void Test(sqlite3_context *context, int argc, sqlite3_value **argv)
{
printf ("Trigger Function Called\n");
if (argc == 1) {
char *text = sqlite3_value_text(argv[0]);
if (text && text[0]) {
  char result[2];
  result[0] = text[0]; result[1] = '\0';
  sqlite3_result_text(context, result, -1, SQLITE_TRANSIENT);
  return;
}
}
sqlite3_result_null(context);
}
/*Create Function */
sqlite3_create_function(Handler, "Test",1, SQLITE_UTF8, NULL, , NULL,
NULL);

/*Create Trigger Query */
create trigger TestTrigger after insert on dbTestTbl for each row begin
SELECT Test (new.RowId) from dbTestTbl; end;


On Fri, Oct 11, 2013 at 5:55 PM, techi eth  wrote:

> Please find below :
>
> #0  0x7fffe0b8 in ?? ()
>
> #1  0x776988f6 in ?? () from
> /usr/lib/x86_64-linux-gnu/libsqlite3.so.0
>
> #2  0x7769e451 in sqlite3_step () from
> /usr/lib/x86_64-linux-gnu/libsqlite3.so.0
>
> #3  0x776a1e4c in sqlite3_exec () from
> /usr/lib/x86_64-linux-gnu/libsqlite3.so.0
>
> #4  0x778e1127 in SqliteTestInsert (SQLitePrivate=0x602300,
> TableName_p=0x4019a0 "dbTestTbl", DataInfoList=0x4)
>
> #5  0x00400d58 in TEST_SqliteTestInsert (RowID=) at
> sqlite3_test.c:340
>
> #6  main (argc=, args=) at sqlite3_test.c:922
>
> Thanks
>
>
> On Fri, Oct 11, 2013 at 5:35 PM, Richard Hipp  wrote:
>
>> On Fri, Oct 11, 2013 at 7:57 AM, techi eth  wrote:
>>
>> > Hi,
>> >
>> > I am getting segmentation fault while executing query in sqlite3. [Linux
>> > OS].
>> >
>>
>> Can you send us a stack trace?
>>
>>
>> >
>> > Find below sequence.
>> >
>> > // Getting SQLiteHandler
>> >
>> > OpenConnection ();
>> >
>> > //Creating user defined function “Test”
>> >
>> > sqlite3_create_function(SQLiteHandler, "Test",1, SQLITE_UTF8, NULL,
>> ,
>> > NULL, NULL)
>> >
>> > //Creating table,Below is DDL
>> >
>> > CREATE TABLE dbTestTbl (
>> >
>> > RowID   INTEGER PRIMARY KEY AUTOINCREMENT,
>> >
>> > ParamaterID INTEGER,
>> >
>> > ParamaterValue  TEXT
>> >
>> > );
>> >
>> > //Createatd Trigger,Below is DDL
>> >
>> > CREATE TRIGGER TestTrigger
>> >
>> >AFTER INSERT ON dbTestTbl
>> >
>> >FOR EACH ROW
>> >
>> > BEGIN
>> >
>> > SELECT Test( RowID )
>> >
>> >   FROM dbTestTbl;
>> >
>> > END;
>> >
>> > // INSERT INTO dbTestTbl
>> >
>> > Please suggest what is wrong defined here.
>> >
>> > Thanks
>> > ___
>> > sqlite-users mailing list
>> > sqlite-users@sqlite.org
>> > http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users
>> >
>>
>>
>>
>> --
>> D. Richard Hipp
>> d...@sqlite.org
>> ___
>> 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


Re: [sqlite] Segmentation Fault With Trigger

2013-10-11 Thread techi eth
Please find below :

#0  0x7fffe0b8 in ?? ()

#1  0x776988f6 in ?? () from
/usr/lib/x86_64-linux-gnu/libsqlite3.so.0

#2  0x7769e451 in sqlite3_step () from
/usr/lib/x86_64-linux-gnu/libsqlite3.so.0

#3  0x776a1e4c in sqlite3_exec () from
/usr/lib/x86_64-linux-gnu/libsqlite3.so.0

#4  0x778e1127 in SqliteTestInsert (SQLitePrivate=0x602300,
TableName_p=0x4019a0 "dbTestTbl", DataInfoList=0x4)

#5  0x00400d58 in TEST_SqliteTestInsert (RowID=) at
sqlite3_test.c:340

#6  main (argc=, args=) at sqlite3_test.c:922

Thanks


On Fri, Oct 11, 2013 at 5:35 PM, Richard Hipp  wrote:

> On Fri, Oct 11, 2013 at 7:57 AM, techi eth  wrote:
>
> > Hi,
> >
> > I am getting segmentation fault while executing query in sqlite3. [Linux
> > OS].
> >
>
> Can you send us a stack trace?
>
>
> >
> > Find below sequence.
> >
> > // Getting SQLiteHandler
> >
> > OpenConnection ();
> >
> > //Creating user defined function “Test”
> >
> > sqlite3_create_function(SQLiteHandler, "Test",1, SQLITE_UTF8, NULL,
> ,
> > NULL, NULL)
> >
> > //Creating table,Below is DDL
> >
> > CREATE TABLE dbTestTbl (
> >
> > RowID   INTEGER PRIMARY KEY AUTOINCREMENT,
> >
> > ParamaterID INTEGER,
> >
> > ParamaterValue  TEXT
> >
> > );
> >
> > //Createatd Trigger,Below is DDL
> >
> > CREATE TRIGGER TestTrigger
> >
> >AFTER INSERT ON dbTestTbl
> >
> >FOR EACH ROW
> >
> > BEGIN
> >
> > SELECT Test( RowID )
> >
> >   FROM dbTestTbl;
> >
> > END;
> >
> > // INSERT INTO dbTestTbl
> >
> > Please suggest what is wrong defined here.
> >
> > Thanks
> > ___
> > sqlite-users mailing list
> > sqlite-users@sqlite.org
> > http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users
> >
>
>
>
> --
> D. Richard Hipp
> d...@sqlite.org
> ___
> 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


Re: [sqlite] SQLite DateTime issue

2013-10-11 Thread Simon Slavin

On 11 Oct 2013, at 4:05am, tpalumbo  wrote:

> Have a strange issue.  Creating a Windows Phone 8 app, (c#, xaml), using
> SQLite.  I have a simple table that has 3 fields defined in database as
> follows
> RecordID (int)
> Name (nvarchar)
> RecordDate (DateTime)
> 
> In the in the app the model is defined the same.
> The table does have 5 records in it and all 3 fields of each record does
> have data in it.  I looked.
> Strange thing is that when I run a query on it to populate a listbox, the
> listbox does fill with all records but the RecordDate column displays
> 1/1/0001 for all 5 records.  What am I doing wrong?

There is no DateTime format in SQLite.  (There's no 'nvarchar' format either.)  
Those dates are probably not being stored correctly because you are assuming 
some conversion is taking place and it isn't.

Dates are usually stored as strings (if you mostly want printing) or epoch 
numbers or Julian date numbers (if you mostly want maths).  Define your field 
as TEXT, INTEGER or REAL appropriately, and do whatever conversion is needed to 
get the right values into the database.

You may find this page useful:



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


Re: [sqlite] sqlite3_blob_open issue

2013-10-11 Thread Richard Hipp
On Fri, Oct 11, 2013 at 3:02 AM, Deepika Sathawane <
deepika.sathaw...@igate.com> wrote:

>
> As per the help the database name is not the filename that contains the
> database but rather the symbolic name of the database that appears after
> the AS keyword when the database is connected using ATTACH<
> http://www.sqlite.org/lang_attach.html>. For the main database file, the
> database name is "main". For TEMP tables, the database name is "temp".
>
> How I can find the DB name from SQLite browser/Manager or SQLite function.
>

All valid DB names for your database connection are shown in the second
column of the output of "PRAGMA database_list;"

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


[sqlite] SQLite with Windows Phone 8

2013-10-11 Thread Tola Fasoyiro

I am attempting to use SQLite with Windows Phone. I have successfully installed 
SQLite for Windows and sqlite-net. I get an error in SQLite.cs  as follows: 

type or namespace "Community" could not be found


#if USE_CSHARP_SQLITE
using Sqlite3 = Community.CsharpSqlite.Sqlite3;
using Sqlite3DatabaseHandle = Community.CsharpSqlite.Sqlite3.sqlite3;
using Sqlite3Statement = Community.CsharpSqlite.Sqlite3.Vdbe;
#elif USE_WP8_NATIVE_SQLITE
using Sqlite3 = Sqlite.Sqlite3;
using Sqlite3DatabaseHandle = Sqlite.Database;
using Sqlite3Statement = Sqlite.Statement;
#else
using Sqlite3DatabaseHandle = System.IntPtr;
using Sqlite3Statement = System.IntPtr;
#endif



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


Re: [sqlite] Bug report.

2013-10-11 Thread Richard Hipp
On Fri, Oct 11, 2013 at 7:57 AM, Alexander Syvak wrote:

> Hello,
>
> I am using the @ as a column name delimeter. For instance, if there's a
> table named woman, then a column describing the size of hips should be
> named woman@hip_size.
>
> There's a table created using
> CREATE TABLE country
> (
> 'country@id' INTEGER,
> 'country@name' TEXT,
> 'country@printable'_name TEXT,
>

Either quote the entire name or none of it.  The fact that you ended the
quote mid-name causes the name to be parsed as two separate tokens:

  "country@printable"  _name  TEXT,

Hence the column name is "country@printable" and the datatype is "_name
TEXT".

Also, you should be using double-quotes not single-quotes for quoting
column names.




> 'country@iso2' TEXT,
> 'country@iso3' TEXT,
> 'country@numcode' INTEGER,
> CONSTRAINT PK_country PRIMARY KEY ('country@id')
> )
>
> After execution of the next query
> pragma table_info('country');
> Sqliteman 1.2.2 yields
> 
> 
> Sqliteman export
> 
> 
> 
>
> cidnametypenotnulldflt_valuepk
> 0country@id
> INTEGER01
> 1country@name
> TEXT00
> 2country@printable_name
> TEXT00
> 3country@iso2
> TEXT00
> 4country@iso3
> TEXT00
> 5country@numcode
> INTEGER00
> 
> 
> 
> As you can see country@printable has the type _name TEXT.
> ___
> sqlite-users mailing list
> sqlite-users@sqlite.org
> http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users
>



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


Re: [sqlite] Segmentation Fault With Trigger

2013-10-11 Thread Richard Hipp
On Fri, Oct 11, 2013 at 7:57 AM, techi eth  wrote:

> Hi,
>
> I am getting segmentation fault while executing query in sqlite3. [Linux
> OS].
>

Can you send us a stack trace?


>
> Find below sequence.
>
> // Getting SQLiteHandler
>
> OpenConnection ();
>
> //Creating user defined function “Test”
>
> sqlite3_create_function(SQLiteHandler, "Test",1, SQLITE_UTF8, NULL, ,
> NULL, NULL)
>
> //Creating table,Below is DDL
>
> CREATE TABLE dbTestTbl (
>
> RowID   INTEGER PRIMARY KEY AUTOINCREMENT,
>
> ParamaterID INTEGER,
>
> ParamaterValue  TEXT
>
> );
>
> //Createatd Trigger,Below is DDL
>
> CREATE TRIGGER TestTrigger
>
>AFTER INSERT ON dbTestTbl
>
>FOR EACH ROW
>
> BEGIN
>
> SELECT Test( RowID )
>
>   FROM dbTestTbl;
>
> END;
>
> // INSERT INTO dbTestTbl
>
> Please suggest what is wrong defined here.
>
> Thanks
> ___
> sqlite-users mailing list
> sqlite-users@sqlite.org
> http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users
>



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


[sqlite] Bug report.

2013-10-11 Thread Alexander Syvak
Hello,

I am using the @ as a column name delimeter. For instance, if there's a
table named woman, then a column describing the size of hips should be
named woman@hip_size.

There's a table created using
CREATE TABLE country
(
'country@id' INTEGER,
'country@name' TEXT,
'country@printable'_name TEXT,
'country@iso2' TEXT,
'country@iso3' TEXT,
'country@numcode' INTEGER,
CONSTRAINT PK_country PRIMARY KEY ('country@id')
)

After execution of the next query
pragma table_info('country');
Sqliteman 1.2.2 yields


Sqliteman export



cidnametypenotnulldflt_valuepk
0country@id
INTEGER01
1country@name
TEXT00
2country@printable_name
TEXT00
3country@iso2
TEXT00
4country@iso3
TEXT00
5country@numcode
INTEGER00



As you can see country@printable has the type _name TEXT.
___
sqlite-users mailing list
sqlite-users@sqlite.org
http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users


[sqlite] sqlite3_blob_open issue

2013-10-11 Thread Deepika Sathawane
Hi,

I am facing issues while reading the data from blob column. I am not able to 
open the blob. I am using sqlite3_blob_open function.
Can someone provide the sample code for the same.

int sqlite3_blob_open(
  sqlite3*,
  const char *zDb,
  const char *zTable,
  const char *zColumn,
  sqlite3_int64 iRow,
  int flags,
  sqlite3_blob **ppBlob
);

As per the help the database name is not the filename that contains the 
database but rather the symbolic name of the database that appears after the AS 
keyword when the database is connected using 
ATTACH. For the main database file, the 
database name is "main". For TEMP tables, the database name is "temp".

How I can find the DB name from SQLite browser/Manager or SQLite function.

Thanks,
Deepika Sathawane


~~Disclaimer~~~
Information contained and transmitted by this e-mail is confidential and 
proprietary to iGATE and its affiliates and is intended for use only by the 
recipient. If you are not the intended recipient, you are hereby notified that 
any dissemination, distribution, copying or use of this e-mail is strictly 
prohibited and you are requested to delete this e-mail immediately and notify 
the originator or mailad...@igate.com . iGATE does 
not enter into any agreement with any party by e-mail. Any views expressed by 
an individual do not necessarily reflect the view of iGATE. iGATE is not 
responsible for the consequences of any actions taken on the basis of 
information provided, through this email. The contents of an attachment to this 
e-mail may contain software viruses, which could damage your own computer 
system. While iGATE has taken every reasonable precaution to minimise this 
risk, we cannot accept liability for any damage which you sustain as a result 
of softwar
 e viruses. You should carry out your own virus checks before opening an 
attachment. To know more about iGATE please visit www.igate.com 
.

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


[sqlite] SQLite DateTime issue

2013-10-11 Thread tpalumbo
Hi All,

Have a strange issue.  Creating a Windows Phone 8 app, (c#, xaml), using
SQLite.  I have a simple table that has 3 fields defined in database as
follows
RecordID (int)
Name (nvarchar)
RecordDate (DateTime)

In the in the app the model is defined the same.
The table does have 5 records in it and all 3 fields of each record does
have data in it.  I looked.
Strange thing is that when I run a query on it to populate a listbox, the
listbox does fill with all records but the RecordDate column displays
1/1/0001 for all 5 records.  What am I doing wrong?



--
View this message in context: 
http://sqlite.1065341.n5.nabble.com/SQLite-DateTime-issue-tp71650.html
Sent from the SQLite mailing list archive at Nabble.com.
___
sqlite-users mailing list
sqlite-users@sqlite.org
http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users


[sqlite] pragma foreign_keys;

2013-10-11 Thread Alexander Syvak
Hello,

there's a need to make delete on cascade, update on cascade work.

I am using the next code for a test =>

int main()
{
sql_q_raw_ptr = "pragma foreign_keys = 1;";
mms::db db_;
db_.open(path);
db_.insert(sql_q_raw_ptr);
sql_q_raw_ptr = "pragma foreign_keys;";
auto selector = mms::sqlite3_selector("");
db_.select(sql_q_raw_ptr, selector.get_data_handle(),
_data());
std::cout << selector.get_data().at(0) << '\n';
}

mms:: db class is a connection wrapper. Hence, sequential insert and select
in the code above are executed on the same connection. Each write-query
uses immediate transaction. Hence, the insert is executed as an immediate
transaction.
However, the output to the shell is 0.
When I execute the same code in sqliteman the output is 1.

Why there's 0 and if it is caused by the IMMEDIATE TRANSACTION then why?
___
sqlite-users mailing list
sqlite-users@sqlite.org
http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users


[sqlite] Segmentation Fault With Trigger

2013-10-11 Thread techi eth
Hi,

I am getting segmentation fault while executing query in sqlite3. [Linux
OS].

Find below sequence.

// Getting SQLiteHandler

OpenConnection ();

//Creating user defined function “Test”

sqlite3_create_function(SQLiteHandler, "Test",1, SQLITE_UTF8, NULL, ,
NULL, NULL)

//Creating table,Below is DDL

CREATE TABLE dbTestTbl (

RowID   INTEGER PRIMARY KEY AUTOINCREMENT,

ParamaterID INTEGER,

ParamaterValue  TEXT

);

//Createatd Trigger,Below is DDL

CREATE TRIGGER TestTrigger

   AFTER INSERT ON dbTestTbl

   FOR EACH ROW

BEGIN

SELECT Test( RowID )

  FROM dbTestTbl;

END;

// INSERT INTO dbTestTbl

Please suggest what is wrong defined here.

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


Re: [sqlite] Consistent reads

2013-10-11 Thread Dan Kennedy

On 10/11/2013 02:29 PM, Paul Harris wrote:

Hi again,

I am wondering if there is any performance benefit in *not* wrapping
multiple SELECT calls in a BEGIN/END transaction?

As I understand it, with wrapping:
BEGIN -- does nothing (yet)
SELECT1 -- creates a SHARE-ONLY lock on the DB
SELECT2 -- nothing extra
SELECT3 -- nothing extra
END -- cancels SHARE lock

Or, without wrapping, does it create and drop the SHARE LOCK each time?
  Does that add overhead?  ie:


Yes. Adds the overhead of obtaining and releasing the SHARED lock
each transaction.


SELECT1 -- creates a SHARE-ONLY lock on the DB, selects, then drops lock
SELECT2 -- creates a SHARE-ONLY lock on the DB, selects, then drops lock
SELECT3 -- creates a SHARE-ONLY lock on the DB, selects, then drops lock


Also, silly question, but if I want to find a row and then read a blob
using the sqlite3_blob_open API, I assume I must use transactions to get a
consistent read, right?
ie, without a transaction,

SELECT rowid FROM table WHERE condition;
** another client could make a change to a db here **
sqlite3_blob_open( rowid )
** blob may now be for the "wrong row"


Transaction is required, yes. Otherwise some other connection may
delete the row in question between the SELECT and sqlite3_blob_open()
calls.

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


[sqlite] Consistent reads

2013-10-11 Thread Paul Harris
Hi again,

I am wondering if there is any performance benefit in *not* wrapping
multiple SELECT calls in a BEGIN/END transaction?

As I understand it, with wrapping:
BEGIN -- does nothing (yet)
SELECT1 -- creates a SHARE-ONLY lock on the DB
SELECT2 -- nothing extra
SELECT3 -- nothing extra
END -- cancels SHARE lock

Or, without wrapping, does it create and drop the SHARE LOCK each time?
 Does that add overhead?  ie:
SELECT1 -- creates a SHARE-ONLY lock on the DB, selects, then drops lock
SELECT2 -- creates a SHARE-ONLY lock on the DB, selects, then drops lock
SELECT3 -- creates a SHARE-ONLY lock on the DB, selects, then drops lock


Also, silly question, but if I want to find a row and then read a blob
using the sqlite3_blob_open API, I assume I must use transactions to get a
consistent read, right?
ie, without a transaction,

SELECT rowid FROM table WHERE condition;
** another client could make a change to a db here **
sqlite3_blob_open( rowid )
** blob may now be for the "wrong row"

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