Re: [sqlite] Delete From Not Working Properly

2014-02-21 Thread Geo Wil
I got it working finally.  There were several problems that were all
contributing and it was not until Kees suggested looking at the
begins/commits to see if errors were happening that I saw the whole
picture.  As mentioned in my past response to the thread, the code worked
when saving after starting a new game but not after loading an already
started game.  The problem was both in the loading code and in the way in
which I was loading the data through my calls in my Database class.

In my loading code I have several areas where I must close and re-open a
connection to the database because of how some things are loaded (some
elements are loaded in as only ID values which I then get the data for from
my Database sqlite file which contains non-player/game instance specific
data like weapons information or message).  Well there was a problem here
where the database connection could not be closed because there were
unfinalized statements.  This is where the second area of problems comes
in.  I was not placing my calls to my finalize function at the end of the
query functions.  This meant that if there was a problem, finalize would
not be called and the prepared statement would not be destroyed.

Another problem was in my getRows function.  The same issue as above
existed except that there were multiple chances for the statement to not be
finalized as I was returning 0 at any point an error was found.  After
placing the calls to finalize in their correct places I found the final
thorn in my program which were the database closes in dataSystem in lData.
I had them setup so that they would be called even if the database was not
actually closed.  This caused even more problems by invalidating previous
database connections and creating new ones.  The end result was that by the
time sData in Database was called the database connection was mutilated.

Fixed everything up and ran the loading process and I was able to rid
myself of several bugs at once including getting the Delete From query to
execute properly.

Thanks for the suggestions and feedback you have all given me, it helped
tremendously.


On Fri, Feb 21, 2014 at 2:15 PM, Geo Wil  wrote:

> Hello,
>
> Yesterday, while working on my game, I noticed that my game data was not
> updating in my save SQLite3 database.  So I started tracking down what was
> going on and eventually my search lead me to my dData function.
>
> How this function works is that you pass a table name and a bool, the bool
> is just there in case errors happen to notify the player.  I did exhaustive
> tests yesterday on this block of code and found that it was not functioning
> properly, it was not deleting the data from my tables.
>
> I checked to see if sqlite3_step was producing an error but it was sending
> back a value of 101 or SQLITE_DONE but the table data remained unchanged.
> I also commented out the code I use to replace the deleted data just to
> make sure the data retrieval code was not at fault.  With just the dData
> call and nothing else the data still would not delete from the table.
>
> Here is the code I am using for my dData function:
>
> void Database::dData(string table, bool* bErrors)
> {
> sqlStr2 = "Delete From " + table;
>
> sqlite3_exec(dBase,"BEGIN TRANSACTION",NULL,NULL,);
>
> if (sqlite3_prepare_v2(dBase, sqlStr2.c_str(), sqlStr2.size(),
> , 0) == SQLITE_OK)
> {
> sqlite3_step(statement2);
> *bErrors = false;
>
> finalize(statement2, bErrors);
> }
>
> else
> {
> *bErrors = true;
> createBInfo();
> d.createBReport("SQL Code 3",sqlite3_errmsg(dBase),bLocale +
> to_string(__LINE__),bTDate,"./SC_Log.txt");
> }
>
> sqlite3_exec(dBase,"END TRANSACTION",NULL,NULL,);
> }
>
> I am also going to link to my save database in case it itself is to blame
> although I tested this on several different files with the same results.
>
> http://sc.lmpgames.com/scSave.sqlite
>
> I already have posted about this on StackOverflow and so far everyone that
> has attempted to figure this out has been stumped.  I am using Microsoft
> Visual Studio 2012 and C++.
>
> Thanks.
>
> --
> "I though what I'd do was, I'd pretend I was one of those Deaf-Mutes...Or
> should I?" -- Laughing Man
> __
>
> Laughing Man Productions² Entertainment and Gaming 
> Network
>



-- 
"I though what I'd do was, I'd pretend I was one of those Deaf-Mutes...Or
should I?" -- Laughing Man
__

Laughing Man Productions² Entertainment and Gaming
Network
___
sqlite-users mailing list
sqlite-users@sqlite.org
http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users


Re: [sqlite] Delete From Not Working Properly

2014-02-21 Thread Simon Slavin

On 21 Feb 2014, at 9:15pm, Geo Wil  wrote:

> I checked to see if sqlite3_step was producing an error but it was sending
> back a value of 101 or SQLITE_DONE but the table data remained unchanged.

Putting this sentence together with the 'Subject' header, it might just be 
worth reminding you that a 'DELETE FROM' that deletes no rows is perfectly 
legit command and returns SQLITE_DONE.

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


Re: [sqlite] Delete From Not Working Properly

2014-02-21 Thread RSmith


On 2014/02/22 01:37, Geo Wil wrote:


As for the fail path issue, it is not an issue or at least it has never been for me.  The way I understand it is that if you just 
put the file name into a function requesting a path in Windows it will look in the folder the process is running from for that 
file. //


Yes of course, but the problem is the typical folder a program will be installed to (which may not be the case in the dev machine) 
is c:\Program Files\ and that path is special and protected, and there is no sub-folder of that path that windows will allow you to 
keep a file and make changes to it unless your manifest specifically requires it (and even then the user will be bothered every time 
for access grants). You need to save the data very far away from the exe, such as the program-data folder I described earlier. You 
may have switched off the UAC on the dev PC, but it will be alive and well on an intended user's PC and it will not allow you (or 
anyone else - which is the beauty of it) to overwrite any file inside your program's exe folder or sub-folder thereof.



Although you are right, I should be a bit more explicit with the path, maybe use ./Databases/[filename] so that it will explicitly 
look in the same folder and not have to use a default behavior that can sometimes be fallible.


Being explicit about the name is of no consequence when the resulting location 
of the file is still inside a protected folder.


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


Re: [sqlite] Delete From Not Working Properly

2014-02-21 Thread Igor Tandetnik

On 2/21/2014 6:37 PM, Geo Wil wrote:

