brown131 / racquel Goto Github PK
View Code? Open in Web Editor NEWAn Object/Relational Mapper for Racket
License: Apache License 2.0
An Object/Relational Mapper for Racket
License: Apache License 2.0
I would be interesting to mix this lib with the datalog lib, as an interface, for the relationships and querying. DRM? :P What do you think?
Hi, how can I use RQL for select * from items order by count desc limit 3
?
when i use racquel to handle data. the same error appear randomly. it makes me confused.
get-field: contract violation
expected: object?
given: #f
context...:
do-raise-argument-error
/Users/aruarian/workon/team.rkt:155:2: add-members
/Users/aruarian/workon/dispatcher.rkt:97:0: case-handler
.../private/arrow-higher-order.rkt:375:33
loop
[repeats 1 more time]
call-in-empty-metacontinuation-frame
.../private/arrow-higher-order.rkt:375:33
loop
call-in-empty-metacontinuation-frame
[repeats 3 more times]
.../dispatchers/dispatch-servlets.rkt:63:2
call-in-empty-metacontinuation-frame
.../private/more-scheme.rkt:168:6: loop
[repeats 1 more time]
.../private/dispatch-server-with-connect-unit.rkt:144:4: connection-loop
Here's an example:
#lang racket
(require racquel
db)
(define conn (sqlite3-connect #:database 'memory))
(query-exec conn
"create table test(a integer, b text, c text);")
(define test%
(data-class object%
(table-name "test")
(init-column [a "a"]
[b #f "b"]
[c #f "c"])
(super-new)))
(define test (new test% [a 12]))
(query-exec conn "insert into test(a, b, c) values (?, ?, ?);" 1 "hello" "world")
(query-rows conn "select * from test;")
(define tests (select-data-objects conn test%))
throws:
C:\Program Files\Racket\collects\racket\private\class-internal.rkt:1268:70: instantiate: no argument for required init variable
init variable name: a
instantiated class name: test%
The error is here.
It should use make-object
instead of new
.
For that I guess every time create-data-object
gets called it will have to have another parameter where the row index of the columns gets specified, and also maybe limit class creation to not be able to use init or init-field? I'd like to help but I'm still trying to understand the code.
Hi,
Is there any plan to license Racquel under Apache2/MIT license?
FYI, Racket core is moving from LGPL2 to Apache2/MIT: racket/racket#1570
Thanks.
After calling (save-data-object ...)
, is there a way to get the auto-incremented id? I'm getting #f
.
Maybe I've set up the data-class
wrongly? If this is something that's supposed to work, I'll post my code.
I can't make save-data-object
work.
I have the following code :
CREATE TABLE `page` (
`page_id` int(11) NOT NULL AUTO_INCREMENT,
`title` varchar(255) NOT NULL,
`content` longtext DEFAULT NULL,
`publication_date` date DEFAULT NULL,
`expiration_date` date DEFAULT NULL,
`user_id` int(11) DEFAULT NULL,
PRIMARY KEY (`page_id`),
KEY `user_id` (`user_id`),
CONSTRAINT `page_ibfk_1` FOREIGN KEY (`user_id`) REFERENCES `user` (`user_id`) ON DELETE CASCADE
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4;
(define page%
(data-class object%
(table-name "page")
(column
[page-id #f "page_id"]
[title #f "title"]
[content #f "content"]
[publication-date #f "publication_date"]
[expiration-date #f "expiration_date"]
[user-id #f "user_id"])
(primary-key page-id)
(super-new)))
(define msc
(mysql-connect #:user "root"
#:database "test1"
#:password "pass123"))
(define page (make-data-object msc page% 1)) ;;works
(displayln (get-column title page)) ;;works
(displayln (data-object-state page)) ;;works
(set-column! content page "Trying to make Racquel work")
(save-data-object msc page)
I get the following error :
car: contract violation
expected: pair?
given: #<sql-null>
It seems that it is unable to serialize an sql-date
.
The returned object looks similar to
(hasheq 'object
(hasheq 'date (sql-date 2015 2 16))))
This is indeed not a jsexpr as shown by
(jsexpr? (hasheq 'object (hasheq 'date (sql-date 2015 2 16))))
data-object->xexpr
works correctly and returns "#(struct:sql-date 2015 2 16)"
I use racquel Integration webserver to make a CRUD application, fetch data function all ok, but when i run in webserver get an error.
get-field: contract violation
expected: object?
given: #f
context...:
"/my-local-path/cartoon.rkt": [running body]
for-loop
run-module-instance!125
for-loop
[repeats 1 more time]
run-module-instance!125
for-loop
[repeats 1 more time]
run-module-instance!125
for-loop
[repeats 1 more time]
run-module-instance!125
perform-require!78
Attempting to use gen-data-class
on an sqlite3 database failed with
../../usr/share/racket/collects/racket/private/kw.rkt:1325:47: query-value: no such table: sqlite_sequence
error code: 1
and investigating led me to this stackoverflow question
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.