Re: [sqlite] Reading error outside the while

2007-10-10 Thread [EMAIL PROTECTED]

John Stanton a écrit :

John Stanton wrote:

[EMAIL PROTECTED] wrote:


John Stanton a écrit :


[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, &db);

   sqlite3_prepare_v2(db, sql, -1, &pStat, 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]
- 






Hello John,

Thanks for reply,

I just tested with your code that seem to be more useful, but 
something is wrong :


#include 
#include 


int main(void) {
   sqlite3 *db;
   sqlite3_stmt *pStat;
   const gchar  *dbname = "test.db";
   int  colcnt;


 int  rc;
 int  finished = 0;


  rc = sqlite3_open(dbname, &db);


 if (rc != SQLITE_OK) {
   printf("error\n");
   exit(1);
 }


   rc = sqlite3_prepare_v2(db, "SELECT * FROM TABLE1", -1, &pStat, 0);

  if (rc != SQLITE_OK) {
printf("error\n");
exit(1);
  }


   while(!finished) {

 rc = sqlite3_step(pstat);

   switch (rc) {

   case SQLITE_ROW:
 /*Get each column*/
 for (colcnt = 0; colcnt < sqlite3_column_count(pStat); 
colcnt++) {


 /*Handle returned data according to type.*/


   switch (sqlite3_column_type(pStat, 0)) {
 case SQLITE_TEXT:
   printf("%s %s ", sqlite3_colimn_name(pstat, colcnt),


sqlite3_column_text(pStat,0));


   break;


   case SQLITE_INTEGER:
 printf("%s %d ", sqlite3_column_name(pstat, colcnt),
 sqlite3_column_int(pstat);
 break;
/*!!!There are more types like SQLITE_NULL ...*/
 }  /*switch*/


 }/*for*/


   printf("\n");
   break;
 case SQLITE_BUSY:
   /*Busy logic*/
   break;
 case SQLITE_DONE:
   sqlite3_finalize(pstat);
   finished = 1;
   break;
 default:
   printf("Error\n");
   break;


   }  /*while*/
 sqlite3_close(db);
   exit(0);
}



You left out quite a bit of the example.  I have corrected it, but not 
tested the code.  This should print out a table of what you read.  
Take note that Sqlite does not have fixed types, so the programmer 
must be aware of that.


You also need to be aware of error conditions and busy states.



Whoops, I left out the sqlite3_step.  Corrected.

- 


To unsubscribe, send email to [EMAIL PROTECTED]
- 






Works perfectly, thanks you very much.

Fred.


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

Re: [sqlite] Reading error outside the while

2007-10-10 Thread John Stanton

John Stanton wrote:

[EMAIL PROTECTED] wrote:


John Stanton a écrit :


[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, &db);

   sqlite3_prepare_v2(db, sql, -1, &pStat, 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]
- 






Hello John,

Thanks for reply,

I just tested with your code that seem to be more useful, but 
something is wrong :


#include 
#include 


int main(void) {
   sqlite3 *db;
   sqlite3_stmt *pStat;
   const gchar  *dbname = "test.db";
   int  colcnt;


 int  rc;
 int  finished = 0;


  rc = sqlite3_open(dbname, &db);


 if (rc != SQLITE_OK) {
   printf("error\n");
   exit(1);
 }


   rc = sqlite3_prepare_v2(db, "SELECT * FROM TABLE1", -1, &pStat, 0);

  if (rc != SQLITE_OK) {
printf("error\n");
exit(1);
  }


   while(!finished) {

 rc = sqlite3_step(pstat);

   switch (rc) {

   case SQLITE_ROW:
 /*Get each column*/
 for (colcnt = 0; colcnt < sqlite3_column_count(pStat); 
colcnt++) {


 /*Handle returned data according to type.*/


   switch (sqlite3_column_type(pStat, 0)) {
 case SQLITE_TEXT:
   printf("%s %s ", sqlite3_colimn_name(pstat, colcnt),


sqlite3_column_text(pStat,0));


   break;


   case SQLITE_INTEGER:
 printf("%s %d ", sqlite3_column_name(pstat, colcnt),
 sqlite3_column_int(pstat);
 break;
/*!!!There are more types like SQLITE_NULL ...*/
 }  /*switch*/


 }/*for*/


   printf("\n");
   break;
 case SQLITE_BUSY:
   /*Busy logic*/
   break;
 case SQLITE_DONE:
   sqlite3_finalize(pstat);
   finished = 1;
   break;
 default:
   printf("Error\n");
   break;


   }  /*while*/
 sqlite3_close(db);
   exit(0);
}



You left out quite a bit of the example.  I have corrected it, but not 
tested the code.  This should print out a table of what you read.  Take 
note that Sqlite does not have fixed types, so the programmer must be 
aware of that.


You also need to be aware of error conditions and busy states.



Whoops, I left out the sqlite3_step.  Corrected.

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



Re: [sqlite] Reading error outside the while

2007-10-10 Thread John Stanton

[EMAIL PROTECTED] wrote:

John Stanton a écrit :


[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, &db);

   sqlite3_prepare_v2(db, sql, -1, &pStat, 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]
- 






Hello John,

Thanks for reply,

I just tested with your code that seem to be more useful, but something 
is wrong :


#include 
#include 


int main(void) {
   sqlite3 *db;
   sqlite3_stmt *pStat;
   const gchar  *dbname = "test.db";
   int  colcnt;

 int  rc;
 int  finished = 0;
   
   rc = sqlite3_open(dbname, &db);

 if (rc != SQLITE_OK) {
   printf("error\n");
   exit(1);
 }

   rc = sqlite3_prepare_v2(db, "SELECT * FROM TABLE1", -1, &pStat, 0);

   while(!finished) {

   switch (rc) {

   case SQLITE_ROW:
 /*Get each column*/
 for (colcnt = 0; colcnt < sqlite3_column_count(pStat); colcnt++) {

 /*Handle returned data according to type.*/

   switch (sqlite3_column_type(pStat, 0)) {
 case SQLITE_TEXT:
   printf("%s %s ", sqlite3_colimn_name(pstat, colcnt),

sqlite3_column_text(pStat,0));

   break;

   case SQLITE_INTEGER:
 printf("%s %d ", sqlite3_column_name(pstat, colcnt),
 sqlite3_column_int(pstat);
 break;
/*!!!There are more types like SQLITE_NULL ...*/
 }  /*switch*/

 }/*for*/

   printf("\n");
   break;
 case SQLITE_BUSY:
   /*Busy logic*/
   break;
 case SQLITE_DONE:
   sqlite3_finalize(pstat);
   finished = 1;
   break;
 default:
   printf("Error\n");
   break;

   }  /*while*/
  
   sqlite3_close(db);

   exit(0);

}



You left out quite a bit of the example.  I have corrected it, but not 
tested the code.  This should print out a table of what you read.  Take 
note that Sqlite does not have fixed types, so the programmer must be 
aware of that.


You also need to be aware of error conditions and busy states.

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



Re: [sqlite] Reading error outside the while

2007-10-10 Thread [EMAIL PROTECTED]

John Stanton a écrit :

[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, &db);

   sqlite3_prepare_v2(db, sql, -1, &pStat, 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]
- 






Hello John,

Thanks for reply,

I just tested with your code that seem to be more useful, but something is 
wrong :

#include 
#include 


int main(void)
{
sqlite3 *db;
   sqlite3_stmt *pStat;
   const gchar *dbname = "test.db";
   int i;
   
	

sqlite3_open(dbname, &db);
   sqlite3_prepare_v2(db, "SELECT * FROM TABLE1", -1, &pStat, 0);

   while(sqlite3_step(pStat) != SQLITE_DONE)
   {
switch (sqlite3_step(pStat)) {
 case SQLITE_ROW:
/*Get each column*/
 	for (i = 0; i < sqlite3_column_count(pStat); i++) 
 	{

   switch (sqlite3_column_type(pStat,0))
{
case SQLITE_TEXT:
printf("%s ", sqlite3_column_text(pStat,0));
break;
}
 break;
   
 	}

   }
   }

   sqlite3_close(db);

return 0;
}


-
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, &db);

sqlite3_prepare_v2(db, sql, -1, &pStat, 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, &db);
sqlite3_prepare_v2(db, sql, -1, &pStat, 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, &db);
sqlite3_prepare_v2(db, sql, -1, &pStat, 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, &db);

   sqlite3_prepare_v2(db, sql, -1, &pStat, 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]
-



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]
-