Re: [sqlite] Help!

2018-11-07 Thread Clemens Ladisch
am...@juno.com wrote:
> how to take a database in database (not structure) form--and copy and paste 
> it into an e-mail

A database file is binary; the easiest way would be to attach it.

If you want to paste it into the e-mail itself, you have to convert it to text 
somehow.
Either create a bunch of SQL commands (which includes all the data):

  $ sqlite3 test.db .dump
  PRAGMA foreign_keys=OFF;
  BEGIN TRANSACTION;
  CREATE TABLE t(x);
  INSERT INTO t VALUES('hello');
  INSERT INTO t VALUES('world');
  CREATE INDEX tx on t(x);
  COMMIT;

Or create a hexdump of the entire file:

  $ od -Ax -tx1 < test.db
  00 53 51 4c 69 74 65 20 66 6f 72 6d 61 74 20 33 00
  10 10 00 01 01 00 40 20 20 00 00 00 04 00 00 00 03
  20 00 00 00 00 00 00 00 00 00 00 00 02 00 00 00 04
  30 00 00 00 00 00 00 00 00 00 00 00 01 00 00 00 00
  40 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
  50 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 04
  60 00 2e 28 6a 0d 00 00 00 02 0f b7 00 0f df 0f b7
  70 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
  *
  000fb0 00 00 00 00 00 00 00 26 02 06 17 11 0f 01 3b 69
  000fc0 6e 64 65 78 74 78 74 03 43 52 45 41 54 45 20 49
  000fd0 4e 44 45 58 20 74 78 20 6f 6e 20 74 28 78 29 1f
  000fe0 01 06 17 0f 0f 01 2f 74 61 62 6c 65 74 74 02 43
  000ff0 52 45 41 54 45 20 54 41 42 4c 45 20 74 28 78 29
  001000 0d 00 00 00 02 0f ee 00 0f f7 0f ee 00 00 00 00
  001010 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
  *
  001fe0 00 00 00 00 00 00 00 00 00 00 00 00 00 00 07 02
  001ff0 02 17 77 6f 72 6c 64 07 01 02 17 68 65 6c 6c 6f
  002000 0a 00 00 00 02 0f ed 00 0f f7 0f ed 00 00 00 00
  002010 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
  *
  002fe0 00 00 00 00 00 00 00 00 00 00 00 00 00 09 03 17
  002ff0 01 77 6f 72 6c 64 02 08 03 17 09 68 65 6c 6c 6f
  003000

The biggest problem is that the recipient has to know how to turn that back
into a database.


Regards,
Clemens
___
sqlite-users mailing list
sqlite-users@mailinglists.sqlite.org
http://mailinglists.sqlite.org/cgi-bin/mailman/listinfo/sqlite-users


Re: [sqlite] about upsert feature.

2018-11-07 Thread Richard Hipp
On 11/6/18, 畑宏和  wrote:
> Hi, I have a question.
>
> We can use upsert after v3.24.0.
>
> Document  says that
> `INSERT INTO table-name (column-name) select-stmt upsert-clause`
> But when I try this syntax, it returns syntax error.
> I think we can't use upsert-clause with select-stmt.
> Is this thought right?

Does your select-stmt include a WHERE clause?  It should, even if it
is a no-op like "WHERE true".  Try adding the WHERE clause and let us
know if that fixes your problem.
-- 
D. Richard Hipp
d...@sqlite.org
___
sqlite-users mailing list
sqlite-users@mailinglists.sqlite.org
http://mailinglists.sqlite.org/cgi-bin/mailman/listinfo/sqlite-users


Re: [sqlite] about upsert feature.

2018-11-07 Thread Shawn Wagner
Show an actual insert statement that causes an error?

On Wed, Nov 7, 2018, 2:22 AM 畑宏和  Hi, I have a question.
>
> We can use upsert after v3.24.0.
>
> Document  says that
> `INSERT INTO table-name (column-name) select-stmt upsert-clause`
> But when I try this syntax, it returns syntax error.
> I think we can't use upsert-clause with select-stmt.
> Is this thought right?
>
> Thanks for reading my post.
> ___
> sqlite-users mailing list
> sqlite-users@mailinglists.sqlite.org
> http://mailinglists.sqlite.org/cgi-bin/mailman/listinfo/sqlite-users
>
___
sqlite-users mailing list
sqlite-users@mailinglists.sqlite.org
http://mailinglists.sqlite.org/cgi-bin/mailman/listinfo/sqlite-users


[sqlite] about upsert feature.

2018-11-07 Thread 畑宏和
Hi, I have a question.

We can use upsert after v3.24.0.

Document  says that
`INSERT INTO table-name (column-name) select-stmt upsert-clause`
But when I try this syntax, it returns syntax error.
I think we can't use upsert-clause with select-stmt.
Is this thought right?

Thanks for reading my post.
___
sqlite-users mailing list
sqlite-users@mailinglists.sqlite.org
http://mailinglists.sqlite.org/cgi-bin/mailman/listinfo/sqlite-users