[sqlite] Data base locked.

2012-02-20 Thread bhaskarReddy

Hi Friends,

   While running Data base with sqlite, i am getting error as Data
base locked.

How to resolve from this error.

Regards,
Bhaskar.
-- 
View this message in context: 
http://old.nabble.com/Data-base-locked.-tp33355225p33355225.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] undefined reference to `sqlite3_db_release_memory'

2012-02-17 Thread bhaskarReddy

Hi Friends,

While i am trying to use `sqlite3_db_release_memory'. I am
getting error and warning as,

createTable.c: In function ‘db_create_table’:
createTable.c:98: warning: implicit declaration of function
‘sqlite3_db_release_memory’
/tmp/ccSyJXew.o: In function `db_create_table':
createTable.c:98: undefined reference to `sqlite3_db_release_memory'
collect2: ld returned 1 exit status

Why it is coming like this.


Regards,
Bhaskar.

-- 
View this message in context: 
http://old.nabble.com/undefined-reference-to-%60sqlite3_db_release_memory%27-tp33341162p33341162.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] How to check whether a selected row is present in the table or not.

2012-02-15 Thread bhaskarReddy

Hi Friends,

   I want to select a row based on some column values. If the row is
matched, the particular values corresponding row can be displayed.

   If not matched and empty message getting displaying. 

   Now my problem is, i want to check whether there is a row with
given column values or not. If the row is there, i'll extract the contents
of that particular row. Other wise return with an error.

   How can i check whether a row is there or not, for particular
column values.


Regards,
Bhaskar.
-- 
View this message in context: 
http://old.nabble.com/How-to-check-whether-a-selected-row-is-present-in-the-table-or-not.-tp33327851p33327851.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] How to check whether a table is empty or not in sqlite.

2012-02-13 Thread bhaskarReddy

HI Friends,

How to check whether a table is empty or not. If a table is empty, i
want to do some logic. If not another logic.


 Can any one tell me how to check if table in a data base is empty
or not, using sqlite3.


Regards,
Bhaskar.
-- 
View this message in context: 
http://old.nabble.com/How-to-check-whether-a-table-is-empty-or-not-in-sqlite.-tp33314679p33314679.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] sqlite3_step getting core dumbed.

2012-02-09 Thread bhaskarReddy

PRAGMA table_info(yourtablename); will display  colNumber, colName, colType,

ex: 0|slotId|INTEGER|0||0
1|ponChannelId|INTEGER|0||0
2|onuType|INTEGER|0||0
3|onuSerialNumber|TEXT|0||0
4|onuId|INTEGER|0||0
5|plannedSwVersion|TEXT|0||0
6|adminStatus|INTEGER|0||0


In that how can we extract INTEGER.

Regards,
Bhaskar.

Kees Nuyt wrote:
> 
> On Thu, 9 Feb 2012 05:07:05 -0800 (PST), bhaskarReddy <uni...@gmail.com>
> wrote:
> 
>>
>>Is it possible to find the data type, even if the table doesn't have data.  
>>That means, my requirement is, 
>>
>>1. I want to find the number of columns in the table. ( I already done.)
>>2. I want to find the names of the columns. (I already done.)
>>3. I want to find the data types. Because, if it is an integer i'll use
>>s***_bind_int(), else if it is test i'll use s***_bind_text().
>>
>>Now if the table is empty, i want to find the data types and according to
>>that i want to fill the row.
>>
>>So is there any way to find the data types even if the  table is empty.
>>(i.e., Table is there, columns and their names are there but no data in
that
>>table.)
> 
> http://www.sqlite.org/c3ref/table_column_metadata.html
> or
> http://www.sqlite.org/c3ref/column_decltype.html 
> or execute the
>   PRAGMA table_info(yourtablename);
> statement and process the resultset.
> 
>>Regards,
>>Bhaskar.
> 
> -- 
> Regards,
> 
> Kees Nuyt
> 
> ___
> sqlite-users mailing list
> sqlite-users@sqlite.org
> http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users
> 
> 

-- 
View this message in context: 
http://old.nabble.com/sqlite3_step-getting-core-dumbed.-tp33292180p33298627.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] sqlite3_step getting core dumbed.

2012-02-09 Thread bhaskarReddy

Is it possible to find the data type, even if the table doesn't have data.  
That means, my requirement is, 

1. I want to find the number of columns in the table. ( I already done.)
2. I want to find the names of the columns. (I already done.)
3. I want to find the data types. Because, if it is an integer i'll use
s***_bind_int(), else if it is test i'll use s***_bind_text().

Now if the table is empty, i want to find the data types and according to
that i want to fill the row.

So is there any way to find the data types even if the  table is empty.
(i.e., Table is there, columns and their names are there but no data in that
table.)


Regards,
Bhaskar.


Marcus Grimm wrote:
> 
> 
> On 09.02.2012 13:12, bhaskarReddy wrote:
>>
>> Thank you. Its working.
>>
>> But why i am getting   sqlite3_column_type returning 5.
>>
> 
> I can only guess:
> 
> a) because you have no data in that table.
> b) probably you have no known type defined in table
> definition and sqlite does a conversion anyhow.
> c) is sqlite3_step(stmt); really required here ?
> what is the result of step ? is it SQLITE_ROW ?
> If not, probably sqlite3_column_type doesn't make much sense.
> 
> 
> Marcus
> 
> 
>>
>>
>>
>> Marcus Grimm wrote:
>>>
>>> try changing this:
>>>
>>> colNames = (char **)malloc(sizeof(char));
>>>
>>> into something like
>>>
>>> colNames = (char **)malloc(sizeof(char * ) * noOfColumns);
>>>
>>>
>>> On 09.02.2012 11:21, bhaskarReddy wrote:
>>>>
>>>> HI Friends,
>>>>
>>>> I dont know why the sqlite3_step getting core dumped.
>>>>
>>>>#include
>>>>#include
>>>>#include "sqlitedb1.h"
>>>>#include
>>>>#include
>>>>#include
>>>>#include
>>>>#include
>>>>
>>>>int db_retrieve_row(char *db_name, char *table_name, int
>>>> num_of_keys,
>>>> char
>>>> * col_names[],column_value_t * col_values);
>>>>
>>>> int main(void)
>>>> {
>>>> column_type_t enm[2];
>>>>  //   int retVal;
>>>> char *col_name[3];
>>>> char *db_name = "LR6002.db";
>>>> char *table_name = "ONTTable";
>>>> column_value_t col_val[3];
>>>>
>>>> enm[0] = COLUMN_TYPE_INT;   // slotId
>>>> enm[1] = COLUMN_TYPE_STRING;
>>>>
>>>> col_val[0].number = 1;
>>>> col_val[1].number = 2;
>>>> col_val[2].number = 3;
>>>>   /* Array of Column Names. */
>>>>col_name[0] = "slotId";
>>>>col_name[1] = "ponChannelId";
>>>>col_name[2] = "onuType";
>>>>
>>>>  db_retrieve_row(db_name, table_name, 3,  col_name,col_val);
>>>>  return 0;
>>>>}
>>>>int db_retrieve_row(char *db_name, char *table_name, int
>>>> num_of_keys,
>>>> char
>>>> * col_names[],column_value_t * col_values)
>>>>{
>>>>sqlite3 *db;
>>>>sqlite3_stmt *stmt;
>>>>int status = 0,loopVar,noOfColumns;
>>>>char *query = NULL,**colNames,*str;
>>>>int  retVal,*colType;
>>>>
>>>>retVal = sqlite3_open(db_name,);
>>>>if(retVal) {
>>>>fprintf(stderr,"Can't  open database:
>>>> %s\n",sqlite3_errmsg(db));
>>>>sqlite3_close(db);
>>>>exit(1);
>>>>}
>>>>   /* A Query to find the number  of columns in the table. */
>>>>   query = (char *)malloc(sizeof(char) * 255);
>>>>   memset(query,0,255);
>>>>   strcat(query, "SELECT * FROM ");
>>>>   strcat(query, table_name);
>>>>   strcat(query, ";");
>>>>
>>>>   status = sqlite3_prepare_v2(db,query,strlen(query) + 1,,
>>>> NULL);
>>>>   if(status != SQLITE_OK) {
>>>>   printf("Prepare error: %s\n", sqlite3_errmsg(db));
>>>>   exit(1);
>>>>   }
>>>>   noOfColumns = sqlite3_column_count(stmt);
>>>>   if(SQLITE_OK != sqlite3_finalize(stmt))
>>>>   

Re: [sqlite] sqlite3_step getting core dumbed.

2012-02-09 Thread bhaskarReddy

Thank you. Its working.

But why i am getting   sqlite3_column_type returning 5.




Marcus Grimm wrote:
> 
> try changing this:
> 
> colNames = (char **)malloc(sizeof(char));
> 
> into something like
> 
> colNames = (char **)malloc(sizeof(char * ) * noOfColumns);
> 
> 
> On 09.02.2012 11:21, bhaskarReddy wrote:
>>
>> HI Friends,
>>
>>I dont know why the sqlite3_step getting core dumped.
>>
>>   #include
>>   #include
>>   #include "sqlitedb1.h"
>>   #include
>>   #include
>>   #include
>>   #include
>>   #include
>>
>>   int db_retrieve_row(char *db_name, char *table_name, int num_of_keys,
>> char
>> * col_names[],column_value_t * col_values);
>>
>> int main(void)
>> {
>>column_type_t enm[2];
>> //   int retVal;
>>char *col_name[3];
>>char *db_name = "LR6002.db";
>>char *table_name = "ONTTable";
>>column_value_t col_val[3];
>>
>>enm[0] = COLUMN_TYPE_INT;   // slotId
>>enm[1] = COLUMN_TYPE_STRING;
>>
>>col_val[0].number = 1;
>>col_val[1].number = 2;
>>col_val[2].number = 3;
>>  /* Array of Column Names. */
>>   col_name[0] = "slotId";
>>   col_name[1] = "ponChannelId";
>>   col_name[2] = "onuType";
>>
>> db_retrieve_row(db_name, table_name, 3,  col_name,col_val);
>> return 0;
>>   }
>>   int db_retrieve_row(char *db_name, char *table_name, int num_of_keys,
>> char
>> * col_names[],column_value_t * col_values)
>>   {
>>   sqlite3 *db;
>>   sqlite3_stmt *stmt;
>>   int status = 0,loopVar,noOfColumns;
>>   char *query = NULL,**colNames,*str;
>>   int  retVal,*colType;
>>
>>   retVal = sqlite3_open(db_name,);
>>   if(retVal) {
>>   fprintf(stderr,"Can't  open database:
>> %s\n",sqlite3_errmsg(db));
>>   sqlite3_close(db);
>>   exit(1);
>>   }
>>  /* A Query to find the number  of columns in the table. */
>>  query = (char *)malloc(sizeof(char) * 255);
>>  memset(query,0,255);
>>  strcat(query, "SELECT * FROM ");
>>  strcat(query, table_name);
>>  strcat(query, ";");
>>
>>  status = sqlite3_prepare_v2(db,query,strlen(query) + 1,, NULL);
>>  if(status != SQLITE_OK) {
>>  printf("Prepare error: %s\n", sqlite3_errmsg(db));
>>  exit(1);
>>  }
>>  noOfColumns = sqlite3_column_count(stmt);
>>  if(SQLITE_OK != sqlite3_finalize(stmt))
>>  {
>>   printf("The prepared statement is Not deleted.\n");
>>  }
>>  free(query);
>>  query = NULL;
>>
>>/* A Query to find the Names of each column. */
>>query = (char *)malloc(sizeof(char) * 255);
>>   memset(query,0,255);
>>strcat(query, "SELECT * FROM ");
>>strcat(query, table_name);
>>strcat(query, ";");
>>
>>//stmt = NULL;
>>status = sqlite3_prepare_v2(db,query,strlen(query) + 1,,
>> NULL);
>>   if(status != SQLITE_OK) {
>>   printf("Prepare error: %s\n", sqlite3_errmsg(db));
>>exit(1);
>>}
>>
>>colNames = (char **)malloc(sizeof(char));
>>memset(colNames,0,1);
>>
>> for(loopVar = 0; loopVar<  noOfColumns; loopVar++)
>> {
>> colNames[loopVar] = (char *)malloc(sizeof(char) * 20);
>> memset(colNames[loopVar], 0, 20);
>>  strcat(colNames[loopVar],sqlite3_column_name(stmt,
>> loopVar));
>> }
>> if(SQLITE_OK != sqlite3_finalize(stmt))
>> {
>>printf("The prepared statement is Not deleted.\n");
>> }
>> free(query);
>>query = NULL;
>>
>>/*  A Query to find types of each column. */
>>str = (char *)malloc(sizeof(char) * 255);
>> memset(str, 0, 255);
>> strcat(str, "SELECT ");
>> for(loopVar = 0; loopVar<  noOfColumns; loopVar++)
>> {
>>   strcat(str, colNames[loopVar]);
>>   if(loopVar<  (noOfColumns -1))
>> strcat(str,",");
>> }
>> strcat(str, " FROM ");
>>

Re: [sqlite] sqlite3_step getting core dumbed.

2012-02-09 Thread bhaskarReddy

No, that is not problem.


Taleeb Anwar wrote:
> 
> /*  A Query to find types of each column. */
>  str = (char *)malloc(sizeof(char) * 255);
>   memset(str, 0, 255);
>   strcat(str, "SELECT ");
>   for(loopVar = 0; loopVar < noOfColumns; loopVar++)
>   {
> strcat(str, colNames[loopVar]);
> if(loopVar < (noOfColumns -1))
>   strcat(str,",");
>   }
> 
> The problem is, perhaps, in the query created through this loop. An extra
> ',' will get appended after the last column name. that is if you have two
> columns called column1 and column2 so your query will be
> SELECT column1,column2, FROM... //(note ',' after column2)
> 
> I may be wrong for more or less I've forgotten "C"; but personally I think
> the sqlite should be throwing exception...
> 
> Thanks & Regards
> Taleeb bin Waquar
> 
> *Hum Mashriq Ke "Miskeenon" Ka Dil Maghrib men Ja Atka Hai!!*
> 
> 
> 
> 
> On Thu, Feb 9, 2012 at 3:51 PM, bhaskarReddy <uni...@gmail.com> wrote:
> 
>>
>> HI Friends,
>>
>>  I dont know why the sqlite3_step getting core dumped.
>>
>>  #include 
>>  #include 
>>  #include "sqlitedb1.h"
>>  #include 
>>  #include 
>>  #include 
>>  #include 
>>  #include 
>>
>>  int db_retrieve_row(char *db_name, char *table_name, int num_of_keys,
>> char
>> * col_names[],column_value_t * col_values);
>>
>> int main(void)
>> {
>>  column_type_t enm[2];
>>   //   int retVal;
>>  char *col_name[3];
>>  char *db_name = "LR6002.db";
>>  char *table_name = "ONTTable";
>>  column_value_t col_val[3];
>>
>>  enm[0] = COLUMN_TYPE_INT;   // slotId
>>  enm[1] = COLUMN_TYPE_STRING;
>>
>>  col_val[0].number = 1;
>>  col_val[1].number = 2;
>>  col_val[2].number = 3;
>>/* Array of Column Names. */
>> col_name[0] = "slotId";
>> col_name[1] = "ponChannelId";
>> col_name[2] = "onuType";
>>
>>   db_retrieve_row(db_name, table_name, 3,  col_name,col_val);
>>   return 0;
>>  }
>>  int db_retrieve_row(char *db_name, char *table_name, int num_of_keys,
>> char
>> * col_names[],column_value_t * col_values)
>>  {
>> sqlite3 *db;
>> sqlite3_stmt *stmt;
>> int status = 0,loopVar,noOfColumns;
>> char *query = NULL,**colNames,*str;
>> int  retVal,*colType;
>>
>> retVal = sqlite3_open(db_name, );
>> if(retVal) {
>> fprintf(stderr,"Can't  open database: %s\n",sqlite3_errmsg(db));
>> sqlite3_close(db);
>> exit(1);
>> }
>>/* A Query to find the number  of columns in the table. */
>>query = (char *)malloc(sizeof(char) * 255);
>>memset(query,0,255);
>>strcat(query, "SELECT * FROM ");
>>strcat(query, table_name);
>>strcat(query, ";");
>>
>>status = sqlite3_prepare_v2(db,query,strlen(query) + 1, , NULL);
>>if(status != SQLITE_OK) {
>>printf("Prepare error: %s\n", sqlite3_errmsg(db));
>>exit(1);
>>}
>>noOfColumns = sqlite3_column_count(stmt);
>>if(SQLITE_OK != sqlite3_finalize(stmt))
>>{
>> printf("The prepared statement is Not deleted.\n");
>>}
>>free(query);
>>query = NULL;
>>
>>  /* A Query to find the Names of each column. */
>>  query = (char *)malloc(sizeof(char) * 255);
>> memset(query,0,255);
>>  strcat(query, "SELECT * FROM ");
>>  strcat(query, table_name);
>>  strcat(query, ";");
>>
>>  //stmt = NULL;
>>  status = sqlite3_prepare_v2(db,query,strlen(query) + 1, ,
>> NULL);
>> if(status != SQLITE_OK) {
>> printf("Prepare error: %s\n", sqlite3_errmsg(db));
>>  exit(1);
>>  }
>>
>>  colNames = (char **)malloc(sizeof(char));
>>  memset(colNames,0,1);
>>
>>   for(loopVar = 0; loopVar < noOfColumns; loopVar++)
>>   {
>>   colNames[loopVar] = (char *)malloc(sizeof(char) * 20);
>>   memset(colNames[loopVar], 0, 20);
>>strcat(colNames[loopVar],sqlite3_column_name(stmt, loopVar));
>>   }
>>   if(SQLITE_OK != sqlite3_finalize(stmt))
>>   {
>>  printf("The prepared statement is Not deleted.\n");
&g

[sqlite] sqlite3_step getting core dumbed.

2012-02-09 Thread bhaskarReddy

HI Friends, 

  I dont know why the sqlite3_step getting core dumped. 

 #include 
 #include 
 #include "sqlitedb1.h"
 #include 
 #include 
 #include 
 #include 
 #include 

 int db_retrieve_row(char *db_name, char *table_name, int num_of_keys, char
* col_names[],column_value_t * col_values);

int main(void)
{
  column_type_t enm[2];
   //   int retVal;
  char *col_name[3];
  char *db_name = "LR6002.db";
  char *table_name = "ONTTable";
  column_value_t col_val[3];
 
  enm[0] = COLUMN_TYPE_INT;   // slotId
  enm[1] = COLUMN_TYPE_STRING;
  
  col_val[0].number = 1;
  col_val[1].number = 2;
  col_val[2].number = 3;
/* Array of Column Names. */
 col_name[0] = "slotId";
 col_name[1] = "ponChannelId";
 col_name[2] = "onuType";
  
   db_retrieve_row(db_name, table_name, 3,  col_name,col_val);
   return 0;
 }
 int db_retrieve_row(char *db_name, char *table_name, int num_of_keys, char
* col_names[],column_value_t * col_values)
 {
 sqlite3 *db;
 sqlite3_stmt *stmt;
 int status = 0,loopVar,noOfColumns;
 char *query = NULL,**colNames,*str;
 int  retVal,*colType;
 
 retVal = sqlite3_open(db_name, );
 if(retVal) {
 fprintf(stderr,"Can't  open database: %s\n",sqlite3_errmsg(db));
 sqlite3_close(db);
 exit(1);
 }
/* A Query to find the number  of columns in the table. */
query = (char *)malloc(sizeof(char) * 255);
memset(query,0,255);
strcat(query, "SELECT * FROM ");
strcat(query, table_name);
strcat(query, ";");
 
status = sqlite3_prepare_v2(db,query,strlen(query) + 1, , NULL);
if(status != SQLITE_OK) {
printf("Prepare error: %s\n", sqlite3_errmsg(db));
exit(1);
}
noOfColumns = sqlite3_column_count(stmt);
if(SQLITE_OK != sqlite3_finalize(stmt))
{
 printf("The prepared statement is Not deleted.\n");
}
free(query);
query = NULL;
 
  /* A Query to find the Names of each column. */
  query = (char *)malloc(sizeof(char) * 255);
 memset(query,0,255);
  strcat(query, "SELECT * FROM ");
  strcat(query, table_name);
  strcat(query, ";");
 
  //stmt = NULL;
  status = sqlite3_prepare_v2(db,query,strlen(query) + 1, , NULL);
 if(status != SQLITE_OK) {
 printf("Prepare error: %s\n", sqlite3_errmsg(db));
  exit(1);
  }
 
  colNames = (char **)malloc(sizeof(char));
  memset(colNames,0,1);
  
   for(loopVar = 0; loopVar < noOfColumns; loopVar++)
   {
   colNames[loopVar] = (char *)malloc(sizeof(char) * 20);
   memset(colNames[loopVar], 0, 20);
strcat(colNames[loopVar],sqlite3_column_name(stmt, loopVar));
   }
   if(SQLITE_OK != sqlite3_finalize(stmt))
   {
  printf("The prepared statement is Not deleted.\n");
   }
   free(query);
  query = NULL;
 
  /*  A Query to find types of each column. */
  str = (char *)malloc(sizeof(char) * 255);
   memset(str, 0, 255);
   strcat(str, "SELECT ");
   for(loopVar = 0; loopVar < noOfColumns; loopVar++)
   {
 strcat(str, colNames[loopVar]);
 if(loopVar < (noOfColumns -1))
   strcat(str,",");
   }
   strcat(str, " FROM ");
   strcat(str, table_name);
   strcat(str, ";");
 
   status=sqlite3_prepare_v2(db,str,strlen(str)+1, , NULL);
   if (status != SQLITE_OK) {
  printf("prepare error:%s\n",sqlite3_errmsg(db));
  exit(1);
  }
  sqlite3_step(stmt);   //Causing Segmentation Fault. //
  colType = (int *)malloc(sizeof(int) * noOfColumns);
  for(loopVar = 0; loopVar < noOfColumns; loopVar++){
  colType[loopVar] = sqlite3_column_type(stmt, loopVar);
  printf("Column Types = %d\n",colType[loopVar]);
   }
  if(SQLITE_OK != sqlite3_finalize(stmt))
  {
 printf("The prepared statement is Not deleted.\n");
  }
  free(query);
  query = NULL;
 
}

And the API 'sqlite3_column_type" always returning 5, i.e., NULL.


Can any one tell me what was the problem that i did.


Regards, 
Bhaskar.

-- 
View this message in context: 
http://old.nabble.com/sqlite3_step-getting-core-dumbed.-tp33292180p33292180.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] How to drop a table using sqlite API

2012-02-02 Thread bhaskarReddy

HI Friends,
  
How can i drop a table using sqlite API.

Regards,
Bhaskar.
-- 
View this message in context: 
http://old.nabble.com/How-to-drop-a-table-using-sqlite-API-tp33249550p33249550.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] How to find type of value that a column contains. Click to flag this post

2012-02-02 Thread bhaskarReddy

Hi Friends,

  I have to find a type of a value in sql.

  Suppose if i pass to a function with column names and values.
I want to find the 'type' for that values first, suppose if it is an INTEGER
i will do some steps, if it is TEXT some other steps.

 How to find the type of a variables.


Regards,
Bhaskar.
-- 
View this message in context: 
http://old.nabble.com/How-to-find-type-of-value-that-a-column-contains.-Click-to-flag-this-post-tp33248834p33248834.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] How to find type of value that a column contains.

2012-02-01 Thread bhaskarReddy

Hi Friends,

  I have to find a type of a value in sql.

  Suppose if i pass to a function with column names and values.
I want to find the 'type' for that values first, suppose if it is an INTEGER
i will do some steps, if it is TEXT some other steps.

 How to find the type of a variables.


Regards,
Bhaskar.
-- 
View this message in context: 
http://old.nabble.com/How-to-find-type-of-value-that-a-column-contains.-tp33248438p33248438.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] File checking mechanism.

2012-02-01 Thread bhaskarReddy

Hi Friends,

 Is there any File checking mechanism in sqilte3.

 Suppose i have a file ABCD.db, before i want to create the data
base file, i want to check whether it is already exit with the same or not.
If it is exist returns an error. 

 Is there any sqlite function to do file checking mechanism.


Regards,
Bhaskar Reddy
-- 
View this message in context: 
http://old.nabble.com/File-checking-mechanism.-tp33241633p33241633.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] Delete data base.

2012-01-31 Thread bhaskarReddy

Hi Friends,
 
 is it possible to delete a database with DROP command.

   ex: DROP DATABASE dbName;


Regards,
Baskar Reddy.
-- 
View this message in context: 
http://old.nabble.com/Delete-data-base.-tp33241353p33241353.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] How to find number of columns and types in a table.

2012-01-31 Thread bhaskarReddy

Hi Friends, 

Is there any way to find the number of columns and column
types in a table.   

   I tried with "select count(*) from tablename". But it is
showing number of records.

 Regards, 
Bhaskar.
-- 
View this message in context: 
http://old.nabble.com/How-to-find-number-of-columns-and-types-in-a-table.-tp33235184p33235184.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] How to access values of a columns with specific row id.

2012-01-31 Thread bhaskarReddy

Hi Friends,


   Can any one tell me how to access values of a table column
with its particular row id.

 I tried with "select * from ontTable where rowid=2;"
  
 I am getting the output as 1|2|3|XYZ234|4|ABCD123|5.

Here i want the values of column should store in separate
variables.


   Can any one tell me how to access column by column.


Regards,
Bhaskar Reddy.




-- 
View this message in context: 
http://old.nabble.com/How-to-access-values-of-a-columns-with-specific-row-id.-tp33234692p33234692.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] Is there any API for counting number of rows in a particular table.

2012-01-30 Thread bhaskarReddy

Its working with only table name.


Regards,
Bhaskar.



Igor Tandetnik wrote:
> 
> bhaskarReddy <uni...@gmail.com> wrote:
>> I am getting an error as,
>> 
>> sqlite> select count (*) from LR6000.ONTtable;
>> Error: no such table: LR6000.ONTtable
> 
> Just do "select count (*) from ONTtable;"
> -- 
> Igor Tandetnik
> 
> ___
> sqlite-users mailing list
> sqlite-users@sqlite.org
> http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users
> 
> 

-- 
View this message in context: 
http://old.nabble.com/Is-there-any-API-for-counting-number-of-rows-in-a-particular-table.-tp33228856p33228993.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] Is there any API for counting number of rows in a particular table.

2012-01-30 Thread bhaskarReddy

I am getting an error as,

sqlite> select count (*) from LR6000.ONTtable;
Error: no such table: LR6000.ONTtable

Regards,
Bhaskar.



Simon Slavin-3 wrote:
> 
> 
> On 30 Jan 2012, at 12:45pm, bhaskarReddy wrote:
> 
>>   Is there any API that will return number of rows (records)
>> present in a particular table. I want to access the table using its
>> database
>> name and corresponding table.
> 
> Nope.  It's quite difficult doing that in SQLite because of how the data
> are stored.  The fastest way is to use the API to run
> 
> SELECT COUNT(*) FROM thisTable
> 
> just the same as you would any other SELECT statement.  If you have
> multiple databases attached then, of course, use
> 
> SELECT COUNT(*) FROM thisDatabase.thisTable
> 
> Simon.
> ___
> sqlite-users mailing list
> sqlite-users@sqlite.org
> http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users
> 
> 

-- 
View this message in context: 
http://old.nabble.com/Is-there-any-API-for-counting-number-of-rows-in-a-particular-table.-tp33228856p33228950.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] Delete data base.

2012-01-30 Thread bhaskarReddy

Tank you very much simon.

Regards,
Bhaskar Reddy.




Simon Slavin-3 wrote:
> 
> 
> On 30 Jan 2012, at 11:42am, bhaskarReddy wrote:
> 
>> Can any one tell me how to delete entire database with its name,
>> using sqlite3 API.
> 
> You can't.  But unless you have the database open using SQLite the entire
> database just one file.  Use whatever language feature you have for
> deleting a file.
> 
> Simon.
> ___
> sqlite-users mailing list
> sqlite-users@sqlite.org
> http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users
> 
> 

-- 
View this message in context: 
http://old.nabble.com/Delete-data-base.-tp33228500p33228869.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] Is there any API for counting number of rows in a particular table.

2012-01-30 Thread bhaskarReddy

Hi Friends,

   Is there any API that will return number of rows (records)
present in a particular table. I want to access the table using its database
name and corresponding table. 

   If possible give one example.

Regards,
Bhaskar Reddy.
-- 
View this message in context: 
http://old.nabble.com/Is-there-any-API-for-counting-number-of-rows-in-a-particular-table.-tp33228856p33228856.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] Delete data base.

2012-01-30 Thread bhaskarReddy

Hi Friends,

 Can any one tell me how to delete entire database with its name,
using sqlite3 API.


Regards,
Bhaskar Reddy.
-- 
View this message in context: 
http://old.nabble.com/Delete-data-base.-tp33228500p33228500.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] how to vice variable names in CREATE query.

2012-01-25 Thread bhaskarReddy

Hi Friends,

   I have two arrays, one is representing field names and
another array representing field types. I am passing these two arrays to
another function which will create a table using sqlite3_exec.

   #define   INTEGER 0
   #define   TEXT1

   Ex:   char *col_names[] = {"slotId", "cardId",
"swversion"};
   int arr[] = {0,0,1};

   create_table (tableName, col_names, arr);

Now in the function  create_table(const char *tableName, const char
*col_names, int *ptr)
   {
char *query;

query = "create table
tableName (fieldNames and fieldTypes) ;";
the actual database name and field names and values should come.

   Can any one tell me how to do this.


Regards,
BhaskarReddy.
   }
-- 
View this message in context: 
http://old.nabble.com/how-to-vice-variable-names-in-CREATE-query.-tp33200658p33200658.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] how to restore the column values into the structure.

2012-01-22 Thread bhaskarReddy

HI Dinesh,

  You just given the classes. You didn't give actual work the
functions do. Can you tell me how i can do in C.

Regards,
Bhaskar.


Dinesh Behl wrote:
> 
> Hi Bhaskar,
> 
> I wrote the code to store the result of SELECT query.
> 
> I treated the resultset as a table where each cell is the column value and
> row is set of cells, and table is set of rows.
> 
> 
> Below is the snippet of the class structure.  You can modify it as per ur
> requirement.
> 
> Hope it helps.
> 
> Dinesh
> 
> class SwCell
> 
> {
> 
> private:
> 
> string m_strName;
> 
> string m_strValue;
> 
> string m_strType;
> 
> public :
> 
> string getName();
> 
> string getValue();
> 
> int getType();
> 
> void setType(int type);
> 
> void setName(string name);
> 
> void setValue(string value);
> 
> };
> 
> class SwRow {
> 
> vector m_Row;
> 
> public:
> 
> void addCell(SwCell val);
> 
> void addCell(vector cells);
> 
> SWDBI_API SwCell getCell(int index);
> 
> SWDBI_API SwCell getCell(string cellName);
> 
> SWDBI_API int size();
> 
> SWDBI_API vector getRow();
> 
> };
> 
> class SwRowset
> 
> {
> 
> vector m_Rowset;
> 
> public:
> 
> void addRow(SwRow val);
> 
> SWDBI_API SwRow getRow(int index);
> 
> SWDBI_API int size();
> 
> };
> 
> 
> On Fri, Jan 20, 2012 at 2:52 AM, bhaskarReddy <uni...@gmail.com> wrote:
> 
>>
>> Hi Friends,
>>
>>How to store the values of a columns in to the appropriate
>> variables.
>>
>> struct ABC
>> {
>> int a;
>> int b;
>> char *str;
>> };
>>
>>a bname
>>1 2 ABCD
>>2 4 WXYZ
>>
>>
>>   Now i am taking a variable to a structure, and i want to load the
>> column
>> values of a particular row.
>>
>>   ex:   struct ABC   st;
>>
>>st.a =  //store the record 1's   'a' value.
>>st.b =  // store the record 1's   'b' value.
>>   st.str = // store the record 1's'name' value.
>>
>> Regards,
>> Bhaskar Reddy.
>> --
>> View this message in context:
>> http://old.nabble.com/how-to-restore-the-column-values-into-the-structure.-tp33172778p33172778.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
> 
> 

-- 
View this message in context: 
http://old.nabble.com/how-to-restore-the-column-values-into-the-structure.-tp33172778p33186337.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] how to restore the column values into the structure.

2012-01-19 Thread bhaskarReddy

Hi Friends,

How to store the values of a columns in to the appropriate
variables.

 struct ABC
 {
 int a;
 int b;
 char *str;
 };

a bname
1 2 ABCD
2 4 WXYZ


   Now i am taking a variable to a structure, and i want to load the column
values of a particular row.

   ex:   struct ABC   st;

st.a =  //store the record 1's   'a' value.  
st.b =  // store the record 1's   'b' value. 
   st.str = // store the record 1's'name' value.

Regards,
Bhaskar Reddy.
-- 
View this message in context: 
http://old.nabble.com/how-to-restore-the-column-values-into-the-structure.-tp33172778p33172778.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] Is there any API that will return a record based on Primary key.

2012-01-19 Thread bhaskarReddy

HI Friends,

  Is there any SQLite API for returning a record based on particular
Primary key id.

Regards,
Bhaskar Reddy.
-- 
View this message in context: 
http://old.nabble.com/Is-there-any-API-that-will-return-a-record-based-on-Primary-key.-tp33166831p33166831.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] Collecting return values from sql commands using SQLite APIs.

2012-01-19 Thread bhaskarReddy

Hi Friends,

   is it possible to collect return value of a SQL command. ex:
SELECT COUNT(*) FROM table;  will return number of records in a table. Is
there any SQLite API to return this value.

Regards,
Bhaskar Reddy. 
 
  
-- 
View this message in context: 
http://old.nabble.com/Collecting-return-values-from-sql-commands-using-SQLite-APIs.-tp33166706p33166706.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] SQLite API for counting number of records in a table.

2012-01-19 Thread bhaskarReddy

Hi Binns,

If i execute the command "SELECT COUNT (*) FROM table;" how
i will get the return value i.e., number of records in the table ?

Regards,
BhaskarReddy





Roger Binns wrote:
> 
> -BEGIN PGP SIGNED MESSAGE-
> Hash: SHA1
> 
> On 18/01/12 23:47, bhaskarReddy wrote:
>> Is there an SQLite API for counting number of records in a table.
> 
> No, but that is because regular SQL will do the trick:
> 
>SELECT COUNT(*) FROM table;
> 
> Roger
> -BEGIN PGP SIGNATURE-
> Version: GnuPG v1.4.11 (GNU/Linux)
> 
> iEYEARECAAYFAk8Xy+QACgkQmOOfHg372QSJsgCgmzxiQMxaQPz+PkTZvLmvhE0h
> R+kAn0G547GDzO1OrPf8Cn9b+d670WAr
> =hEiw
> -END PGP SIGNATURE-
> ___
> sqlite-users mailing list
> sqlite-users@sqlite.org
> http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users
> 
> 

-- 
View this message in context: 
http://old.nabble.com/SQLite-API-for-counting-number-of-records-in-a-table.-tp33166164p33166535.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] SQLite API for counting number of records in a table.

2012-01-18 Thread bhaskarReddy

Hi Friends,

Is there an SQLite API for counting number of records in a
table.

Ex:  StudentNameRollNo sub1sub2sub3
total   avg
   abcd   188   
99   88 ...
   xyz 277  
6666...   


  Now the SQLite API should return the 2 (for 2 records).
 
  Is there any such a kind of API that returns this info.


Regards,
Bhaskar Reddy.
-- 
View this message in context: 
http://old.nabble.com/SQLite-API-for-counting-number-of-records-in-a-table.-tp33166164p33166164.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] sqlite3_bind. error as library routine called out of sequence.

2012-01-16 Thread bhaskarReddy

Hi Mr Black,

   I am very thankful to you. My code is working fine. 

Regards,
Bhaskar Reddy.


Black, Michael (IS) wrote:
> 
> You have to do all the binds together, THEN step.  This works for me.
> 
> 
> 
> #include 
> #include 
> #include 
> #include "sqlite3.h"
> 
> int main()
> {
>   sqlite3 *db;
>   sqlite3_stmt *stmt;
>   int status;
>   char *create = "create table
> ONTTable(slotId,ponChannelId,onuType,onuId,adminStatus);";
> char *query = "insert into ONTTable
> (slotId,ponChannelId,onuType,onuId,adminStatus) values (?1,?2,?3,?4,?5);";
> 
>  
> status=sqlite3_open_v2("test.db",,SQLITE_OPEN_READWRITE|SQLITE_OPEN_CREATE,NULL);
>   if (status != SQLITE_OK)  {
> printf("open error:%s\n",sqlite3_errmsg(db));
> exit(1);
>   }
>   sqlite3_exec(db,create,NULL,NULL,NULL);
>   status=sqlite3_prepare_v2(db,query,strlen(query)+1, , NULL);
>   if (status != SQLITE_OK) {
> printf("prepare error:%s\n",sqlite3_errmsg(db));
> exit(1);
>   }
> 
>   status=sqlite3_bind_int(stmt,1,1);
>   if (status != SQLITE_OK) {
> printf("bind1 error:%s\n",sqlite3_errmsg(db));
> exit(1);
>   }
>   status=sqlite3_bind_int(stmt,2,2);
>   if (status != SQLITE_OK) {
> printf("bind2 error:%s\n",sqlite3_errmsg(db));
> exit(1);
>   }
>   status=sqlite3_bind_int(stmt,3,3);
>   if (status != SQLITE_OK) {
> printf("bind3 error:%s\n",sqlite3_errmsg(db));
> exit(1);
>   }
>   status=sqlite3_bind_int(stmt,4,4);
>   if (status != SQLITE_OK) {
> printf("bind4 error:%s\n",sqlite3_errmsg(db));
> exit(1);
>   }
>   status=sqlite3_bind_int(stmt,5,5);
>   if (status != SQLITE_OK) {
> printf("bind5 error:%s\n",sqlite3_errmsg(db));
> exit(1);
>   }
> 
>   status=sqlite3_step(stmt);
>   if (status != SQLITE_DONE) {
> printf("step error:%s\n",sqlite3_errmsg(db));
> exit(1);
>   }
>   return 0;
> }
> 
> 
> 
> Michael D. Black
> 
> Senior Scientist
> 
> Advanced Analytics Directorate
> 
> Advanced GEOINT Solutions Operating Unit
> 
> Northrop Grumman Information Systems
> 
> 
> From: sqlite-users-boun...@sqlite.org [sqlite-users-boun...@sqlite.org] on
> behalf of bhaskarReddy [uni...@gmail.com]
> Sent: Monday, January 16, 2012 7:46 AM
> To: sqlite-users@sqlite.org
> Subject: EXT :[sqlite] sqlite3_bind. error as library routine called out
> of sequence.
> 
> 
> Hi Friends,
> 
>   When i tried,
>  query = "insert into ONTTable
> (slotId,ponChannelId,onuType,onuId,adminStatus) values (?1,?2,?3,?4,?5);";
> then binding each parameter.
> 
> //sqlite3_prepare_v2(db,query,strlen(query)+1, , NULL);
> sqlite3_bind_int(stmt,1,ontTable -> slotId);
> sqlite3_step(stmt,DONE);
> 
> //sqlite3_prepare_v2(db,query,strlen(query)+1, , NULL);
> sqlite3_bind_int(stmt,1,ontTable -> ponChannelId);
> sqlite3_step(stmt,DONE);
> 
> //sqlite_prepare_v2(db,query,strlen(query)+1, , NULL);
> sqlite3_bind_int(stmt,1,ontTable -> ontType);
> sqlite3_step(stmt,DONE);
> 
> //sqlite3_prepare_v2(db,query,strlen(query)+1, , NULL);
> sqlite3_bind_int(stmt,1,ontTable -> onuId);
> sqlite3_step(stmt,DONE);
> 
> //sqlite3_bind_prepare_v2(db,query,strlen(query)+1, , NULL);
> sqlite3_bind_int(stmt,1,ontTable -> adminStatus);
> 
> I am getting the following error.
> sqilte3_bind_int(stmt,1,ontTable -> ponChannelId) failed with status 21:
> library routine called out of sequence.
> 
> 
> 
> Regards,
> Bhaskar Reddy.
> 
> --
> View this message in context:
> http://old.nabble.com/sqlite3_bind.-error-as-library-routine-called-out-of-sequence.-tp33147572p33147572.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
> 
> 

-- 
View this message in context: 
http://old.nabble.com/sqlite3_bind.-error-as-library-routine-called-out-of-sequence.-tp33147572p33152332.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] sqlite3_bind. error as library routine called out of sequence.

2012-01-16 Thread bhaskarReddy

Hi Friends,

  When i tried,
 query = "insert into ONTTable
(slotId,ponChannelId,onuType,onuId,adminStatus) values (?1,?2,?3,?4,?5);";   
then binding each parameter.

//sqlite3_prepare_v2(db,query,strlen(query)+1, , NULL);
sqlite3_bind_int(stmt,1,ontTable -> slotId);
sqlite3_step(stmt,DONE);

//sqlite3_prepare_v2(db,query,strlen(query)+1, , NULL);
sqlite3_bind_int(stmt,1,ontTable -> ponChannelId);
sqlite3_step(stmt,DONE);
 
//sqlite_prepare_v2(db,query,strlen(query)+1, , NULL);
sqlite3_bind_int(stmt,1,ontTable -> ontType);
sqlite3_step(stmt,DONE);

//sqlite3_prepare_v2(db,query,strlen(query)+1, , NULL);
sqlite3_bind_int(stmt,1,ontTable -> onuId);
sqlite3_step(stmt,DONE);

//sqlite3_bind_prepare_v2(db,query,strlen(query)+1, , NULL);
sqlite3_bind_int(stmt,1,ontTable -> adminStatus);

I am getting the following error.
sqilte3_bind_int(stmt,1,ontTable -> ponChannelId) failed with status 21:
library routine called out of sequence.

   

Regards,
Bhaskar Reddy.

-- 
View this message in context: 
http://old.nabble.com/sqlite3_bind.-error-as-library-routine-called-out-of-sequence.-tp33147572p33147572.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] All values of a fields are not stored in the single record.

2012-01-16 Thread bhaskarReddy

Hi Mr. Black,

I tried what you recommend me. But i am getting error as, 
sqilte3_bind_int(stmt,2,ontTable -> ponChannelId) failed with status 21:
library routine called out of sequence.

Regards,
Bhaskar Reddy.
 


Black, Michael (IS) wrote:
> 
> You did 5 inserts and got 5 records.  You need to do either just ONE
> insert or ONE insert and FOUR updates.
> 
> I'd got for the one insert.
> 
> 
> 
> query = "insert into ONTTable
> (slotId,ponChannelId,onuType,onuId,adminStatus) values (?1,?2,?3,?4,?5);";
> then bind each parameter.
> 
> 
> 
> Michael D. Black
> 
> Senior Scientist
> 
> Advanced Analytics Directorate
> 
> Advanced GEOINT Solutions Operating Unit
> 
> Northrop Grumman Information Systems
> 
> 
> From: sqlite-users-boun...@sqlite.org [sqlite-users-boun...@sqlite.org] on
> behalf of bhaskarReddy [uni...@gmail.com]
> Sent: Monday, January 16, 2012 7:10 AM
> To: sqlite-users@sqlite.org
> Subject: EXT :[sqlite] All values of a fields are not stored in the single
> record.
> 
> 
> Hi friends,
> 
>  While i am writing data into the table the values are not storing
> in a single records, instead the values are storing in improper order.
> 
>   I am adding the values to the table as,
> 
> query = "insert into ONTTable (slotId) values (?1);";
> sqlite3_prepare_v2(db,query,strlen(query)+1, , NULL);
> sqlite3_bind_int(stmt,1,ontTable -> slotId);
> sqlite3_step(stmt,DONE);
> 
> query = "insert into ONTTable (ponChannelId) values (?);";
> sqlite3_prepare_v2(db,query,strlen(query)+1, , NULL);
> sqlite3_bind_int(stmt,1,ontTable -> ponChannelId);
> sqlite3_step(stmt,DONE);
> 
> 
> query = "insert into ONTTable (onuType) values (?);";
> sqlite_prepare_v2(db,query,strlen(query)+1, , NULL);
> sqlite3_bind_int(stmt,1,ontTable -> ontType);
> sqlite3_step(stmt,DONE);
> 
> query = "insert into ONTTable (onuId) values (?);";
> sqlite3_prepare_v2(db,query,strlen(query)+1, , NULL);
> sqlite3_bind_int(stmt,1,ontTable -> onuId);
> sqlite3_step(stmt,DONE);
> 
> query = "insert into ONTTable (adminStatus) values (?);";
> sqlite3_bind_prepare_v2(db,query,strlen(query)+1, , NULL);
> sqlite3_bind_int(stmt,1,ontTable -> adminStatus);
> 
> 
> slotId   ponChannelId onuType   onuId
> adminStatus
> 
> 1
> 
> 2
> 
> 
>3
> 
>  4
> 
> 
> 5
> 
> 
> 
> 
> 
> 
>  Can any one tell me how i can get all values at one record.
> 
> 
> Regards
> Bhaskar Reddy
> 
> --
> View this message in context:
> http://old.nabble.com/All-values-of-a-fields-are-not-stored-in-the-single-record.-tp33147362p33147362.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
> 
> 

-- 
View this message in context: 
http://old.nabble.com/All-values-of-a-fields-are-not-stored-in-the-single-record.-tp33147362p33147453.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] All values of a fields are not stored in the single record.

2012-01-16 Thread bhaskarReddy

Hi friends,

 While i am writing data into the table the values are not storing
in a single records, instead the values are storing in improper order. 

  I am adding the values to the table as,

query = "insert into ONTTable (slotId) values (?1);";
sqlite3_prepare_v2(db,query,strlen(query)+1, , NULL);
sqlite3_bind_int(stmt,1,ontTable -> slotId);
sqlite3_step(stmt,DONE);
 
query = "insert into ONTTable (ponChannelId) values (?);";
sqlite3_prepare_v2(db,query,strlen(query)+1, , NULL);
sqlite3_bind_int(stmt,1,ontTable -> ponChannelId);
sqlite3_step(stmt,DONE);
 
 
query = "insert into ONTTable (onuType) values (?);";
sqlite_prepare_v2(db,query,strlen(query)+1, , NULL);
sqlite3_bind_int(stmt,1,ontTable -> ontType);
sqlite3_step(stmt,DONE);

query = "insert into ONTTable (onuId) values (?);";
sqlite3_prepare_v2(db,query,strlen(query)+1, , NULL);
sqlite3_bind_int(stmt,1,ontTable -> onuId);
sqlite3_step(stmt,DONE);

query = "insert into ONTTable (adminStatus) values (?);";
sqlite3_bind_prepare_v2(db,query,strlen(query)+1, , NULL);
sqlite3_bind_int(stmt,1,ontTable -> adminStatus);


slotId   ponChannelId onuType   onuId
adminStatus

1

2
   

   3

 4


 
5
  





 Can any one tell me how i can get all values at one record.


Regards
Bhaskar Reddy

-- 
View this message in context: 
http://old.nabble.com/All-values-of-a-fields-are-not-stored-in-the-single-record.-tp33147362p33147362.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] Need a sqlite c api that wrires data into a table.

2012-01-12 Thread bhaskarReddy

Hi friends,


  I check all the C APIs which are provided by sqlite.  I can able
to write data to a table, using sqlite3_exec() function.

But i need a C API that will write data into table, i.e., sqlite3_exec().

   Ex: if i give "database name", table name and values to that
function, the particular function will enter the record of values into that
table.

   Is there any C API like that in SQlite.


Regards,
Bhaskar
-- 
View this message in context: 
http://old.nabble.com/Need-a-sqlite-c-api-that-wrires-data-into-a-table.-tp33132538p33132538.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] SQLite C - APIs to insert data in to a table.

2012-01-12 Thread bhaskarReddy

Hi Friends,

  I am using SQLite. This is the first time. And i am creating,
accessing and retrieving data from the table. 

 I am using sqlite3_exec() function to insert and retrieve data.
Instead using sqlite3_exec(), is there any other APIs which help inserting
data into tables.

 
Regards,
Bhaskar Reddy.
-- 
View this message in context: 
http://old.nabble.com/SQLite--C---APIs-to-insert-data-in-to-a-table.-tp33127130p33127130.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