As for the fail path issue, it is not an issue or at least it has never
been for me.  The way I understand it is that if you just put the file name
into a function requesting a path in Windows it will look in the folder the
process is running from for that file.


No, it would look in the current working directory (see 
GetCurrentDirectory, SetCurrentDirectory), which may or may not be the 
same directory where the EXE is located.

--
Igor Tandetnik

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


Re: [sqlite] Delete From Not Working Properly

2014-02-21 Thread Geo Wil
I thought of another possible reason why this is going on.  The code in
question works under one set of circumstances and not under another.  If
there is no data in my database then I am able to save data.  This begged
the question "why?" and the answer is because I do not load my data if I
start a new game.  I have been looking at my lData code in my dataSystem
class and I found that I am getting errors there too when trying to close
my database connection from there.  This, I think, is why I am getting
locked out during the save process.  I am going to try updating the code in
lData and see what happens.

As for the fail path issue, it is not an issue or at least it has never
been for me.  The way I understand it is that if you just put the file name
into a function requesting a path in Windows it will look in the folder the
process is running from for that file.  Although you are right, I should be
a bit more explicit with the path, maybe use ./Databases/[filename] so that
it will explicitly look in the same folder and not have to use a default
behavior that can sometimes be fallible.

Thanks for the suggestions.  Will post back what the results of my work
with lData are.


On Fri, Feb 21, 2014 at 3:59 PM, RSmith  wrote:

