custom-data-type

STL with a custom data type

What am I doing wrong? #include <iostream> #include <deque> using namespace std; struct mystruct { int number1; int number2; }; int main() { std::deque<mystruct> mydeque; mydeque.number1.push_front(77); return 0; } ...

Rails migrations with database-specific data types

I'm currently running a Rails migration where I am adding a datatype specific to Postgres, the tsvector. It holds search information in the form that Postgres expects for its built-in text searching capabilities. This is the line from my migration: t.column "search_vectors", :tsvector Everything seems to be working fine, and the sea...

How to create this MongoMapper custom data type?

I'm trying to create a custom MongoMapper data type in RoR 2.3.5 called Translatable: class Translatable < String def initialize(translation, culture="en") end def languages end def has_translation(culture)? end def self.to_mongo(value) end def self.from_mongo(value) end end I want to be able to use it l...

Best way to store data in database when you don't know the type

I have a table in my database that represents datafields in a custom form. The DataField gives some representation of what kind of control it should be represented with, and what value type it should take. Simplified you can say that I have 2 entities in this table - Textbox taking any string and Textbox only taking numbers. Now I have...