Re: [Factor-talk] sqlite-error #21 - Library used incorrectly
Hi, Thanks to Shaping for pointing this out, but essentially I forgot to add the alloy word from Furnace, which creates a database pool and calls each responder with the with-db word. The original invocation I used only worked for the main-responder and not the child responders. If I had looked further in the tutorial, I would have seen the run-blog word which explicitly uses alloy to set this up. Thanks, Dave -- Gaining the trust of online customers is vital for the success of any company that requires sensitive data to be transmitted over the Web. Learn how to best implement a security strategy that keeps consumers' information secure and instills the confidence they need to proceed with transactions. http://p.sf.net/sfu/oracle-sfdevnl ___ Factor-talk mailing list Factor-talk@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/factor-talk
Re: [Factor-talk] sqlite-error #21 - Library used incorrectly
and the sqlite3.dll is in the factor exe folder? On Wed, Jan 5, 2011 at 10:52 PM, Otoburb otob...@gmail.com wrote: Hi, I've been trying to go through malu's factor-blog-gitutorial[1] and I'm at commit 3e91728fd6b2021fc11d, where I should be able to at least show the list of recent posts and create new posts. Using the following instructions in the listener, I keep running into a 500 error from Furnace. USING: blog db db.sqlite http.server namespaces threads ; blog main-responder set-global [ blog.db sqlite-db [ 8080 httpd ] with-db ] in-thread When I look into the http log (logs/http.server/1.log), it showed the following errors: [2011-01-06T01:15:32-05:00] ERROR do-request: sqlite-error [] ERROR do-request: n 21 [] ERROR do-request: string Library used incorrectly I sprinkled debug log-messages throughout the code and saw that the problem occurs when attempting to execute select-tuples within the page-action init quotation, specifically a problem with the recent-posts word. The particular code fragments (with debug log messages removed): : recent-posts ( num -- posts ) f post query swap limit created_at desc order select-tuples ; : recent-posts-action ( -- action ) page-action [ 5 recent-posts posts set-value ] init { blog recent-posts } template ; Executing the recent-posts word from the listener: ( scratchpad ) blog.db sqlite-db [ 5 recent-posts ] with-db ... returns a proper result (either an empty array, or a result, depending on whether I entered a post or not previously). I thought that the problem might be the gitutorial, so I went and tried to launch webapps.blogs since they seem rather similar. In the listener, I typed the following: ( scratchpad ) temp.db sqlite-db [ blogs main-responder set-global 8080 httpd ] with-db However, this resulted in the same error in the http log. With additional debug messages in webapps.blogs, I was able to narrow down the issue in a similar place. In this case, the problem occurs when the select-tuples is called within the list-posts word. Checking basis/db/sqlite/ffi/ffi.factor shows the CONSTANT: SQLITE_MISUSE 21 ! Library used incorrectly line. Since that seemed like a sqlite3.dll lib throwing an error, I ran db.sqlite test in the listener and all of the unit tests passed. I'm hoping it's just the way that I'm setting up the environment or perhaps misusing with-db. At the limit of my Factor capabilities trying to figure this out. Further information if required: - Factor win32-2010-12-27 - sqlite3 version 3.7.4 Thanks, Dave -- Learn how Oracle Real Application Clusters (RAC) One Node allows customers to consolidate database storage, standardize their database environment, and, should the need arise, upgrade to a full multi-node Oracle RAC database without downtime or disruption http://p.sf.net/sfu/oracle-sfdevnl ___ Factor-talk mailing list Factor-talk@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/factor-talk -- Jim I'm for extending the working Medicare program for our seniors all the way back to contraception, so Americans can concentrate on living their lives without fear of changing a job, going bankrupt from deductibles or fighting HMO bureaucracy. -- Learn how Oracle Real Application Clusters (RAC) One Node allows customers to consolidate database storage, standardize their database environment, and, should the need arise, upgrade to a full multi-node Oracle RAC database without downtime or disruption http://p.sf.net/sfu/oracle-sfdevnl___ Factor-talk mailing list Factor-talk@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/factor-talk
[Factor-talk] sqlite-error #21 - Library used incorrectly
Hi, I've been trying to go through malu's factor-blog-gitutorial[1] and I'm at commit 3e91728fd6b2021fc11d, where I should be able to at least show the list of recent posts and create new posts. Using the following instructions in the listener, I keep running into a 500 error from Furnace. USING: blog db db.sqlite http.server namespaces threads ; blog main-responder set-global [ blog.db sqlite-db [ 8080 httpd ] with-db ] in-thread When I look into the http log (logs/http.server/1.log), it showed the following errors: [2011-01-06T01:15:32-05:00] ERROR do-request: sqlite-error [] ERROR do-request: n 21 [] ERROR do-request: string Library used incorrectly I sprinkled debug log-messages throughout the code and saw that the problem occurs when attempting to execute select-tuples within the page-action init quotation, specifically a problem with the recent-posts word. The particular code fragments (with debug log messages removed): : recent-posts ( num -- posts ) f post query swap limit created_at desc order select-tuples ; : recent-posts-action ( -- action ) page-action [ 5 recent-posts posts set-value ] init { blog recent-posts } template ; Executing the recent-posts word from the listener: ( scratchpad ) blog.db sqlite-db [ 5 recent-posts ] with-db ... returns a proper result (either an empty array, or a result, depending on whether I entered a post or not previously). I thought that the problem might be the gitutorial, so I went and tried to launch webapps.blogs since they seem rather similar. In the listener, I typed the following: ( scratchpad ) temp.db sqlite-db [ blogs main-responder set-global 8080 httpd ] with-db However, this resulted in the same error in the http log. With additional debug messages in webapps.blogs, I was able to narrow down the issue in a similar place. In this case, the problem occurs when the select-tuples is called within the list-posts word. Checking basis/db/sqlite/ffi/ffi.factor shows the CONSTANT: SQLITE_MISUSE 21 ! Library used incorrectly line. Since that seemed like a sqlite3.dll lib throwing an error, I ran db.sqlite test in the listener and all of the unit tests passed. I'm hoping it's just the way that I'm setting up the environment or perhaps misusing with-db. At the limit of my Factor capabilities trying to figure this out. Further information if required: - Factor win32-2010-12-27 - sqlite3 version 3.7.4 Thanks, Dave -- Learn how Oracle Real Application Clusters (RAC) One Node allows customers to consolidate database storage, standardize their database environment, and, should the need arise, upgrade to a full multi-node Oracle RAC database without downtime or disruption http://p.sf.net/sfu/oracle-sfdevnl ___ Factor-talk mailing list Factor-talk@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/factor-talk