>
> On 2014/02/22 00:32, Geo Wil wrote:
>
>> 1. Windows 7 Ultimate 64-bit
>>
>> 2. Here is the path I am using:
>> void Database::openSave(bool* bErrors)
>> {
>>  if (sqlite3_open("*scSave.sqlite*",) != SQLITE_OK)
>>
>>  {
>>  *bErrors = true;
>>  createBInfo();
>>  d.createBReport("SQL Code 1",sqlite3_errmsg(dBase),bLocale +
>> to_string(__LINE__),bTDate,"./SC_Log.txt");
>>  }
>>
>>  else
>>  {
>>  *bErrors = false;
>>  }
>> }
>>
>> 3. I checked that earlier today as well as the permission on the database
>> itself.  Everything checks out.
>>
>> 4. Here you inspired me to do some extra digging.  I added some couts to
>> the player data transaction block in the event that error is not null and
>> I
>> got an error of "Database is Locked".  This was surprising because I have
>> no programs open that have my save database open and the only other call
>> to
>> the database before the transaction block starts is the openSave function
>> listed above.
>>
>>
> That path doesn't seem like a path, but just a call to open a filename,
> which should be in the same folder as the exe. Now, depending on where the
> exe is in Win7, that could be a problem. If your exe is in any of the
> protected or system folders (such as Program_files), Windows won't let you
> edit files in those places, it might simply shift the file to the
> virtualized folder and open it there, which usually works ok and very much
> transparent to your app - unless you are trying to force the full path in
> an open statement, such as SQLite should be doing. This may explain why the
> permission seem ok but the physical file is locked when you try to open it.
>
> The way to fix this is to use the correct program data path (typically
> "c:\users\myUser\AppData\Roaming\MyProgramName\") or the user's documents
> folder (should you want this file to be handled by the user at some point),
> in stead of the exe path  - and/or to let Windows know that you know what
> you are doing and expect your datafiles to be changed by specifying a
> manifest to your exe with appropriate settings - just MSDN "Manifest file"
> for examples.
>
> btw: Getting the path to the correct program data path on any PC requires
> simply a call to the Windows Shell API with the correct parameter, again
> just MSDN it.
>
> Good luck!
>
>
> ___
> sqlite-users mailing list
> sqlite-users@sqlite.org
> http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users
>



-- 
"I though what I'd do was, I'd pretend I was one of those Deaf-Mutes...Or
should I?" -- Laughing Man
__

Laughing Man Productions² Entertainment and Gaming
Network
___
sqlite-users mailing list
sqlite-users@sqlite.org
http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users


Re: [sqlite] Delete From Not Working Properly

2014-02-21 Thread RSmith


On 2014/02/22 00:32, Geo Wil wrote:

1. Windows 7 Ultimate 64-bit

2. Here is the path I am using:
void Database::openSave(bool* bErrors)
{
 if (sqlite3_open("*scSave.sqlite*",) != SQLITE_OK)
 {
 *bErrors = true;
 createBInfo();
 d.createBReport("SQL Code 1",sqlite3_errmsg(dBase),bLocale +
to_string(__LINE__),bTDate,"./SC_Log.txt");
 }

 else
 {
 *bErrors = false;
 }
}

3. I checked that earlier today as well as the permission on the database
itself.  Everything checks out.

4. Here you inspired me to do some extra digging.  I added some couts to
the player data transaction block in the event that error is not null and I
got an error of "Database is Locked".  This was surprising because I have
no programs open that have my save database open and the only other call to
the database before the transaction block starts is the openSave function
listed above.



That path doesn't seem like a path, but just a call to open a filename, which should be in the same folder as the exe. Now, 
depending on where the exe is in Win7, that could be a problem. If your exe is in any of the protected or system folders (such as 
Program_files), Windows won't let you edit files in those places, it might simply shift the file to the virtualized folder and open 
it there, which usually works ok and very much transparent to your app - unless you are trying to force the full path in an open 
statement, such as SQLite should be doing. This may explain why the permission seem ok but the physical file is locked when you try 
to open it.


The way to fix this is to use the correct program data path (typically "c:\users\myUser\AppData\Roaming\MyProgramName\") or the 
user's documents folder (should you want this file to be handled by the user at some point), in stead of the exe path  - and/or to 
let Windows know that you know what you are doing and expect your datafiles to be changed by specifying a manifest to your exe with 
appropriate settings - just MSDN "Manifest file" for examples.


btw: Getting the path to the correct program data path on any PC requires simply a call to the Windows Shell API with the correct 
parameter, again just MSDN it.


Good luck!

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


Re: [sqlite] Delete From Not Working Properly

2014-02-21 Thread Geo Wil
1. Windows 7 Ultimate 64-bit

2. Here is the path I am using:
void Database::openSave(bool* bErrors)
{
if (sqlite3_open("*scSave.sqlite*",) != SQLITE_OK)
{
*bErrors = true;
createBInfo();
d.createBReport("SQL Code 1",sqlite3_errmsg(dBase),bLocale +
to_string(__LINE__),bTDate,"./SC_Log.txt");
}

else
{
*bErrors = false;
}
}

3. I checked that earlier today as well as the permission on the database
itself.  Everything checks out.

4. Here you inspired me to do some extra digging.  I added some couts to
the player data transaction block in the event that error is not null and I
got an error of "Database is Locked".  This was surprising because I have
no programs open that have my save database open and the only other call to
the database before the transaction block starts is the openSave function
listed above.



On Fri, Feb 21, 2014 at 3:06 PM, Kees Nuyt  wrote:

> On Fri, 21 Feb 2014 14:15:10 -0700, Geo Wil 
> wrote:
>
> >Hello,
> >
> >Yesterday, while working on my game, I noticed that my game data was not
> >updating in my save SQLite3 database.  So I started tracking down what was
> >going on and eventually my search lead me to my dData function.
> >
> >How this function works is that you pass a table name and a bool, the bool
> >is just there in case errors happen to notify the player.  I did
> exhaustive
> >tests yesterday on this block of code and found that it was not
> functioning
> >properly, it was not deleting the data from my tables.
> >
> >I checked to see if sqlite3_step was producing an error but it was sending
> >back a value of 101 or SQLITE_DONE but the table data remained unchanged.
> >I also commented out the code I use to replace the deleted data just to
> >make sure the data retrieval code was not at fault.  With just the dData
> >call and nothing else the data still would not delete from the table.
> >
> >Here is the code I am using for my dData function:
> >
> >void Database::dData(string table, bool* bErrors)
> >{
> >sqlStr2 = "Delete From " + table;
> >
> >sqlite3_exec(dBase,"BEGIN TRANSACTION",NULL,NULL,);
> >
> >if (sqlite3_prepare_v2(dBase, sqlStr2.c_str(), sqlStr2.size(),
> >, 0) == SQLITE_OK)
> >{
> >sqlite3_step(statement2);
> >*bErrors = false;
> >
> >finalize(statement2, bErrors);
> >}
> >
> >else
> >{
> >*bErrors = true;
> >createBInfo();
> >d.createBReport("SQL Code 3",sqlite3_errmsg(dBase),bLocale +
> >to_string(__LINE__),bTDate,"./SC_Log.txt");
> >}
> >
> >sqlite3_exec(dBase,"END TRANSACTION",NULL,NULL,);
> >}
> >
> >I am also going to link to my save database in case it itself is to blame
> >although I tested this on several different files with the same results.
> >
> >http://sc.lmpgames.com/scSave.sqlite
> >
> >I already have posted about this on StackOverflow and so far everyone that
> >has attempted to figure this out has been stumped.  I am using Microsoft
> >Visual Studio 2012 and C++.
>
> Which version of MS Windows?
> What is the path to the database file?
> Is the database perhaps stored in a "protected" directory?
> Any errors on execution of the BEGIN and COMMIT statements?
>
> --
> Groet, Cordialement, Pozdrawiam, Regards,
>
> Kees Nuyt
>
> ___
> sqlite-users mailing list
> sqlite-users@sqlite.org
> http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users
>



-- 
"I though what I'd do was, I'd pretend I was one of those Deaf-Mutes...Or
should I?" -- Laughing Man
__

Laughing Man Productions² Entertainment and Gaming
Network
___
sqlite-users mailing list
sqlite-users@sqlite.org
http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users


Re: [sqlite] Delete From Not Working Properly

2014-02-21 Thread Richard Hipp
Please consider adding an error and warning log (
http://www.sqlite.org/errlog.html) to your program to record any errors
that SQLite might be encountering.


On Fri, Feb 21, 2014 at 4:15 PM, Geo Wil  wrote:

> Hello,
>
> Yesterday, while working on my game, I noticed that my game data was not
> updating in my save SQLite3 database.  So I started tracking down what was
> going on and eventually my search lead me to my dData function.
>
> How this function works is that you pass a table name and a bool, the bool
> is just there in case errors happen to notify the player.  I did exhaustive
> tests yesterday on this block of code and found that it was not functioning
> properly, it was not deleting the data from my tables.
>
> I checked to see if sqlite3_step was producing an error but it was sending
> back a value of 101 or SQLITE_DONE but the table data remained unchanged.
> I also commented out the code I use to replace the deleted data just to
> make sure the data retrieval code was not at fault.  With just the dData
> call and nothing else the data still would not delete from the table.
>
> Here is the code I am using for my dData function:
>
> void Database::dData(string table, bool* bErrors)
> {
> sqlStr2 = "Delete From " + table;
>
> sqlite3_exec(dBase,"BEGIN TRANSACTION",NULL,NULL,);
>
> if (sqlite3_prepare_v2(dBase, sqlStr2.c_str(), sqlStr2.size(),
> , 0) == SQLITE_OK)
> {
> sqlite3_step(statement2);
> *bErrors = false;
>
> finalize(statement2, bErrors);
> }
>
> else
> {
> *bErrors = true;
> createBInfo();
> d.createBReport("SQL Code 3",sqlite3_errmsg(dBase),bLocale +
> to_string(__LINE__),bTDate,"./SC_Log.txt");
> }
>
> sqlite3_exec(dBase,"END TRANSACTION",NULL,NULL,);
> }
>
> I am also going to link to my save database in case it itself is to blame
> although I tested this on several different files with the same results.
>
> http://sc.lmpgames.com/scSave.sqlite
>
> I already have posted about this on StackOverflow and so far everyone that
> has attempted to figure this out has been stumped.  I am using Microsoft
> Visual Studio 2012 and C++.
>
> Thanks.
>
> --
> "I though what I'd do was, I'd pretend I was one of those Deaf-Mutes...Or
> should I?" -- Laughing Man
> __
>
> Laughing Man Productions² Entertainment and Gaming
> Network
> ___
> 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] Delete From Not Working Properly

2014-02-21 Thread Kees Nuyt
On Fri, 21 Feb 2014 14:15:10 -0700, Geo Wil 
wrote:

>Hello,
>
>Yesterday, while working on my game, I noticed that my game data was not
>updating in my save SQLite3 database.  So I started tracking down what was
>going on and eventually my search lead me to my dData function.
>
>How this function works is that you pass a table name and a bool, the bool
>is just there in case errors happen to notify the player.  I did exhaustive
>tests yesterday on this block of code and found that it was not functioning
>properly, it was not deleting the data from my tables.
>
>I checked to see if sqlite3_step was producing an error but it was sending
>back a value of 101 or SQLITE_DONE but the table data remained unchanged.
>I also commented out the code I use to replace the deleted data just to
>make sure the data retrieval code was not at fault.  With just the dData
>call and nothing else the data still would not delete from the table.
>
>Here is the code I am using for my dData function:
>
>void Database::dData(string table, bool* bErrors)
>{
>sqlStr2 = "Delete From " + table;
>
>sqlite3_exec(dBase,"BEGIN TRANSACTION",NULL,NULL,);
>
>if (sqlite3_prepare_v2(dBase, sqlStr2.c_str(), sqlStr2.size(),
>, 0) == SQLITE_OK)
>{
>sqlite3_step(statement2);
>*bErrors = false;
>
>finalize(statement2, bErrors);
>}
>
>else
>{
>*bErrors = true;
>createBInfo();
>d.createBReport("SQL Code 3",sqlite3_errmsg(dBase),bLocale +
>to_string(__LINE__),bTDate,"./SC_Log.txt");
>}
>
>sqlite3_exec(dBase,"END TRANSACTION",NULL,NULL,);
>}
>
>I am also going to link to my save database in case it itself is to blame
>although I tested this on several different files with the same results.
>
>http://sc.lmpgames.com/scSave.sqlite
>
>I already have posted about this on StackOverflow and so far everyone that
>has attempted to figure this out has been stumped.  I am using Microsoft
>Visual Studio 2012 and C++.

Which version of MS Windows?
What is the path to the database file?
Is the database perhaps stored in a "protected" directory?
Any errors on execution of the BEGIN and COMMIT statements?

-- 
Groet, Cordialement, Pozdrawiam, Regards,

Kees Nuyt

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


[sqlite] Delete From Not Working Properly

2014-02-21 Thread Geo Wil
Hello,

Yesterday, while working on my game, I noticed that my game data was not
updating in my save SQLite3 database.  So I started tracking down what was
going on and eventually my search lead me to my dData function.

How this function works is that you pass a table name and a bool, the bool
is just there in case errors happen to notify the player.  I did exhaustive
tests yesterday on this block of code and found that it was not functioning
properly, it was not deleting the data from my tables.

I checked to see if sqlite3_step was producing an error but it was sending
back a value of 101 or SQLITE_DONE but the table data remained unchanged.
I also commented out the code I use to replace the deleted data just to
make sure the data retrieval code was not at fault.  With just the dData
call and nothing else the data still would not delete from the table.

Here is the code I am using for my dData function:

void Database::dData(string table, bool* bErrors)
{
sqlStr2 = "Delete From " + table;

sqlite3_exec(dBase,"BEGIN TRANSACTION",NULL,NULL,);

if (sqlite3_prepare_v2(dBase, sqlStr2.c_str(), sqlStr2.size(),
, 0) == SQLITE_OK)
{
sqlite3_step(statement2);
*bErrors = false;

finalize(statement2, bErrors);
}

else
{
*bErrors = true;
createBInfo();
d.createBReport("SQL Code 3",sqlite3_errmsg(dBase),bLocale +
to_string(__LINE__),bTDate,"./SC_Log.txt");
}

sqlite3_exec(dBase,"END TRANSACTION",NULL,NULL,);
}

I am also going to link to my save database in case it itself is to blame
although I tested this on several different files with the same results.

http://sc.lmpgames.com/scSave.sqlite

I already have posted about this on StackOverflow and so far everyone that
has attempted to figure this out has been stumped.  I am using Microsoft
Visual Studio 2012 and C++.

Thanks.

-- 
"I though what I'd do was, I'd pretend I was one of those Deaf-Mutes...Or
should I?" -- Laughing Man
__

Laughing Man Productions² Entertainment and Gaming
Network
___
sqlite-users mailing list
sqlite-users@sqlite.org
http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users


Re: [sqlite] partially excluding records

2014-02-21 Thread mm.w
Hello

I would simply inner join, then filtering.

Best Regards.


On Fri, Feb 21, 2014 at 12:11 PM, David Bicking  wrote:

>
> 
> On Fri, 2/21/14, Igor Tandetnik  wrote:
>
>  Subject: Re: [sqlite] partially excluding records
>  To: sqlite-users@sqlite.org
>  Date: Friday, February 21, 2014, 2:58 PM
>
>  On 2/21/2014 1:23 PM,
>  David Bicking wrote:
>  >> SELECT Key, COUNT(STATUS) Cnt
>  >> , MIN(STATUS) || CASE WHEN COUNT(STATUS)>1 THEN '+' ELSE '' END
> Statuses
>  >> FROM T1
>  >> WHERE ...
>  >> GROUP BY KEY;
>  >>
>
> > You might be looking for something like this:
> > select key, sum(STATUS != 'C') + (case when sum(STATUS != 'C') = 0 then
>  sum(STATUS
> > 'C') else 0 end) Cnt, ...
>
> > No special WHERE clause needed.
>
> *** found another typo in my example, that should have been WHEN
> COUNT(DISTINCT STATUS)>1 ***
>
> *** Annoying that they make up their minds that they want it to work like
> this today, then end the meeting with... and you can have this done by
> Monday, right? I need to calm down. ***
>
> Anyway, there are other fields and messy CASE statements that probably
> wouldn't work with this solution.
>
> But I am curious, wouldn't this yield a "Statuses" for key 2 of 'C+', when
> it should be 'O'?
>
> Thanks,
> David
>
>  ___
>  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-users mailing list
sqlite-users@sqlite.org
http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users


Re: [sqlite] partially excluding records

2014-02-21 Thread Igor Tandetnik

On 2/21/2014 3:11 PM, David Bicking wrote:

But I am curious, wouldn't this yield a "Statuses" for key 2 of 'C+', when it 
should be 'O'?


You could use the same technique there. The technique lets you know 
whether you have only C's, only non-C's, or a mix of the two, and act 
accordingly.


For example, you could replace min(STATUS) with something like

case when sum(STATUS != 'C') then min(case when STATUS='C' then 'ZZZ' 
else STATUS end) else 'C' end


This returns the smallest of statuses other than C if any, and C otherwise.
--
Igor Tandetnik

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


Re: [sqlite] partially excluding records

2014-02-21 Thread David Bicking


On Fri, 2/21/14, Igor Tandetnik  wrote:

 Subject: Re: [sqlite] partially excluding records
 To: sqlite-users@sqlite.org
 Date: Friday, February 21, 2014, 2:58 PM
 
 On 2/21/2014 1:23 PM,
 David Bicking wrote:
 >> SELECT Key, COUNT(STATUS) Cnt
 >> , MIN(STATUS) || CASE WHEN COUNT(STATUS)>1 THEN '+' ELSE '' END Statuses
 >> FROM T1
 >> WHERE ...
 >> GROUP BY KEY;
 >>
 
> You might be looking for something like this:
> select key, sum(STATUS != 'C') + (case when sum(STATUS != 'C') = 0 then  
> sum(STATUS
> 'C') else 0 end) Cnt, ...
 
> No special WHERE clause needed.
 
*** found another typo in my example, that should have been WHEN COUNT(DISTINCT 
STATUS)>1 ***

*** Annoying that they make up their minds that they want it to work like this 
today, then end the meeting with... and you can have this done by Monday, 
right? I need to calm down. ***

Anyway, there are other fields and messy CASE statements that probably wouldn't 
work with this solution.

But I am curious, wouldn't this yield a "Statuses" for key 2 of 'C+', when it 
should be 'O'? 

Thanks,
David

 ___
 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] partially excluding records

2014-02-21 Thread David Bicking


On Fri, 2/21/14, Clemens Ladisch  wrote:

 Subject: Re: [sqlite] partially excluding records
 To: sqlite-users@sqlite.org
 Date: Friday, February 21, 2014, 1:38 PM
 
 David Bicking wrote:
 >> The complication is that if a given key has any non-C value, the C values 
 >> are to be excluded.
 
> First, just exclude all C values:
> ... WHERE Status <> 'C' ...
 
 > If there are only C values, they are to be included.
 >Then do the same query again, but with the all-C keys:
 
>   ...
>   UNION ALL
>   SELECT ...
>   WHERE Key NOT IN (SELECT Key FROM T1 WHERE Status <> 'C')
>   ...
 
Reality is that the "Key" is a combination of 3 or 4 fields.  I suppose I can 
concatenate the fields, but that seems overly ugly.
And the select and existing part of the where clause are complicated, so if I 
can avoid repeating all of that, I'd rather avoid doing it as a union query. 

But if needs must, I will go with this idea.


Thanks,
David

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


Re: [sqlite] partially excluding records

2014-02-21 Thread Igor Tandetnik

On 2/21/2014 1:23 PM, David Bicking wrote:

SELECT Key, COUNT(STATUS) Cnt
, MIN(STATUS) || CASE WHEN COUNT(STATUS)>1 THEN '+' ELSE '' END Statuses
FROM T1
WHERE ...
GROUP BY KEY;

Key  Cnt  Statuses
1  2 O
2  1 C
4  2 O+

The complication is that if a given key has any non-C value, the C values are 
to be excluded. If there are only C values, they are to be included.
How can I state the WHERE clause to do that?


You might be looking for something like this:

select key, sum(STATUS != 'C') + (case when sum(STATUS != 'C') = 0 then 
sum(STATUS = 'C') else 0 end) Cnt, ...


No special WHERE clause needed.

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


Re: [sqlite] partially excluding records

2014-02-21 Thread David Bicking


On Fri, 2/21/14, RSmith  wrote:

 Subject: Re: [sqlite] partially excluding records
 To: sqlite-users@sqlite.org
 Date: Friday, February 21, 2014, 1:34 PM
 
 
 On
 2014/02/21 20:23, David Bicking wrote:
 >
 I have a table like
 >
 > SELECT * FROM T1;
 >
 Key  Status
 > 1      O
 > 1      O
 > 2  O
 > 2      C
 > 3     C
 > 3      C
 > 4      O
 > 4    P
 >
 >
 > Now, I need to consolidate that data.
 >
 > SELECT Key,
 COUNT(STATUS) Cnt
 > , MIN(STATUS) || CASE
 WHEN COUNT(STATUS)>1 THEN '+' ELSE '' END
 Statuses
 > FROM T1
 >
 WHERE ...
 > GROUP BY KEY;
 >
 > Key  Cnt  Statuses
 > 1      2O
 > 2      1     C
 > 4      2     O+
 >
 >> The complication is that if a given key has any non-C value, the C values 
 >> are to be excluded. If there are only C values, they are to be included.
 >> How can I state the WHERE clause to do that?
 
 >This last statement contradicts your example completely. You say: "if a given 
 >key
 >has any non-C value, the C values are to be excluded"
 
 >But looking at the table the Key-value 2 has one non-C value, yet it is
 >included and showing the C.
 
 >You then say: "If there are only C values, they are to be included"
 
 >But Key "3" clearly contains only C values, yet they are explicitly excluded 
 >from the result list
 >If you could kindly fix either the statement or the example so we know which 
 >is accurate, then will gladly try to solve the
 >WHERE riddle for you!

Sorry, stupid typos on my part.
 

 Key  Cnt  Statuses
  1  2 O
  2  1 O
  3  2 C
  4  2 O+
 

 ___
 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] Time taken to perform checkpoint operation and does it lock database during this operation?

