Re: [fossil-users] 'fossil sqlite3' db init issues

2013-09-02 Thread Stephan Beal
On Sun, Sep 1, 2013 at 11:43 PM, David Given d...@cowlark.com wrote:

 What I'm actually trying to do is to add some functionality which is
 accessed via a couple of extra SQL functions. What's the preferred way
 to do this?


Most of the custom funcs are registered in db.c:db_open(), but apparently
that one isn't used by the sqlite command:

[stephan@host:~/cvs/fossil/libfossil]$ f sqlite
SQLite version 3.8.1 2013-08-30 06:20:23
Enter .help for instructions
Enter SQL statements terminated with a ;
sqlite select now();
Error: no such function: now

It might help to split those func registrations into a separate function
and call it from both db_open() and the sqlite command setup.

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


Re: [fossil-users] 'fossil sqlite3' db init issues

2013-09-01 Thread David Given
On 29/08/13 23:19, David Given wrote:
[...]
 I enclose a patch which I think fixes it; please comment...

A little bit more investigation shows that there's actually several ways
in which the code initialises the database connection, and they all very
slightly, and I'm now a bit confused. It looks like the extra functions
described in sqlcmd_autoinit() only get registered when using 'fossil
sqlite3' (subject to the bug mentioned earlier). Other db connections,
such as the ones used when actually doing work, get re_add_sql_func()
called on them to register 'regexp()' but don't get the other functions.

What I'm actually trying to do is to add some functionality which is
accessed via a couple of extra SQL functions. What's the preferred way
to do this?

-- 
┌─── dg@cowlark.com ─ http://www.cowlark.com ─
│
│ Ripley's Law: Never go further for the cat than the cat would go for
│ you. --- Vexxarr Bleen (trans. Hunter Cressall)



signature.asc
Description: OpenPGP digital signature
___
fossil-users mailing list
fossil-users@lists.fossil-scm.org
http://lists.fossil-scm.org:8080/cgi-bin/mailman/listinfo/fossil-users


[fossil-users] 'fossil sqlite3' db init issues

2013-08-29 Thread David Given
I've found a minor bug in the way the patched sqlite3 shell handles
opening the db. In particular, this code from shell.c:

  if( data.zDbFilename==0 ){
#ifndef SQLITE_OMIT_MEMORYDB
data.zDbFilename = :memory:;
#else
fprintf(stderr,%s: Error: no database filename specified\n, Argv0);
return 1;
#endif
/* Begin Fossil Patch */
{
  extern void fossil_open(const char **);
  fossil_open(data.zDbFilename);
}
/* End Fossil Patch */
  }

  if( access(data.zDbFilename, 0)==0 ){
open_db(data);
  }

This is manifesting in a particularly confusing way. Specifically:

(a) 'fossil sqlite3' calls sqlcmd_autoinit
(b) 'fossil sqlite3 foo.fossil' does not

What's happening with (a), I think, is that fossil_open is opening
:memory:, which registers the autoinit handler, and then further down
the database is reopened with open_db which calls the handler.

However, with (b), :memory: is not being opened at all, therefore the
handler is not being registered, so open_db doesn't call it.

I enclose a patch which I think fixes it; please comment...

-- 
┌─── dg@cowlark.com ─ http://www.cowlark.com ─
│
│ Ripley's Law: Never go further for the cat than the cat would go for
│ you. --- Vexxarr Bleen (trans. Hunter Cressall)
--- src/shell.c
+++ src/shell.c
@@ -3230,27 +3230,25 @@
 data.zDbFilename = :memory:;
 #else
 fprintf(stderr,%s: Error: no database filename specified\n, Argv0);
 return 1;
 #endif
-/* Begin Fossil Patch */
-{
-  extern void fossil_open(const char **);
-  fossil_open(data.zDbFilename);
-}
-/* End Fossil Patch */
   }
