Re: [sqlite] how to get file handle from sqlite3 object?

2007-10-09 Thread Cyrus Durgin
Maybe it would help to state my use case: without this functionality, what
is the proper way to copy a database using the C API without introducing a
race condition?

On 10/9/07, Robert Simpson <[EMAIL PROTECTED]> wrote:
>
> > -Original Message-
> > From: Cyrus Durgin [mailto:[EMAIL PROTECTED]
> > Sent: Tuesday, October 09, 2007 5:02 PM
> > To: sqlite-users@sqlite.org
> > Subject: [sqlite] how to get file handle from sqlite3 object?
> >
> > i'm wondering if there's a "standard" way to get an open file
> > handle from an
> > sqlite3 pointer using the C API.  anyone know?
> >
>
> There's no public way to get this, nor should there be.  The internal
> implementation of the database should be kept separate from the logical
> API
> to access it.  Such a function would muddy the water between
> implementation
> and interface and hamper the ability to change the implementation without
> changing the interface.
>
> Not all filesystems would be able to return one, nor could it guarantee
> that
> the database is in fit state for someone to fiddle with its internal
> handle.
> Furthermore, it could not be guaranteed that once a caller obtained the
> handle that the caller might then do something damaging to it or alter its
> state.
>
> Such a function definitely falls into the BAD IDEA category, IMO.
>
> Robert
>
>
>
>
> -
> To unsubscribe, send email to [EMAIL PROTECTED]
>
> -
>
>


-- 
Cyrus.
<[EMAIL PROTECTED]>


Re: [sqlite] how to get file handle from sqlite3 object?

2007-10-09 Thread Joe Wilson
--- Cyrus Durgin <[EMAIL PROTECTED]> wrote:
> i'm wondering if there's a "standard" way to get an open file handle from an
> sqlite3 pointer using the C API.  anyone know?

Patch below implements getting a file descriptor for a UNIX database 
using the existing sqlite3 API function sqlite3_file_control() and a 
new non-standard option SQLITE_FCNTL_FD. If the function succeeds 
SQLITE_OK is returned.

Sample usage:

 // The second parameter to sqlite3_file_control is the database alias.
 // "main" is the default database alias.
 // If you ran the command "attach database 'test.db' as 'whatever';",
 // then "whatever" would be the second parameter.
 int fd = -1;
 if (SQLITE_OK == sqlite3_file_control(db, "main", SQLITE_FCNTL_FD, )){
   printf("\nSQLITE_FCNTL_FD = %d\n", fd);
 }

Patch is OS dependent. To add Windows support, change winFileControl in 
os_win.c in the same way as unixFileControl below.

_
Index: src/os_unix.c
===
RCS file: /sqlite/sqlite/src/os_unix.c,v
retrieving revision 1.169
diff -u -3 -p -r1.169 os_unix.c
--- src/os_unix.c   20 Sep 2007 10:02:54 -  1.169
+++ src/os_unix.c   10 Oct 2007 03:51:41 -
@@ -2018,6 +2018,10 @@ static int unixFileControl(sqlite3_file
   *(int*)pArg = ((unixFile*)id)->locktype;
   return SQLITE_OK;
 }
+case SQLITE_FCNTL_FD: {
+  *(int*)pArg = ((unixFile*)id)->h;
+  return SQLITE_OK;
+}
   }
   return SQLITE_ERROR;
 }