2014-02-21 Thread veeresh kumar
I guess this is what happening in my application. The WAL size has grown to 1 
GB...But again my concern is why each commit is taking long time. I see a big 
pause before commit happens. 


In a multi-threaded application, sqlite may have below limitations. Is this a 
fair statement?

- Response time to the client application would increase because
  only 1 thread would be able to update database.

- WAL size may grow since successful checkpoint operation 
  is dependent on if any read operation are in a open 
  transaction?

Is there any improvements or suggestions or best practices that are being 
followed for Multi threaded application.

Thank you,

-Veeresh






On Thursday, 20 February 2014 4:46 PM, Richard Hipp  wrote:
 





On Thu, Feb 20, 2014 at 7:41 PM, veeresh kumar  wrote:

Haven't measured the time, but I have seen a pause before
commit happens. As stated during my earlier discussion, my service cannot pause
for more than 10 sec as it would be result in time out for the clients that are
connected to this service. 
> 
>What my understanding towards the checkpoint is taking my
below settings as example, WAL size would never grow beyond 1MB because check
point occurs after WAL file size reaches 1 MB. Please correct me if I am wrong. 
>


Long-running or overlapping readers can prevent the checkpoint from occurring.  
The checkpoint will be retried again and again, but if there is always a read 
transaction open on a transaction other than the most recent transaction, the 
the checkpoint will never have an opportunity to run to completion and reset 
the WAL file.

 -- 
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] partially excluding records