+
   data.out = stdout;
 
   /* Go ahead and open the database file if it already exists.  If the
   ** file does not exist, delay opening it.  This prevents empty database
   ** files from being created if a user mistypes the database name argument
   ** to the sqlite command-line tool.
   */
-  if( access(data.zDbFilename, 0)==0 ){
-open_db(data);
+  /* Begin Fossil Patch */
+  {
+extern void fossil_open(const char **);
+fossil_open(data.zDbFilename);
   }
+  /* End Fossil Patch */
 
   /* Process the initialization file if there is one.  If no -init option
   ** is given on the command line, look for a file named ~/.sqliterc and
   ** try to process it.
   */



signature.asc
Description: OpenPGP digital signature
___
fossil-users mailing list
fossil-users@lists.fossil-scm.org
http://lists.fossil-scm.org:8080/cgi-bin/mailman/listinfo/fossil-users


Re: [fossil-users] fossil sqlite3

2012-12-31 Thread Petr Ferdus
 Od: Edward Berner e...@bernerfam.com
 Komu: fossil-users@lists.fossil-scm.org
 Datum: 31.12.2012 08:53
 Předmět: Re: [fossil-users] fossil sqlite3

On 12/30/2012 10:43 PM, Michael Richter wrote:
 Is there any way to execute SQL statements from the command line using 
 fossil sqlite3? The docs for this 
 http://www.fossil-scm.org/xfer/help?cmd=sqlite3 are a bit skimpy (to 
 say the least).  Like what are the /?OPTIONS?/ mentioned, precisely?

 What I'm specifically trying to accomplish is to extract the project 
 ID from the repository in a script file.  If there's another way to do 
 this I'm happy to use that instead, of course.

I think fossil info will get what you're looking for.  eg:

$ ../fossil info -R ~/fossil/test.fossil
project-name: unnamed
project-code: 07660919180b651835b3a51776a58007ca9fb6f9

fossil info calls it project-code but it seems to be the same thing 
that fossil new and fossil clone call project-id.

using  fossil sqlite3:

echo select value as 'project ID' from config where name = 'project-code'; 
statement.sql
fossil sqlite3 -R .\myfossilclone.fossil  .\statement.sql

(myfossilclone.fossil  is my clone of fossil repository)

Peter
___
fossil-users mailing list
fossil-users@lists.fossil-scm.org
http://lists.fossil-scm.org:8080/cgi-bin/mailman/listinfo/fossil-users


Re: [fossil-users] fossil sqlite3

2012-12-31 Thread Michael Richter
On 31 December 2012 15:53, Edward Berner e...@bernerfam.com wrote:

 fossil info calls it project-code but it seems to be the same thing
 that fossil new and fossil clone call project-id.


Waitwhat?  My version of Fossil (This is fossil version 1.25 [558a17a686]
2012-12-22 13:48:31 UTC) doesn't show anything about project-id for
fossil new/clone.

-- 
Perhaps people don't believe this, but throughout all of the discussions
of entering China our focus has really been what's best for the Chinese
people. It's not been about our revenue or profit or whatnot.
--Sergey Brin, demonstrating the emptiness of the don't be evil mantra.
___
fossil-users mailing list
fossil-users@lists.fossil-scm.org
http://lists.fossil-scm.org:8080/cgi-bin/mailman/listinfo/fossil-users


Re: [fossil-users] fossil sqlite3

2012-12-31 Thread Edward Berner

On 12/31/2012 12:24 AM, Michael Richter wrote:
On 31 December 2012 15:53, Edward Berner e...@bernerfam.com 
mailto:e...@bernerfam.com wrote:


fossil info calls it project-code but it seems to be the same
thing that fossil new and fossil clone call project-id.


Waitwhat?  My version of Fossil (This is fossil version 1.25 
[558a17a686] 2012-12-22 13:48:31 UTC) doesn't show anything about 
project-id for fossil new/clone.




What do you get when you create a test repository?  It should, I think, 
display the project-id, etc., after creating the repository. eg:


$ ./fossil new test.fossil
project-id: 2d7cade36dce2af94df648e178d588e5a3b00a14
server-id:  af94c0a2462bc18103a19c20fd0b3918c3f9a2a3
admin-user: erb (initial password is 811b05)

--
Edward

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


Re: [fossil-users] fossil sqlite3

2012-12-31 Thread Michael Richter
On 31 December 2012 17:27, Edward Berner e...@bernerfam.com wrote:

 Waitwhat?  My version of Fossil (This is fossil version 1.25 [558a17a686]
 2012-12-22 13:48:31 UTC) doesn't show anything about project-id for
 fossil new/clone.


 What do you get when you create a test repository?  It should, I think,
 display the project-id, etc., after creating the repository. eg:

 $ ./fossil new test.fossil
 project-id: 2d7cade36dce2af94df648e178d588**e5a3b00a14
 server-id:  af94c0a2462bc18103a19c20fd0b39**18c3f9a2a3
 admin-user: erb (initial password is 811b05)


Ah.  I misunderstood.  I thought you meant there was a command line option
related to the project ID.

-- 
Perhaps people don't believe this, but throughout all of the discussions
of entering China our focus has really been what's best for the Chinese
people. It's not been about our revenue or profit or whatnot.
--Sergey Brin, demonstrating the emptiness of the don't be evil mantra.
___
fossil-users mailing list
fossil-users@lists.fossil-scm.org
http://lists.fossil-scm.org:8080/cgi-bin/mailman/listinfo/fossil-users


Re: [fossil-users] fossil sqlite3

2012-12-31 Thread Tomek Kott
there might have been email overlap. fossil info also spits out the 
project-id. That's what Petr was saying I believe.
Date: Mon, 31 Dec 2012 17:51:31 +0800
From: ttmrich...@gmail.com
To: fossil-users@lists.fossil-scm.org
Subject: Re: [fossil-users] fossil sqlite3

On 31 December 2012 17:27, Edward Berner e...@bernerfam.com wrote:


Waitwhat?  My version of Fossil (This is fossil version 1.25 [558a17a686] 
2012-12-22 13:48:31 UTC) doesn't show anything about project-id for fossil 
new/clone.





What do you get when you create a test repository?  It should, I think, display 
the project-id, etc., after creating the repository. eg:



$ ./fossil new test.fossil

project-id: 2d7cade36dce2af94df648e178d588e5a3b00a14

server-id:  af94c0a2462bc18103a19c20fd0b3918c3f9a2a3

admin-user: erb (initial password is 811b05)
Ah.  I misunderstood.  I thought you meant there was a command line option 
related to the project ID.


-- 
Perhaps people don't believe this, but throughout all of the discussions of 
entering China our focus has really been what's best for the Chinese people. 
It's not been about our revenue or profit or whatnot.

--Sergey Brin, demonstrating the emptiness of the don't be evil mantra.


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


[fossil-users] fossil sqlite3

2012-12-30 Thread Michael Richter
Is there any way to execute SQL statements from the command line using
fossil sqlite3?  The docs for
thishttp://www.fossil-scm.org/xfer/help?cmd=sqlite3are a bit skimpy
(to say the least).  Like what are the
*?OPTIONS?* mentioned, precisely?

What I'm specifically trying to accomplish is to extract the project ID
from the repository in a script file.  If there's another way to do this
I'm happy to use that instead, of course.

-- 
Perhaps people don't believe this, but throughout all of the discussions
of entering China our focus has really been what's best for the Chinese
people. It's not been about our revenue or profit or whatnot.
--Sergey Brin, demonstrating the emptiness of the don't be evil mantra.
___
fossil-users mailing list
fossil-users@lists.fossil-scm.org
http://lists.fossil-scm.org:8080/cgi-bin/mailman/listinfo/fossil-users


Re: [fossil-users] fossil sqlite3

2012-12-30 Thread Edward Berner

