Hi!
I'm new in SQLite, and I'm studying it to do a work in my college, and would be
helpful if I get the SQLite to print, while executing the sql, after each table
scan or join, the name of the table and number of rows that are going to the
next operator...
for example.. the following sql:
On Apr 3, 2011, at 3:18 PM, Marcelo Serrano Zanetti wrote:
> It does not work in this way ... could somebody tell me please what is
> the correct sintax or whether this is possible at all.
As mentioned, SQL is not a procedural language, so, no.
That said, you can achieve the same effect with
On Sun, Apr 3, 2011 at 3:49 AM, Marcelo S Zanetti wrote:
> IF 1==SELECT COUNT(*) from table
> WHERE item==new THEN SELECT itemID from tabel WHERE item==new ELSE
> INSERT INTO table (item) VALUES (new)
INSERT INTO t (item) SELECT :new WHERE NOT EXISTS (SELECT item FROM t
Hi
I would like to do the following
I have an item to insert in the table which will be inserted only if
this item is not yet in that table otherwise I would like to return the
item's key.
like that
IF 1==SELECT COUNT(*) from table WHERE item==new THEN SELECT itemID from
tabel WHERE
On 03/04/2011, at 6:49 PM, Marcelo S Zanetti wrote:
> I have an item to insert in the table which will be inserted only if this
> item is not yet in that table otherwise I would like to return the item's key.
>
> like that
>
> IF 1==SELECT COUNT(*) from table
> WHERE item==new THEN SELECT
On 04/03/2011 03:12 PM, Igor Tandetnik wrote:
> Marcelo S Zanetti wrote:
>> I
>> have an item to insert in the table which will be inserted only if this
>> item is not yet in that table otherwise I would like to return the
>> item's key.
>>
>> like that
>>
>> IF 1==SELECT
On Sun, Apr 3, 2011 at 3:15 PM, Lynton Grice wrote:
> Thanks, issue solved with the following:
>
> len = sqlite3_column_bytes(stmt,2);
> memcpy(msg->raw_stream_in, sqlite3_column_text(stmt, 2), len);
>
> sqlite3_column_blob is a better function to use.
Lynton Grice wrote:
> Thanks, issue solved with the following:
>
> len = sqlite3_column_bytes(stmt,2);
> memcpy(msg->raw_stream_in, sqlite3_column_text(stmt, 2), len);
Actually, you are supposed to use sqlite3_column_blob for binary data.
--
Igor Tandetnik
Thanks, issue solved with the following:
len = sqlite3_column_bytes(stmt,2);
memcpy(msg->raw_stream_in, sqlite3_column_text(stmt, 2), len);
Thanks to everyone for your help ;-)
Lynton
On 03/04/2011 14:52, Paul van Helden wrote:
> On Sun, Apr 3, 2011 at 2:46 PM, Lynton
>
Marcelo S Zanetti wrote:
> I
> have an item to insert in the table which will be inserted only if this
> item is not yet in that table otherwise I would like to return the
> item's key.
>
> like that
>
> IF 1==SELECT COUNT(*) from table
> WHERE item==new THEN SELECT itemID
On Apr 3, 2011, at 7:50 AM, Luuk wrote:
> On 03-04-2011 14:43, Colin Cuthbert wrote:
>> First time I've used this (or any!) mailing list, so sorry if I've done
>> something wrong.
>>
>> Pretty sure my question (in the subect) is phrased badly but it's the best I
>> could do!
>>
>> create
On Sun, Apr 3, 2011 at 2:46 PM, Lynton Grice wrote:
> char* from SQLite? You say that SELECT treats message as TEXT which is
> fine, but then how can I get the FULL payload back into a char* so that
> I can write it to a file?
>
> SELECT doesn't treat the BLOB as
On 03-04-2011 14:43, Colin Cuthbert wrote:
> First time I've used this (or any!) mailing list, so sorry if I've done
> something wrong.
>
> Pretty sure my question (in the subect) is phrased badly but it's the best I
> could do!
>
> create table People(id integer primary key, name text);
>
Hi Michael,
Thanks for you feedback, I must say I have learnt something for
sure.BUT I still face the problem on how to I READ the BLOB into a
char* from SQLite? You say that SELECT treats message as TEXT which is
fine, but then how can I get the FULL payload back into a char* so that
I
First time I've used this (or any!) mailing list, so sorry if I've done
something wrong.
Pretty sure my question (in the subect) is phrased badly but it's the best I
could do!
create table People(id integer primary key, name text);
insert into People (name) values ('bob');
insert into People
That she blows!!! (to quote Popeye).
Your select treats the message as text..and properly truncates at the first nul
character.
Since it's actuallly binary and NOT text use this:
select hex(raw_stream_in) from queue;
4142004445464748494A
You also forgot to do
select length(raw_stream_in)
I ran your code with my test file and I get this...which is perfectly correct.
Do you get something different? What makes you think the stream is truncated
in the database?
Also...change SQLITE_STATIC to SQLITE_TRANSIENT...that could be your culprit if
you are still seeing truncation.
Plus
Hi Michael,
When I mean't the ".output" I was meaning when I am using the SQLite
command line tool, I type in ".output result.txt" and then type "select
raw_stream_in from queue;" to stream that result to file.
The result file only contains character up until the first NUL.
Also, I know it
Hi Drake, Hi Richard, Hi Paul,
Thanks for all your comments, I really appreciate the help.
Please see FULL code below. You can literally copy and paste this and
compile it with something like:
gcc -m64 -Wall -g -I./ -c ./main.c -o ./bigbyte.o
gcc -o ./bigbyte ./bigbyte.o -L./ -Wl,-rpath,./
Hi Michael,
Well to be honest I am trying to mimic an "SAP IDoc (essentially a raw
stream) coming out of SAP. In this case the "SAP IDoc" contains a large
image, but 99% of the time it is just "plain text". So I probably forgot
the "rb", my mistake
When I say "point to MSG" I mean I do
How are you trying to view the ouitput.result.txt (and I"ll note that it'sNOT a
text file...it's an image according to what you said.). What's the size of the
file.
And you should be able to post a COMPLETE example to show your testing. What
you say you want to do has been done by many
Hi Richard,
My apologies on the subject line, I did not mean it to say the function
is incorrect, but merely to understand why it is chopping it off
I am responding to the other now
Lynton
On 03/04/2011 13:16, Richard Hipp wrote:
> Others have responded with requests for information
Hi Paul,
Yes, I am using fsize as the msg.num_bytes_in..
When I run "SELECT Length(raw_stream_in) FROM test " I get the FULL
13035138 bytes
But it I read the "raw_stream_in" and sent it to a file (using ".output
result.txt") I only see chars up until the FIRST NUL.
Any ideas?
Others have responded with requests for information needed to help track
down the root of this problem. (Thanks!) But in the meantime, let me just
assure you that your subject line is absolutely, positively incorrect.
--
D. Richard Hipp
d...@sqlite.org
Quoth Lynton Grice , on 2011-04-03 12:37:06 +0200:
> There are NULL characters
You mean NUL characters.
> in the first couple header fields [...]
>
> I am no C expert but I have the following table defined:
>
> char *queueTable = "CREATE TABLE [test] ( "
>
Hi there,
I have a 15MB file I need to read and store in an SQLite database.
I have attached a file to show you that there are NULL characters in the
first couple header fields and the rest is pure BINARY data. But just
incase the image gets stipped off while posting you can imagine the file
You apparently don't understand "strings" in C. Or are you actually reading in
binary data?
#1 Since you said "image" I assume you're reading binaary. So get rid of
buffer[fsize]=0. You don't null terminate binary data and that statement is
1-beyond the end of the array (which is from 0 to
Hi Lynton,
What is the value of msg.num_bytes_in? Is it fsize?
And what do you get when you SELECT Length(raw_stream_in) FROM test ?
Regards,
Paul.
___
sqlite-users mailing list
sqlite-users@sqlite.org
Hi there,
I have a 15MB file I need to read and store in an SQLite database.
There are NULL characters in the first couple header fields and the
rest is pure BINARY data. You can imagine the file looking like:
ppphNULNUL3STR.and then all the BINARY data..
I am no C expert but I
Hi
I would like to do the following
I
have an item to insert in the table which will be inserted only if this
item is not yet in that table otherwise I would like to return the
item's key.
like that
IF 1==SELECT COUNT(*) from table
WHERE item==new THEN SELECT itemID from tabel WHERE
30 matches
Mail list logo