2014-02-21 Thread Clemens Ladisch
David Bicking wrote:
> The complication is that if a given key has any non-C value, the C values are 
> to be excluded.

First, just exclude all C values:

... WHERE Status <> 'C' ...

> If there are only C values, they are to be included.

Then do the same query again, but with the all-C keys:

  ...
  UNION ALL
  SELECT ...
  WHERE Key NOT IN (SELECT Key FROM T1 WHERE Status <> 'C')
  ...


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


Re: [sqlite] partially excluding records

2014-02-21 Thread RSmith


On 2014/02/21 20:23, David Bicking wrote:

I have a table like

SELECT * FROM T1;
Key  Status
1  O
1  O
2  O
2  C
3  C
3  C
4  O
4  P


Now, I need to consolidate that data.

SELECT Key, COUNT(STATUS) Cnt
, MIN(STATUS) || CASE WHEN COUNT(STATUS)>1 THEN '+' ELSE '' END Statuses
FROM T1
WHERE ...
GROUP BY KEY;

Key  Cnt  Statuses
1  2 O
2  1 C
4  2 O+

The complication is that if a given key has any non-C value, the C values are 
to be excluded. If there are only C values, they are to be included.
How can I state the WHERE clause to do that?


This last statement contradicts your example completely. You say:
"if a given key has any non-C value, the C values are to be excluded"

