Re: [sqlite] remote access to sqlite db?

2007-09-03 Thread Mina R Waheeb
On 9/4/07, Scott Derrick <[EMAIL PROTECTED]> wrote:
> You could always use rails and get to your database through an html
> connection.  You can take your choice of web servers though the built in
> mongrel-rails server will easily handle 20-30 concurrent connections.
>
> Scott
>
> Kees Nuyt wrote:
> > On Sun, 2 Sep 2007 23:23:43 -0400, you wrote:
> >
> >> Hi,
> >>
> >> Does sqlite offer the ability to connect to a sqlite db file on a
> >> remote machine? I've been using it locally for awhile and it's great.
> >> Wanted to see if it could be used remotely for some simple tasks.
> >
> > It does, but there are restrictions:
> > http://www.sqlite.org/whentouse.html
> >
> > For very low concurrency (one user at a time), it shouldn't be a
> > problem, but you will notice loss of speed.
> >
> > There are also a few client/server drivers for SQLite:
> > http://www.sqlite.org/cvstrac/wiki?p=SqliteNetwork
> > http://www.sqlite.org/contrib
> > sqlite-networked
> >
> >> Thanks,
> >> Mark
> >
> > Hope this helps.
> > Regards,
>
> --
>
> -
>  What county can preserve its liberties, if its rulers are not
> warned from time to time that its people preserve the spirit of resistance.
>
>  Thomas Jefferson
>
> -
> To unsubscribe, send email to [EMAIL PROTECTED]
> -
>
>

-
To unsubscribe, send email to [EMAIL PROTECTED]
-



Re: [sqlite] Aggregate and query limit

2007-08-18 Thread Mina R Waheeb
Hi,
  Yes, You are right. How SQLite will know the position of the row 990
unless it ordered by indexed field.

That takes me to another point, How SQLite exactly interpret the query, I
read in the documentation "After the parser assembles tokens into complete
SQL statements, it calls the code generator to produce virtual machine code
that will do the work that the SQL statements request", And in another part
"The program generated by the code generator is executed by the virtual
machine"

So, I have two questions about that mechanism of executing the quires:
- What is the language type that's the code generator is generating?
- Can i skip the SQL parsing and provide ready compiled statement to be
executed by the VM and tells SQLite what exactly to do, Not what the
generator understands from my SQL.?

I know if it possible writing pre-compiled quires may cause compatiblity
problems with the SQLite future releases but please let me know if it
possible.

Thanks,
Mina.


Re: [sqlite] Aggregate and query limit

2007-08-17 Thread Mina R Waheeb
Hi,
  Thanks for reply. I'm still confused about that. I don't know much
about SQLite internals, But what i understanded from your reply that
SQLite fetch any row match the query condation and then apply to it
the GROUP BY then apply to it the ORDER BY is there is any, And when
the LIMIT appears SQLite keep fetching the result from the "start"
until the result set size equals the requested limit.

Do you mean the LIMIT in SQLite is not optimized? and the performance
of selecting from table contains 1000 rows match the query condation
equal selecting the same condation with limit 990,10?

Thanks,
Mina.

On 8/17/07, Joe Wilson <[EMAIL PROTECTED]> wrote:
> --- Mina R Waheeb <[EMAIL PROTECTED]> wrote:
> >   I have some questions about the behavior of aggregate functions and
> > the result LIMIT.
> > After register TEST function and executing query (SELECT TEST() FROM
> > objects group by id LIMIT 30,3)
> >
> > I was expect calling back TEST() only 3 times but what happened is the
> > TEST() is called 33 time, and the result set is correct 3 rows.
>
> Test() would (and should) be called for each row in the
> table "objects". How else could it aggregate the information?
>
> > My questions:
> > - Why TEST() is called for non-result rows? Is this designed  feature?
>
> Regarding non-results rows - you only know that after the fact that it's
> a non result row - after all rows are processed. Do the query yourself
> manually on paper and see.
>
> > - When the evaluation of the result-column functions happen?
> > - How SQLite preform the LIMIT?
>
> Logically, it operates on the result set after the GROUP BY.
> In code, it is more involved than that.
>
> Also keep in mind that you're assuming that GROUP BY does an ordering
> on "id". In SQLite it happens to be the case because of its use
> of btrees, but this is not guaranteed on other databases where they
> may use a hash map for group by. You need an explicit "ORDER BY id"
> to guarantee an order.
>
>
>
> 
> Got a little couch potato?
> Check out fun summer activities for kids.
> http://search.yahoo.com/search?fr=oni_on_mail=summer+activities+for+kids=bz
>
> -
> To unsubscribe, send email to [EMAIL PROTECTED]
> -
>
>