Index: src/sqlite.h.in
===
RCS file: /sqlite/sqlite/src/sqlite.h.in,v
retrieving revision 1.266
diff -u -3 -p -r1.266 sqlite.h.in
--- src/sqlite.h.in 3 Oct 2007 20:15:28 -   1.266
+++ src/sqlite.h.in 10 Oct 2007 03:51:42 -
@@ -557,6 +557,7 @@ struct sqlite3_io_methods {
 ** is defined.
 */
 #define SQLITE_FCNTL_LOCKSTATE1
+#define SQLITE_FCNTL_FD   64

 /*
 ** CAPI3REF: Mutex Handle




   

Take the Internet to Go: Yahoo!Go puts the Internet in your pocket: mail, news, 
photos & more. 
http://mobile.yahoo.com/go?refer=1GNXIC

-
To unsubscribe, send email to [EMAIL PROTECTED]
-



RE: [sqlite] how to get file handle from sqlite3 object?

2007-10-09 Thread Robert Simpson
> -Original Message-
> From: Cyrus Durgin [mailto:[EMAIL PROTECTED] 
> Sent: Tuesday, October 09, 2007 5:02 PM
> To: sqlite-users@sqlite.org
> Subject: [sqlite] how to get file handle from sqlite3 object?
> 
> i'm wondering if there's a "standard" way to get an open file 
> handle from an
> sqlite3 pointer using the C API.  anyone know?
> 

There's no public way to get this, nor should there be.  The internal
implementation of the database should be kept separate from the logical API
to access it.  Such a function would muddy the water between implementation
and interface and hamper the ability to change the implementation without
changing the interface.

Not all filesystems would be able to return one, nor could it guarantee that
the database is in fit state for someone to fiddle with its internal handle.
Furthermore, it could not be guaranteed that once a caller obtained the
handle that the caller might then do something damaging to it or alter its
state.

Such a function definitely falls into the BAD IDEA category, IMO.

Robert



-
To unsubscribe, send email to [EMAIL PROTECTED]
-



Re: [sqlite] how to get file handle from sqlite3 object?

2007-10-09 Thread Joe Wilson
--- Cyrus Durgin <[EMAIL PROTECTED]> wrote:
> i'm wondering if there's a "standard" way to get an open file handle from an
> sqlite3 pointer using the C API.  anyone know?

No such function exists, but it would be a useful addition to the API.
Copying the database during an exclusive lock without spawning a process 
for instance...

  http://www.sqlite.org/cvstrac/tktview?tn=2665



  

Tonight's top picks. What will you watch tonight? Preview the hottest shows on 
Yahoo! TV.
http://tv.yahoo.com/ 


-
To unsubscribe, send email to [EMAIL PROTECTED]
-



Re: [sqlite] how to get file handle from sqlite3 object?

2007-10-09 Thread Vitali Lovich
Can you please clarify why this would be needed?  Sqlite databases are 
opened by name, thereby you can use standard OS or stdlib functions to 
open the same file with a different handle.


Cyrus Durgin wrote:

i'm wondering if there's a "standard" way to get an open file handle from an
sqlite3 pointer using the C API.  anyone know?

  


-
To unsubscribe, send email to [EMAIL PROTECTED]
-



Re: [sqlite] SELECT crashes with small cache?

2007-10-09 Thread Richard Klein

Joe Wilson wrote:

--- Richard Klein <[EMAIL PROTECTED]> wrote:

I am seeing SQLite crashing during execution
of a SELECT statement when I make the page
cache very small (40 pages).

When I bump the cache up to 50 pages, the
problem goes away.

The problem only occurs on my RISC platform,
not on my x86-based platform.  Also, I am
using SQLite 2 (not 3).


I've never used the sqlite2 library, so I can't comment on that.
But sqlite3 does a lot of checking in low memory situations
and has very robust error handling and recovery.
For example, SQLite3 is the only complex library I've seen that 
can survive malloc returning NULL for no memory.


Actually, sqlite2 seems to manage quite nicely in
low memory situations, at least on my x86-based
platform:  I was able to reduce MAX_PAGES to 1,
and TEMP_PAGES to 0, and sqlite2 still seemed to
run just fine.

It's only on my SPARC-based platform that I have
any problem, and that could be due to factors
beyond sqlite2's control.  For example, there
could be a problem with the way we've redefined
malloc() and free() on that platform.

Without a decent debugger on that platform, it's
difficult to track down the problem.  However,
I'm not going to worry about it right now; instead,
I'm going to upgrade to sqlite3.  If the problem
still exists after I upgrade, then I'll worry it.

- Richard Klein


-
To unsubscribe, send email to [EMAIL PROTECTED]
-

[sqlite] how to get file handle from sqlite3 object?

2007-10-09 Thread Cyrus Durgin
i'm wondering if there's a "standard" way to get an open file handle from an
sqlite3 pointer using the C API.  anyone know?

-- 
Cyrus.
<[EMAIL PROTECTED]>


Re: [sqlite] auto library function loading

2007-10-09 Thread Kees Nuyt
On Tue, 9 Oct 2007 07:06:48 -0700 (PDT), you wrote:

> Is there a way for SQLITE to automatically load user
> defined functions at database instantiation or upon
> database connection? 

You can put a file .sqliterc in the users homedirectory with
commands for the command line tool. They will be executed
immediately after the database is opened.

That might do (part of) what you need.

D:\opt\research>sqlite3 tmp/test_05.db3
-- Loading resources from C:\Users\knuytadm/.sqliterc
.bail ON
.mode tabs
select * from sqlite_master;
table   testTbl testTbl 2   CREATE TABLE testTbl(
t_id INTEGER PRIMARY KEY,
t_name TEXT
)
SQLite version 3.4.2
Enter ".help" for instructions
sqlite>

Hope this helps.
Regards,
-- 
  (  Kees Nuyt
  )
c[_]

-
To unsubscribe, send email to [EMAIL PROTECTED]
-



[sqlite] Re: Reading error outside the while

2007-10-09 Thread Igor Tandetnik

[EMAIL PROTECTED] wrote:

sqlite3_open(dbname, );
  sqlite3_prepare_v2(db, sql, -1, , 0);

   while(sqlite3_step(pStat) == SQLITE_ROW)
   {
row = (char *)sqlite3_column_text(pStat, 0);
my_array[i] = malloc( sizeof row *  sizeof *my_array[i]);

memcpy (my_array[i], row, sizeof row * sizeof *my_array[i]);


sizeof(row) == sizeof(char*) == 4 (assuming a 32-bit system). In any 
case, sizeof(row) is completely unrelated to the length of the string 
'row' might be pointing to. See sqlite3_column_bytes.



   printf ("%s\n",my_array[i]); // ok


Are you sure the output is correct here? It's only possible if your 
strings happen to be short enough to fit in 4 bytes.




i++;
   }

for (i = 0; i<3; i++);{
printf ("%s\n", my_array[i]); //error


Remove the semicolon between the closing paren and the opening brace. 
Your code as written is equivalent to this:


for (i = 0; i < 3; i++) {
   // loop body is empty
}

// At this point, i == 3
printf ("%s\n", my_array[3]);  // index out of bounds


free (my_array);


You haven't allocated my_array with malloc, so you shouldn't deallocate 
it with free. Your program will likely crash on this statement.


You did allocate my_array[0], my_array[1] and my_array[2] with malloc, 
so you should deallocate these three pointers with free. Do you 
understand the difference?



With all due respect, I suggest you spend some time with your favorite C 
textbook. The problems in your code have very little to do with SQLite, 
and a lot to do with misusing C language.


Igor Tandetnik 



-
To unsubscribe, send email to [EMAIL PROTECTED]
-



Re[2]: [sqlite] Reading error outside the while

2007-10-09 Thread Teg


The original example's an accident waiting to happen. You've hard
coded the results to 3 but, not limited the number of loops in the
while loop so, you could easily crash/corrupt the stack. You'll crash
if you have less than 3 results too. What happens if you only get one
result from the while loop? You're going to induce a crash in the
printf, even with the strdup.

I'd pull the while loop out and verify that you can make it work for
one item. Then expand it to work with more items.


const char *dbname = "test.db";
const char *sql = "SELECT * FROM table1";
const unsigned char *my_array[3];
int i=0;;


 sqlite3_open(dbname, );
sqlite3_prepare_v2(db, sql, -1, , 0);

 while(sqlite3_step(pStat) == SQLITE_ROW && (i < 3))
 {
   const char* pszData = sqlite3_column_text(pStat, 0);
   if( pszData )
   {
my_array[i] = strdup(pszData)
printf ("%s\n",pszData); // ok
 i++;
   }
 }

 
 //
 // Only printf what you actually read in
 //
 int Loop = 0;
 for (Loop  = 0; Loop < i; Loop++);
 {
   printf ("%s\n", my_array[Loop]); // error
 }



Tuesday, October 9, 2007, 10:50:57 AM, you wrote:

>> 
>> 
>> "[EMAIL PROTECTED]" <[EMAIL PROTECTED]> wrote: Hello,
>> 
>> I got an error when I try to read some data outside the while{}, inside the 
>> while{} it's ok, an idea ?
>> test.db have just one "table1" and a "field1" with values "one", "two", 
>> "three".
>> 
>> 
>> #include 
>> #include 
>> 
>> int main(void)
>> {
>> sqlite3 *db;
>> sqlite3_stmt *pStat;
>> 
>> const char *dbname = "test.db";
>> const char *sql = "SELECT * FROM table1";
>> const unsigned char *my_array[3];
>> int i=0;;
>>   
>>  
>> sqlite3_open(dbname, );
>> sqlite3_prepare_v2(db, sql, -1, , 0);
>> 
>> while(sqlite3_step(pStat) == SQLITE_ROW)
>> {
>>  my_array[i] = sqlite3_column_text(pStat, 0);
>>  printf ("%s\n",my_array[i]); // ok
>> 
>>  i++;
>> }
>> 
>> for (i = 0; i<3; i++);{
>>  printf ("%s\n", my_array[i]); // error
>> }
>>
>> sqlite3_finalize(pStat);
>> sqlite3_close(db);
>>  
>> return 0;
>> }
>> 
>> 
>> Fred.
>> 
>> 
>> -
>> To unsubscribe, send email to [EMAIL PROTECTED]
>> -
>> 
>> 
>> 

fff> Ken a écrit :
>> You need to make a copy of the str instead of just capturing a pointer 
>> reference.
>> 
>> try:
>>   my_array[i] = strdup(sqlite3_column_text(pStat, 0));
>> 

fff> Its same with strdup()


fff> 
-
fff> To unsubscribe, send email to [EMAIL PROTECTED]
fff> 
-



-- 
Best regards,
 Tegmailto:[EMAIL PROTECTED]


-
To unsubscribe, send email to [EMAIL PROTECTED]
-



Re: [sqlite] auto library function loading

2007-10-09 Thread John Stanton

Ken wrote:
Is there a way for SQLITE to automatically load user defined functions at database instantiation or upon database connection? 
   
Can it test for a .so/.dll and perform a call to load user functions? If the .dll does not exist maybe issue a warning? 


Just a thought as a way to allow users to create their own  presentation 
library to implement things like math functions/ presentation functions etc 
without having to make and maintain code changes to the core software.



Build your own wrapper for the sqlite3_open API function.  You can have 
some form of library of user defined functions which you bind just after 
you have made a DB connection.



-
To unsubscribe, send email to [EMAIL PROTECTED]
-



Re: [sqlite] Reading error outside the while

2007-10-09 Thread [EMAIL PROTECTED]





"[EMAIL PROTECTED]" <[EMAIL PROTECTED]> wrote: Hello,

I got an error when I try to read some data outside the while{}, inside the 
while{} it's ok, an idea ?
test.db have just one "table1" and a "field1" with values "one", "two", "three".


#include 
#include 


int main(void)
{
sqlite3 *db;
sqlite3_stmt *pStat;

const char *dbname = "test.db";
const char *sql = "SELECT * FROM table1";
const unsigned char *my_array[3];
int i=0;;
  
 
sqlite3_open(dbname, );

sqlite3_prepare_v2(db, sql, -1, , 0);

while(sqlite3_step(pStat) == SQLITE_ROW)

{
 my_array[i] = sqlite3_column_text(pStat, 0);
 printf ("%s\n",my_array[i]); // ok

 i++;
}

for (i = 0; i<3; i++);{
 printf ("%s\n", my_array[i]); // error
}
 
sqlite3_finalize(pStat);

sqlite3_close(db);
 
return 0;

}


Fred.


-
To unsubscribe, send email to [EMAIL PROTECTED]
-





Ken a écrit :

You need to make a copy of the str instead of just capturing a pointer 
reference.

try:
  my_array[i] = strdup(sqlite3_column_text(pStat, 0));



Its same with strdup()


-
To unsubscribe, send email to [EMAIL PROTECTED]
-



Re: [sqlite] Reading error outside the while

2007-10-09 Thread [EMAIL PROTECTED]

Simon Davies a écrit :

On 09/10/2007, [EMAIL PROTECTED] <[EMAIL PROTECTED]> wrote:

Hello,

I got an error when I try to read some data outside the while{}, inside the 
while{} it's ok, an idea ?
test.db have just one "table1" and a "field1" with values "one", "two", "three".

.
.
.

   const unsigned char *my_array[3];

.

   while(sqlite3_step(pStat) == SQLITE_ROW)
   {
   my_array[i] = sqlite3_column_text(pStat, 0);
   printf ("%s\n",my_array[i]); // ok

   i++;
   }

   for (i = 0; i<3; i++);{
   printf ("%s\n", my_array[i]); // error
   }



Hi Fred,

sqlite3_column_text is returning a pointer to a text string stored
within sqlite's private address space. If you want to access that data
after calling sqlite_step() again, then copy the data to some storage
of your own.

i.e
unsigned char* my_array[3];

while(sqlite3_step(pStat) == SQLITE_ROW)
{
my_array[i] = malloc( sqlite3_column_bytes(pStat, 0) );
memcpy( my_array[i], sqlite3_column_text(pStat, 0));
printf ("%s\n",my_array[i]);
i++;
}

for (i = 0; i<3; i++);{
printf ("%s\n", my_array[i]);
free( my_array[i] );
}

(or something like this - have not tested this code...)

Rgds,
Simon

-
To unsubscribe, send email to [EMAIL PROTECTED]
-






Thanks for your reply Simon.
I tried that code but it same :


#include 
#include 
#include 
#include 


int main(void)
{
sqlite3 *db;
   sqlite3_stmt *pStat;

   const char *dbname = "test.db";
   const char *sql = "SELECT * FROM table1";
   char *row;
   char *my_array[3];
   int i=0;
 
	

sqlite3_open(dbname, );
sqlite3_prepare_v2(db, sql, -1, , 0);
   
   while(sqlite3_step(pStat) == SQLITE_ROW)

   {
row = (char *)sqlite3_column_text(pStat, 0);
my_array[i] = malloc( sizeof row *  sizeof *my_array[i]);

memcpy (my_array[i], row, sizeof row * sizeof *my_array[i]);
printf ("%s\n",my_array[i]); // ok

i++;
   }

for (i = 0; i<3; i++);{
printf ("%s\n", my_array[i]); //error
free (my_array);
}

sqlite3_finalize(pStat);
sqlite3_close(db);

return 0;
}


-
To unsubscribe, send email to [EMAIL PROTECTED]
-



Re: [sqlite] Reading error outside the while

2007-10-09 Thread Ken
You need to make a copy of the str instead of just capturing a pointer 
reference.

try:
  my_array[i] = strdup(sqlite3_column_text(pStat, 0));



"[EMAIL PROTECTED]" <[EMAIL PROTECTED]> wrote: Hello,

I got an error when I try to read some data outside the while{}, inside the 
while{} it's ok, an idea ?
test.db have just one "table1" and a "field1" with values "one", "two", "three".


#include 
#include 

int main(void)
{
sqlite3 *db;
sqlite3_stmt *pStat;

const char *dbname = "test.db";
const char *sql = "SELECT * FROM table1";
const unsigned char *my_array[3];
int i=0;;
  
 
sqlite3_open(dbname, );
sqlite3_prepare_v2(db, sql, -1, , 0);

while(sqlite3_step(pStat) == SQLITE_ROW)
{
 my_array[i] = sqlite3_column_text(pStat, 0);
 printf ("%s\n",my_array[i]); // ok

 i++;
}

for (i = 0; i<3; i++);{
 printf ("%s\n", my_array[i]); // error
}
 
sqlite3_finalize(pStat);
sqlite3_close(db);
 
return 0;
}


Fred.


-
To unsubscribe, send email to [EMAIL PROTECTED]
-




Re: [sqlite] Reading error outside the while

2007-10-09 Thread John Stanton

[EMAIL PROTECTED] wrote:

Hello,

I got an error when I try to read some data outside the while{}, inside 
the while{} it's ok, an idea ?
test.db have just one "table1" and a "field1" with values "one", "two", 
"three".



#include 
#include 

int main(void)
{
   sqlite3 *db;
   sqlite3_stmt *pStat;

   const char *dbname = "test.db";
   const char *sql = "SELECT * FROM table1";
   const unsigned char *my_array[3];
   int i=0;;
 

   sqlite3_open(dbname, );

   sqlite3_prepare_v2(db, sql, -1, , 0);
  while(sqlite3_step(pStat) == SQLITE_ROW)
   {
my_array[i] = sqlite3_column_text(pStat, 0);
   printf ("%s\n",my_array[i]); // ok

i++;
   }

   for (i = 0; i<3; i++);{
printf ("%s\n", my_array[i]); // error
   }

   sqlite3_finalize(pStat);

   sqlite3_close(db);

   return 0;

}


Fred.



Your program is wrongly structured.  Try this layout:

sqlite3_prepare_V2

while (TRUE) {
  rc = sqlite3_step
  switch (rc) {
case SQLITE_ROW:
  /*Get each column*/
  for (count = 0; count > sqlite3_column_count; count++) {
switch (sqlite3_column_type) {
  case SQLITE_TEXT:
pt = sqlite3_column_text
/*Move text into your output*/
sprintf(outval, "%s", pt);  /*Or some other move.*/
break;
  case SQLITE_INTEGER:
outnbr = sqlite3_column_int;
or
sprintf(outval, "%d", sqlite_column_int(..));
break;
  
  add other types
 }
}
  break;
case SQLITE_DONE:
  sqlite3_finalize
  return from function
case SQLITE_BUSY:
  /*Handle BUSY condition.*/
  break;
default:
  /*Handle error condition.*/
  break;
   } /*switch*/
  }  /*while*/