But looking at the table the Key-value 2 has one non-C value, yet it is 
included and showing the C.

You then say:
"If there are only C values, they are to be included"

But Key "3" clearly contains only C values, yet they are explicitly excluded 
from the result list

If you could kindly fix either the statement or the example so we know which is accurate, then will gladly try to solve the WHERE 
riddle for you!




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


[sqlite] partially excluding records

2014-02-21 Thread David Bicking
I have a table like

SELECT * FROM T1;
Key  Status
1  O
1  O
2  O
2  C
3  C
3  C
4  O
4  P


Now, I need to consolidate that data.

SELECT Key, COUNT(STATUS) Cnt
, MIN(STATUS) || CASE WHEN COUNT(STATUS)>1 THEN '+' ELSE '' END Statuses
FROM T1
WHERE ...
GROUP BY KEY;

Key  Cnt  Statuses
1  2 O
2  1 C
4  2 O+

The complication is that if a given key has any non-C value, the C values are 
to be excluded. If there are only C values, they are to be included.
How can I state the WHERE clause to do that?

Thanks,
David

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


Re: [sqlite] Problem with .mode line

2014-02-21 Thread RSmith


On 2014/02/20 16:58, pelek wrote:

indeed ! I tried to open same file with Programers Notepad and file looked
exacly like I need. But when I was opening file in standard windows notepad
then I got whole CREATE TABLE code in one line!
It is problem for me, because I am trying to open same file with c# code.
Unfortunetly c# is opening the code: CREATE TABLE in one line  - which is
wrong !! :( :( :(



Open it with C# code how?

Load a string or byte-stream from the file and then put it into some component? Probably the component is expecting full compatible 
line truncation which is platform dependent, and you can simply fix it by the following operation on your string (after loaded from 
file, but before using it in any component:


Replace all Linefeed  characters ( h0A ) with full Carriage-Return+Linefeed  characters ( h0D+h0A ) or the inter-OS string 
"\n".


On most Unix Systems a single LF character is taken as a new-line specifier, and the CR is ignored silently, which has the advantage 
that no matter if you use LF or CR + LF, you will see the same lines as a result. using just CR though has no real effect but can be 
used in post-processing to distinguish data items, etc.


Android works a bit different and Windows takes only a full CR+LF set as a formal line-break. The advantage here is that a normal 
line can contain multiple lines of information without being split down, whether you use only CR or only LF for it doesn't matter, 
the line is only broken if a full CR+LF is found. This is why your lines look like 1 line when it contains multiple lines. A bonus 
if you look to store multi-line data in single lines, but rather silly if you hope to display lines as lines and the originator is 
of Unix descent. Most OSes encodes the " \n " character in a string line to whatever the specific OS uses as a valid line-break. 
Still it is useless when the file is created on this OS only to be opened on another target OS.


I think in the case of the sqlite3.exe tool the thought is to use it the way it has always been from the Unix origins and not try to 
re-encode for other OS methods since existing apps may break if that suddenly changes - but it is very easy (as explained above) to 
simply fix the output for inter-OS compatibility. Note that this only applies to the tool's output, and not SQLite itself, which is 
ambivalent to line-breaks.



Take Care: using "\n" might change the actual string or length thereof if your 
app is multi-platform or web-based.



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


Re: [sqlite] Problem with .mode line

2014-02-21 Thread mm.w
hello,

this is only a problem of carriage returns or/and line feed.

http://notepad-plus-plus.org/

Best Regards.



On Thu, Feb 20, 2014 at 6:58 AM, pelek  wrote:

> indeed ! I tried to open same file with Programers Notepad and file looked
> exacly like I need. But when I was opening file in standard windows notepad
> then I got whole CREATE TABLE code in one line!
> It is problem for me, because I am trying to open same file with c# code.
> Unfortunetly c# is opening the code: CREATE TABLE in one line  - which is
> wrong !! :( :( :(
>
>
>
> --
> View this message in context:
> http://sqlite.1065341.n5.nabble.com/Problem-with-mode-line-tp74045p74058.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-users mailing list
sqlite-users@sqlite.org
http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users


Re: [sqlite] Wrong filename handling in sqlite3_load_extension() for Cygwin

2014-02-21 Thread Jan Nijtmans
2014-02-20 14:39 GMT+01:00 Jan Nijtmans :
> The function sqlite3_load_extension() on Cygwin expects a
> win32 path, even though it is compiled for Cygwin.

Here is a new version of my patch which fixes this bug,
which handles better the case that the path does not
contain slashes (just a bare filename). And added comments
to the function winConvertFromUtf8Filename(), making
it clearer what this function is supposed to do in Cygwin 1.7+

I plan to include some standard extensions in the
SQLite 3.8.4 build for Cygwin, this patch is needed
to make dynamical loading work at all on Cygwin.

I hope this patch will be given some time for proper
evaluation, so it can be included in SQLite 3.8.4.

The first chunk in this patch does the actual work,
the last 3 are only optimization, showing how other
code can be simplified when winConvertFromUtf8Filename
is modified to be able to handle Cygwin paths. More
optimizations like this are possible, and will be submitted
as follow-up.

Thanks to Joe for providing feedback at my previous
attempt! I hope this patch makes things clearer.

Regards,
   Jan Nijtmans

Index: src/os_win.c
==
--- src/os_win.c
+++ src/os_win.c
@@ -4127,14 +4127,51 @@
 /*
 ** Convert a UTF-8 filename into whatever form the underlying
 ** operating system wants filenames in.  Space to hold the result
 ** is obtained from malloc and must be freed by the calling
 ** function.
+**
+** On Cygwin 1.7 and higher, 3 possible input forms are accepted:
+** - If the filename starts with ":/" or ":\",
+**   it is converted to UTF-16 as-is.
+** - If the filename contains '/', it is assumed to be a
+**   Cygwin absolute path, it is converted to a win32
+**   absolute path in UTF-16.
+** - Otherwise it must be a filename only, the win32 filename
+**   is returned in UTF-16.
+** Note: The function cygwin_conv_path does not exist in
+**   Cygwin 1.5. Cygwin 1.7 does not run in Windows 95/98/ME.
+**   Therefore the !osIsNT() case does not need special handling.
+** Note 2: If the function cygwin_conv_path() fails, only
+**   UTF-8 -> UTF-16 conversion will be done. This can only
+**   happen when the file path >32k, in which case winUtf8ToUnicode()
+**   will fail too.
 */
 static void *winConvertFromUtf8Filename(const char *zFilename){
   void *zConverted = 0;
   if( osIsNT() ){
+#ifdef __CYGWIN__
+if( !(winIsDriveLetterAndColon(zFilename)
+&& winIsDirSep(zFilename[2])) ){
+  int nByte;
+  int convertflag = CCP_POSIX_TO_WIN_W;
+  if( !strchr(zFilename, '/') ) convertflag |= CCP_RELATIVE;
+  nByte = cygwin_conv_path(convertflag,
+  zFilename, 0, 0);
+  if( nByte>0 ){
+zConverted = sqlite3MallocZero(nByte);
+if ( zConverted==0 ){
+  return zConverted;
+}
+if( cygwin_conv_path(convertflag, zFilename,
+ zConverted, nByte)==0 ){
+  return zConverted;
+}
+sqlite3_free(zConverted);
+  }
+}
+#endif
 zConverted = winUtf8ToUnicode(zFilename);
   }
 #ifdef SQLITE_WIN32_HAS_ANSI
   else{
 zConverted = sqlite3_win32_utf8_to_mbcs(zFilename);
@@ -4243,11 +4280,11 @@
   /* If the path starts with a drive letter followed by the colon
   ** character, assume it is already a native Win32 path; otherwise,
   ** it must be converted to a native Win32 path via the Cygwin API
   ** prior to using it.
   */
-  if( winIsDriveLetterAndColon(zDir) ){
+  if( 1 ){
 zConverted = winConvertFromUtf8Filename(zDir);
 if( !zConverted ){
   sqlite3_free(zBuf);
   OSTRACE(("TEMP-FILENAME rc=SQLITE_IOERR_NOMEM\n"));
   return SQLITE_IOERR_NOMEM;
@@ -4256,10 +4293,11 @@
   sqlite3_snprintf(nMax, zBuf, "%s", zDir);
   sqlite3_free(zConverted);
   break;
 }
 sqlite3_free(zConverted);
+#if 0 /* not necessary any more */
   }else{
 zConverted = sqlite3MallocZero( nMax+1 );
 if( !zConverted ){
   sqlite3_free(zBuf);
   OSTRACE(("TEMP-FILENAME rc=SQLITE_IOERR_NOMEM\n"));
@@ -4290,10 +4328,11 @@
   sqlite3_free(zUtf8);
   sqlite3_free(zConverted);
   break;
 }
 sqlite3_free(zConverted);
+#endif /* not necessary any more */
   }
 }
   }
 #elif !SQLITE_OS_WINRT && !defined(__CYGWIN__)
   else if( osIsNT() ){
___
sqlite-users mailing list
sqlite-users@sqlite.org
http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users


Re: [sqlite] Latest Sqlite grammar as machine understandable file

2014-02-21 Thread Max Vlasov
On Fri, Feb 21, 2014 at 5:24 PM, Richard Hipp  wrote:
> On Fri, Feb 21, 2014 at 7:29 AM, Max Vlasov  wrote:
>
>>
>> The only one a little similar I found is
>>   http://www.sqlite.org/docsrc/artifact/873cf35adf14cf34
>>   ( mentioned as art/syntax/all-bnf.html )
>>
>
> An updated version of all-bnf.html has now been checked in at
> http://www.sqlite.org/docsrc/doc/trunk/art/syntax/all-bnf.html
>

Thanks a lot, that human-machine activity was much faster than my
writing reply post :)

My  thoughts about parsing was about using it to recognize some states
of user queries to suggest additional tasks. In a sense any query is a
small database containing for example
- the list of datasets used (might be a quick hint nearby),
- possible state of master-detail relationship (enabling menu item for
showing tow connected list views instead of the joined table)

I already tried to detect some states without parsing, but obviously
not so much is possible without full AST at hands.

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


Re: [sqlite] Latest Sqlite grammar as machine understandable file

2014-02-21 Thread Richard Hipp
On Fri, Feb 21, 2014 at 7:29 AM, Max Vlasov  wrote:

> Hi,
>
> Is there a machine-readable (BNF or other) grammar as equivalent to
> the current syntax diagrams?
>   http://www.sqlite.org/syntaxdiagrams.html
>
> The only one a little similar I found is
>   http://www.sqlite.org/docsrc/artifact/873cf35adf14cf34
>   ( mentioned as art/syntax/all-bnf.html )
>

An updated version of all-bnf.html has now been checked in at
http://www.sqlite.org/docsrc/doc/trunk/art/syntax/all-bnf.html

-- 
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] Latest Sqlite grammar as machine understandable file

2014-02-21 Thread Richard Hipp
On Fri, Feb 21, 2014 at 8:09 AM, Max Vlasov  wrote:

> On Fri, Feb 21, 2014 at 4:47 PM, Richard Hipp  wrote:
> > On Fri, Feb 21, 2014 at 7:29 AM, Max Vlasov 
> wrote:
> >
> >> Is there a machine-readable (BNF or other) grammar as equivalent to
> >
> > Not that I am aware of.
> >
>
> I just noticed the file ( bubble-generator-data.tcl )
>
> www.sqlite.org/docsrc/doc/tip/art/syntax/bubble-generator-data.tcl?mimetype=text/plain
> is it created by a human or by a machine?


That is the human-generated input file to the utility that creates the
bubble diagrams.

It looks like a good
> candidate, but might lack some essential information for parsing. If
> it was generated by a machine then the source of this generation might
> be next good candidate :)
>
> Max
> ___
> 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] Latest Sqlite grammar as machine understandable file

2014-02-21 Thread Max Vlasov
On Fri, Feb 21, 2014 at 4:47 PM, Richard Hipp  wrote:
> On Fri, Feb 21, 2014 at 7:29 AM, Max Vlasov  wrote:
>
>> Is there a machine-readable (BNF or other) grammar as equivalent to
>
> Not that I am aware of.
>

I just noticed the file ( bubble-generator-data.tcl )
  
www.sqlite.org/docsrc/doc/tip/art/syntax/bubble-generator-data.tcl?mimetype=text/plain
is it created by a human or by a machine? It looks like a good
candidate, but might lack some essential information for parsing. If
it was generated by a machine then the source of this generation might
be next good candidate :)

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


Re: [sqlite] Latest Sqlite grammar as machine understandable file

2014-02-21 Thread Richard Hipp
On Fri, Feb 21, 2014 at 7:29 AM, Max Vlasov  wrote:

> Hi,
>
> Is there a machine-readable (BNF or other) grammar as equivalent to
> the current syntax diagrams?
>   http://www.sqlite.org/syntaxdiagrams.html
>

Not that I am aware of.


-- 
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] Latest Sqlite grammar as machine understandable file

2014-02-21 Thread Max Vlasov
Hi,

Is there a machine-readable (BNF or other) grammar as equivalent to
the current syntax diagrams?
  http://www.sqlite.org/syntaxdiagrams.html

The only one a little similar I found is
  http://www.sqlite.org/docsrc/artifact/873cf35adf14cf34
  ( mentioned as art/syntax/all-bnf.html )

but it's pretty outdated (no CTE)

Thanks

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


Re: [sqlite] Problem with .mode line

2014-02-21 Thread pelek
indeed ! I tried to open same file with Programers Notepad and file looked
exacly like I need. But when I was opening file in standard windows notepad
then I got whole CREATE TABLE code in one line!
It is problem for me, because I am trying to open same file with c# code.
Unfortunetly c# is opening the code: CREATE TABLE in one line  - which is
wrong !! :( :( :(



--
View this message in context: 
http://sqlite.1065341.n5.nabble.com/Problem-with-mode-line-tp74045p74058.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


Re: [sqlite] Proposed enhancement to the sqlite3.exe command-line shell

2014-02-21 Thread RSmith


On 2014/02/21 11:54, _ph_ wrote:

Suggestion: Warning banner, and a .saveas command that copies the db to a
file.

(I haven't read the entire thread, sorry if this already came up.)


There is usually no call to read an entire thread, unless you decide to 
actually post an opinion, in which case it becomes paramount.



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


Re: [sqlite] Proposed enhancement to the sqlite3.exe command-line shell

2014-02-21 Thread _ph_
Suggestion: Warning banner, and a .saveas command that copies the db to a
file. 

(I haven't read the entire thread, sorry if this already came up.)



--
View this message in context: 
http://sqlite.1065341.n5.nabble.com/Proposed-enhancement-to-the-sqlite3-exe-command-line-shell-tp73827p74071.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