Beispiel #1
0
 public static string GetSqlLiteral(SqlFormatProperties props, IDialectDataAdapter dda, SqlFormatterState state, IBedValueReader reader, DbTypeBase dsttype)
 {
     if (props.BinaryStrings)
     {
         switch (reader.GetFieldType())
         {
         case TypeStorage.String:
             if (props.BinaryStrings)
             {
                 return(dda.GetSqlLiteral(props.RealBinaryEncoding.GetBytes(reader.GetString()), dsttype));
             }
             break;
         }
     }
     return(dda.GetSqlLiteral(reader, dsttype));
 }
Beispiel #2
0
        public void WriteRecord(StreamWriter fw, ITableStructure table, IBedRecord record, int index, object manager)
        {
            if (m_dda == null)
            {
                m_dda = (m_dialect ?? GenericDialect.Instance).CreateDataAdapter();
            }
            fw.Write("INSERT INTO ");
            fw.Write(m_tableName);
            fw.Write(" (");
            bool was = false;

            for (int i = 0; i < record.FieldCount; i++)
            {
                if (was)
                {
                    fw.Write(",");
                }
                fw.Write(record.GetName(i));
                was = true;
            }
            fw.Write(") VALUES (");
            was = false;
            for (int i = 0; i < record.FieldCount; i++)
            {
                if (was)
                {
                    fw.Write(",");
                }
                record.ReadValue(i);
                fw.Write(m_dda.GetSqlLiteral(record));
                //TypeStorage type = record.GetFieldType();

                //if (record.IsDBNull(i))
                //{
                //    fw.Write("NULL");
                //}
                //else
                //{
                //    fw.Write(m_quoteCharacter);
                //    string val = XmlTool.ObjectToString(record.GetValue(i));
                //    val = val.Replace("" + m_quoteCharacter, m_escapedQuote);
                //    fw.Write(val);
                //    fw.Write(m_quoteCharacter);
                //}
                was = true;
            }
            fw.Write(")");
            fw.Write(m_statementSeparator.ReplaceCEscapes());
        }
Beispiel #3
0
 public static string GetSqlLiteral(SqlFormatProperties props, IDialectDataAdapter dda, SqlFormatterState state, ICdlValueReader reader, DbTypeBase dsttype)
 {
     if (props.BinaryStrings)
     {
         switch (reader.GetFieldType())
         {
             case TypeStorage.String:
                 if (props.BinaryStrings)
                 {
                     return dda.GetSqlLiteral(props.RealBinaryEncoding.GetBytes(reader.GetString()), dsttype);
                 }
                 break;
         }
     }
     return dda.GetSqlLiteral(reader, dsttype);
 }
Beispiel #4
0
 public static string GetSqlLiteral(this IDialectDataAdapter dda, object value)
 {
     return(dda.GetSqlLiteral(value, null));
 }
Beispiel #5
0
 public static string GetSqlLiteral(this IDialectDataAdapter dda, IBedValueReader reader)
 {
     return(dda.GetSqlLiteral(reader, null));
 }