RE: [sqlite] FW: BLOB data retrieval
Actually I am not counting the rows now. I am new to SQLite database. Hence, thought that I should know the number of rows present to retrieve all data in the database one after another. Now I understood how to retrieve data without knowing the number of rows! -Original Message- From: Jonas Sandman [mailto:[EMAIL PROTECTED] Sent: Thursday, June 28, 2007 11:41 AM To: sqlite-users@sqlite.org Subject: Re: [sqlite] FW: BLOB data retrieval Still would be nice to know why you feel like stepping through the whole lot to count rows? On 6/28/07, Krishnamoorthy, Priya (IE10) <[EMAIL PROTECTED]> wrote: > Thanks all for the help. > I fixed the problem by stepping through one row after another. > Thanks a lot. > Priya > > -Original Message- > From: Trevor Talbot [mailto:[EMAIL PROTECTED] > Sent: Thursday, June 28, 2007 11:35 AM > To: sqlite-users@sqlite.org > Subject: Re: [sqlite] FW: BLOB data retrieval > > On 6/27/07, Krishnamoorthy, Priya (IE10) > <[EMAIL PROTECTED]> wrote: > > > I am writing a program (in MS VC++) which has to read the blob data in > > all the rows of the above mentioned table one after another. I am > using > > cppSQLite3 which is C++ wrapper function for accessing sqlite3 db. > Mine > > is an offline program that reads the data in the database which is > > updated by another program. > > > Please let me know how I can go about doing this? > > In the interest of being helpful, I should probably mention that the > standard way of doing this in concept is: > > begin query "select BlobColumn from table;" > while not at end of rows in result > get blob data for current row > move to next row > > > - > To unsubscribe, send email to [EMAIL PROTECTED] > > - > > - > To unsubscribe, send email to [EMAIL PROTECTED] > - > > - To unsubscribe, send email to [EMAIL PROTECTED] - - To unsubscribe, send email to [EMAIL PROTECTED] -
Re: [sqlite] FW: BLOB data retrieval
On 6/27/07, Krishnamoorthy, Priya (IE10) <[EMAIL PROTECTED]> wrote: I am writing a program (in MS VC++) which has to read the blob data in all the rows of the above mentioned table one after another. I am using cppSQLite3 which is C++ wrapper function for accessing sqlite3 db. Mine is an offline program that reads the data in the database which is updated by another program. Please let me know how I can go about doing this? In the interest of being helpful, I should probably mention that the standard way of doing this in concept is: begin query "select BlobColumn from table;" while not at end of rows in result get blob data for current row move to next row - To unsubscribe, send email to [EMAIL PROTECTED] -
Re: [sqlite] FW: BLOB data retrieval
Still would be nice to know why you feel like stepping through the whole lot to count rows? On 6/28/07, Krishnamoorthy, Priya (IE10) <[EMAIL PROTECTED]> wrote: Thanks all for the help. I fixed the problem by stepping through one row after another. Thanks a lot. Priya -Original Message- From: Trevor Talbot [mailto:[EMAIL PROTECTED] Sent: Thursday, June 28, 2007 11:35 AM To: sqlite-users@sqlite.org Subject: Re: [sqlite] FW: BLOB data retrieval On 6/27/07, Krishnamoorthy, Priya (IE10) <[EMAIL PROTECTED]> wrote: > I am writing a program (in MS VC++) which has to read the blob data in > all the rows of the above mentioned table one after another. I am using > cppSQLite3 which is C++ wrapper function for accessing sqlite3 db. Mine > is an offline program that reads the data in the database which is > updated by another program. > Please let me know how I can go about doing this? In the interest of being helpful, I should probably mention that the standard way of doing this in concept is: begin query "select BlobColumn from table;" while not at end of rows in result get blob data for current row move to next row - To unsubscribe, send email to [EMAIL PROTECTED] - - To unsubscribe, send email to [EMAIL PROTECTED] - - To unsubscribe, send email to [EMAIL PROTECTED] -
RE: [sqlite] FW: BLOB data retrieval
Thanks all for the help. I fixed the problem by stepping through one row after another. Thanks a lot. Priya -Original Message- From: Trevor Talbot [mailto:[EMAIL PROTECTED] Sent: Thursday, June 28, 2007 11:35 AM To: sqlite-users@sqlite.org Subject: Re: [sqlite] FW: BLOB data retrieval On 6/27/07, Krishnamoorthy, Priya (IE10) <[EMAIL PROTECTED]> wrote: > I am writing a program (in MS VC++) which has to read the blob data in > all the rows of the above mentioned table one after another. I am using > cppSQLite3 which is C++ wrapper function for accessing sqlite3 db. Mine > is an offline program that reads the data in the database which is > updated by another program. > Please let me know how I can go about doing this? In the interest of being helpful, I should probably mention that the standard way of doing this in concept is: begin query "select BlobColumn from table;" while not at end of rows in result get blob data for current row move to next row - To unsubscribe, send email to [EMAIL PROTECTED] - - To unsubscribe, send email to [EMAIL PROTECTED] -
Re: [sqlite] FW: BLOB data retrieval
You need to know the number of rows, don't you already have that in b.numRows() ? /Jonas On 6/28/07, Trevor Talbot <[EMAIL PROTECTED]> wrote: On 6/27/07, Krishnamoorthy, Priya (IE10) <[EMAIL PROTECTED]> wrote: > for (int i=1;i <= b.numRows() ; i++) >sql_command.format("select Data from %s where Row_Num = > %d;",table_name,i); >q = db.execQuery(sql_command); >if (!q.eof()) > This method works fine only when the table size is small. For example, I > have a database of size over 2GB in which case I get an error > SQLITE_NOMEM when I try to do db.gettable(). But i need to know the > number of rows in the table for reading BLOB data in each of the rows > one after another. Why? The query wrapper appears to support iteration, since it has a notion of "eof". Why do you need the row count ahead of time? Why do you assume it's a monotonic sequence (no gaps)? If you really do need the row count for some reason, you can construct a query to give it to you, without retrieving all the data. And since you retrieved all the data at once in the first place, why are you retrieving it again anyway? I'm getting confused just trying to analyze what you're doing. I think you need to stop and think about what you really want to do :) > Secondly, the column "Row_Num" is of type INTEGER_PRIMARY_KEY. So, it > will take negative value after 2GB as mine is a 32 bit machine. SQLite integers are 64 bits, so the database will have no issue. If your wrapper is only capable of giving you 32 bit integers, you'll have to get a different wrapper. - To unsubscribe, send email to [EMAIL PROTECTED] - - To unsubscribe, send email to [EMAIL PROTECTED] -
Re: [sqlite] FW: BLOB data retrieval
On 6/27/07, Krishnamoorthy, Priya (IE10) <[EMAIL PROTECTED]> wrote: for (int i=1;i <= b.numRows() ; i++) sql_command.format("select Data from %s where Row_Num = %d;",table_name,i); q = db.execQuery(sql_command); if (!q.eof()) This method works fine only when the table size is small. For example, I have a database of size over 2GB in which case I get an error SQLITE_NOMEM when I try to do db.gettable(). But i need to know the number of rows in the table for reading BLOB data in each of the rows one after another. Why? The query wrapper appears to support iteration, since it has a notion of "eof". Why do you need the row count ahead of time? Why do you assume it's a monotonic sequence (no gaps)? If you really do need the row count for some reason, you can construct a query to give it to you, without retrieving all the data. And since you retrieved all the data at once in the first place, why are you retrieving it again anyway? I'm getting confused just trying to analyze what you're doing. I think you need to stop and think about what you really want to do :) Secondly, the column "Row_Num" is of type INTEGER_PRIMARY_KEY. So, it will take negative value after 2GB as mine is a 32 bit machine. SQLite integers are 64 bits, so the database will have no issue. If your wrapper is only capable of giving you 32 bit integers, you'll have to get a different wrapper. - To unsubscribe, send email to [EMAIL PROTECTED] -
Re: [sqlite] FW: BLOB data retrieval
GetTable will retrive entire snapshot of our table.I guess u app is a 32bit application hence u can maximum access 2GB of user address space. Upgrade to 64bit to access beyond this limit. regards ragha PS:Sqlite is designed for small data sets amied at Embedded apps ** This email and its attachments contain confidential information from HUAWEI, which is intended only for the person or entity whose address is listed above. Any use of the information contained herein in any way (including, but not limited to, total or partial disclosure, reproduction, or dissemination) by persons other than the intended recipient(s) is prohibited. If you receive this e-mail in error, please notify the sender by phone or email immediately and delete it! * - Original Message - From: "Krishnamoorthy, Priya (IE10)" <[EMAIL PROTECTED]> Date: Thursday, June 28, 2007 1:21 pm Subject: [sqlite] FW: BLOB data retrieval > Hi, > > > > I have a database which has a table that contains BLOB data. The table > has two columns - one is "Row_Num" which is of type AUTO_INCREMENT > (INTERGER_PRIMARY_KEY) and the other column "Data" contains BLOB data. > > > > I am writing a program (in MS VC++) which has to read the blob > data in > all the rows of the above mentioned table one after another. I am > usingcppSQLite3 which is C++ wrapper function for accessing > sqlite3 db. Mine > is an offline program that reads the data in the database which is > updated by another program. > > > > I wrote the following code for reading from the database. > > > > CppSQLite3DBdb; > >CppSQLite3Buffer bufSQL; > > > >// Open the database. The name is provided by the user > >db.open(database_name); > >// Read the entire binary table > >bufSQL.format("select * from %s order by 1;",table_name); > >CppSQLite3Table b = db.getTable(bufSQL); > >CppSQLite3Binary blobz; > > > >// Read binary records one at a time from the database > until all > the records are read > >for (int i=1;i <= b.numRows() ; i++) > >{ > > CppSQLite3Query q; > > CppSQLite3Buffer sql_command; > > long length = 0; > > > > // Read binary record from row number "i" > > sql_command.format("select Data from %s where Row_Num = > %d;",table_name,i); > > q = db.execQuery(sql_command); > > > > if (!q.eof()) > > { > > blobz.setEncoded((unsigned char*)q.fieldValue("Data")); > > cout << "Retrieved binary Length: " << > blobz.getBinaryLength() << endl; > > } > > > > const unsigned char* pbin = blobz.getBinary(); > >} > > > > This method works fine only when the table size is small. For > example, I > have a database of size over 2GB in which case I get an error > SQLITE_NOMEM when I try to do db.gettable(). But i need to know the > number of rows in the table for reading BLOB data in each of the rows > one after another. > > > > Please let me know how I can go about doing this? > > Secondly, the column "Row_Num" is of type INTEGER_PRIMARY_KEY. So, it > will take negative value after 2GB as mine is a 32 bit machine. > > So, how do I access data beyond 2 GB? > > > > Please help me in this regard. > > > > Regards, > > Priya > > > > - To unsubscribe, send email to [EMAIL PROTECTED] -
Re: [sqlite] FW: BLOB data retrieval
Krishnamoorthy, Priya (IE10) wrote: Hi, I have a database which has a table that contains BLOB data. The table has two columns - one is "Row_Num" which is of type AUTO_INCREMENT (INTERGER_PRIMARY_KEY) and the other column "Data" contains BLOB data. I am writing a program (in MS VC++) which has to read the blob data in all the rows of the above mentioned table one after another. I am using cppSQLite3 which is C++ wrapper function for accessing sqlite3 db. Mine is an offline program that reads the data in the database which is updated by another program. I wrote the following code for reading from the database. CppSQLite3DBdb; CppSQLite3Buffer bufSQL; // Open the database. The name is provided by the user db.open(database_name); // Read the entire binary table bufSQL.format("select * from %s order by 1;",table_name); CppSQLite3Table b = db.getTable(bufSQL); CppSQLite3Binary blobz; // Read binary records one at a time from the database until all the records are read for (int i=1;i <= b.numRows() ; i++) { CppSQLite3Query q; CppSQLite3Buffer sql_command; long length = 0; // Read binary record from row number "i" sql_command.format("select Data from %s where Row_Num = %d;",table_name,i); q = db.execQuery(sql_command); if (!q.eof()) { blobz.setEncoded((unsigned char*)q.fieldValue("Data")); cout << "Retrieved binary Length: " << blobz.getBinaryLength() << endl; } const unsigned char* pbin = blobz.getBinary(); } This method works fine only when the table size is small. For example, I have a database of size over 2GB in which case I get an error SQLITE_NOMEM when I try to do db.gettable(). But i need to know the number of rows in the table for reading BLOB data in each of the rows one after another. Please let me know how I can go about doing this? Secondly, the column "Row_Num" is of type INTEGER_PRIMARY_KEY. So, it will take negative value after 2GB as mine is a 32 bit machine. So, how do I access data beyond 2 GB? Please help me in this regard. Regards, Priya If you use the Sqlite API with sqlite3_prepare/sqlite3_step logic you will not have a memory problem. - To unsubscribe, send email to [EMAIL PROTECTED] -
[sqlite] FW: BLOB data retrieval
Hi, I have a database which has a table that contains BLOB data. The table has two columns - one is "Row_Num" which is of type AUTO_INCREMENT (INTERGER_PRIMARY_KEY) and the other column "Data" contains BLOB data. I am writing a program (in MS VC++) which has to read the blob data in all the rows of the above mentioned table one after another. I am using cppSQLite3 which is C++ wrapper function for accessing sqlite3 db. Mine is an offline program that reads the data in the database which is updated by another program. I wrote the following code for reading from the database. CppSQLite3DBdb; CppSQLite3Buffer bufSQL; // Open the database. The name is provided by the user db.open(database_name); // Read the entire binary table bufSQL.format("select * from %s order by 1;",table_name); CppSQLite3Table b = db.getTable(bufSQL); CppSQLite3Binary blobz; // Read binary records one at a time from the database until all the records are read for (int i=1;i <= b.numRows() ; i++) { CppSQLite3Query q; CppSQLite3Buffer sql_command; long length = 0; // Read binary record from row number "i" sql_command.format("select Data from %s where Row_Num = %d;",table_name,i); q = db.execQuery(sql_command); if (!q.eof()) { blobz.setEncoded((unsigned char*)q.fieldValue("Data")); cout << "Retrieved binary Length: " << blobz.getBinaryLength() << endl; } const unsigned char* pbin = blobz.getBinary(); } This method works fine only when the table size is small. For example, I have a database of size over 2GB in which case I get an error SQLITE_NOMEM when I try to do db.gettable(). But i need to know the number of rows in the table for reading BLOB data in each of the rows one after another. Please let me know how I can go about doing this? Secondly, the column "Row_Num" is of type INTEGER_PRIMARY_KEY. So, it will take negative value after 2GB as mine is a 32 bit machine. So, how do I access data beyond 2 GB? Please help me in this regard. Regards, Priya