[sqlite] .dump returns error 32512... sometimes

2007-11-21 Thread Jevgenijs Rogovs
Hi everyone,

I have a script that does some backup. Amongst other things, it dumps
certain SQLite database, like sqlite3 /path/to/db/dname.db .dump > somefile.
When I run the script manually from the command line, it works like a charm.
If, however, I launch it via crontab - it fails. sqlite3 returns error code
32512, which I cannot decypher... Nor can I understand what happens with the
script when it is scheduled to run automatically.

Can anyone advise please?

I'm running SQLite 3.5.2 on Linux.

Thanks in advance!

With best regards,
J.R.


Re: [sqlite] INSERT: how to include CR & LF symbols in a string constant?

2007-11-14 Thread Jevgenijs Rogovs
Thanks!

Simplest solutions tend to be forgotten, unfortunately...
What I did was to simply replace every occurence of \r\n in my script with
LF character...
And it worked like a charm!

Thanks again!

With best regards,
J.R.

On Nov 14, 2007 4:46 PM, <[EMAIL PROTECTED]> wrote:

> "Jevgenijs Rogovs" <[EMAIL PROTECTED]> wrote:
> > I suppose I could try raising the limit of tree depth, or removing it
> > whatsoever, but how do I do that, provided that I'm doing my import like
> > this:
> >
> > sqlite3 mydatabase.db < myhugescript.sql
> >
>
> You are making this *way* harder than it needs to be.  Just
> put the CR and LF in the middle of the string.  No need to escape
> them.
>
> --
> D. Richard Hipp <[EMAIL PROTECTED]>
>
>
>
> -
> To unsubscribe, send email to [EMAIL PROTECTED]
>
> -
>
>


Re: [sqlite] Re: Re: INSERT: how to include CR & LF symbols in a string constant?

2007-11-14 Thread Jevgenijs Rogovs
Sounds too complicated for this simple situation...
Can anything be done w/o coding?

On Nov 14, 2007 3:53 PM, Igor Tandetnik <[EMAIL PROTECTED]> wrote:

> Jevgenijs Rogovs <[EMAIL PROTECTED]>
> wrote:
> > Thanks, but how do I use those?
> > See, I have a huge file of INSERT statements, which look like this:
> >
> > INSERT INTO sometable VALUES ('blablabla\r\nyadayadayada');
>
> Prepare a single statement of the form
>
> INSERT INTO sometable VALUES (?);
>
> Then read your file and from each line extract the actual string value,
> without quotes and with \r and \n replaced by actual CR and LF
> characters. Bind this string to the parameter of the statement
> (sqlite3_bind_text), call sqlite3_step and sqlite3_reset. Repeat for
> each line.
>
> Igor Tandetnik
>
>
>
> -
> To unsubscribe, send email to [EMAIL PROTECTED]
>
> -
>
>


Re: [sqlite] Re: INSERT: how to include CR & LF symbols in a string constant?