-
To unsubscribe, send email to [EMAIL PROTECTED]
-



Re: [sqlite] Aggregate and query limit

2007-08-17 Thread Mina R Waheeb
Hi,
   What I got 33 call to the xFinal (NOT EXPECTED) and 33 call to
xStep and only 3 rows as a result (AS EXPECTED).  Even if I have 11
elements grouped, I should got only 3 calls to xFinal and 33 to xStep.
 Also by debuging the code xStep and xFinal called with non-result
data.

Thanks,
Mina.

On 8/17/07, Sreedhar.a <[EMAIL PROTECTED]> wrote:
> Hi,
>
> One idea,Please check whether each row has 11 elements.
> That's could be the reason why u have got 33 times call back.
>
>
> Best Regards,
> A.Sreedhar.
>
>
> -----Original Message-
> From: Mina R Waheeb [mailto:[EMAIL PROTECTED]
> Sent: Friday, August 17, 2007 12:12 PM
> To: sqlite-users@sqlite.org
> Subject: [sqlite] Aggregate and query limit
>
> Hi,
>   I have some questions about the behavior of aggregate functions and the
> result LIMIT.
> After register TEST function and executing query (SELECT TEST() FROM objects
> group by id LIMIT 30,3)
>
> I was expect calling back TEST() only 3 times but what happened is the
> TEST() is called 33 time, and the result set is correct 3 rows.
>
> My questions:
> - Why TEST() is called for non-result rows? Is this designed  feature?
> - When the evaluation of the result-column functions happen?
> - How SQLite preform the LIMIT?
>
> Thanks,
> Mina.
>
> 
> -
> To unsubscribe, send email to [EMAIL PROTECTED]
> 
> -
>
>
>
>
> -
> To unsubscribe, send email to [EMAIL PROTECTED]
> -
>
>

-
To unsubscribe, send email to [EMAIL PROTECTED]
-



[sqlite] Aggregate and query limit

2007-08-17 Thread Mina R Waheeb
Hi,
  I have some questions about the behavior of aggregate functions and
the result LIMIT.
After register TEST function and executing query (SELECT TEST() FROM
objects group by id LIMIT 30,3)

I was expect calling back TEST() only 3 times but what happened is the
TEST() is called 33 time, and the result set is correct 3 rows.

My questions:
- Why TEST() is called for non-result rows? Is this designed  feature?
- When the evaluation of the result-column functions happen?
- How SQLite preform the LIMIT?

Thanks,
Mina.

-
To unsubscribe, send email to [EMAIL PROTECTED]
-



[sqlite] sqlite3_value LOST

2007-08-14 Thread Mina R Waheeb
Hi,
  I'm trying to pass object pointer from aggregate function to the result set.

The function set the result in this way:
Mem *pBest;
pBest = sqliteMalloc(sizeof(*pBest));
if( !pBest ) return;
pBest->i = toref(value); // i set
//pBest->r = 0;
//pBest->z = 0;
pBest->flags = MEM_Static;
pBest->type = MEM_Int;
pBest->xDel = 
sqlite3_result_value(context, pBest);

But when i try to fetch the value always get SQLITE_NULL with Mem->i = 1
After playing with the code for a while i didn't understand what is
the function of sqlite3VdbeMemShallowCopy(Mem *, Mem *, int) in
vdbemem.c the value i pass copied or duplicated by it or what happen
to the value i supplied.

My question is:  What happen to my sqlite_value?

Also i have note If Mem->xDel is not NULL SQLite pass only Mem->z why
not pass the whole Mem* .

I'm not expert in C but please advise me if I miss anything. I know
SQLite don't support custom "storage" datatype. but why not support
custom data fetching.

Thanks,
Mina.

-
To unsubscribe, send email to [EMAIL PROTECTED]
-