GithubHelp home page GithubHelp logo

racquel's People

Contributors

brown131 avatar kurinoku avatar samth avatar tim-brown avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar

racquel's Issues

[Idea] Datalog

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?

Contract violation error appear randomly

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

`select-data-objects` doesn't work if `data-class` has required init variables.

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.

Get id after save?

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.

Error with save-data-object

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>

data-object->jsexpr: broke its own contract

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)"

can not use racquel in a webserver.

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

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.