Now you can handle errors, busy conditions and the return of differring
types from Sqlite.  When you get a pointer to a text value from Sqlite 
it is the programmer's responsibility to move data from that pointer 
into data in your program.


-
To unsubscribe, send email to [EMAIL PROTECTED]
-



[sqlite] auto library function loading

2007-10-09 Thread Ken
Is there a way for SQLITE to automatically load user defined functions at 
database instantiation or upon database connection? 
   
Can it test for a .so/.dll and perform a call to load user functions? If 
the .dll does not exist maybe issue a warning? 

Just a thought as a way to allow users to create their own  presentation 
library to implement things like math functions/ presentation functions etc 
without having to make and maintain code changes to the core software.





Re: [sqlite] Reading error outside the while

2007-10-09 Thread Simon Davies
On 09/10/2007, [EMAIL PROTECTED] <[EMAIL PROTECTED]> wrote:
> Hello,
>
> I got an error when I try to read some data outside the while{}, inside the 
> while{} it's ok, an idea ?
> test.db have just one "table1" and a "field1" with values "one", "two", 
> "three".
.
.
.
>const unsigned char *my_array[3];
.
>while(sqlite3_step(pStat) == SQLITE_ROW)
>{
>my_array[i] = sqlite3_column_text(pStat, 0);
>printf ("%s\n",my_array[i]); // ok
>
>i++;
>}
>
>for (i = 0; i<3; i++);{
>printf ("%s\n", my_array[i]); // error
>}
>