On 12/30/2012 10:43 PM, Michael Richter wrote:
Is there any way to execute SQL statements from the command line using 
fossil sqlite3? The docs for this 
http://www.fossil-scm.org/xfer/help?cmd=sqlite3 are a bit skimpy (to 
say the least).  Like what are the /?OPTIONS?/ mentioned, precisely?


What I'm specifically trying to accomplish is to extract the project 
ID from the repository in a script file.  If there's another way to do 
this I'm happy to use that instead, of course.



I think fossil info will get what you're looking for.  eg:

$ ../fossil info -R ~/fossil/test.fossil
project-name: unnamed
project-code: 07660919180b651835b3a51776a58007ca9fb6f9

fossil info calls it project-code but it seems to be the same thing 
that fossil new and fossil clone call project-id.


--
Edward

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


Re: [fossil-users] fossil sqlite3 shell vs regular sqlite3 shell

2011-06-11 Thread Richard Hipp
On Sat, Jun 11, 2011 at 7:01 AM, Joerg Sonnenberger jo...@britannica.bec.de
 wrote:

 On Fri, Jun 10, 2011 at 10:09:52PM -0400, Martin Gagnon wrote:
  When use the fossil sqlite3 shell, the arrow key doesn't work and I
  get something like ^[[A caracter appearing on screen when I try the up
  arrow to access command history. (similar for left and right to move
  cursor)

 It doesn't provide the readline/libedit functionality.


It can if you recompile with the right command-line options.  I think:

-DHAVE_READLINE ... -lreadline -lncurses

The precompiled binaries do not do this because the necessarily libraries
are not available on every system.



 Joerg
 ___
 fossil-users mailing list
 fossil-users@lists.fossil-scm.org
 http://lists.fossil-scm.org:8080/cgi-bin/mailman/listinfo/fossil-users




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


Re: [fossil-users] fossil sqlite3 shell vs regular sqlite3 shell

2011-06-11 Thread Martin Gagnon
Le 2011-06-11 à 08:01, Richard Hipp d...@sqlite.org a écrit :

 
 
 On Sat, Jun 11, 2011 at 7:01 AM, Joerg Sonnenberger jo...@britannica.bec.de 
 wrote:
 On Fri, Jun 10, 2011 at 10:09:52PM -0400, Martin Gagnon wrote:
  When use the fossil sqlite3 shell, the arrow key doesn't work and I
  get something like ^[[A caracter appearing on screen when I try the up
  arrow to access command history. (similar for left and right to move
  cursor)
 
 It doesn't provide the readline/libedit functionality.
 
 It can if you recompile with the right command-line options.  I think:
 
 -DHAVE_READLINE ... -lreadline -lncurses
 
Thanks, I'll try this, I already compile it myself anyway.

 The precompiled binaries do not do this because the necessarily libraries are 
 not available on every system.
 
That's logical...

-- 
Martin___
fossil-users mailing list
fossil-users@lists.fossil-scm.org
http://lists.fossil-scm.org:8080/cgi-bin/mailman/listinfo/fossil-users


[fossil-users] fossil sqlite3 shell vs regular sqlite3 shell

2011-06-10 Thread Martin Gagnon
When use the fossil sqlite3 shell, the arrow key doesn't work and I
get something like ^[[A caracter appearing on screen when I try the up
arrow to access command history. (similar for left and right to move
cursor)

I'm get used to the regular sqlite3 shell because our product use sqlite3
database. With the regular sqlite3 shell, I can use the up and down
arrow key to get through command history, and left and right arrow to
move cursor on command line without any problem. It seems there's something
different on the fossil sqlite3 shell...

I notice this problem on Mac OSX (regular Terminal.App) and Ubuntu Linux.
For some reason, I tried on windows and it work (I don't really use windows;
but it might be useful to know..)

Someone else encounter the same problem ?

Thanks

-- 
Martin
___
fossil-users mailing list
fossil-users@lists.fossil-scm.org
http://lists.fossil-scm.org:8080/cgi-bin/mailman/listinfo/fossil-users