# HG changeset patch
# User Alexandre Fayolle <alexandre.fayolle@logilab.fr>
# Date 1260799327 -3600
# Node ID 6ec0fca7070170d7f0c235cc91430b4db5203470
# Parent  a75a6e77071723093ce485fe91ee0106a6ef24ed# Parent  b33a9f3e19d685c71297a0d718ea9d7b36949ed0
merge

diff -r b33a9f3e19d6 -r 6ec0fca70701 server/sources/native.py
--- a/server/sources/native.py	Mon Dec 14 14:49:37 2009 +0100
+++ b/server/sources/native.py	Mon Dec 14 15:02:07 2009 +0100
@@ -593,6 +593,7 @@
 
 def sql_schema(driver):
     helper = get_adv_func_helper(driver)
+    tstamp_col_type = helper.TYPE_MAPPING.get('TIMESTAMP', 'TIMESTAMP')
     schema = """
 /* Create the repository's system database */
 
@@ -602,7 +603,7 @@
   eid INTEGER PRIMARY KEY NOT NULL,
   type VARCHAR(64) NOT NULL,
   source VARCHAR(64) NOT NULL,
-  mtime TIMESTAMP NOT NULL,
+  mtime %s NOT NULL,
   extid VARCHAR(256)
 );
 CREATE INDEX entities_type_idx ON entities(type);
@@ -613,13 +614,13 @@
   eid INTEGER PRIMARY KEY NOT NULL,
   type VARCHAR(64) NOT NULL,
   source VARCHAR(64) NOT NULL,
-  dtime TIMESTAMP NOT NULL,
+  dtime %s NOT NULL,
   extid VARCHAR(256)
 );
 CREATE INDEX deleted_entities_type_idx ON deleted_entities(type);
 CREATE INDEX deleted_entities_dtime_idx ON deleted_entities(dtime);
 CREATE INDEX deleted_entities_extid_idx ON deleted_entities(extid);
-""" % helper.sql_create_sequence('entities_id_seq')
+""" % (helper.sql_create_sequence('entities_id_seq'), tstamp_col_type, tstamp_col_type)
     return schema
 
 
diff -r b33a9f3e19d6 -r 6ec0fca70701 server/sources/rql2sql.py
--- a/server/sources/rql2sql.py	Mon Dec 14 14:49:37 2009 +0100
+++ b/server/sources/rql2sql.py	Mon Dec 14 15:02:07 2009 +0100
@@ -995,7 +995,9 @@
             return self.keyword_map[value]()
         if constant.type == 'Boolean':
             value = self.dbms_helper.boolean_value(value)
-        if constant.type == 'Substitute':
+        elif constant.type == 'Password' or constant.type == 'Bytes':
+            value = self.dbms_helper.binary_value(value)
+        elif constant.type == 'Substitute':
             _id = constant.value
             if isinstance(_id, unicode):
                 _id = _id.encode()