Hi Fred,

sqlite3_column_text is returning a pointer to a text string stored
within sqlite's private address space. If you want to access that data
after calling sqlite_step() again, then copy the data to some storage
of your own.

i.e
unsigned char* my_array[3];

while(sqlite3_step(pStat) == SQLITE_ROW)
{
my_array[i] = malloc( sqlite3_column_bytes(pStat, 0) );
memcpy( my_array[i], sqlite3_column_text(pStat, 0));
printf ("%s\n",my_array[i]);
i++;
}

for (i = 0; i<3; i++);{
printf ("%s\n", my_array[i]);
free( my_array[i] );
}

(or something like this - have not tested this code...)

Rgds,
Simon

-
To unsubscribe, send email to [EMAIL PROTECTED]
-



[sqlite] Reading error outside the while

2007-10-09 Thread [EMAIL PROTECTED]

Hello,

I got an error when I try to read some data outside the while{}, inside the 
while{} it's ok, an idea ?
test.db have just one "table1" and a "field1" with values "one", "two", "three".


#include 
#include 

int main(void)
{
   sqlite3 *db;
   sqlite3_stmt *pStat;

   const char *dbname = "test.db";
   const char *sql = "SELECT * FROM table1";
   const unsigned char *my_array[3];
   int i=0;;
 
	

   sqlite3_open(dbname, );
   sqlite3_prepare_v2(db, sql, -1, , 0);
   
   while(sqlite3_step(pStat) == SQLITE_ROW)

   {
my_array[i] = sqlite3_column_text(pStat, 0);
printf ("%s\n",my_array[i]); // ok

i++;
   }

   for (i = 0; i<3; i++);{
printf ("%s\n", my_array[i]); // error
   }

   sqlite3_finalize(pStat);
   sqlite3_close(db);

   return 0;
}


Fred.


-
To unsubscribe, send email to [EMAIL PROTECTED]
-



Re: [sqlite] Null-ifying the columns

2007-10-09 Thread Dan Kennedy
On Mon, 2007-10-08 at 02:03 -0700, chetana bhargav wrote:
> SQL Guru's,
> 
> Want to know is there any easy way to make all the columns in a particular 
> row to NULL other than specifying column name and NULL value, no delete as 
> that would change the row-id

What happens if you do:

  INSERT OR REPLACE INTO tbl (rowid) SELECT rowid FROM tbl WHERE
;

when all the column defaults are NULL (the default default)?

Dan.



> -x-
> Chetana
> 
> 
>
> 
> Be a better Heartthrob. Get better relationship answers from someone who 
> knows. Yahoo! Answers - Check it out. 
> http://answers.yahoo.com/dir/?link=list=396545433


-
To unsubscribe, send email to [EMAIL PROTECTED]
-