2007-11-14 Thread Jevgenijs Rogovs
It runs fine as long as it is small...
If the text in the field is longer, it seems to crash.
Any idea how to drop that stupid depth limit? Where do I specify that
option?
The official site (http://www.sqlite.org/limits.html) does not explain
this...

On Nov 14, 2007 3:53 PM, Dan Kennedy <[EMAIL PROTECTED]> wrote:

> On Wed, 2007-11-14 at 15:38 +0200, Jevgenijs Rogovs wrote:
> > Thanks, but how do I use those?
> > See, I have a huge file of INSERT statements, which look like this:
> >
> > INSERT INTO sometable VALUES ('blablabla\r\nyadayadayada');
> >
> > What I need is to import this data into SQLite database. If I change all
> > \r\n occurances into the following:
> >
> > INSERT INTO sometable VALUES ('blablabla'||x'0A'||'yadayadayada');
>
> Is it possible that you have mismatched quotes in the
> preprocessed script? The statement above runs fine here.
>
> Dan.
>
>
> > I'm getting "Expression tree is too large (maximum depth 1000)" error...
> >
> > Any ideas on how to cope with this?
> >
> > Thanks again!
> >
> > With best regards,
> > J.R.
> >
> > On Nov 14, 2007 3:19 PM, Igor Tandetnik <[EMAIL PROTECTED]> wrote:
> >
> > > Jevgenijs Rogovs <[EMAIL PROTECTED]>
> > > wrote:
> > > > Could someone please assist me with the following: how do I insert a
> > > > string into an SQLite database that contains a CR or LF character?
> > > > C-style escapes (like \r and \n) are not working with SQLite, so how
> > > > can I do this?
> > >
> > > Use parameterized statements - see sqlite3_prepare[_v2],
> sqlite3_bind_*,
> > > sqlite3_step et al.
> > >
> > > Igor Tandetnik
> > >
> > >
> > >
> > >
> -
> > > To unsubscribe, send email to [EMAIL PROTECTED]
> > >
> > >
> -
> > >
> > >
>
>
>
> -
> To unsubscribe, send email to [EMAIL PROTECTED]
>
> -
>
>


Re: [sqlite] Re: INSERT: how to include CR & LF symbols in a string constant?

2007-11-14 Thread Jevgenijs Rogovs
I suppose I could try raising the limit of tree depth, or removing it
whatsoever, but how do I do that, provided that I'm doing my import like
this:

sqlite3 mydatabase.db < myhugescript.sql

Tried the -DSQLITE_MAX_EXPR_DEPTH=0 option on sqlite3 command line, but it
doesn't recognize it!

What am I doing wrong?

With best regards,
J.R.

On Nov 14, 2007 3:38 PM, Jevgenijs Rogovs <[EMAIL PROTECTED]> wrote:

> Thanks, but how do I use those?
> See, I have a huge file of INSERT statements, which look like this:
>
> INSERT INTO sometable VALUES ('blablabla\r\nyadayadayada');
>
> What I need is to import this data into SQLite database. If I change all
> \r\n occurances into the following:
>
> INSERT INTO sometable VALUES ('blablabla'||x'0A'||'yadayadayada');
>
> I'm getting "Expression tree is too large (maximum depth 1000)" error...
>
> Any ideas on how to cope with this?
>
> Thanks again!
>
> With best regards,
> J.R.
>
> On Nov 14, 2007 3:19 PM, Igor Tandetnik <[EMAIL PROTECTED]> wrote:
>
> > Jevgenijs Rogovs <[EMAIL PROTECTED]>
> > wrote:
> > > Could someone please assist me with the following: how do I insert a
> > > string into an SQLite database that contains a CR or LF character?
> > > C-style escapes (like \r and \n) are not working with SQLite, so how
> > > can I do this?
> >
> > Use parameterized statements - see sqlite3_prepare[_v2], sqlite3_bind_*,
> >
> > sqlite3_step et al.
> >
> > Igor Tandetnik
> >
> >
> >
> > -
> > To unsubscribe, send email to [EMAIL PROTECTED]
> >
> > -
> >
> >
>


Re: [sqlite] Re: INSERT: how to include CR & LF symbols in a string constant?

2007-11-14 Thread Jevgenijs Rogovs
Thanks, but how do I use those?
See, I have a huge file of INSERT statements, which look like this:

INSERT INTO sometable VALUES ('blablabla\r\nyadayadayada');

What I need is to import this data into SQLite database. If I change all
\r\n occurances into the following:

INSERT INTO sometable VALUES ('blablabla'||x'0A'||'yadayadayada');

I'm getting "Expression tree is too large (maximum depth 1000)" error...

Any ideas on how to cope with this?

Thanks again!

With best regards,
J.R.

On Nov 14, 2007 3:19 PM, Igor Tandetnik <[EMAIL PROTECTED]> wrote:

> Jevgenijs Rogovs <[EMAIL PROTECTED]>
> wrote:
> > Could someone please assist me with the following: how do I insert a
> > string into an SQLite database that contains a CR or LF character?
> > C-style escapes (like \r and \n) are not working with SQLite, so how
> > can I do this?
>
> Use parameterized statements - see sqlite3_prepare[_v2], sqlite3_bind_*,
> sqlite3_step et al.
>
> Igor Tandetnik
>
>
>
> -
> To unsubscribe, send email to [EMAIL PROTECTED]
>
> -
>
>


[sqlite] INSERT: how to include CR & LF symbols in a string constant?

2007-11-14 Thread Jevgenijs Rogovs
Hello everyone!

Could someone please assist me with the following: how do I insert a string
into an SQLite database that contains a CR or LF character? C-style escapes
(like \r and \n) are not working with SQLite, so how can I do this?

Thanks in advance!

With best regards,
J.R.